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.
Modifier and Type | Field and Description |
---|---|
private final AtomicBoolean | |
private String | |
private MBeanServer | |
private ObjectName | |
private String | |
private final Map |
Access | Constructor and Description |
---|---|
public | RelationSupport(String
relation identifier, to identify the relation in the
Relation Service.
relationId, ObjectName Expected to be unique in the given Relation Service. ObjectName of the Relation Service where
the relation will be registered.
relationServiceName, String This parameter is required as it is the Relation Service that is aware of the definition of the relation type of the given relation, so that will be able to check update operations (set). Name of relation type.
relationTypeName, RoleList Expected to have been created in the given Relation Service. list of roles (Role objects) to initialize the
relation. Can be list)null .
Expected to conform to relation info in associated relation type. Creates a |
public | RelationSupport(String
relation identifier, to identify the relation in the
Relation Service.
relationId, ObjectName Expected to be unique in the given Relation Service. ObjectName of the Relation Service where
the relation will be registered.
relationServiceName, MBeanServer This parameter is required as it is the Relation Service that is aware of the definition of the relation type of the given relation, so that will be able to check update operations (set). MBean Server where the wrapping MBean
is or will be registered.
relationServiceMBeanServer, String Expected to be the MBean Server where the Relation Service is or will be registered. Name of relation type.
relationTypeName, RoleList Expected to have been created in the given Relation Service. list of roles (Role objects) to initialize the
relation. Can be list)null .
Expected to conform to relation info in associated relation type. Creates a |
Modifier and Type | Method and Description |
---|---|
public RoleResult | Returns: a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not readable).Implements javax. Returns all roles present in the relation. |
pack-priv RoleResult | |
public Map | Returns: a HashMap mapping:ObjectName -> ArrayList of String (role names) Implements javax. Retrieves MBeans referenced in the various roles of the relation. |
public String | Returns: the relation id.Implements javax. Returns relation identifier (used to uniquely identify the relation inside the Relation Service). |
public ObjectName | Returns: the ObjectName of the Relation Service.Implements javax. Returns ObjectName of the Relation Service handling the relation. |
public String | getRelationTypeName()
Implements javax. Returns name of associated relation type. |
public List | Returns: the ArrayList of ObjectName objects being the role valuename of role roleName)Implements javax. Retrieves role value for given role name. |
public Integer | Returns: the number of currently referenced MBeans in that rolename of role roleName)Implements javax. Returns the number of MBeans currently referenced in the given role. |
pack-priv Object | getRoleInt(String roleName, boolean relationServCallFlg, RelationService relationServ, boolean multiRoleFlg)
|
public RoleResult | Returns: a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not retrieved).array of names of roles to be retrieved roleNameArray)Implements javax. Retrieves values of roles with given names. |
pack-priv RoleResult | |
public void | handleMBeanUnregistration(ObjectName
ObjectName of unregistered MBean objectName, String name of role where the MBean is referenced roleName)Implements javax. Callback used by the Relation Service when a MBean referenced in a role is unregistered. |
pack-priv void | handleMBeanUnregistrationInt(ObjectName objectName, String roleName, boolean relationServCallFlg, RelationService relationServ)
|
private void | initMembers(String relationId, ObjectName relationServiceName, MBeanServer relationServiceMBeanServer, String relationTypeName, RoleList list)
|
private void | |
public Boolean | isInRelationService()
Implements javax. Returns an internal flag specifying if the object is still handled by the Relation Service. |
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 RoleList | Returns: a RoleListImplements javax. Returns all roles in the relation without checking read mode. |
private void | sendRoleUpdateNotification(Role newRole, List<ObjectName> oldRoleValue, boolean relationServCallFlg, RelationService relationServ)
|
public void | setRelationServiceManagementFlag(Boolean
whether the relation is handled by the Relation Service. flag)Implements javax. Specifies whether this relation is handled by the Relation Service. |
public void | setRole(Role
role to be set (name and new value) role)Implements javax. Sets the given role. |
pack-priv Object | setRoleInt(Role aRole, boolean relationServCallFlg, RelationService relationServ, boolean multiRoleFlg)
|
public RoleResult | Returns: a RoleResult object, including a RoleList (for roles successfully set) and a RoleUnresolvedList (for roles not set).list of roles to be set list)Implements javax. Sets the given roles. |
pack-priv RoleResult | |
private void | updateRelationServiceMap(Role newRole, List<ObjectName> oldRoleValue, boolean relationServCallFlg, RelationService relationServ)
|
myInRelServFlg | back to summary |
---|---|
private final AtomicBoolean myInRelServFlg |
myRelId | back to summary |
---|---|
private String myRelId |
myRelServiceMBeanServer | back to summary |
---|---|
private MBeanServer myRelServiceMBeanServer |
myRelServiceName | back to summary |
---|---|
private ObjectName myRelServiceName |
myRelTypeName | back to summary |
---|---|
private String myRelTypeName |
myRoleName2ValueMap | back to summary |
---|---|
private final Map<String, Role> myRoleName2ValueMap |
RelationSupport | back to summary |
---|---|
public RelationSupport(String relationId, ObjectName relationServiceName, String relationTypeName, RoleList list) throws InvalidRoleValueException, IllegalArgumentException Creates a 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 whose class extends RelationSupport. Nothing is done at the Relation Service level, i.e.
the - any of the required parameters is - the same name is used for two roles. To be handled as a relation, the
|
RelationSupport | back to summary |
---|---|
public RelationSupport(String relationId, ObjectName relationServiceName, MBeanServer relationServiceMBeanServer, String relationTypeName, RoleList list) throws InvalidRoleValueException, IllegalArgumentException Creates a This constructor has to be used when the user relation MBean implements the interfaces expected to be supported by a relation by delegating to a RelationSupport object. This object needs to know the Relation Service expected to handle the relation. So it has to know the MBean Server where the Relation Service is registered. According to a limitation, a relation MBean must be registered in the same MBean Server as the Relation Service expected to handle it. So the user relation MBean has to be created and registered, and then the wrapped RelationSupport object can be created within the identified MBean Server. Nothing is done at the Relation Service level, i.e.
the - any of the required parameters is - the same name is used for two roles. To be handled as a relation, the
|
getAllRoles | back to summary |
---|---|
public RoleResult getAllRoles() throws RelationServiceNotRegisteredException Implements javax. Returns all roles present in the relation.
|
getAllRolesInt | back to summary |
---|---|
pack-priv RoleResult getAllRolesInt(boolean relationServCallFlg, RelationService relationServ) throws IllegalArgumentException, RelationServiceNotRegisteredException |
getReferencedMBeans | back to summary |
---|---|
public Map Implements javax. Retrieves MBeans referenced in the various roles of the relation.
|
getRelationId | back to summary |
---|---|
public String getRelationId() Implements javax. Returns relation identifier (used to uniquely identify the relation inside the Relation Service).
|
getRelationServiceName | back to summary |
---|---|
public ObjectName getRelationServiceName() Implements javax. Returns ObjectName of the Relation Service handling the relation.
|
getRelationTypeName | back to summary |
---|---|
public String getRelationTypeName() Implements javax. Returns name of associated relation type.
|
getRole | back to summary |
---|---|
public List Implements javax. Retrieves role value for given role name. Checks if the role exists and is readable according to the relation type.
|
getRoleCardinality | back to summary |
---|---|
public Integer getRoleCardinality(String roleName) throws IllegalArgumentException, RoleNotFoundException Implements javax. Returns the number of MBeans currently referenced in the given role.
|
getRoleInt | back to summary |
---|---|
pack-priv Object getRoleInt(String roleName, boolean relationServCallFlg, RelationService relationServ, boolean multiRoleFlg) throws IllegalArgumentException, RoleNotFoundException, RelationServiceNotRegisteredException |
getRoles | back to summary |
---|---|
public RoleResult getRoles(String[] roleNameArray) throws IllegalArgumentException, RelationServiceNotRegisteredException Implements javax. Retrieves values of roles with given names. Checks for each role if it exists and is readable according to the relation type.
|
getRolesInt | back to summary |
---|---|
pack-priv RoleResult getRolesInt(String[] roleNameArray, boolean relationServCallFlg, RelationService relationServ) throws IllegalArgumentException, RelationServiceNotRegisteredException |
handleMBeanUnregistration | back to summary |
---|---|
public void handleMBeanUnregistration(ObjectName objectName, String roleName) throws IllegalArgumentException, RoleNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException Implements javax. Callback used by the Relation Service when a MBean referenced in a role is unregistered. 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.
|
handleMBeanUnregistrationInt | back to summary |
---|---|
pack-priv void handleMBeanUnregistrationInt(ObjectName objectName, String roleName, boolean relationServCallFlg, RelationService relationServ) throws IllegalArgumentException, RoleNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException |
initMembers | back to summary |
---|---|
private void initMembers(String relationId, ObjectName relationServiceName, MBeanServer relationServiceMBeanServer, String relationTypeName, RoleList list) throws InvalidRoleValueException, IllegalArgumentException |
initRoleMap | back to summary |
---|---|
private void initRoleMap(RoleList list) throws InvalidRoleValueException |
isInRelationService | back to summary |
---|---|
public Boolean isInRelationService() Implements javax. Returns an internal flag specifying if the object is still handled by the Relation Service.
|
postDeregister | back to summary |
---|---|
public void postDeregister() Implements javax. Doc from javax. Allows the MBean to perform any operations needed after having been unregistered in the MBean server. If the implementation of this method throws a This might be confusing for the code calling
|
postRegister | back to summary |
---|---|
public void postRegister(Boolean registrationDone) Implements javax. Doc from javax. Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed. If the implementation of this method throws a This might be confusing for the code calling
|
preDeregister | back to summary |
---|---|
public void preDeregister() throws Exception Implements javax. Doc from javax. Allows the MBean to perform any operations it needs before being unregistered by the MBean server.
|
preRegister | back to summary |
---|---|
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception Implements javax. Doc from javax. 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.
|
retrieveAllRoles | back to summary |
---|---|
public RoleList retrieveAllRoles() Implements javax. Returns all roles in the relation without checking read mode.
|
sendRoleUpdateNotification | back to summary |
---|---|
private void sendRoleUpdateNotification(Role newRole, List<ObjectName> oldRoleValue, boolean relationServCallFlg, RelationService relationServ) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException |
setRelationServiceManagementFlag | back to summary |
---|---|
public void setRelationServiceManagementFlag(Boolean flag) throws IllegalArgumentException Implements javax. Doc from javax. Specifies whether this relation is handled by the Relation Service. BEWARE, this method has to be exposed as the Relation Service will access the relation through its 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!
|
setRole | back to summary |
---|---|
public void setRole(Role role) throws IllegalArgumentException, RoleNotFoundException, RelationTypeNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationNotFoundException Implements javax. Sets the given role. 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).
|
setRoleInt | back to summary |
---|---|
pack-priv Object setRoleInt(Role aRole, boolean relationServCallFlg, RelationService relationServ, boolean multiRoleFlg) throws IllegalArgumentException, RoleNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException |
setRoles | back to summary |
---|---|
public RoleResult setRoles(RoleList list) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException Implements javax. Sets the given roles. 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.
|
setRolesInt | back to summary |
---|---|
pack-priv RoleResult setRolesInt(RoleList list, boolean relationServCallFlg, RelationService relationServ) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException |
updateRelationServiceMap | back to summary |
---|---|
private void updateRelationServiceMap(Role newRole, List<ObjectName> oldRoleValue, boolean relationServCallFlg, RelationService relationServ) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException |