| java.lang.Object javax.management.NotificationBroadcasterSupport javax.management.relation.RelationService
Method Summary | |
public void | addRelation(ObjectName relationMBeanObjectName) | public void | addRelationType(RelationType relationType) | public Integer | checkRoleReading(String roleName, String relationTypeName) | public Integer | checkRoleWriting(Role role, String relationTypeName, Boolean isInitialized) | public void | createRelation(String relationId, String relationTypeName, RoleList roleList) | public void | createRelationType(String relationTypeName, RoleInfo[] roleInfos) Parameters: relationTypeName - - a string giving relations a type name this must be a unique name Parameters: roleInfos - - an array of RoleInfo objects.Which are used to define the roles a relation plays a part in. | public Map | findAssociatedMBeans(ObjectName mbeanObjectName, String relationTypeName, String roleName) Retrieves the MBeans associated to given one in a relation.
Parameters: mbeanObjectName - - ObjectName of MBean Parameters: relationTypeName - - can be null; if specified, only the relations of that type will be considered in the search. | public Map | findReferencingRelations(ObjectName mbeanObjectName, String relationTypeName, String roleName) Retrieves the relations where a given MBean is referenced.
Parameters: mbeanObjectName - - ObjectName of MBean Parameters: relationTypeName - - can be null; if specified, only the relations of that type will be considered in the search. | public List | findRelationsOfType(String relationTypeName) Returns the relation ids for relations of the given type. | public List | getAllRelationIds() | public List | getAllRelationTypeNames() | public RoleResult | getAllRoles(String relationId) | public MBeanNotificationInfo[] | getNotificationInfo() | public boolean | getPurgeFlag() | public Map | getReferencedMBeans(String relationId) | public String | getRelationTypeName(String relationId) | public List | getRole(String relationId, String roleName) | public Integer | getRoleCardinality(String relationId, String roleName) | public RoleInfo | getRoleInfo(String relationTypeName, String roleInfoName) | public List | getRoleInfos(String relationTypeName) | public RoleResult | getRoles(String relationId, String[] roleNames) | public void | handleNotification(Notification notification, Object handback) Invoked when a JMX notification occurs. | public Boolean | hasRelation(String relationId) | public void | isActive() | public String | isRelation(ObjectName objectName) | public ObjectName | isRelationMBean(String relationId) | public void | postDeregister() | public void | postRegister(Boolean registrationDone) | public void | preDeregister() Allows the MBean to perform any operations it needs before being unregistered by the MBean server. | public ObjectName | preRegister(MBeanServer server, ObjectName name) Implementation of interface MBeanRegistration @see MBeanRegistration
Allows the MBean to perform any operations it needs before being registered in the MBean server. | public void | purgeRelations() Purges the relations
Depending on the purgeFlag value, this method is either called automatically when a notification is received for the
unregistration of an MBean referenced in a relation (if the flag is set to true), or not (if the flag is set to false).
In that case it is up to the user to call it to maintain the consistency of the relations. | public void | removeRelation(String relationId) | public void | removeRelationType(String relationTypeName) | public void | sendRelationCreationNotification(String relationId) Sends a notification (RelationNotification) for a relation creation. | public void | sendRelationRemovalNotification(String relationId, List unregisteredMBeanList) Sends a notification (RelationNotification) for a relation removal. | public void | sendRoleUpdateNotification(String relationId, Role newRole, List oldRoleValues) Sends a notification (RelationNotification) for a role update in the given relation. | public void | setPurgeFlag(boolean purgeFlag) | public void | setRole(String relationId, Role role) | public RoleResult | setRoles(String relationId, RoleList roleList) | static void | throwRoleProblemException(int problemType, String roleName) | public void | updateRoleMap(String relationId, Role role, List oldRoleValues) Handles update of the Relation Service role map for the update of given role in given relation
It is called in relation MBean setRole() (for given role) and setRoles()(for each role) methods
(implementation provided in RelationSupport class).
It is also called in Relation Service setRole() (for given role) and setRoles() (for each role) methods.
To allow the Relation Service to maintain the consistency (in case of MBean unregistration) and to be able to
perform queries, this method must be called when a role is updated. |
RelationService | public RelationService(boolean purgeFlag)(Code) | | constructor
Parameters: purgeFlag - - this is a flag, if true indicates an immediate update of relations is to be done when anotification is recieved for the unregistration of an MBean referenced in a relation- if false update of relations must be performed explicitly by calling purgeRelations() See Also: RelationService.purgeRelations |
addRelationType | public void addRelationType(RelationType relationType) throws IllegalArgumentException, InvalidRelationTypeException(Code) | | Parameters: relationType - - an Object implementing the RelationType interface a utility implementation is provided by theRelationTypeSupport class throws: IllegalArgumentException - if a null RelationType is passed in as a parameter or if that RelationType has no RoleInfo defined throws: InvalidRelationTypeException - if the RoleInfo obtained from the RelationType is- empty- null- the RoleName is already in useThis method makes an externally defined relation type available through the relationService The RelationType is immutable, hence the returned values should never change while the relationType is registeredwith the realtion service |
checkRoleReading | public Integer checkRoleReading(String roleName, String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException(Code) | | Checks if given Role can be read in a relation of the given type
Parameters: roleName - - name of role to be checked Parameters: relationTypeName - - name of the relation type - an Integer wrapping an integer corresponding to possible problems represented as constants in RoleUnresolved:- 0 if role can be read
- integer corresponding to RoleStatus.NO_ROLE_WITH_NAME
- integer corresponding to RoleStatus.ROLE_NOT_READABLE
throws: IllegalArgumentException - - if null parameter throws: RelationTypeNotFoundException - - if the relation type is not known in the Relation Service |
checkRoleWriting | public Integer checkRoleWriting(Role role, String relationTypeName, Boolean isInitialized) throws IllegalArgumentException, RelationTypeNotFoundException(Code) | | Checks if given Role can be set in a relation of given type
Parameters: role - - role to be checked Parameters: relationTypeName - - name of relation type Parameters: isInitialized - - flag to specify that the checking is done for the initialization of a role, write access shall not be verified - an Integer wrapping an integer corresponding to possible problems represented as constants in RoleUnresolved:- 0 if role can be set
- integer corresponding to RoleStatus.NO_ROLE_WITH_NAME
- integer for RoleStatus.ROLE_NOT_WRITABLE
- integer for RoleStatus.LESS_THAN_MIN_ROLE_DEGREE
- integer for RoleStatus.MORE_THAN_MAX_ROLE_DEGREE
- integer for RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS
- integer for RoleStatus.REF_MBEAN_NOT_REGISTERED
throws: IllegalArgumentException - - if null parameter throws: RelationTypeNotFoundException - - if unknown relation type |
createRelation | public void createRelation(String relationId, String relationTypeName, RoleList roleList) throws IllegalArgumentException, RelationServiceNotRegisteredException, RoleNotFoundException, InvalidRelationIdException, RelationTypeNotFoundException, InvalidRoleValueException(Code) | | Parameters: relationId - - the id through which this relation is referenced Parameters: relationTypeName - - a unique name for the RelationType Parameters: roleList - - a list of roles to be associated with this relation throws: IllegalArgumentException - - if the relationId, or relationTypeName is null throws: RelationServiceNotRegisteredException - - if the relationService has not been registered in the MBeanServer throws: RoleNotFoundException - - if a role defined in the RoleList is null or empty throws: InvalidRelationIdException - - if the relationId is already in use. throws: RelationTypeNotFoundException - - if the relationType is not found throws: InvalidRoleValueException - - if cardinality is not correct i.e min cardinality is greater than max cardinalityAccording to the RI spec this method is used only to create internal relations - hence creates an InternalRelation This creates a relation represented by a RelationSupport Object, and a RelationNotification,with type RELATION_BASIC_CREATION, is sent |
createRelationType | public void createRelationType(String relationTypeName, RoleInfo[] roleInfos) throws IllegalArgumentException, InvalidRelationTypeException(Code) | | Parameters: relationTypeName - - a string giving relations a type name this must be a unique name Parameters: roleInfos - - an array of RoleInfo objects.Which are used to define the roles a relation plays a part in. It defines attributessuch as cardinality, role reading and writing...The RelationService will then use these RoleInfo to maintain the relation throws: IllegalArgumentException - - thrown if any of the parameters are null throws: InvalidRelationTypeException - - thrown if the role name, contained in the RoleInfo, already exists.This method creates a relationType (a RelationTypeSupport Object) from the parameters passed in. The RelationTypeSupport represents an internal relation |
findAssociatedMBeans | public Map findAssociatedMBeans(ObjectName mbeanObjectName, String relationTypeName, String roleName) throws IllegalArgumentException(Code) | | Retrieves the MBeans associated to given one in a relation.
Parameters: mbeanObjectName - - ObjectName of MBean Parameters: relationTypeName - - can be null; if specified, only the relations of that type will be considered in the search. Else all relation types are considered Parameters: roleName - - can be null; if specified, only the relations where the MBean is referenced in that role will be considered. Else all roles are considered. - HashMap, where the keys are the ObjectNames of the MBeans associated to given MBean, and the value is, for each key, an ArrayList of therelation ids of the relations where the key MBean is associated to given one (as they can be associated inseveral different relations). throws: IllegalArgumentException - - if mbeanObjectName is null |
findReferencingRelations | public Map findReferencingRelations(ObjectName mbeanObjectName, String relationTypeName, String roleName) throws IllegalArgumentException(Code) | | Retrieves the relations where a given MBean is referenced.
Parameters: mbeanObjectName - - ObjectName of MBean Parameters: relationTypeName - - can be null; if specified, only the relations of that type will be considered in the search. Else all relation types are considered. Parameters: roleName - - can be null; if specified, only the relations where the MBean is referenced in that role will be returned. Else all roles are considered. - HashMap, where the keys are the relation ids of the relations where the MBean is referenced, and the value is, for each key,an ArrayList of role names (as an MBean can be referenced in several roles in the same relation). throws: IllegalArgumentException - - if mbeanObjectName is null |
getAllRelationIds | public List getAllRelationIds()(Code) | | Returns all the relation ids for all the relations handled by the Relation Service
an arrayList containing the relation ids |
getAllRelationTypeNames | public List getAllRelationTypeNames()(Code) | | a list containing all the relationTypeNames registered with the relation service |
getNotificationInfo | public MBeanNotificationInfo[] getNotificationInfo()(Code) | | Returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent
- the array of possible notifications |
getPurgeFlag | public boolean getPurgeFlag()(Code) | | true - if the purgeFlag has been set, false if updates of a relation must be called explicitly See Also: RelationService.purgeRelations |
handleNotification | public void handleNotification(Notification notification, Object handback)(Code) | | Invoked when a JMX notification occurs. Currently handles notifications for unregistration of MBeans,
either referenced in a relation role or being a relation itself.
Parameters: notification - - the notification needs to be of type MBeanServerNotification Parameters: handback - - An opaque object which helps the listener to associate information regarding the MBean emitter (can be null). |
hasRelation | public Boolean hasRelation(String relationId) throws IllegalArgumentException(Code) | | Checks if there is a relation identified in Relation Service with given relation id.
Parameters: relationId - - the relation id identifying the relation boolean: true if there is a relation, false otherwise throws: IllegalArgumentException - - if parameter is null |
isRelation | public String isRelation(ObjectName objectName) throws IllegalArgumentException(Code) | | Returns the relation id associated to the given ObjectName if the MBean has been added as a relation in the Relation Service
Parameters: objectName - - the ObjectName of supposed relation - the relation id (String) or null (if the ObjectName is not a relation handled by the Relation Service) throws: IllegalArgumentException - - if the parameter is null |
postDeregister | public void postDeregister()(Code) | | logs nothing but log postRegisration
Implementation of MBeanRegistration
|
postRegister | public void postRegister(Boolean registrationDone)(Code) | | Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed
Parameters: registrationDone - - Indicates whether or not the MBean has been successfully registered in the MBean server.The value false means that the registration phase has failed See Also: MBeanRegistration |
preDeregister | public void preDeregister() throws Exception(Code) | | Allows the MBean to perform any operations it needs before being unregistered by the MBean server.
throws: Exception - - This exception will be caught by the MBean server and re-thrown as an See Also: MBeanRegistration See Also: See Also: The impmentation does nothing but log registration of the relation service See Also: javax.management.MBeanRegistrationException See Also: or a @see RuntimeMBeanException |
preRegister | public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception(Code) | | Implementation of interface MBeanRegistration @see MBeanRegistration
Allows the MBean to perform any operations it needs before being registered in the MBean server. If the name of the MBean is
not specified, the MBean can provide a name for its registration. If any exception is raised, the MBean will not be registered
in the MBean server.
Parameters: server - - The MBean server in which the MBean will be registered Parameters: name - - The object name of the MBean. This name is null if the name parameter to one of the createMBean or registerMBeanmethods in the @see MBeanServer interface is null. In that case, this method must return a non-null ObjectName for the new MBean. - The name under which the MBean is to be registered. This value must not be null. If the name parameter isnot null, it will usually but not necessarily be the returned value throws: Exception - - This exception will be caught by the MBean server and re-thrown as an See Also: javax.management.MBeanRegistrationException See Also: or a @see RuntimeMBeanException. |
purgeRelations | public void purgeRelations() throws RelationServiceNotRegisteredException(Code) | | Purges the relations
Depending on the purgeFlag value, this method is either called automatically when a notification is received for the
unregistration of an MBean referenced in a relation (if the flag is set to true), or not (if the flag is set to false).
In that case it is up to the user to call it to maintain the consistency of the relations. To be kept in mind that if an MBean is
unregistered and the purge not done immediately, if the ObjectName is reused and assigned to another MBean referenced in a relation,
calling manually this purgeRelations() method will cause trouble, as will consider the ObjectName as corresponding to the unregistered MBean,
not seeing the new one.
- if removing one MBean reference in the role makes its number of references less than the minimum degree, the relation has to be removed.
- if the remaining number of references after removing the MBean reference is still in the cardinality range, keep the relation and update
it calling its handleMBeanUnregistration() callback.
throws: RelationServiceNotRegisteredException - - if the Relation Service is not registered in the MBean Server. |
removeRelationType | public void removeRelationType(String relationTypeName) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationTypeNotFoundException(Code) | | Parameters: relationTypeName - - a string name representing the Relationtype Object throws: IllegalArgumentException - - if the relationTypeName is null throws: RelationServiceNotRegisteredException - - if the RelationService has not been registered in the MBeanServer throws: RelationTypeNotFoundException - - if the RelationType has not been foundThis method removes a RelationType, it's name(represented by the relationTypeName) and any relationIds associated with it,and all MBeans referenced in it's roles Note: this will not remove any mbeans registered with the MBeanServer this must be done if required via the MBeanServer.Any Mbeans registered with the MBean server will continue to be accessed via the MBeanServer, they will no longer be able to bereferenced, queried via the relation service though. |
sendRelationCreationNotification | public void sendRelationCreationNotification(String relationId) throws IllegalArgumentException, RelationNotFoundException(Code) | | Sends a notification (RelationNotification) for a relation creation. The notification type is:
- RelationNotification.RELATION_BASIC_CREATION if the relation is an object internal to the Relation Service
- RelationNotification.RELATION_MBEAN_CREATION if the relation is a MBean added as a relation
The source object is the Relation Service itself
It is called in Relation Service createRelation() and addRelation() methods
Parameters: relationId - - relation identifier of the updated relation throws: IllegalArgumentException - - if null parameter throws: RelationNotFoundException - - if there is no relation for given relation id |
sendRelationRemovalNotification | public void sendRelationRemovalNotification(String relationId, List unregisteredMBeanList) throws IllegalArgumentException, RelationNotFoundException(Code) | | Sends a notification (RelationNotification) for a relation removal. The notification type is:
- RelationNotification.RELATION_BASIC_REMOVAL if the relation is an object internal to the Relation Service
- RelationNotification.RELATION_MBEAN_REMOVAL if the relation is a MBean added as a relation
The source object is the Relation Service itself
It is called in Relation Service removeRelation() method
Parameters: relationId - - relation identifier of the updated relation Parameters: unregisteredMBeanList - - ArrayList of ObjectNames of MBeans expected to be unregistered due to relation removal (can be null) throws: IllegalArgumentException - - if relationId is null throws: RelationNotFoundException - - if there is no relation for given relation id |
sendRoleUpdateNotification | public void sendRoleUpdateNotification(String relationId, Role newRole, List oldRoleValues) throws IllegalArgumentException, RelationNotFoundException(Code) | | Sends a notification (RelationNotification) for a role update in the given relation. The notification type is:
- RelationNotification.RELATION_BASIC_UPDATE if the relation is an object internal to the Relation Service
- RelationNotification.RELATION_MBEAN_UPDATE if the relation is a MBean added as a relation
The source object is the Relation Service itself.
This method is called in relation MBean setRole() (for given role) and setRoles() (for each role) methods
(implementation provided in RelationSupport class)
It is also called in Relation Service setRole() (for given role) and setRoles() (for each role) methods
Parameters: relationId - - the relation identifier of the updated relation Parameters: newRole - - new role (name and new value) Parameters: oldRoleValues - - old role value (ArrayList of ObjectName objects) throws: IllegalArgumentException - - if null parameter throws: RelationNotFoundException - - if there is no relation for given relation id |
setPurgeFlag | public void setPurgeFlag(boolean purgeFlag)(Code) | | Parameters: purgeFlag - - a flag that when set to true indicates to the RelationService that it must update all relationswhen it recieves a unregistration notificationif false this will not occur and purgeRelations must be called explicitly |
updateRoleMap | public void updateRoleMap(String relationId, Role role, List oldRoleValues) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException(Code) | | Handles update of the Relation Service role map for the update of given role in given relation
It is called in relation MBean setRole() (for given role) and setRoles()(for each role) methods
(implementation provided in RelationSupport class).
It is also called in Relation Service setRole() (for given role) and setRoles() (for each role) methods.
To allow the Relation Service to maintain the consistency (in case of MBean unregistration) and to be able to
perform queries, this method must be called when a role is updated.
Parameters: relationId - - relation identifier of the updated relation Parameters: role - - new role (name and new value) Parameters: oldRoleValues - - old role value (ArrayList of ObjectName objects) throws: IllegalArgumentException - - if null parameter throws: RelationServiceNotRegisteredException - - if the Relation Service is not registered in the MBean Server throws: RelationNotFoundException - - if no relation for given id |
|
|