|
|||||||||
| Home >> All >> javax >> management >> [ relation overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
javax.management.relation
Class RelationSupport

java.lang.Objectjavax.management.relation.RelationSupport
- All Implemented Interfaces:
- javax.management.MBeanRegistration, Relation, RelationSupportMBean
- public class RelationSupport
- extends java.lang.Object
- implements RelationSupportMBean, javax.management.MBeanRegistration
- extends java.lang.Object
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.
- Version:
- $Revision: 1.5.6.1 $
Revisions:
20020412 Juha Lindfors:
- Changed MBeanProxy exception handling on create methods -- only need to catch one MBeanProxyCreationException
| Field Summary | |
(package private) java.lang.Boolean |
registered
Wether this relation is registered in the relation service |
(package private) java.lang.String |
relationId
The relation id. |
(package private) javax.management.ObjectName |
relationService
The relation service |
(package private) java.lang.String |
relationTypeName
The relation type name |
(package private) java.util.HashMap |
roles
The roles mapped by role name |
(package private) javax.management.MBeanServer |
server
The mbean server |
private RelationServiceMBean |
serviceProxy
A proxy to the relation service |
| Constructor Summary | |
RelationSupport(java.lang.String relationId,
javax.management.ObjectName relationService,
javax.management.MBeanServer mbeanServer,
java.lang.String relationTypeName,
RoleList roleList)
Construct a new relation support object. |
|
RelationSupport(java.lang.String relationId,
javax.management.ObjectName relationService,
java.lang.String relationTypeName,
RoleList roleList)
Construct a new relation support object. |
|
| Method Summary | |
private void |
checkRegistered()
Check that we are registered with the relation service |
private int |
checkRoleReadable(Role role)
Check a role is readable |
private int |
checkRoleWritable(Role role,
boolean initFlag)
Check a role is writable |
private void |
checkServiceProxy()
Check the relation service proxy has been constructed. |
RoleResult |
getAllRoles()
Retrieves all the roles in this relation. |
java.util.Map |
getReferencedMBeans()
Retrieves MBeans referenced by roles of this relation. |
java.lang.String |
getRelationId()
Retrieves the relation id used to identify the relation within the relation service. |
javax.management.ObjectName |
getRelationServiceName()
Retrieves the object name of the relation service this relation is registered with. |
java.lang.String |
getRelationTypeName()
Retrieves the relation type for this relation. |
java.util.List |
getRole(java.lang.String roleName)
Retrieves the role for the passed role name. |
java.lang.Integer |
getRoleCardinality(java.lang.String roleName)
Retrieves the number of MBeans in a given role. |
RoleResult |
getRoles(java.lang.String[] roleNames)
Retrieves the roles in this relation with the passed names. |
void |
handleMBeanUnregistration(javax.management.ObjectName objectName,
java.lang.String roleName)
The relation service will call this service when an MBean referenced in a role is unregistered. |
private void |
init(java.lang.String relationId,
javax.management.ObjectName relationService,
javax.management.MBeanServer mbeanServer,
java.lang.String relationTypeName,
RoleList roleList)
Constructor support. |
java.lang.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(java.lang.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. |
javax.management.ObjectName |
preRegister(javax.management.MBeanServer server,
javax.management.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(java.lang.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. |
private void |
updateRole(Role role,
java.util.ArrayList oldRoleValue)
Update the role |
private Role |
validateRoleFound(java.lang.String roleName)
Validate the role is found |
private void |
validateRoleReadable(java.lang.String roleName)
Validate the role is readable, i.e. |
private Role |
validateRoleWritable(java.lang.String roleName,
boolean initFlag)
Validate the role is writable, i.e. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
relationId
java.lang.String relationId
- The relation id.
relationService
javax.management.ObjectName relationService
- The relation service
serviceProxy
private RelationServiceMBean serviceProxy
- A proxy to the relation service
server
javax.management.MBeanServer server
- The mbean server
relationTypeName
java.lang.String relationTypeName
- The relation type name
roles
java.util.HashMap roles
- The roles mapped by role name
registered
java.lang.Boolean registered
- Wether this relation is registered in the relation service
| Constructor Detail |
RelationSupport
public RelationSupport(java.lang.String relationId, javax.management.ObjectName relationService, java.lang.String relationTypeName, RoleList roleList) throws java.lang.IllegalArgumentException, InvalidRoleValueException
- Construct a new relation support object.
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.
RelationSupport
public RelationSupport(java.lang.String relationId, javax.management.ObjectName relationService, javax.management.MBeanServer mbeanServer, java.lang.String relationTypeName, RoleList roleList) throws java.lang.IllegalArgumentException, InvalidRoleValueException
- Construct a new relation support object.
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.
| Method Detail |
getAllRoles
public RoleResult getAllRoles() throws RelationServiceNotRegisteredException
- Description copied from interface:
Relation - Retrieves all the roles in this relation.
- Specified by:
getAllRolesin interfaceRelation
getReferencedMBeans
public java.util.Map getReferencedMBeans()
- Description copied from interface:
Relation - Retrieves MBeans referenced by roles of this 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.
- Specified by:
getReferencedMBeansin interfaceRelation
getRelationId
public java.lang.String getRelationId()
- Description copied from interface:
Relation - Retrieves the relation id used to identify the relation within
the relation service.
- Specified by:
getRelationIdin interfaceRelation
getRelationServiceName
public javax.management.ObjectName getRelationServiceName()
- Description copied from interface:
Relation - Retrieves the object name of the relation service this relation
is registered with.
- Specified by:
getRelationServiceNamein interfaceRelation
getRelationTypeName
public java.lang.String getRelationTypeName()
- Description copied from interface:
Relation - Retrieves the relation type for this relation.
- Specified by:
getRelationTypeNamein interfaceRelation
getRole
public java.util.List getRole(java.lang.String roleName) throws java.lang.IllegalArgumentException, RoleNotFoundException, RelationServiceNotRegisteredException
- Description copied from interface:
Relation - Retrieves the role for the passed role name. The role
must exist and be readable.
The return value is an ArrayList of object names in the role.
getRoleCardinality
public java.lang.Integer getRoleCardinality(java.lang.String roleName) throws java.lang.IllegalArgumentException, RoleNotFoundException
- Description copied from interface:
Relation - Retrieves the number of MBeans in a given role.
- Specified by:
getRoleCardinalityin interfaceRelation
getRoles
public RoleResult getRoles(java.lang.String[] roleNames) throws java.lang.IllegalArgumentException, RelationServiceNotRegisteredException
- Description copied from interface:
Relation - Retrieves the roles in this relation with the passed names.
handleMBeanUnregistration
public void handleMBeanUnregistration(javax.management.ObjectName objectName, java.lang.String roleName) throws RoleNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException
- Description copied from interface:
Relation - The relation service will call this service when an MBean
referenced in a role is unregistered.
The object name should be removed from the role.
Calling this method manually may result in incorrect behaviour
- Specified by:
handleMBeanUnregistrationin interfaceRelation
retrieveAllRoles
public RoleList retrieveAllRoles()
- Description copied from interface:
Relation - Retrieve all the roles in this relation without checking the role mode.
- Specified by:
retrieveAllRolesin interfaceRelation
setRole
public void setRole(Role role) throws java.lang.IllegalArgumentException, InvalidRoleValueException, RoleNotFoundException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException
- Description copied from interface:
Relation - Sets the passed role for this 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.
setRoles
public RoleResult setRoles(RoleList roleList) throws java.lang.IllegalArgumentException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException
- Description copied from interface:
Relation - Sets the roles.
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.
isInRelationService
public java.lang.Boolean isInRelationService()
- Description copied from interface:
RelationSupportMBean - Check to see whether this relation thinks it is in relation service.
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.
- Specified by:
isInRelationServicein interfaceRelationSupportMBean
setRelationServiceManagementFlag
public void setRelationServiceManagementFlag(java.lang.Boolean value)
- Description copied from interface:
RelationSupportMBean - Set the flag to specify whether this relation is registered with
the relation service.
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.
- Specified by:
setRelationServiceManagementFlagin interfaceRelationSupportMBean
preRegister
public javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName objectName) throws java.lang.Exception
- Description copied from interface:
javax.management.MBeanRegistration - This method is called by the MBeanServer before registration takes
place. The MBean is passed a reference of the MBeanServer it is
about to be registered with. The MBean must return the ObjectName it
will be registered with. The MBeanServer can pass a suggested object
depending upon how the MBean is registered.
The MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.
- Specified by:
preRegisterin interfacejavax.management.MBeanRegistration
postRegister
public void postRegister(java.lang.Boolean registered)
- Description copied from interface:
javax.management.MBeanRegistration - This method is called by the MBeanServer after registration takes
place or when registration fails.
- Specified by:
postRegisterin interfacejavax.management.MBeanRegistration
preDeregister
public void preDeregister()
throws java.lang.Exception
- Description copied from interface:
javax.management.MBeanRegistration - This method is called by the MBeanServer before deregistration takes
place.
The MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.
- Specified by:
preDeregisterin interfacejavax.management.MBeanRegistration
postDeregister
public void postDeregister()
- Description copied from interface:
javax.management.MBeanRegistration - This method is called by the MBeanServer after deregistration takes
place.
- Specified by:
postDeregisterin interfacejavax.management.MBeanRegistration
init
private void init(java.lang.String relationId, javax.management.ObjectName relationService, javax.management.MBeanServer mbeanServer, java.lang.String relationTypeName, RoleList roleList) throws java.lang.IllegalArgumentException, InvalidRoleValueException
- Constructor support.
See the constructors for more information
checkRegistered
private void checkRegistered()
throws RelationNotFoundException
- Check that we are registered with the relation service
checkRoleReadable
private int checkRoleReadable(Role role) throws RelationServiceNotRegisteredException
- Check a role is readable
checkRoleWritable
private int checkRoleWritable(Role role, boolean initFlag) throws RelationServiceNotRegisteredException, RelationTypeNotFoundException
- Check a role is writable
updateRole
private void updateRole(Role role, java.util.ArrayList oldRoleValue)
- Update the role
validateRoleFound
private Role validateRoleFound(java.lang.String roleName) throws RoleNotFoundException
- Validate the role is found
validateRoleReadable
private void validateRoleReadable(java.lang.String roleName) throws RoleNotFoundException, RelationServiceNotRegisteredException
- Validate the role is readable, i.e. it is found and readable
validateRoleWritable
private Role validateRoleWritable(java.lang.String roleName, boolean initFlag) throws RoleNotFoundException, RelationServiceNotRegisteredException, RelationTypeNotFoundException
- Validate the role is writable, i.e. it is found and readable
checkServiceProxy
private void checkServiceProxy()
throws RelationServiceNotRegisteredException
- Check the relation service proxy has been constructed.
|
|||||||||
| Home >> All >> javax >> management >> [ relation overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
javax.management.relation.RelationSupport