It implements the NotificationBroadcaster by extending NotificationBroadcasterSupport to send notifications when a relation is removed from it.
It implements the NotificationListener interface to be able to receive notifications concerning unregistration of MBeans referenced in relation roles and of relation MBeans.
It implements the MBeanRegistration interface to be able to retrieve its ObjectName and MBean Server.
Modifier and Type | Field and Description |
---|---|
private final AtomicLong | |
private MBeanServer | |
private ObjectName | |
private boolean | |
private final Map | |
private Map | |
private Map | |
private Map | |
private Map | |
private Map | |
private MBeanServerNotificationFilter | |
private List |
Access | Constructor and Description |
---|---|
public | RelationService(boolean
flag to indicate when a notification is
received for the unregistration of an MBean referenced in a relation, if
an immediate "purge" of the relations (look for the relations no
longer valid) has to be performed , or if that will be performed only
when the purgeRelations method will be explicitly called.
immediatePurgeFlag)true is immediate purge. Constructor. |
Modifier and Type | Method and Description |
---|---|
private boolean | |
public void | addRelation(ObjectName
ObjectName of the relation MBean to be added. relationObjectName)Implements javax. Adds an MBean created by the user (and registered by him in the MBean Server) as a relation in the Relation Service. |
private void | addRelationInt(boolean relationBaseFlag, RelationSupport relationObj, ObjectName relationObjName, String relationId, String relationTypeName, RoleList roleList)
|
public void | addRelationType(RelationType
relation type object (implementing the
RelationType interface) relationTypeObj)Implements javax. Adds given object as a relation type. |
private void | |
private Integer | checkRoleInt(int chkType, String roleName, List<ObjectName> roleValue, RoleInfo roleInfo, boolean writeChkFlag)
|
public Integer | Returns: 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 name of role to be checked roleName, String name of the relation type relationTypeName)Implements javax. Checks if given Role can be read in a relation of the given type. |
public Integer | Returns: 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 role to be checked role, String name of relation type relationTypeName, Boolean flag to specify that the checking is done for the
initialization of a role, write access shall not be verified. initFlag)Implements javax. Checks if given Role can be set in a relation of given type. |
public void | createRelation(String
relation identifier, to identify uniquely the relation
inside the Relation Service relationId, String name of the relation type (has to be created
in the Relation Service) relationTypeName, RoleList role list to initialize roles of the relation (can
be null). roleList)Implements javax. Creates a simple relation (represented by a RelationSupport object) of given relation type, and adds it in the Relation Service. |
public void | createRelationType(String
name of the relation type relationTypeName, RoleInfo[] array of role infos roleInfoArray)Implements javax. Creates a relation type (a RelationTypeSupport object) with given role infos (provided by the RoleInfo objects), and adds it in the Relation Service. |
public Map | Returns: an HashMap, where the keys are the ObjectNames of the MBeans associated to given MBean, and the value is, for each key, an ArrayList of the relation ids of the relations where the key MBean is associated to given one (as they can be associated in several different relations).ObjectName of MBean mbeanName, String can be null; if specified, only the relations
of that type will be considered in the search. Else all
relation types are considered. relationTypeName, String can be null; if specified, only the relations
where the MBean is referenced in that role will be considered. Else all
roles are considered. roleName)Implements javax. Retrieves the MBeans associated to given one in a relation. |
public Map | Returns: an 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).ObjectName of MBean mbeanName, String can be null; if specified, only the relations
of that type will be considered in the search. Else all relation types
are considered. relationTypeName, String can be null; if specified, only the relations
where the MBean is referenced in that role will be returned. Else all
roles are considered. roleName)Implements javax. Retrieves the relations where a given MBean is referenced. |
public List | Returns: an ArrayList of relation ids.relation type name relationTypeName)Implements javax. Returns the relation ids for relations of the given type. |
public List | Returns: ArrayList of StringImplements javax. Returns all the relation ids for all the relations handled by the Relation Service. |
public List | Returns: ArrayList of relation type names (Strings)Implements javax. Retrieves names of all known relation types. |
public RoleResult | Returns: a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not readable).relation id relationId)Implements javax. Returns all roles present in the relation. |
public MBeanNotificationInfo[] | getNotificationInfo()
Overrides javax. Implements javax. Returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent. |
public boolean | Returns: true if purges are automatic.Implements javax. Returns the flag to indicate if when a notification is received for the unregistration of an MBean referenced in a relation, if an immediate "purge" of the relations (look for the relations no longer valid) has to be performed , or if that will be performed only when the purgeRelations method will be explicitly called. |
public Map | Returns: a HashMap mapping:ObjectName -> ArrayList of String (role names) relation id relationId)Implements javax. Retrieves MBeans referenced in the various roles of the relation. |
pack-priv Object | |
pack-priv RelationType | |
public String | Returns: the name of the associated relation type.relation id relationId)Implements javax. Returns name of associated relation type for given relation. |
public List | Returns: the ArrayList of ObjectName objects being the role valuerelation id relationId, String name of role roleName)Implements javax. Retrieves role value for given role name in given relation. |
public Integer | Returns: the number of currently referenced MBeans in that rolerelation id relationId, String name of role roleName)Implements javax. Retrieves the number of MBeans currently referenced in the given role. |
public RoleInfo | Returns: RoleInfo object.name of relation type relationTypeName, String name of role roleInfoName)Implements javax. Retrieves role info for given role name of a given relation type. |
public List | Returns: ArrayList of RoleInfo.name of relation type relationTypeName)Implements javax. Retrieves list of role infos (RoleInfo objects) of a given relation type. |
public RoleResult | Returns: a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not retrieved).relation id relationId, String[] array of names of roles to be retrieved roleNameArray)Implements javax. Retrieves values of roles with given names in given relation. |
public void | handleNotification(Notification
The notification. notif, Object An opaque object which helps the listener to
associate information regarding the MBean emitter (can be null). handback)Implements javax. Invoked when a JMX notification occurs. |
private void | |
public Boolean | Returns: boolean: true if there is a relation, false elserelation id identifying the relation relationId)Implements javax. Checks if there is a relation identified in Relation Service with given relation id. |
private void | initializeMissingRoles(boolean relationBaseFlag, RelationSupport relationObj, ObjectName relationObjName, String relationId, String relationTypeName, List<RoleInfo> roleInfoList)
|
public void | isActive()
Implements javax. Checks if the Relation Service is active. |
public String | Returns: relation id (String) or null (if the ObjectName is not a relation handled by the Relation Service)ObjectName of supposed relation objectName)Implements javax. Returns the relation id associated to the given ObjectName if the MBean has been added as a relation in the Relation Service. |
public ObjectName | Returns: ObjectName of the corresponding relation MBean, or null if the relation is not an MBean.relation id identifying the relation relationId)Implements javax. If the relation is represented by an MBean (created by the user and added as a relation in the Relation Service), returns the ObjectName of the MBean. |
public void | postDeregister()
Implements javax. Allows the MBean to perform any operations needed after having been unregistered in the MBean server. |
public void | postRegister(Boolean
Indicates whether or not the MBean has
been successfully registered in the MBean server. The value
false means that the registration phase has failed. registrationDone)Implements javax. Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed. |
public void | preDeregister()
Implements javax. Allows the MBean to perform any operations it needs before being unregistered by the MBean server. |
public ObjectName | preRegister(MBeanServer
The MBean Server in which the MBean will be registered. server, ObjectName The object name of the MBean. This name is null if
the name parameter to one of the name)createMBean or
registerMBean methods in the MBeanServer
interface is null. In that case, this method must return a
non-null ObjectName for the new MBean.Implements javax. Allows the MBean to perform any operations it needs before being registered in the MBean Server. |
public void | purgeRelations()
Implements javax. Purges the relations. |
private boolean | removeMBeanReference(ObjectName objectName, String relationId, String roleName, boolean allRolesFlag)
|
public void | removeRelation(String
relation id of the relation to be removed relationId)Implements javax. Removes given relation from the Relation Service. |
public void | removeRelationType(String
name of the relation type to be removed relationTypeName)Implements javax. Removes given relation type from Relation Service. |
private void | sendNotificationInt(int intNtfType, String message, String relationId, List<ObjectName> unregMBeanList, String roleName, List<ObjectName> roleNewValue, List<ObjectName> oldValue)
|
public void | sendRelationCreationNotification(String
relation identifier of the updated relation relationId)Implements javax. Sends a notification (RelationNotification) for a relation creation. |
public void | sendRelationRemovalNotification(String
relation identifier of the updated relation relationId, List<ObjectName> List of ObjectNames of MBeans expected
to be unregistered due to relation removal (can be null) unregMBeanList)Implements javax. Sends a notification (RelationNotification) for a relation removal. |
public void | sendRoleUpdateNotification(String
relation identifier of the updated relation relationId, Role new role (name and new value) newRole, List<ObjectName> old role value (List of ObjectName objects) oldValue)Implements javax. Sends a notification (RelationNotification) for a role update in the given relation. |
public void | setPurgeFlag(boolean
flag purgeFlag)Implements javax. Sets the flag to indicate if when a notification is received for the unregistration of an MBean referenced in a relation, if an immediate "purge" of the relations (look for the relations no longer valid) has to be performed , or if that will be performed only when the purgeRelations method will be explicitly called. |
public void | setRole(String
relation id relationId, Role role to be set (name and new value) role)Implements javax. Sets the given role in given relation. |
public RoleResult | Returns: a RoleResult object, including a RoleList (for roles successfully set) and a RoleUnresolvedList (for roles not set).relation id relationId, RoleList list of roles to be set roleList)Implements javax. Sets the given roles in given relation. |
pack-priv static void | |
public void | updateRoleMap(String
relation identifier of the updated relation relationId, Role new role (name and new value) newRole, List<ObjectName> old role value (List of ObjectName objects) oldValue)Implements javax. Handles update of the Relation Service role map for the update of given role in given relation. |
private void |