javax.management.relation
Interface Relation

All Known Subinterfaces:
RelationSupportMBean sample code for javax.management.relation.RelationSupportMBean definition code for javax.management.relation.RelationSupportMBean
All Known Implementing Classes:
RelationSupport sample code for javax.management.relation.RelationSupport definition code for javax.management.relation.RelationSupport

public interface Relation

This interface has to be implemented by any MBean class expected to represent a relation managed using the Relation Service.

Simple relations, i.e. having only roles, no properties or methods, can be created directly by the Relation Service (represented as RelationSupport objects, internally handled by the Relation Service).

If the user wants to represent more complex relations, involving properties and/or methods, he has to provide his own class implementing the Relation interface. This can be achieved either by inheriting from RelationSupport class, or by implementing the interface (fully or delegation to a RelationSupport object member).

Specifying such user relation class is to introduce properties and/or methods. Those have to be exposed for remote management. So this means that any user relation class must be a MBean class.

Since:
1.5

Method Summary
 RoleResult sample code for javax.management.relation.RoleResult definition code for javax.management.relation.RoleResult getAllRoles sample code for javax.management.relation.Relation.getAllRoles() definition code for javax.management.relation.Relation.getAllRoles() ()
          Returns all roles present in the relation.
 Map sample code for java.util.Map definition code for java.util.Map getReferencedMBeans sample code for javax.management.relation.Relation.getReferencedMBeans() definition code for javax.management.relation.Relation.getReferencedMBeans() ()
          Retrieves MBeans referenced in the various roles of the relation.
 String sample code for java.lang.String definition code for java.lang.String getRelationId sample code for javax.management.relation.Relation.getRelationId() definition code for javax.management.relation.Relation.getRelationId() ()
          Returns relation identifier (used to uniquely identify the relation inside the Relation Service).
 ObjectName sample code for javax.management.ObjectName definition code for javax.management.ObjectName getRelationServiceName sample code for javax.management.relation.Relation.getRelationServiceName() definition code for javax.management.relation.Relation.getRelationServiceName() ()
          Returns ObjectName of the Relation Service handling the relation.
 String sample code for java.lang.String definition code for java.lang.String getRelationTypeName sample code for javax.management.relation.Relation.getRelationTypeName() definition code for javax.management.relation.Relation.getRelationTypeName() ()
          Returns name of associated relation type.
 List sample code for java.util.List definition code for java.util.List getRole sample code for javax.management.relation.Relation.getRole(java.lang.String) definition code for javax.management.relation.Relation.getRole(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  theRoleName)
          Retrieves role value for given role name.
 Integer sample code for java.lang.Integer definition code for java.lang.Integer getRoleCardinality sample code for javax.management.relation.Relation.getRoleCardinality(java.lang.String) definition code for javax.management.relation.Relation.getRoleCardinality(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  theRoleName)
          Returns the number of MBeans currently referenced in the given role.
 RoleResult sample code for javax.management.relation.RoleResult definition code for javax.management.relation.RoleResult getRoles sample code for javax.management.relation.Relation.getRoles(java.lang.String[]) definition code for javax.management.relation.Relation.getRoles(java.lang.String[]) (String sample code for java.lang.String definition code for java.lang.String [] theRoleNameArray)
          Retrieves values of roles with given names.
 void handleMBeanUnregistration sample code for javax.management.relation.Relation.handleMBeanUnregistration(javax.management.ObjectName, java.lang.String) definition code for javax.management.relation.Relation.handleMBeanUnregistration(javax.management.ObjectName, java.lang.String) (ObjectName sample code for javax.management.ObjectName definition code for javax.management.ObjectName  theObjName, String sample code for java.lang.String definition code for java.lang.String  theRoleName)
          Callback used by the Relation Service when a MBean referenced in a role is unregistered.
 RoleList sample code for javax.management.relation.RoleList definition code for javax.management.relation.RoleList retrieveAllRoles sample code for javax.management.relation.Relation.retrieveAllRoles() definition code for javax.management.relation.Relation.retrieveAllRoles() ()
          Returns all roles in the relation without checking read mode.
 void setRole sample code for javax.management.relation.Relation.setRole(javax.management.relation.Role) definition code for javax.management.relation.Relation.setRole(javax.management.relation.Role) (Role sample code for javax.management.relation.Role definition code for javax.management.relation.Role  theRole)
          Sets the given role.
 RoleResult sample code for javax.management.relation.RoleResult definition code for javax.management.relation.RoleResult setRoles sample code for javax.management.relation.Relation.setRoles(javax.management.relation.RoleList) definition code for javax.management.relation.Relation.setRoles(javax.management.relation.RoleList) (RoleList sample code for javax.management.relation.RoleList definition code for javax.management.relation.RoleList  theRoleList)
          Sets the given roles.
 

Method Detail

getRole sample code for javax.management.relation.Relation.getRole(java.lang.String) definition code for javax.management.relation.Relation.getRole(java.lang.String)

List sample code for java.util.List definition code for java.util.List  getRole(String sample code for java.lang.String definition code for java.lang.String  theRoleName)
             throws IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException ,
                    RoleNotFoundException sample code for javax.management.relation.RoleNotFoundException definition code for javax.management.relation.RoleNotFoundException ,
                    RelationServiceNotRegisteredException sample code for javax.management.relation.RelationServiceNotRegisteredException definition code for javax.management.relation.RelationServiceNotRegisteredException 
Retrieves role value for given role name.

Checks if the role exists and is readable according to the relation type.

Parameters:
theRoleName - name of role
Returns:
the ArrayList of ObjectName objects being the role value
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if null role name
RoleNotFoundException sample code for javax.management.relation.RoleNotFoundException definition code for javax.management.relation.RoleNotFoundException - if:

- there is no role with given name

- the role is not readable.

RelationServiceNotRegisteredException sample code for javax.management.relation.RelationServiceNotRegisteredException definition code for javax.management.relation.RelationServiceNotRegisteredException - if the Relation Service is not registered in the MBean Server
See Also:
setRole(javax.management.relation.Role) sample code for javax.management.relation.Relation.setRole(javax.management.relation.Role) definition code for javax.management.relation.Relation.setRole(javax.management.relation.Role)

getRoles sample code for javax.management.relation.Relation.getRoles(java.lang.String[]) definition code for javax.management.relation.Relation.getRoles(java.lang.String[])

RoleResult sample code for javax.management.relation.RoleResult definition code for javax.management.relation.RoleResult  getRoles(String sample code for java.lang.String definition code for java.lang.String [] theRoleNameArray)
                    throws IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException ,
                           RelationServiceNotRegisteredException sample code for javax.management.relation.RelationServiceNotRegisteredException definition code for javax.management.relation.RelationServiceNotRegisteredException 
Retrieves values of roles with given names.

Checks for each role if it exists and is readable according to the relation type.

Parameters:
theRoleNameArray - array of names of roles to be retrieved
Returns:
a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not retrieved).
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if null role name
RelationServiceNotRegisteredException sample code for javax.management.relation.RelationServiceNotRegisteredException definition code for javax.management.relation.RelationServiceNotRegisteredException - if the Relation Service is not registered in the MBean Server
See Also:
setRoles(javax.management.relation.RoleList) sample code for javax.management.relation.Relation.setRoles(javax.management.relation.RoleList) definition code for javax.management.relation.Relation.setRoles(javax.management.relation.RoleList)

getRoleCardinality sample code for javax.management.relation.Relation.getRoleCardinality(java.lang.String) definition code for javax.management.relation.Relation.getRoleCardinality(java.lang.String)

Integer sample code for java.lang.Integer definition code for java.lang.Integer  getRoleCardinality(String sample code for java.lang.String definition code for java.lang.String  theRoleName)
                           throws IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException ,
                                  RoleNotFoundException sample code for javax.management.relation.RoleNotFoundException definition code for javax.management.relation.RoleNotFoundException 
Returns the number of MBeans currently referenced in the given role.

Parameters:
theRoleName - name of role
Returns:
the number of currently referenced MBeans in that role
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if null role name
RoleNotFoundException sample code for javax.management.relation.RoleNotFoundException definition code for javax.management.relation.RoleNotFoundException - if there is no role with given name

getAllRoles sample code for javax.management.relation.Relation.getAllRoles() definition code for javax.management.relation.Relation.getAllRoles()

RoleResult sample code for javax.management.relation.RoleResult definition code for javax.management.relation.RoleResult  getAllRoles()
                       throws RelationServiceNotRegisteredException sample code for javax.management.relation.RelationServiceNotRegisteredException definition code for javax.management.relation.RelationServiceNotRegisteredException 
Returns all roles present in the relation.

Returns:
a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not readable).
Throws:
RelationServiceNotRegisteredException sample code for javax.management.relation.RelationServiceNotRegisteredException definition code for javax.management.relation.RelationServiceNotRegisteredException - if the Relation Service is not registered in the MBean Server

retrieveAllRoles sample code for javax.management.relation.Relation.retrieveAllRoles() definition code for javax.management.relation.Relation.retrieveAllRoles()

RoleList sample code for javax.management.relation.RoleList definition code for javax.management.relation.RoleList  retrieveAllRoles()
Returns all roles in the relation without checking read mode.

Returns:
a RoleList.

setRole sample code for javax.management.relation.Relation.setRole(javax.management.relation.Role) definition code for javax.management.relation.Relation.setRole(javax.management.relation.Role)

void setRole(Role sample code for javax.management.relation.Role definition code for javax.management.relation.Role  theRole)
             throws IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException ,
                    RoleNotFoundException sample code for javax.management.relation.RoleNotFoundException definition code for javax.management.relation.RoleNotFoundException ,
                    RelationTypeNotFoundException sample code for javax.management.relation.RelationTypeNotFoundException definition code for javax.management.relation.RelationTypeNotFoundException ,
                    InvalidRoleValueException sample code for javax.management.relation.InvalidRoleValueException definition code for javax.management.relation.InvalidRoleValueException ,
                    RelationServiceNotRegisteredException sample code for javax.management.relation.RelationServiceNotRegisteredException definition code for javax.management.relation.RelationServiceNotRegisteredException ,
                    RelationNotFoundException sample code for javax.management.relation.RelationNotFoundException definition code for javax.management.relation.RelationNotFoundException 
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).

Parameters:
theRole - role to be set (name and new value)
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if null role
RoleNotFoundException sample code for javax.management.relation.RoleNotFoundException definition code for javax.management.relation.RoleNotFoundException - if the role is not writable (no test on the write access mode performed when initialising the role)
InvalidRoleValueException sample code for javax.management.relation.InvalidRoleValueException definition code for javax.management.relation.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 sample code for javax.management.relation.RelationServiceNotRegisteredException definition code for javax.management.relation.RelationServiceNotRegisteredException - if the Relation Service is not registered in the MBean Server
RelationTypeNotFoundException sample code for javax.management.relation.RelationTypeNotFoundException definition code for javax.management.relation.RelationTypeNotFoundException - if the relation type has not been declared in the Relation Service.
RelationNotFoundException sample code for javax.management.relation.RelationNotFoundException definition code for javax.management.relation.RelationNotFoundException - if the relation has not been added in the Relation Service.
See Also:
getRole(java.lang.String) sample code for javax.management.relation.Relation.getRole(java.lang.String) definition code for javax.management.relation.Relation.getRole(java.lang.String)

setRoles sample code for javax.management.relation.Relation.setRoles(javax.management.relation.RoleList) definition code for javax.management.relation.Relation.setRoles(javax.management.relation.RoleList)

RoleResult sample code for javax.management.relation.RoleResult definition code for javax.management.relation.RoleResult  setRoles(RoleList sample code for javax.management.relation.RoleList definition code for javax.management.relation.RoleList  theRoleList)
                    throws IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException ,
                           RelationServiceNotRegisteredException sample code for javax.management.relation.RelationServiceNotRegisteredException definition code for javax.management.relation.RelationServiceNotRegisteredException ,
                           RelationTypeNotFoundException sample code for javax.management.relation.RelationTypeNotFoundException definition code for javax.management.relation.RelationTypeNotFoundException ,
                           RelationNotFoundException sample code for javax.management.relation.RelationNotFoundException definition code for javax.management.relation.RelationNotFoundException 
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.

Parameters:
theRoleList - list of roles to be set
Returns:
a RoleResult object, including a RoleList (for roles successfully set) and a RoleUnresolvedList (for roles not set).
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if null role name
RelationServiceNotRegisteredException sample code for javax.management.relation.RelationServiceNotRegisteredException definition code for javax.management.relation.RelationServiceNotRegisteredException - if the Relation Service is not registered in the MBean Server
RelationTypeNotFoundException sample code for javax.management.relation.RelationTypeNotFoundException definition code for javax.management.relation.RelationTypeNotFoundException - if the relation type has not been declared in the Relation Service.
RelationNotFoundException sample code for javax.management.relation.RelationNotFoundException definition code for javax.management.relation.RelationNotFoundException - if the relation MBean has not been added in the Relation Service.
See Also:
getRoles(java.lang.String[]) sample code for javax.management.relation.Relation.getRoles(java.lang.String[]) definition code for javax.management.relation.Relation.getRoles(java.lang.String[])

handleMBeanUnregistration sample code for javax.management.relation.Relation.handleMBeanUnregistration(javax.management.ObjectName, java.lang.String) definition code for javax.management.relation.Relation.handleMBeanUnregistration(javax.management.ObjectName, java.lang.String)

void handleMBeanUnregistration(ObjectName sample code for javax.management.ObjectName definition code for javax.management.ObjectName  theObjName,
                               String sample code for java.lang.String definition code for java.lang.String  theRoleName)
                               throws IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException ,
                                      RoleNotFoundException sample code for javax.management.relation.RoleNotFoundException definition code for javax.management.relation.RoleNotFoundException ,
                                      InvalidRoleValueException sample code for javax.management.relation.InvalidRoleValueException definition code for javax.management.relation.InvalidRoleValueException ,
                                      RelationServiceNotRegisteredException sample code for javax.management.relation.RelationServiceNotRegisteredException definition code for javax.management.relation.RelationServiceNotRegisteredException ,
                                      RelationTypeNotFoundException sample code for javax.management.relation.RelationTypeNotFoundException definition code for javax.management.relation.RelationTypeNotFoundException ,
                                      RelationNotFoundException sample code for javax.management.relation.RelationNotFoundException definition code for javax.management.relation.RelationNotFoundException 
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.

Parameters:
theObjName - ObjectName of unregistered MBean
theRoleName - name of role where the MBean is referenced
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if null parameter
RoleNotFoundException sample code for javax.management.relation.RoleNotFoundException definition code for javax.management.relation.RoleNotFoundException - if role does not exist in the relation or is not writable
InvalidRoleValueException sample code for javax.management.relation.InvalidRoleValueException definition code for javax.management.relation.InvalidRoleValueException - if role value does not conform to the associated role info (this will never happen when called from the Relation Service)
RelationServiceNotRegisteredException sample code for javax.management.relation.RelationServiceNotRegisteredException definition code for javax.management.relation.RelationServiceNotRegisteredException - if the Relation Service is not registered in the MBean Server
RelationTypeNotFoundException sample code for javax.management.relation.RelationTypeNotFoundException definition code for javax.management.relation.RelationTypeNotFoundException - if the relation type has not been declared in the Relation Service.
RelationNotFoundException sample code for javax.management.relation.RelationNotFoundException definition code for javax.management.relation.RelationNotFoundException - if this method is called for a relation MBean not added in the Relation Service.

getReferencedMBeans sample code for javax.management.relation.Relation.getReferencedMBeans() definition code for javax.management.relation.Relation.getReferencedMBeans()

Map sample code for java.util.Map definition code for java.util.Map  getReferencedMBeans()
Retrieves MBeans referenced in the various roles of the relation.

Returns:
a HashMap mapping:

ObjectName -> ArrayList of String (role names)


getRelationTypeName sample code for javax.management.relation.Relation.getRelationTypeName() definition code for javax.management.relation.Relation.getRelationTypeName()

String sample code for java.lang.String definition code for java.lang.String  getRelationTypeName()
Returns name of associated relation type.

Returns:
the name of the relation type.

getRelationServiceName sample code for javax.management.relation.Relation.getRelationServiceName() definition code for javax.management.relation.Relation.getRelationServiceName()

ObjectName sample code for javax.management.ObjectName definition code for javax.management.ObjectName  getRelationServiceName()
Returns ObjectName of the Relation Service handling the relation.

Returns:
the ObjectName of the Relation Service.

getRelationId sample code for javax.management.relation.Relation.getRelationId() definition code for javax.management.relation.Relation.getRelationId()

String sample code for java.lang.String definition code for java.lang.String  getRelationId()
Returns relation identifier (used to uniquely identify the relation inside the Relation Service).

Returns:
the relation id.