|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--javax.management.relation.RelationSupport
A RelationSupport object is used internally by the Relation Service to represent simple relations (only roles, no properties or methods), with an unlimited number of roles, of any relation type. As internal representation, it is not exposed to the user.
RelationSupport class conforms to the design patterns of standard MBean. So the user can decide to instantiate a RelationSupport object himself as a MBean (as it follows the MBean design patterns), to register it in the MBean Server, and then to add it in the Relation Service.
The user can also, when creating his own MBean relation class, have it extending RelationSupport, to retrieve the implementations of required interfaces (see below).
It is also possible to have in a user relation MBean class a member being a RelationSupport object, and to implement the required interfaces by delegating all to this member.
RelationSupport implements the Relation interface (to be handled by the Relation Service).
It implements also the MBeanRegistration interface to be able to retrieve the MBean Server where it is registered (if registered as a MBean) to access to its Relation Service.
| Field Summary | |
protected java.lang.String |
id
|
protected java.lang.String |
relationTypeName
|
protected java.util.Map |
roleMap
|
| Constructor Summary | |
RelationSupport(java.lang.String relationId,
ObjectName relationServiceObjectName,
MBeanServer mbeanServer,
java.lang.String relationTypeName,
RoleList roleList)
|
|
RelationSupport(java.lang.String relationId,
ObjectName relationServiceObjectName,
java.lang.String relationTypeName,
RoleList roleList)
Creates object. |
|
| Method Summary | |
protected java.lang.Object |
_getRole(java.lang.String roleName)
|
protected java.lang.Object |
_setRole(Role role)
|
RoleResult |
getAllRoles()
Returns all roles present in the relation |
java.util.Map |
getReferencedMBeans()
Retrieves MBeans referenced in the various roles of the relation. tell us how many role's refrences a MBean has |
java.lang.String |
getRelationId()
Returns relation identifier (used to uniquely identify the relation inside the Relation Service) |
ObjectName |
getRelationServiceName()
Returns ObjectName of the Relation Service handling the relation |
java.lang.String |
getRelationTypeName()
Returns name of associated relation type. |
java.util.List |
getRole(java.lang.String roleName)
Retrieves role value for given role name. |
java.lang.Integer |
getRoleCardinality(java.lang.String roleName)
Returns the number of MBeans currently referenced in the given role |
RoleResult |
getRoles(java.lang.String[] roleNames)
Retrieves values of roles with given names. |
void |
handleMBeanUnregistration(ObjectName objectName,
java.lang.String roleName)
Callback used by the Relation Service when a MBean referenced in a role is unregistered. |
java.lang.Boolean |
isInRelationService()
Returns an internal flag specifying if the object is still handled by the Relation Service. |
void |
postDeregister()
Allows the MBean to perform any operations needed after having been de-registered in the MBean server. |
void |
postRegister(java.lang.Boolean registrationDone)
Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed. |
void |
preDeregister()
Allows the MBean to perform any operations it needs before being de-registered by the MBean server. |
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
Allows the MBean to perform any operations it needs before being registered in the MBean server. |
RoleList |
retrieveAllRoles()
Returns all roles in the relation without checking read mode |
void |
setRelationServiceManagementFlag(java.lang.Boolean flag)
Sets the flag to specify that it is handled or not by the Relation Service BEWARE, this method has to be exposed for the user relation MBeans, as the Relation Service will access them through their management interface. |
void |
setRole(Role role)
Sets the given role. |
RoleResult |
setRoles(RoleList roleList)
Sets the given roles. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String id
protected java.lang.String relationTypeName
protected java.util.Map roleMap
| Constructor Detail |
public RelationSupport(java.lang.String relationId,
ObjectName relationServiceObjectName,
java.lang.String relationTypeName,
RoleList roleList)
throws InvalidRoleValueException,
java.lang.IllegalArgumentException
This constructor has to be used when the RelationSupport object will be registered as a MBean by the user, or when creating a user relation MBean those class extends RelationSupport.
Nothing is done at the Relation Service level, i.e. the RelationSupport object is not added, and no check if the provided values are correct. The object is always created, EXCEPT if:
- one mandatory parameter is not provided
- the same name is used for two roles.
To be handled as a relation, the object has then to be added in the Relation Service using Relation Service method addRelation().
relationId - relation identifier, to identify the relation in the
Relation Service.
Expected to be unique in the given Relation Service.
relationServiceObjectName - ObjectName of the Relation Service where
the relation will be registered.
It is required as this is the Relation Service that is aware of the definition of the relation type of given relation, so that will be able to check update operations (set).
relationTypeName - Name of relation type.
Expected to have been created in given Relation Service.
roleList - list of roles (Role objects) to initialised the
relation. Can be null.
Expected to conform to relation info in associated relation type.
InvalidRoleValueException - if the same name is used for two
roles.java.lang.IllegalArgumentException - if a required value (Relation
Service Object Name, etc.) is not provided as parameter.
public RelationSupport(java.lang.String relationId,
ObjectName relationServiceObjectName,
MBeanServer mbeanServer,
java.lang.String relationTypeName,
RoleList roleList)
throws InvalidRoleValueException,
java.lang.IllegalArgumentException
| Method Detail |
public java.util.List getRole(java.lang.String roleName)
throws java.lang.IllegalArgumentException,
RoleNotFoundException,
RelationServiceNotRegisteredException
Checks if the role exists and is readable according to the relation type.
getRole in interface RelationroleName - name of rolejava.lang.IllegalArgumentException - if null role nameRoleNotFoundException - if:
- there is no role with given name
- the role is not readable.
RelationServiceNotRegisteredException - if the Relation
Service is not registered in the MBean Server
public RoleResult getRoles(java.lang.String[] roleNames)
throws java.lang.IllegalArgumentException,
RelationServiceNotRegisteredException
Checks for each role if it exists and is readable according to the relation type.
getRoles in interface RelationroleNames - array of names of roles to be retrievedjava.lang.IllegalArgumentException - if null role nameRelationServiceNotRegisteredException - if the Relation
Service is not registered in the MBean Server
public RoleResult getAllRoles()
throws RelationServiceNotRegisteredException
getAllRoles in interface RelationRelationServiceNotRegisteredException - if the Relation
Service is not registered in the MBean Serverpublic RoleList retrieveAllRoles()
retrieveAllRoles in interface Relation
public java.lang.Integer getRoleCardinality(java.lang.String roleName)
throws java.lang.IllegalArgumentException,
RoleNotFoundException
getRoleCardinality in interface RelationroleName - name of rolejava.lang.IllegalArgumentException - if null role nameRoleNotFoundException - if there is no role with given name
public void setRole(Role role)
throws java.lang.IllegalArgumentException,
RoleNotFoundException,
RelationTypeNotFoundException,
InvalidRoleValueException,
RelationServiceNotRegisteredException,
RelationNotFoundException
Will check the role according to its corresponding role definition provided in relation's relation type
Will send a notification (RelationNotification with type RELATION_BASIC_UPDATE or RELATION_MBEAN_UPDATE, depending if the relation is a MBean or not).
setRole in interface Relationrole - role to be set (name and new value)java.lang.IllegalArgumentException - if null roleRoleNotFoundException - if the role is not writable (no
test on the write access mode performed when initialising the role)InvalidRoleValueException - if value provided for
role is not valid, i.e.:
- the number of referenced MBeans in given value is less than expected minimum degree
- the number of referenced MBeans in provided value exceeds expected maximum degree
- one referenced MBean in the value is not an Object of the MBean class expected for that role
- a MBean provided for that role does not exist
RelationServiceNotRegisteredException - if the Relation
Service is not registered in the MBean ServerRelationTypeNotFoundException - if the relation type has not
been declared in the Relation ServiceRelationNotFoundException - if the relation has not been
added in the Relation Service.
public RoleResult setRoles(RoleList roleList)
throws java.lang.IllegalArgumentException,
RelationServiceNotRegisteredException,
RelationTypeNotFoundException,
RelationNotFoundException
Will check the role according to its corresponding role definition provided in relation's relation type
Will send one notification (RelationNotification with type RELATION_BASIC_UPDATE or RELATION_MBEAN_UPDATE, depending if the relation is a MBean or not) per updated role.
setRoles in interface RelationroleList - list of roles to be setjava.lang.IllegalArgumentException - if null role nameRelationServiceNotRegisteredException - if the Relation
Service is not registered in the MBean ServerRelationTypeNotFoundException - if the relation type has not
been declared in the Relation Service.RelationNotFoundException - if the relation MBean has not been
added in the Relation Service.
public void handleMBeanUnregistration(ObjectName objectName,
java.lang.String roleName)
throws java.lang.IllegalArgumentException,
RoleNotFoundException,
InvalidRoleValueException,
RelationServiceNotRegisteredException,
RelationTypeNotFoundException,
RelationNotFoundException
The Relation Service will call this method to let the relation take action to reflect the impact of such unregistration.
BEWARE. the user is not expected to call this method.
Current implementation is to set the role with its current value (list of ObjectNames of referenced MBeans) without the unregistered one.
handleMBeanUnregistration in interface RelationobjectName - ObjectName of unregistered MBeanroleName - name of role where the MBean is referencedjava.lang.IllegalArgumentException - if null parameterRoleNotFoundException - if role does not exist in the
relation or is not writableInvalidRoleValueException - if role value does not conform to
the associated role info (this will never happen when called from the
Relation Service)RelationServiceNotRegisteredException - if the Relation
Service is not registered in the MBean ServerRelationTypeNotFoundException - if the relation type has not
been declared in the Relation Service.RelationNotFoundException - if this method is called for a
relation MBean not added in the Relation Service.public java.util.Map getReferencedMBeans()
getReferencedMBeans in interface RelationObjectName -> ArrayList of String (role names)
public java.lang.String getRelationTypeName()
getRelationTypeName in interface Relationpublic ObjectName getRelationServiceName()
getRelationServiceName in interface Relationpublic java.lang.String getRelationId()
getRelationId in interface Relation
public ObjectName preRegister(MBeanServer server,
ObjectName name)
throws java.lang.Exception
MBeanRegistrationpreRegister in interface MBeanRegistrationjavax.management.MBeanRegistrationserver - The MBean server in which the MBean will be registered.name - The object name of the MBean.java.lang.Exception - This exception should be caught by the MBean server and re-thrown
as an MBeanRegistrationException.public void postRegister(java.lang.Boolean registrationDone)
MBeanRegistrationpostRegister in interface MBeanRegistrationjavax.management.MBeanRegistrationregistrationDone - Indicates whether or not the MBean has been successfully registered in
the MBean server. The value false means that the registration phase has failed.
public void preDeregister()
throws java.lang.Exception
MBeanRegistrationpreDeregister in interface MBeanRegistrationjavax.management.MBeanRegistrationjava.lang.Exception - This exception should be caught by the MBean server and re-thrown
as an MBeanRegistrationException.public void postDeregister()
MBeanRegistrationpostDeregister in interface MBeanRegistrationpublic java.lang.Boolean isInRelationService()
isInRelationService in interface RelationSupportMBean
public void setRelationServiceManagementFlag(java.lang.Boolean flag)
throws java.lang.IllegalArgumentException
BEWARE, this method has to be exposed for the user relation MBeans, as the Relation Service will access them through their management interface. It is RECOMMENDED NOT to use this method. Using it does not affect the registration of the relation object in the Relation Service, but will provide wrong information about it!!!!
setRelationServiceManagementFlag in interface RelationSupportMBeanjava.lang.IllegalArgumentException - if null parameter
protected java.lang.Object _getRole(java.lang.String roleName)
throws java.lang.IllegalArgumentException,
RelationServiceNotRegisteredException
protected java.lang.Object _setRole(Role role)
throws java.lang.IllegalArgumentException,
RelationServiceNotRegisteredException,
RelationTypeNotFoundException,
RelationNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||