|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.management.relation.RelationSupport
Implements the management interface for a relation created internally within the relation service. The relation can have only roles - no attributes or methods.
The relation support managed bean can be created externally, including extending it, and then registered with the relation service.
Revisions:
20020412 Juha Lindfors:
Constructor Summary | |
RelationSupport(String relationId,
ObjectName relationService,
MBeanServer mbeanServer,
String relationTypeName,
RoleList roleList)
Construct a new relation support object. |
|
RelationSupport(String relationId,
ObjectName relationService,
String relationTypeName,
RoleList roleList)
Construct a new relation support object. |
Method Summary | |
RoleResult |
getAllRoles()
Retrieves all the roles in this relation. |
Map |
getReferencedMBeans()
Retrieves MBeans referenced by roles of this relation. |
String |
getRelationId()
Retrieves the relation id used to identify the relation within the relation service. |
ObjectName |
getRelationServiceName()
Retrieves the object name of the relation service this relation is registered with. |
String |
getRelationTypeName()
Retrieves the relation type for this relation. |
List |
getRole(String roleName)
Retrieves the role for the passed role name. |
Integer |
getRoleCardinality(String roleName)
Retrieves the number of MBeans in a given role. |
RoleResult |
getRoles(String[] roleNames)
Retrieves the roles in this relation with the passed names. |
void |
handleMBeanUnregistration(ObjectName objectName,
String roleName)
The relation service will call this service when an MBean referenced in a role is unregistered. |
Boolean |
isInRelationService()
Check to see whether this relation thinks it is in relation service. |
void |
postDeregister()
This method is called by the MBeanServer after deregistration takes place. |
void |
postRegister(Boolean registered)
This method is called by the MBeanServer after registration takes place or when registration fails. |
void |
preDeregister()
This method is called by the MBeanServer before deregistration takes place. |
ObjectName |
preRegister(MBeanServer server,
ObjectName objectName)
This method is called by the MBeanServer before registration takes place. |
RoleList |
retrieveAllRoles()
Retrieve all the roles in this relation without checking the role mode. |
void |
setRelationServiceManagementFlag(Boolean value)
Set the flag to specify whether this relation is registered with the relation service. |
void |
setRole(Role role)
Sets the passed role for this relation. |
RoleResult |
setRoles(RoleList roleList)
Sets the roles. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RelationSupport(String relationId, ObjectName relationService, String relationTypeName, RoleList roleList) throws IllegalArgumentException, InvalidRoleValueException
This constructor is intended for use when manually registrating a relation support object or an class that extends it.
Constructing the object does not register it with the relation service, only the following is validated at this stage.
The relation id is mandatory.
The relation service name is mandatory.
.
The relation type name is mandatory.
The same name is used for more than one role.
relationId
- the relation IdrelationService
- the object name of the relation servicerelationTypeName
- the name of the relation typeroleList
- the roles in this relation
IllegalArgumentException
- for null values.
InvalidRoleValueException
- when two roles have the same name.public RelationSupport(String relationId, ObjectName relationService, MBeanServer mbeanServer, String relationTypeName, RoleList roleList) throws IllegalArgumentException, InvalidRoleValueException
This constructor is intended for use when manually registrating a relation that delegates to relation support.
Constructing the object does not register it with the relation service, only the following is validated at this stage.
The relation id is mandatory.
The relation service name is mandatory.
.
The mbean service is mandatory.
.
The relation type name is mandatory.
The same name is used for more than one role.
relationId
- the relation IdrelationService
- the object name of the relation servicembeanServer
- the object name of the relation servicerelationTypeName
- the name of the relation typeroleList
- the roles in this relation
IllegalArgumentException
- for null values.
InvalidRoleValueException
- when two roles have the same name.Method Detail |
public RoleResult getAllRoles() throws RelationServiceNotRegisteredException
Relation
getAllRoles
in interface Relation
RelationServiceNotRegisteredException
- when the relation service
is not registered with an MBeanServer.public Map getReferencedMBeans()
Relation
The return value is a map keyed by MBean object names. The objects are associated with an ArrayList that contains all the role names the MBean has within this relation.
getReferencedMBeans
in interface Relation
public String getRelationId()
Relation
getRelationId
in interface Relation
public ObjectName getRelationServiceName()
Relation
getRelationServiceName
in interface Relation
public String getRelationTypeName()
Relation
getRelationTypeName
in interface Relation
public List getRole(String roleName) throws IllegalArgumentException, RoleNotFoundException, RelationServiceNotRegisteredException
Relation
The return value is an ArrayList of object names in the role.
roleName
- the role name.
RoleNotFoundException
- when there is no such role or
it is not readable.
IllegalArgumentException
- for a null role name.
RelationServiceNotRegisteredException
- when the relation service
is not registered with an MBeanServer.public Integer getRoleCardinality(String roleName) throws IllegalArgumentException, RoleNotFoundException
Relation
getRoleCardinality
in interface Relation
roleName
- the role name.
IllegalArgumentException
- for a null role name.
RoleNotFoundException
- when there is no such role.public RoleResult getRoles(String[] roleNames) throws IllegalArgumentException, RelationServiceNotRegisteredException
Relation
roleNames
- an array of role names
IllegalArgumentException
- for a null role names.
RelationServiceNotRegisteredException
- when the relation service
is not registered with an MBeanServer.public void handleMBeanUnregistration(ObjectName objectName, String roleName) throws IllegalArgumentException, RoleNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException
Relation
The object name should be removed from the role.
Calling this method manually may result in incorrect behaviour
handleMBeanUnregistration
in interface Relation
objectName
- the object name unregistered.roleName
- the role the containing the object.
InvalidRoleValueException
- when the role does not conform
to the associated role info.
RelationNotFoundException
- when this method is called for
for an MBean not registered with the relation service.
RelationServiceNotRegisteredException
- when the relation service
is not registered with an MBeanServer.
RelationTypeNotFoundException
- when the relation type has
not been registered in the relation service.
RoleNotFoundException
- if the role does exist or it is not
writable.
IllegalArgumentException
public RoleList retrieveAllRoles()
Relation
retrieveAllRoles
in interface Relation
public void setRole(Role role) throws IllegalArgumentException, RoleNotFoundException, RelationTypeNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationNotFoundException
Relation
The role is checked according to its role definition in the relation type. The role is not valid if there are the wrong number of MBeans, an MBean is of an incorrect class or an MBean does not exist.
The notification RELATION_BASIC_UPDATE is sent when the relation is not an MBean or RELATION_MBEAN_UPDATE when it is.
role
- the new role.
RelationTypeNotFoundException
- when the relation type has
not been registered in the relation service.
RoleNotFoundException
- if the role is not writable.
This test is not performed at initialisation.
IllegalArgumentException
- for a null role.
RelationNotFoundException
- when this method is called for
for an MBean not registered with the relation service.
InvalidRoleValueException
- if the role is not valid.
RelationServiceNotRegisteredException
- when the relation service
is not registered with an MBeanServer.public RoleResult setRoles(RoleList roleList) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException
Relation
The roles are checked according to its role definition in the relation type. The role is not valid if there are the wrong number of MBeans, an MBean is of an incorrect class or an MBean does not exist.
A notification RELATION_BASIC_UPDATE is sent when the relation is not an MBean or RELATION_MBEAN_UPDATE when it is for every updated role.
The return role result has a role list for successfully updated roles and an unresolved list for roles not set.
roleList
- the new roles.
RelationServiceNotRegisteredException
- when the relation service
is not registered with an MBeanServer.
RelationTypeNotFoundException
- when the relation type has
not been registered in the relation service.
RelationNotFoundException
- when this method is called for
for an MBean not registered with the relation service.
IllegalArgumentException
- for a null role name.public Boolean isInRelationService()
RelationSupportMBean
WARNING: This is not a dynamic check. The flag is set within the relation support object by the relation service, malicious programs may modifiy it to an incorrect value.
isInRelationService
in interface RelationSupportMBean
public void setRelationServiceManagementFlag(Boolean value) throws IllegalArgumentException
RelationSupportMBean
WARNING: This method is exposed for management by the relation service. Using this method outside of the relation service does not affect the registration with the relation service.
setRelationServiceManagementFlag
in interface RelationSupportMBean
value
- pass true for managed by the relation service, false
otherwise.
IllegalArgumentException
- for a null valuepublic ObjectName preRegister(MBeanServer server, ObjectName objectName) throws Exception
MBeanRegistration
The MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.
preRegister
in interface MBeanRegistration
Exception
- for any error, the MBean is not registered.public void postRegister(Boolean registered)
MBeanRegistration
postRegister
in interface MBeanRegistration
registered
- the MBeanServer passes true when the
MBean was registered, false otherwise.public void preDeregister() throws Exception
MBeanRegistration
The MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.
preDeregister
in interface MBeanRegistration
Exception
public void postDeregister()
MBeanRegistration
postDeregister
in interface MBeanRegistration
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |