Top Description Methods
javax.management.relation

public Interface Relation

Known Direct Subinterfaces
javax.management.relation.RelationSupportMBean
Imports
java.util.List, .Map, javax.management.ObjectName

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

Modifier and TypeMethod and Description
public RoleResult

Returns:

a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not readable).
getAllRoles
()

Returns all roles present in the relation.

public Map<ObjectName, List<String>>

Returns:

a HashMap mapping:

ObjectName -> ArrayList of String (role names)

getReferencedMBeans
()

Retrieves MBeans referenced in the various roles of the relation.

public String

Returns:

the relation id.
getRelationId
()

Returns relation identifier (used to uniquely identify the relation inside the Relation Service).

public ObjectName

Returns:

the ObjectName of the Relation Service.
getRelationServiceName
()

Returns ObjectName of the Relation Service handling the relation.

public String

Returns:

the name of the relation type.
getRelationTypeName
()

Returns name of associated relation type.

public List<ObjectName>

Returns:

the ArrayList of ObjectName objects being the role value
getRole
(String
name of role
roleName
)

Retrieves role value for given role name.

public Integer

Returns:

the number of currently referenced MBeans in that role
getRoleCardinality
(String
name of role
roleName
)

Returns the number of MBeans currently referenced in the given role.

public RoleResult

Returns:

a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not retrieved).
getRoles
(String[]
array of names of roles to be retrieved
roleNameArray
)

Retrieves values of roles with given names.

public void
handleMBeanUnregistration(ObjectName
ObjectName of unregistered MBean
objectName
,
String
name of role where the MBean is referenced
roleName
)

Callback used by the Relation Service when a MBean referenced in a role is unregistered.

public RoleList

Returns:

a RoleList.
retrieveAllRoles
()

Returns all roles in the relation without checking read mode.

public void
setRole(Role
role to be set (name and new value)
role
)

Sets the given role.

public RoleResult

Returns:

a RoleResult object, including a RoleList (for roles successfully set) and a RoleUnresolvedList (for roles not set).
setRoles
(RoleList
list of roles to be set
roleList
)

Sets the given roles.

Method Detail

getAllRolesback to summary
public RoleResult getAllRoles() throws RelationServiceNotRegisteredException

Returns all roles present in the relation.

Returns:RoleResult

a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not readable).

Exceptions
RelationServiceNotRegisteredException:
if the Relation Service is not registered in the MBean Server
getReferencedMBeansback to summary
public Map<ObjectName, List<String>> getReferencedMBeans()

Retrieves MBeans referenced in the various roles of the relation.

Returns:Map<ObjectName, List<String>>

a HashMap mapping:

ObjectName -> ArrayList of String (role names)

getRelationIdback to summary
public String getRelationId()

Returns relation identifier (used to uniquely identify the relation inside the Relation Service).

Returns:String

the relation id.

getRelationServiceNameback to summary
public ObjectName getRelationServiceName()

Returns ObjectName of the Relation Service handling the relation.

Returns:ObjectName

the ObjectName of the Relation Service.

getRelationTypeNameback to summary
public String getRelationTypeName()

Returns name of associated relation type.

Returns:String

the name of the relation type.

getRoleback to summary
public List<ObjectName> getRole(String roleName) throws IllegalArgumentException, RoleNotFoundException, RelationServiceNotRegisteredException

Retrieves role value for given role name.

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

Parameters
roleName:String

name of role

Returns:List<ObjectName>

the ArrayList of ObjectName objects being the role value

Exceptions
IllegalArgumentException:
if null role name
RoleNotFoundException:
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
See Also
setRole
getRoleCardinalityback to summary
public Integer getRoleCardinality(String roleName) throws IllegalArgumentException, RoleNotFoundException

Returns the number of MBeans currently referenced in the given role.

Parameters
roleName:String

name of role

Returns:Integer

the number of currently referenced MBeans in that role

Exceptions
IllegalArgumentException:
if null role name
RoleNotFoundException:
if there is no role with given name
getRolesback to summary
public RoleResult getRoles(String[] roleNameArray) throws IllegalArgumentException, RelationServiceNotRegisteredException

Retrieves values of roles with given names.

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

Parameters
roleNameArray:String[]

array of names of roles to be retrieved

Returns:RoleResult

a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not retrieved).

Exceptions
IllegalArgumentException:
if null role name
RelationServiceNotRegisteredException:
if the Relation Service is not registered in the MBean Server
See Also
setRoles
handleMBeanUnregistrationback to summary
public void handleMBeanUnregistration(ObjectName objectName, String roleName) throws IllegalArgumentException, RoleNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, 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
objectName:ObjectName

ObjectName of unregistered MBean

roleName:String

name of role where the MBean is referenced

Exceptions
IllegalArgumentException:
if null parameter
RoleNotFoundException:
if role does not exist in the relation or is not writable
InvalidRoleValueException:
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 Server
RelationTypeNotFoundException:
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.
retrieveAllRolesback to summary
public RoleList retrieveAllRoles()

Returns all roles in the relation without checking read mode.

Returns:RoleList

a RoleList.

setRoleback to summary
public void setRole(Role role) throws IllegalArgumentException, RoleNotFoundException, RelationTypeNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, 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
role:Role

role to be set (name and new value)

Exceptions
IllegalArgumentException:
if null role
RoleNotFoundException:
if there is no role with the supplied role's name or if the role is not writable (no test on the write access mode performed when initializing the role)
RelationTypeNotFoundException:
if the relation type has not been declared in the Relation Service.
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 Server
RelationNotFoundException:
if the relation has not been added in the Relation Service.
See Also
getRole
setRolesback to summary
public RoleResult setRoles(RoleList roleList) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, 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
roleList:RoleList

list of roles to be set

Returns:RoleResult

a RoleResult object, including a RoleList (for roles successfully set) and a RoleUnresolvedList (for roles not set).

Exceptions
IllegalArgumentException:
if null role list
RelationServiceNotRegisteredException:
if the Relation Service is not registered in the MBean Server
RelationTypeNotFoundException:
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.
See Also
getRoles