站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 jmx API Documentation 英文版文档

RelationService (JBoss/JMX API) - JBoss 4.0.1 sp1 jmx API Documentation 英文版文档


javax.management.relation
Class RelationService

java.lang.Object
  extended byjavax.management.NotificationBroadcasterSupport
      extended byjavax.management.relation.RelationService
All Implemented Interfaces:
EventListener, MBeanRegistration, NotificationBroadcaster, NotificationEmitter, NotificationListener, RelationServiceMBean

public class RelationService
extends NotificationBroadcasterSupport
implements RelationServiceMBean, MBeanRegistration, NotificationListener

Implements the management interface for a relation service.

Revisions:

20020311 Adrian Brock:

20020312 Adrian Brock:

Version:
$Revision: 1.12 $
Author:
Adrian Brock.
See Also:
RelationServiceMBean

Constructor Summary
RelationService(boolean purgeFlag)
          Construct a new relation service
 
Method Summary
 void addRelation(ObjectName relation)
          Add a manually created relation to the relation service.
 void addRelationType(RelationType relationType)
          Add a relation type to the relation service.
 Integer checkRoleReading(String roleName, String relationTypeName)
          Checks whether the passed role can be read in the given relation type.
 Integer checkRoleWriting(Role role, String relationTypeName, Boolean initFlag)
          Checks whether the passed role can be written in the given relation type.
 void createRelation(String relationId, String relationTypeName, RoleList roleList)
          Create a simple relation using RelationSupport for a relation type within the relation service.
 void createRelationType(String relationTypeName, RoleInfo[] roleInfos)
          Create a relation type within the relation service.
 Map findAssociatedMBeans(ObjectName mbeanName, String relationTypeName, String roleName)
          Retrieves MBeans associated with the passed MBean in the passed relation type and role.
 Map findReferencingRelations(ObjectName mbeanName, String relationTypeName, String roleName)
          Retrieves MBeans referencing the passed MBean in the passed relation type and role.
 List findRelationsOfType(String relationTypeName)
          Retrieves the relation ids for relations of the passed type.
 List getAllRelationIds()
          Retrieves all the relation ids.
 List getAllRelationTypeNames()
          Retrieves all the relation type names.
 RoleResult getAllRoles(String relationId)
          Retrieves all the roles for a given relation id.
 MBeanNotificationInfo[] getNotificationInfo()
          Returns the notification metadata associated with the MBean.
 boolean getPurgeFlag()
          Retrieves the purge flag.
 Map getReferencedMBeans(String relationId)
          Retrieves all the MBeans referenced in all the roles of a relation.
 String getRelationTypeName(String relationId)
          Retrieves the relation type name for the passed relation.
 List getRole(String relationId, String roleName)
          Retrieves MBeans in a role for a given relation id.
 Integer getRoleCardinality(String relationId, String roleName)
          Retrieves the number of MBeans in a role for a given relation id.
 RoleInfo getRoleInfo(String relationTypeName, String roleInfoName)
          Retrieves the role information for a given relation type.
 List getRoleInfos(String relationTypeName)
          Retrieves all the role information for a given relation type.
 RoleResult getRoles(String relationId, String[] roleNames)
          Retrieves selected roles for a relation.
 void handleNotification(Notification notification, Object handback)
          Callback method from the broadcaster MBean this listener implementation is registered to.
 Boolean hasRelation(String relationId)
          Checks whether the relation service has the passed relation id.
 void isActive()
          Checks whether the relation service is active, i.e.
 String isRelation(ObjectName objectName)
          Checks whether the passed object name is a relation in this relation service.
 ObjectName isRelationMBean(String relationId)
          Checks whether the passed relation id is an MBean created by a user or has been internally created by the 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.
 void purgeRelations()
          Purge relations.
 void removeRelation(String relationId)
          Removes a relation from the relation service.
 void removeRelationType(String relationTypeName)
          Removes a relation type from the relation service.
 void sendRelationCreationNotification(String relationId)
          Sends a relation creation notification

For internally created relations, a RELATION_BASIC_CREATION notification is sent.

 void sendRelationRemovalNotification(String relationId, List unregMBeans)
          Sends a relation removal notification

For internally created relations, a RELATION_BASIC_REMOVAL notification is sent.

 void sendRoleUpdateNotification(String relationId, Role newRole, List oldRoleValue)
          Sends a relation update notification

For internally created relations, a RELATION_BASIC_UPDATE notification is sent.

 void setPurgeFlag(boolean value)
          Sets the purge flag.
 void setRole(String relationId, Role role)
          Sets the role in the passed relation.
 RoleResult setRoles(String relationId, RoleList roles)
          Sets the roles in the passed relation.
 void updateRoleMap(String relationId, Role newRole, List oldRoleValue)
          Handles the update of the relation service role map when a role is changed.
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationService

public RelationService(boolean purgeFlag)
Construct a new relation service

Parameters:
purgeFlag - whether immediate purges should be performed, pass true for immediate, false otherwise
Method Detail

addRelation

public void addRelation(ObjectName relation)
                 throws IllegalArgumentException,
                        NoSuchMethodException,
                        RelationServiceNotRegisteredException,
                        InvalidRelationIdException,
                        InvalidRelationServiceException,
                        RelationTypeNotFoundException,
                        InvalidRoleValueException,
                        RoleNotFoundException,
                        InstanceNotFoundException
Description copied from interface: RelationServiceMBean
Add a manually created relation to the relation service. It must be registered with the same MBeanService as the relation service.

A RELATION_MBEAN_CREATION notification is sent.

Specified by:
addRelation in interface RelationServiceMBean
Parameters:
relation - the object name of the relation
Throws:
InvalidRelationServiceException - if the relation service in the relation is null or is not the relation service to which it is being added.
NoSuchMethodException - if the mbean does not implement the Relation interface.
IllegalArgumentException - for a null object name.
RelationTypeNotFoundException - if there is no relation type in the relation or the relation type has not been registered with the relation service.
InvalidRelationIdException - if the relation id is already used by another relation.
RelationServiceNotRegisteredException - when the relation service is not registered with the MBeanServer.
InstanceNotFoundException - when the relation is not registered in the MBeanServer.
RoleNotFoundException - if a role in the relation is not in the relation type.
InvalidRoleValueException - if the number of MBeans in a role is outside the bounds of the RoleInfo defined in the relation type, one of the MBeans is not of the correct class or an MBean does not exist.

addRelationType

public void addRelationType(RelationType relationType)
                     throws IllegalArgumentException,
                            InvalidRelationTypeException
Description copied from interface: RelationServiceMBean
Add a relation type to the relation service.

Specified by:
addRelationType in interface RelationServiceMBean
Parameters:
relationType - the relation type.
Throws:
InvalidRelationTypeException - if a relation type already exists in the relation service with the given name.
IllegalArgumentException - for a null relation type.

checkRoleReading

public Integer checkRoleReading(String roleName,
                                String relationTypeName)
                         throws IllegalArgumentException,
                                RelationTypeNotFoundException
Description copied from interface: RelationServiceMBean
Checks whether the passed role can be read in the given relation type.

The return value is either zero when readable or a value from RoleStatus.

Specified by:
checkRoleReading in interface RelationServiceMBean
Parameters:
roleName - the name of the role to check.
relationTypeName - the relation type to check.
Returns:
the result described above.
Throws:
IllegalArgumentException - for a null parameters.
RelationTypeNotFoundException - if the relation type does exist in the relation service.

checkRoleWriting

public Integer checkRoleWriting(Role role,
                                String relationTypeName,
                                Boolean initFlag)
                         throws IllegalArgumentException,
                                RelationTypeNotFoundException
Description copied from interface: RelationServiceMBean
Checks whether the passed role can be written in the given relation type.

The return value is either zero when writable or a value from RoleStatus.

Specified by:
checkRoleWriting in interface RelationServiceMBean
Parameters:
role - the role to check.
relationTypeName - the relation type to check.
initFlag - write access is not check when this flag is true.
Returns:
the result described above.
Throws:
RelationTypeNotFoundException - if the relation type does exist in the relation service.
IllegalArgumentException - for a null parameters.

createRelation

public void createRelation(String relationId,
                           String relationTypeName,
                           RoleList roleList)
                    throws IllegalArgumentException,
                           RelationServiceNotRegisteredException,
                           InvalidRelationIdException,
                           RelationTypeNotFoundException,
                           InvalidRoleValueException,
                           RoleNotFoundException
Description copied from interface: RelationServiceMBean
Create a simple relation using RelationSupport for a relation type within the relation service.

Roles not initialised are set to an empty ArrayList.

A RELATION_BASIC_CREATION notification is sent.

Specified by:
createRelation in interface RelationServiceMBean
Parameters:
relationId - the relation id of the relation
relationTypeName - the relation type of the relation
roleList - the roles to initialise in the relation (can be null)
Throws:
InvalidRoleValueException - if the number of MBeans in a role is outside the bounds of the RoleInfo defined in the relation type, one of the MBeans is not of the correct class, an MBean does not exist, the same role name is used in two different relations.
RoleNotFoundException - if a role in the relation is not in the relation type.
InvalidRelationIdException - if the relation id is already used by another relation.
RelationTypeNotFoundException - if there is no relation type in the relation or the relation type has not been registered with the relation service.
IllegalArgumentException - for a null parameter.
RelationServiceNotRegisteredException - when the relation service is not registered with the MBeanServer.

createRelationType

public void createRelationType(String relationTypeName,
                               RoleInfo[] roleInfos)
                        throws IllegalArgumentException,
                               InvalidRelationTypeException
Description copied from interface: RelationServiceMBean
Create a relation type within the relation service.

Specified by:
createRelationType in interface RelationServiceMBean
Parameters:
relationTypeName - the relation type name.
roleInfos - an array of role infos.
Throws:
IllegalArgumentException - for a null relation type.
InvalidRelationTypeException - if a relation type already exists in the relation service with the given name, there are problems with the role infos.

findAssociatedMBeans

public Map findAssociatedMBeans(ObjectName mbeanName,
                                String relationTypeName,
                                String roleName)
                         throws IllegalArgumentException
Description copied from interface: RelationServiceMBean
Retrieves MBeans associated with the passed MBean in the passed relation type and role.

Specified by:
findAssociatedMBeans in interface RelationServiceMBean
Parameters:
mbeanName - the name of the reference MBean
relationTypeName - the relation type, null means check all relation types.
roleName - the role, null means check all roles.
Returns:
a HashMap with keys of the related MBeans with the value for each MBean an ArrayList of Relation Types.
Throws:
IllegalArgumentException - for a null object name.

findReferencingRelations

public Map findReferencingRelations(ObjectName mbeanName,
                                    String relationTypeName,
                                    String roleName)
                             throws IllegalArgumentException
Description copied from interface: RelationServiceMBean
Retrieves MBeans referencing the passed MBean in the passed relation type and role.

Specified by:
findReferencingRelations in interface RelationServiceMBean
Parameters:
mbeanName - the name of the referenced MBean
relationTypeName - the relation type, null means check all relation types.
roleName - the role, null means check all roles.
Returns:
a HashMap with keys of the referencing MBeans with the value for each MBean an ArrayList of Relation Types.
Throws:
IllegalArgumentException - for a null object name.

findRelationsOfType

public List findRelationsOfType(String relationTypeName)
                         throws IllegalArgumentException,
                                RelationTypeNotFoundException
Description copied from interface: RelationServiceMBean
Retrieves the relation ids for relations of the passed type.

Specified by:
findRelationsOfType in interface RelationServiceMBean
Parameters:
relationTypeName - the relation type.
Returns:
an ArrayList of relation ids.
Throws:
IllegalArgumentException - for a null relation type name.
RelationTypeNotFoundException - if there is no relation type with the passed name.

getAllRelationIds

public List getAllRelationIds()
Description copied from interface: RelationServiceMBean
Retrieves all the relation ids.

Specified by:
getAllRelationIds in interface RelationServiceMBean
Returns:
an ArrayList of relation ids.

getAllRelationTypeNames

public List getAllRelationTypeNames()
Description copied from interface: RelationServiceMBean
Retrieves all the relation type names.

Specified by:
getAllRelationTypeNames in interface RelationServiceMBean
Returns:
an ArrayList of relation type names

getAllRoles

public RoleResult getAllRoles(String relationId)
                       throws IllegalArgumentException,
                              RelationNotFoundException,
                              RelationServiceNotRegisteredException
Description copied from interface: RelationServiceMBean
Retrieves all the roles for a given relation id.

Specified by:
getAllRoles in interface RelationServiceMBean
Parameters:
relationId - the relation id
Returns:
a RoleResult with a RoleList for readable roles and a RoleUnresolvedList for roles that are not readable.
Throws:
RelationNotFoundException - when the relation id does not exist.
RelationServiceNotRegisteredException - when the relation service is not registered with an MBeanServer.
IllegalArgumentException - for a null relation id.

getPurgeFlag

public boolean getPurgeFlag()
Description copied from interface: RelationServiceMBean
Retrieves the purge flag. This flag controls whether all relations have to validated when notification is received of an MBeans unregistration or whether the purgeRelations() method has to be called.

Specified by:
getPurgeFlag in interface RelationServiceMBean
Returns:
true for an immediate purge on unregistration, false otherwise.

getReferencedMBeans

public Map getReferencedMBeans(String relationId)
                        throws IllegalArgumentException,
                               RelationNotFoundException
Description copied from interface: RelationServiceMBean
Retrieves all the MBeans referenced in all the roles of a relation.

Specified by:
getReferencedMBeans in interface RelationServiceMBean
Parameters:
relationId - the relation id
Returns:
a HashMap with a key of the MBeans and the values an array list of the role names for each MBean.
Throws:
IllegalArgumentException - for a null relation id.
RelationNotFoundException - when the relation id does not exist.

getRelationTypeName

public String getRelationTypeName(String relationId)
                           throws IllegalArgumentException,
                                  RelationNotFoundException
Description copied from interface: RelationServiceMBean
Retrieves the relation type name for the passed relation.

Specified by:
getRelationTypeName in interface RelationServiceMBean
Parameters:
relationId - the relation id
Returns:
the relation type name.
Throws:
RelationNotFoundException - when the relation id does not exist.
IllegalArgumentException - for a null relation id.

getRole

public List getRole(String relationId,
                    String roleName)
             throws IllegalArgumentException,
                    RelationNotFoundException,
                    RelationServiceNotRegisteredException,
                    RoleNotFoundException
Description copied from interface: RelationServiceMBean
Retrieves MBeans in a role for a given relation id.

Specified by:
getRole in interface RelationServiceMBean
Parameters:
relationId - the relation id
roleName - the role name
Returns:
an ArrayList of object names for mbeans in the role.
Throws:
RelationNotFoundException - when the relation id does not exist.
RoleNotFoundException - when the role does not exist or is not readable.
IllegalArgumentException - for a null parameter.
RelationServiceNotRegisteredException - when the relation service is not registered with an MBeanServer.

getRoleCardinality

public Integer getRoleCardinality(String relationId,
                                  String roleName)
                           throws IllegalArgumentException,
                                  RelationNotFoundException,
                                  RoleNotFoundException
Description copied from interface: RelationServiceMBean
Retrieves the number of MBeans in a role for a given relation id.

Specified by:
getRoleCardinality in interface RelationServiceMBean
Parameters:
relationId - the relation id
roleName - the role name
Returns:
the number of mbeans in the role
Throws:
RelationNotFoundException - when the relation id does not exist.
RoleNotFoundException - when the role does not exist or is not readable.
IllegalArgumentException - for a null parameter.

getRoleInfo

public RoleInfo getRoleInfo(String relationTypeName,
                            String roleInfoName)
                     throws IllegalArgumentException,
                            RelationTypeNotFoundException,
                            RoleInfoNotFoundException
Description copied from interface: RelationServiceMBean
Retrieves the role information for a given relation type.

Specified by:
getRoleInfo in interface RelationServiceMBean
Parameters:
relationTypeName - the relation type name
roleInfoName - the role information name
Returns:
the role information.
Throws:
RoleInfoNotFoundException - when the role information does not exist for the relation type.
IllegalArgumentException - for a null parameter.
RelationTypeNotFoundException - when the relation type does not exist.

getRoleInfos

public List getRoleInfos(String relationTypeName)
                  throws IllegalArgumentException,
                         RelationTypeNotFoundException
Description copied from interface: RelationServiceMBean
Retrieves all the role information for a given relation type.

Specified by:
getRoleInfos in interface RelationServiceMBean
Parameters:
relationTypeName - the relation type name
Returns:
an ArrayList of role information.
Throws:
RelationTypeNotFoundException - when the relation id does not exist.
IllegalArgumentException - for a null parameter.

getRoles

public RoleResult getRoles(String relationId,
                           String[] roleNames)
                    throws IllegalArgumentException,
                           RelationNotFoundException,
                           RelationServiceNotRegisteredException
Description copied from interface: RelationServiceMBean
Retrieves selected roles for a relation.

Specified by:
getRoles in interface RelationServiceMBean
Parameters:
relationId - the relation id
roleNames - an array of role name
Returns:
a RoleResult containing resolved and unresolved roles.
Throws:
RelationNotFoundException - when the relation id does not exist.
IllegalArgumentException - for a null parameter.
RelationServiceNotRegisteredException - when the relation service is not registered with an MBeanServer.

hasRelation

public Boolean hasRelation(String relationId)
                    throws IllegalArgumentException
Description copied from interface: RelationServiceMBean
Checks whether the relation service has the passed relation id.

Specified by:
hasRelation in interface RelationServiceMBean
Parameters:
relationId - the relation id
Returns:
true when it has the relationId, false otherwise.
Throws:
IllegalArgumentException - for a null parameter.

isActive

public void isActive()
              throws RelationServiceNotRegisteredException
Description copied from interface: RelationServiceMBean
Checks whether the relation service is active, i.e. it is registered with an MBeanServer.

Specified by:
isActive in interface RelationServiceMBean
Throws:
RelationServiceNotRegisteredException - when the relation service is not registered with an MBeanServer.

isRelation

public String isRelation(ObjectName objectName)
                  throws IllegalArgumentException
Description copied from interface: RelationServiceMBean
Checks whether the passed object name is a relation in this relation service.

Specified by:
isRelation in interface RelationServiceMBean
Parameters:
objectName - the name of the MBean to check
Returns:
the relation id the MBean is registered as, or null when not registered.
Throws:
IllegalArgumentException - for a null object name.

isRelationMBean

public ObjectName isRelationMBean(String relationId)
                           throws IllegalArgumentException,
                                  RelationNotFoundException
Description copied from interface: RelationServiceMBean
Checks whether the passed relation id is an MBean created by a user or has been internally created by the relation service.

Specified by:
isRelationMBean in interface RelationServiceMBean
Parameters:
relationId - the relation id to check
Returns:
the object name of the MBean when it is externally created, null otherwise.
Throws:
IllegalArgumentException - for a null object name.
RelationNotFoundException - when the relation id does not exist.

purgeRelations

public void purgeRelations()
                    throws RelationServiceNotRegisteredException
Description copied from interface: RelationServiceMBean
Purge relations. This method is called automatically when the purge flag is true and an MBean in a relation is unregistered.

Not purging relations automatically can lead to problems when the same object name is reused.

If the unregistration causes a role to go below its minimal cardinality, the relation is removed. Otherwise the relation's handleMBeanUnregistration() is called.

Specified by:
purgeRelations in interface RelationServiceMBean
Throws:
RelationServiceNotRegisteredException - when the relation service is not registered with an MBeanServer.

removeRelation

public void removeRelation(String relationId)
                    throws IllegalArgumentException,
                           RelationNotFoundException,
                           RelationServiceNotRegisteredException
Description copied from interface: RelationServiceMBean
Removes a relation from the relation service.

For internally created relations, a RELATION_BASIC_REMOVAL notification is sent.

For externally created relations, a RELATION_MBEAN_REMOVAL notification is sent.

The MBeans referenced in the relation are unaffected.

Specified by:
removeRelation in interface RelationServiceMBean
Parameters:
relationId - the relation id
Throws:
RelationServiceNotRegisteredException - when the relation service is not registered with an MBeanServer.
RelationNotFoundException - when the relation id does not exist.
IllegalArgumentException - for a null parameter.

removeRelationType

public void removeRelationType(String relationTypeName)
                        throws IllegalArgumentException,
                               RelationTypeNotFoundException,
                               RelationServiceNotRegisteredException
Description copied from interface: RelationServiceMBean
Removes a relation type from the relation service.

Any relations using this relation type are also removed.

Specified by:
removeRelationType in interface RelationServiceMBean
Parameters:
relationTypeName - the relation type name
Throws:
RelationTypeNotFoundException - when the relation type does not exist.
IllegalArgumentException - for a null parameter.
RelationServiceNotRegisteredException - when the relation service is not registered with an MBeanServer.

sendRelationCreationNotification

public void sendRelationCreationNotification(String relationId)
                                      throws IllegalArgumentException,
                                             RelationNotFoundException
Description copied from interface: RelationServiceMBean
Sends a relation creation notification

For internally created relations, a RELATION_BASIC_CREATION notification is sent.

For externally created relations, a RELATION_MBEAN_CREATION notification is sent.

The source is this relation service.

This method is called by addRelation() and createRelation()

Specified by:
sendRelationCreationNotification in interface RelationServiceMBean
Parameters:
relationId - the relation id
Throws:
RelationNotFoundException - when the relation id does not exist.
IllegalArgumentException - for a null parameter.

sendRelationRemovalNotification

public void sendRelationRemovalNotification(String relationId,
                                            List unregMBeans)
                                     throws IllegalArgumentException,
                                            RelationNotFoundException
Description copied from interface: RelationServiceMBean
Sends a relation removal notification

For internally created relations, a RELATION_BASIC_REMOVAL notification is sent.

For externally created relations, a RELATION_MBEAN_REMOVAL notification is sent.

The source is this relation service.

This method is called by removeRelation()

Specified by:
sendRelationRemovalNotification in interface RelationServiceMBean
Parameters:
relationId - the relation id
unregMBeans - a list of MBeans to be unregistered due to this removal (can be null)
Throws:
IllegalArgumentException - for a null parameter.
RelationNotFoundException - when the relation id does not exist.

sendRoleUpdateNotification

public void sendRoleUpdateNotification(String relationId,
                                       Role newRole,
                                       List oldRoleValue)
                                throws IllegalArgumentException,
                                       RelationNotFoundException
Description copied from interface: RelationServiceMBean
Sends a relation update notification

For internally created relations, a RELATION_BASIC_UPDATE notification is sent.

For externally created relations, a RELATION_MBEAN_UPDATE notification is sent.

The source is this relation service.

This method is called from the RelationSupport setRole() and setRoles() methods.

Specified by:
sendRoleUpdateNotification in interface RelationServiceMBean
Parameters:
relationId - the relation id
newRole - the new role
oldRoleValue - a list of MBeans in the old role
Throws:
RelationNotFoundException - when the relation id does not exist.
IllegalArgumentException - for a null parameter.

setPurgeFlag

public void setPurgeFlag(boolean value)
Description copied from interface: RelationServiceMBean
Sets the purge flag. This flag controls whether all relations have to validated when notification is received of an MBeans unregistration or whether the purgeRelations() method has to be called.

Specified by:
setPurgeFlag in interface RelationServiceMBean
Parameters:
value - true for an immediate purge on unregistration, false otherwise.

setRole

public void setRole(String relationId,
                    Role role)
             throws RelationServiceNotRegisteredException,
                    IllegalArgumentException,
                    RelationNotFoundException,
                    RoleNotFoundException,
                    InvalidRoleValueException
Description copied from interface: RelationServiceMBean
Sets the role in the passed relation.

The role will be validated according to information in the relation type.

The relation service will keep track the MBeans unregistration to maintain the consistency of the relation.

Specified by:
setRole in interface RelationServiceMBean
Parameters:
relationId - the relation to change the role for.
role - the new role
Throws:
RoleNotFoundException - when this is an internal relation or the role does not exist or it is not writable.
IllegalArgumentException - for null parameters
RelationNotFoundException - when the relation does not exist in the relation service.
RelationServiceNotRegisteredException - when the relation service has not been registered with an MBeanServer
InvalidRoleValueException - when the role is not valid according to information in the relation type.

setRoles

public RoleResult setRoles(String relationId,
                           RoleList roles)
                    throws IllegalArgumentException,
                           RelationServiceNotRegisteredException,
                           RelationNotFoundException
Description copied from interface: RelationServiceMBean
Sets the roles in the passed relation.

The roles will be validated according to information in the relation type.

The relation service will keep track the MBeans unregistration to maintain the consistency of the relation.

Specified by:
setRoles in interface RelationServiceMBean
Parameters:
relationId - the relation to change the role for.
roles - the list of roles
Throws:
IllegalArgumentException - for null parameters
RelationServiceNotRegisteredException - when the relation service has not been registered with an MBeanServer
RelationNotFoundException - when the relation does not exist in the relation service.

updateRoleMap

public void updateRoleMap(String relationId,
                          Role newRole,
                          List oldRoleValue)
                   throws IllegalArgumentException,
                          RelationServiceNotRegisteredException,
                          RelationNotFoundException
Description copied from interface: RelationServiceMBean
Handles the update of the relation service role map when a role is changed.

It is called from RelationSupport setRole() and setRoles() and the relation service's setRole() and setRoles() methods.

The relation service will keep track the MBeans unregistration to maintain the consistency of the relation.

Specified by:
updateRoleMap in interface RelationServiceMBean
Parameters:
relationId - the relation id
newRole - the new role
oldRoleValue - a list of MBeans in the old role
Throws:
RelationServiceNotRegisteredException - when the relation service has not been registered with an MBeanServer
RelationNotFoundException - when the relation id does not exist.
IllegalArgumentException - for a null parameter.

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName objectName)
                       throws Exception
Description copied from interface: 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:
preRegister in interface MBeanRegistration
Returns:
the actual ObjectName to register this MBean with.
Throws:
Exception - for any error, the MBean is not registered.

postRegister

public void postRegister(Boolean registered)
Description copied from interface: MBeanRegistration
This method is called by the MBeanServer after registration takes place or when registration fails.

Specified by:
postRegister in interface MBeanRegistration
Parameters:
registered - the MBeanServer passes true when the MBean was registered, false otherwise.

preDeregister

public void preDeregister()
                   throws Exception
Description copied from interface: 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:
preDeregister in interface MBeanRegistration
Throws:
Exception

postDeregister

public void postDeregister()
Description copied from interface: MBeanRegistration
This method is called by the MBeanServer after deregistration takes place.

Specified by:
postDeregister in interface MBeanRegistration

handleNotification

public void handleNotification(Notification notification,
                               Object handback)
Description copied from interface: NotificationListener
Callback method from the broadcaster MBean this listener implementation is registered to.

Specified by:
handleNotification in interface NotificationListener
Parameters:
notification - the notification object
handback - the handback object given to the broadcaster upon listener registration

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
Description copied from interface: NotificationBroadcaster
Returns the notification metadata associated with the MBean.

Specified by:
getNotificationInfo in interface NotificationBroadcaster
Overrides:
getNotificationInfo in class NotificationBroadcasterSupport


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.