| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.management.relation.RelationSupport
public class 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 RelationRelationServiceNotRegisteredException - when the relation service
          is not registered with an MBeanServer.public Map getReferencedMBeans()
RelationThe 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 Relationpublic String getRelationId()
Relation
getRelationId in interface Relationpublic ObjectName getRelationServiceName()
Relation
getRelationServiceName in interface Relationpublic String getRelationTypeName()
Relation
getRelationTypeName in interface Relation
public List getRole(String roleName)
             throws IllegalArgumentException,
                    RoleNotFoundException,
                    RelationServiceNotRegisteredException
RelationThe return value is an ArrayList of object names in the role.
getRole in interface RelationroleName - the role name.
IllegalArgumentException - for a null role name.
RoleNotFoundException - when there is no such role or
                                  it is not readable.
RelationServiceNotRegisteredException - when the relation service
                                  is not registered with an MBeanServer.
public Integer getRoleCardinality(String roleName)
                           throws IllegalArgumentException,
                                  RoleNotFoundException
Relation
getRoleCardinality in interface RelationroleName - 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
getRoles in interface RelationroleNames - 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
RelationThe object name should be removed from the role.
Calling this method manually may result in incorrect behaviour
handleMBeanUnregistration in interface RelationobjectName - the object name unregistered.roleName - the role the containing the object.
RoleNotFoundException - if the role does exist or it is not
                                       writable.
InvalidRoleValueException - when the role does not conform
                                       to the associated role info.
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.
IllegalArgumentExceptionpublic RoleList retrieveAllRoles()
Relation
retrieveAllRoles in interface Relation
public void setRole(Role role)
             throws IllegalArgumentException,
                    RoleNotFoundException,
                    RelationTypeNotFoundException,
                    InvalidRoleValueException,
                    RelationServiceNotRegisteredException,
                    RelationNotFoundException
RelationThe 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.
setRole in interface Relationrole - the new role.
IllegalArgumentException - for a null role.
RoleNotFoundException - if the role is not writable.
                                       This test is not performed at initialisation.
RelationTypeNotFoundException - when the relation type has
                                       not been registered in the relation service.
InvalidRoleValueException - if the role is not valid.
RelationServiceNotRegisteredException - when the relation service
                                       is not registered with an MBeanServer.
RelationNotFoundException - when this method is called for
                                       for an MBean not registered with the relation service.
public RoleResult setRoles(RoleList roleList)
                    throws IllegalArgumentException,
                           RelationServiceNotRegisteredException,
                           RelationTypeNotFoundException,
                           RelationNotFoundException
RelationThe 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.
setRoles in interface RelationroleList - the new roles.
IllegalArgumentException - for a null role name.
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.public Boolean isInRelationService()
RelationSupportMBeanWARNING: 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
RelationSupportMBeanWARNING: 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 RelationSupportMBeanvalue - pass true for managed by the relation service, false 
        otherwise.
IllegalArgumentException - for a null value
public ObjectName preRegister(MBeanServer server,
                              ObjectName objectName)
                       throws Exception
MBeanRegistrationThe MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.
preRegister in interface MBeanRegistrationException - for any error, the MBean is not registered.public void postRegister(Boolean registered)
MBeanRegistration
postRegister in interface MBeanRegistrationregistered - the MBeanServer passes true when the
 MBean was registered, false otherwise.
public void preDeregister()
                   throws Exception
MBeanRegistrationThe MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.
preDeregister in interface MBeanRegistrationExceptionpublic void postDeregister()
MBeanRegistration
postDeregister in interface MBeanRegistration| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||