Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Standard Ed. 5.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.management.relation
Class RelationService

    java.lang.Object
      javax.management.NotificationBroadcasterSupport
          javax.management.relation.RelationService

All Implemented Interfaces:
  EventListener, MBeanRegistration, NotificationBroadcaster, NotificationEmitter, NotificationListener, RelationServiceMBean

    public class RelationService

extends NotificationBroadcasterSupport
implements RelationServiceMBean, MBeanRegistration, NotificationListener

The Relation Service is in charge of creating and deleting relation types and relations, of handling the consistency and of providing query mechanisms.

It implements the NotificationBroadcaster by extending NotificationBroadcasterSupport to send notifications when a relation is removed from it.

It implements the NotificationListener interface to be able to receive notifications concerning unregistration of MBeans referenced in relation roles and of relation MBeans.

It implements the MBeanRegistration interface to be able to retrieve its ObjectName and MBean Server.

Since:
  1.5

Constructor Summary
`RelationService(boolean theImmediatePurgeFlg)` Constructor.

Method Summary
`void` | `addRelation(ObjectName theRelObjectName)` Adds an MBean created by the user (and registered by him in the MBean Server) as a relation in the Relation Service.
`void` | `addRelationType(RelationType theRelTypeObj)` Adds given object as a relation type.
`Integer` | `checkRoleReading(String theRoleName, String theRelTypeName)` Checks if given Role can be read in a relation of the given type.
`Integer` | `checkRoleWriting(Role theRole, String theRelTypeName, Boolean theInitFlg)` Checks if given Role can be set in a relation of given type.
`void` | `createRelation(String theRelId, String theRelTypeName, RoleList theRoleList)` Creates a simple relation (represented by a RelationSupport object) of given relation type, and adds it in the Relation Service.
`void` | `createRelationType(String theRelTypeName, RoleInfo[] theRoleInfoArray)` Creates a relation type (a RelationTypeSupport object) with given role infos (provided by the RoleInfo objects), and adds it in the Relation Service.
`Map` | `findAssociatedMBeans(ObjectName theMBeanName, String theRelTypeName, String theRoleName)` Retrieves the MBeans associated to given one in a relation.
`Map` | `findReferencingRelations(ObjectName theMBeanName, String theRelTypeName, String theRoleName)` Retrieves the relations where a given MBean is referenced.
`List` | `findRelationsOfType(String theRelTypeName)` Returns the relation ids for relations of the given type.
`List` | `getAllRelationIds()` Returns all the relation ids for all the relations handled by the Relation Service.
`List` | `getAllRelationTypeNames()` Retrieves names of all known relation types.
`RoleResult` | `getAllRoles(String theRelId)` Returns all roles present in the relation.
`MBeanNotificationInfo[]` | `getNotificationInfo()` Returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent.
`boolean` | `getPurgeFlag()` Returns the flag to indicate if when a notification is received for the unregistration of an MBean referenced in a relation, if an immediate "purge" of the relations (look for the relations no longer valid) has to be performed , or if that will be performed only when the purgeRelations method will be explicitly called.
`Map` | `getReferencedMBeans(String theRelId)` Retrieves MBeans referenced in the various roles of the relation.
`String` | `getRelationTypeName(String theRelId)` Returns name of associated relation type for given relation.
`List` | `getRole(String theRelId, String theRoleName)` Retrieves role value for given role name in given relation.
`Integer` | `getRoleCardinality(String theRelId, String theRoleName)` Retrieves the number of MBeans currently referenced in the given role.
`RoleInfo` | `getRoleInfo(String theRelTypeName, String theRoleInfoName)` Retrieves role info for given role name of a given relation type.
`List` | `getRoleInfos(String theRelTypeName)` Retrieves list of role infos (RoleInfo objects) of a given relation type.
`RoleResult` | `getRoles(String theRelId, String[] theRoleNameArray)` Retrieves values of roles with given names in given relation.
`void` | `handleNotification(Notification theNtf, Object theHandback)` Invoked when a JMX notification occurs.
`Boolean` | `hasRelation(String theRelId)` Checks if there is a relation identified in Relation Service with given relation id.
`void` | `isActive()` Checks if the Relation Service is active.
`String` | `isRelation(ObjectName theObjName)` Returns the relation id associated to the given ObjectName if the MBean has been added as a relation in the Relation Service.
`ObjectName` | `isRelationMBean(String theRelId)` If the relation is represented by an MBean (created by the user and added as a relation in the Relation Service), returns the ObjectName of the MBean.
`void` | `postDeregister()` Allows the MBean to perform any operations needed after having been unregistered in the MBean server.
`void` | `postRegister(Boolean registrationDone)` Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.
`void` | `preDeregister()` Allows the MBean to perform any operations it needs before being unregistered by the MBean server.
`ObjectName` | `preRegister(MBeanServer server, ObjectName name)` Allows the MBean to perform any operations it needs before being registered in the MBean server.
`void` | `purgeRelations()` Purges the relations.
`void` | `removeRelation(String theRelId)` Removes given relation from the Relation Service.
`void` | `removeRelationType(String theRelTypeName)` Removes given relation type from Relation Service.
`void` | `sendRelationCreationNotification(String theRelId)` Sends a notification (RelationNotification) for a relation creation.
`void` | `sendRelationRemovalNotification(String theRelId, List theUnregMBeanList)` Sends a notification (RelationNotification) for a relation removal.
`void` | `sendRoleUpdateNotification(String theRelId, Role theNewRole, List theOldRoleValue)` Sends a notification (RelationNotification) for a role update in the given relation.
`void` | `setPurgeFlag(boolean thePurgeFlg)` Sets the flag to indicate if when a notification is received for the unregistration of an MBean referenced in a relation, if an immediate "purge" of the relations (look for the relations no longer valid) has to be performed , or if that will be performed only when the purgeRelations method will be explicitly called.
`void` | `setRole(String theRelId, Role theRole)` Sets the given role in given relation.
`RoleResult` | `setRoles(String theRelId, RoleList theRoleList)` Sets the given roles in given relation.
`void` | `updateRoleMap(String theRelId, Role theNewRole, List theOldRoleValue)` Handles update of the Relation Service role map for the update of given role in given relation.

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 theImmediatePurgeFlg)

  Constructor.

  Parameters:
    `theImmediatePurgeFlg` - flag to indicate when a notification is received for the unregistration of an MBean referenced in a relation, if an immediate "purge" of the relations (look for the relations no longer valid) has to be performed , or if that will be performed only when the purgeRelations method will be explicitly called.

    true is immediate purge.

Method Detail

### isActive

    public void isActive()
                  throws RelationServiceNotRegisteredException

  Checks if the Relation Service is active. Current condition is that the Relation Service must be registered in the MBean Server

  Specified by:
    `isActive` in interface `RelationServiceMBean`
  Throws:
    `RelationServiceNotRegisteredException` - if it is not registered

### preRegister

    public ObjectName preRegister(MBeanServer server,
                                  ObjectName name)
                           throws Exception

  Description copied from interface: `MBeanRegistration`
  Allows the MBean to perform any operations it needs before being registered in the MBean server. If the name of the MBean is not specified, the MBean can provide a name for its registration. If any exception is raised, the MBean will not be registered in the MBean server.

  Specified by:
    `preRegister` in interface `MBeanRegistration`
  Parameters:
    `server` - The MBean server in which the MBean will be registered.
    `name` - The object name of the MBean. This name is null if the name parameter to one of the `createMBean` or `registerMBean` methods in the `MBeanServer` interface is null. In that case, this method must return a non-null ObjectName for the new MBean.
  Returns:
    The name under which the MBean is to be registered. This value must not be null. If the `name` parameter is not null, it will usually but not necessarily be the returned value.
  Throws:
    `Exception` - This exception will be caught by the MBean server and re-thrown as an `MBeanRegistrationException`.

### postRegister

    public void postRegister(Boolean registrationDone)

  Description copied from interface: `MBeanRegistration`
  Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.

  Specified by:
    `postRegister` in interface `MBeanRegistration`
  Parameters:
    `registrationDone` - Indicates whether or not the MBean has been successfully registered in the MBean server. The value false means that the registration phase has failed.

### preDeregister

    public void preDeregister()
                       throws Exception

  Description copied from interface: `MBeanRegistration`
  Allows the MBean to perform any operations it needs before being unregistered by the MBean server.

  Specified by:
    `preDeregister` in interface `MBeanRegistration`
  Throws:
    `Exception` - This exception will be caught by the MBean server and re-thrown as an `MBeanRegistrationException`.

### postDeregister

    public void postDeregister()

  Description copied from interface: `MBeanRegistration`
  Allows the MBean to perform any operations needed after having been unregistered in the MBean server.

  Specified by:
    `postDeregister` in interface `MBeanRegistration`

### getPurgeFlag

    public boolean getPurgeFlag()

  Returns the flag to indicate if when a notification is received for the unregistration of an MBean referenced in a relation, if an immediate "purge" of the relations (look for the relations no longer valid) has to be performed , or if that will be performed only when the purgeRelations method will be explicitly called.

  true is immediate purge.

  Specified by:
    `getPurgeFlag` in interface `RelationServiceMBean`
  Returns:
    true if purges are automatic.
  See Also:
    `setPurgeFlag(boolean)`

### setPurgeFlag

    public void setPurgeFlag(boolean thePurgeFlg)

  Sets the flag to indicate if when a notification is received for the unregistration of an MBean referenced in a relation, if an immediate "purge" of the relations (look for the relations no longer valid) has to be performed , or if that will be performed only when the purgeRelations method will be explicitly called.

  true is immediate purge.

  Specified by:
    `setPurgeFlag` in interface `RelationServiceMBean`
  Parameters:
    `thePurgeFlg` - flag
  See Also:
    `getPurgeFlag()`

### createRelationType

    public void createRelationType(String theRelTypeName,
                                   RoleInfo[] theRoleInfoArray)
                            throws IllegalArgumentException,
                                   InvalidRelationTypeException

  Creates a relation type (a RelationTypeSupport object) with given role infos (provided by the RoleInfo objects), and adds it in the Relation Service.

  Specified by:
    `createRelationType` in interface `RelationServiceMBean`
  Parameters:
    `theRelTypeName` - name of the relation type
    `theRoleInfoArray` - array of role infos
  Throws:
    `IllegalArgumentException` - if null parameter
    `InvalidRelationTypeException` - If:

    - there is already a relation type with that name

    - the same name has been used for two different role infos

    - no role info provided

    - one null role info provided

### addRelationType

    public void addRelationType(RelationType theRelTypeObj)
                         throws IllegalArgumentException,
                                InvalidRelationTypeException

  Adds given object as a relation type. The object is expected to implement the RelationType interface.

  Specified by:
    `addRelationType` in interface `RelationServiceMBean`
  Parameters:
    `theRelTypeObj` - relation type object (implementing the RelationType interface)
  Throws:
    `IllegalArgumentException` - if null parameter
    `InvalidRelationTypeException` - if:

    - the same name has been used for two different roles

    - no role info provided

    - one null role info provided

    - there is already a relation type with that name

### getAllRelationTypeNames

    public List getAllRelationTypeNames()

  Retrieves names of all known relation types.

  Specified by:
    `getAllRelationTypeNames` in interface `RelationServiceMBean`
  Returns:
    ArrayList of relation type names (Strings)

### getRoleInfos

    public List getRoleInfos(String theRelTypeName)
                      throws IllegalArgumentException,
                             RelationTypeNotFoundException

  Retrieves list of role infos (RoleInfo objects) of a given relation type.

  Specified by:
    `getRoleInfos` in interface `RelationServiceMBean`
  Parameters:
    `theRelTypeName` - name of relation type
  Returns:
    ArrayList of RoleInfo.
  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationTypeNotFoundException` - if there is no relation type with that name.

### getRoleInfo

    public RoleInfo getRoleInfo(String theRelTypeName,
                                String theRoleInfoName)
                         throws IllegalArgumentException,
                                RelationTypeNotFoundException,
                                RoleInfoNotFoundException

  Retrieves role info for given role name of a given relation type.

  Specified by:
    `getRoleInfo` in interface `RelationServiceMBean`
  Parameters:
    `theRelTypeName` - name of relation type
    `theRoleInfoName` - name of role
  Returns:
    RoleInfo object.
  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationTypeNotFoundException` - if the relation type is not known in the Relation Service
    `RoleInfoNotFoundException` - if the role is not part of the relation type.

### removeRelationType

    public void removeRelationType(String theRelTypeName)
                            throws RelationServiceNotRegisteredException,
                                   IllegalArgumentException,
                                   RelationTypeNotFoundException

  Removes given relation type from Relation Service.

  The relation objects of that type will be removed from the Relation Service.

  Specified by:
    `removeRelationType` in interface `RelationServiceMBean`
  Parameters:
    `theRelTypeName` - name of the relation type to be removed
  Throws:
    `RelationServiceNotRegisteredException` - if the Relation Service is not registered in the MBean Server
    `IllegalArgumentException` - if null parameter
    `RelationTypeNotFoundException` - If there is no relation type with that name

### createRelation

    public void createRelation(String theRelId,
                               String theRelTypeName,
                               RoleList theRoleList)
                        throws RelationServiceNotRegisteredException,
                               IllegalArgumentException,
                               RoleNotFoundException,
                               InvalidRelationIdException,
                               RelationTypeNotFoundException,
                               InvalidRoleValueException

  Creates a simple relation (represented by a RelationSupport object) of given relation type, and adds it in the Relation Service.

  Roles are initialized according to the role list provided in parameter. The ones not initialized in this way are set to an empty ArrayList of ObjectNames.

  A RelationNotification, with type RELATION_BASIC_CREATION, is sent.

  Specified by:
    `createRelation` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation identifier, to identify uniquely the relation inside the Relation Service
    `theRelTypeName` - name of the relation type (has to be created in the Relation Service)
    `theRoleList` - role list to initialize roles of the relation (can be null).
  Throws:
    `RelationServiceNotRegisteredException` - if the Relation Service is not registered in the MBean Server
    `IllegalArgumentException` - if null parameter, except the role list which can be null if no role initialization
    `RoleNotFoundException` - if a value is provided for a role that does not exist in the relation type
    `InvalidRelationIdException` - if relation id already used
    `RelationTypeNotFoundException` - if relation type not known in Relation Service
    `InvalidRoleValueException` - if:

    - the same role name is used for two different roles

    - 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

    - an MBean provided for that role does not exist

### addRelation

    public void addRelation(ObjectName theRelObjectName)
                     throws IllegalArgumentException,
                            RelationServiceNotRegisteredException,
                            NoSuchMethodException,
                            InvalidRelationIdException,
                            InstanceNotFoundException,
                            InvalidRelationServiceException,
                            RelationTypeNotFoundException,
                            RoleNotFoundException,
                            InvalidRoleValueException

  Adds an MBean created by the user (and registered by him in the MBean Server) as a relation in the Relation Service.

  To be added as a relation, the MBean must conform to the following:

  - implement the Relation interface

  - have for RelationService ObjectName the ObjectName of current Relation Service

  - have a relation id unique and unused in current Relation Service

  - have for relation type a relation type created in the Relation Service

  - have roles conforming to the role info provided in the relation type.

  Specified by:
    `addRelation` in interface `RelationServiceMBean`
  Parameters:
    `theRelObjectName` - ObjectName of the relation MBean to be added.
  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationServiceNotRegisteredException` - if the Relation Service is not registered in the MBean Server
    `NoSuchMethodException` - If the MBean does not implement the Relation interface
    `InvalidRelationIdException` - if:

    - no relation identifier in MBean

    - the relation identifier is already used in the Relation Service

    `InstanceNotFoundException` - if the MBean for given ObjectName has not been registered
    `InvalidRelationServiceException` - if:

    - no Relation Service name in MBean

    - the Relation Service name in the MBean is not the one of the current Relation Service

    `RelationTypeNotFoundException` - if:

    - no relation type name in MBean

    - the relation type name in MBean does not correspond to a relation type created in the Relation Service

    `InvalidRoleValueException` - if:

    - the number of referenced MBeans in a role is less than expected minimum degree

    - the number of referenced MBeans in a role exceeds expected maximum degree

    - one referenced MBean in the value is not an Object of the MBean class expected for that role

    - an MBean provided for a role does not exist

    `RoleNotFoundException` - if a value is provided for a role that does not exist in the relation type

### isRelationMBean

    public ObjectName isRelationMBean(String theRelId)
                               throws IllegalArgumentException,
                                      RelationNotFoundException

  If the relation is represented by an MBean (created by the user and added as a relation in the Relation Service), returns the ObjectName of the MBean.

  Specified by:
    `isRelationMBean` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation id identifying the relation
  Returns:
    ObjectName of the corresponding relation MBean, or null if the relation is not an MBean.
  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - there is no relation associated to that id

### isRelation

    public String isRelation(ObjectName theObjName)
                      throws IllegalArgumentException

  Returns the relation id associated to the given ObjectName if the MBean has been added as a relation in the Relation Service.

  Specified by:
    `isRelation` in interface `RelationServiceMBean`
  Parameters:
    `theObjName` - ObjectName of supposed relation
  Returns:
    relation id (String) or null (if the ObjectName is not a relation handled by the Relation Service)
  Throws:
    `IllegalArgumentException` - if null parameter

### hasRelation

    public Boolean hasRelation(String theRelId)
                        throws IllegalArgumentException

  Checks if there is a relation identified in Relation Service with given relation id.

  Specified by:
    `hasRelation` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation id identifying the relation
  Returns:
    boolean: true if there is a relation, false else
  Throws:
    `IllegalArgumentException` - if null parameter

### getAllRelationIds

    public List getAllRelationIds()

  Returns all the relation ids for all the relations handled by the Relation Service.

  Specified by:
    `getAllRelationIds` in interface `RelationServiceMBean`
  Returns:
    ArrayList of String

### checkRoleReading

    public Integer checkRoleReading(String theRoleName,
                                    String theRelTypeName)
                             throws IllegalArgumentException,
                                    RelationTypeNotFoundException

  Checks if given Role can be read in a relation of the given type.

  Specified by:
    `checkRoleReading` in interface `RelationServiceMBean`
  Parameters:
    `theRoleName` - name of role to be checked
    `theRelTypeName` - name of the relation type
  Returns:
    an Integer wrapping an integer corresponding to possible problems represented as constants in RoleUnresolved:

    - 0 if role can be read

    - integer corresponding to RoleStatus.NO_ROLE_WITH_NAME

    - integer corresponding to RoleStatus.ROLE_NOT_READABLE

  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationTypeNotFoundException` - if the relation type is not known in the Relation Service

### checkRoleWriting

    public Integer checkRoleWriting(Role theRole,
                                    String theRelTypeName,
                                    Boolean theInitFlg)
                             throws IllegalArgumentException,
                                    RelationTypeNotFoundException

  Checks if given Role can be set in a relation of given type.

  Specified by:
    `checkRoleWriting` in interface `RelationServiceMBean`
  Parameters:
    `theRole` - role to be checked
    `theRelTypeName` - name of relation type
    `theInitFlg` - flag to specify that the checking is done for the initialization of a role, write access shall not be verified.
  Returns:
    an Integer wrapping an integer corresponding to possible problems represented as constants in RoleUnresolved:

    - 0 if role can be set

    - integer corresponding to RoleStatus.NO_ROLE_WITH_NAME

    - integer for RoleStatus.ROLE_NOT_WRITABLE

    - integer for RoleStatus.LESS_THAN_MIN_ROLE_DEGREE

    - integer for RoleStatus.MORE_THAN_MAX_ROLE_DEGREE

    - integer for RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS

    - integer for RoleStatus.REF_MBEAN_NOT_REGISTERED

  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationTypeNotFoundException` - if unknown relation type

### sendRelationCreationNotification

    public void sendRelationCreationNotification(String theRelId)
                                          throws IllegalArgumentException,
                                                 RelationNotFoundException

  Sends a notification (RelationNotification) for a relation creation. The notification type is:

  - RelationNotification.RELATION_BASIC_CREATION if the relation is an object internal to the Relation Service

  - RelationNotification.RELATION_MBEAN_CREATION if the relation is a MBean added as a relation.

  The source object is the Relation Service itself.

  It is called in Relation Service createRelation() and addRelation() methods.

  Specified by:
    `sendRelationCreationNotification` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation identifier of the updated relation
  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - if there is no relation for given relation id

### sendRoleUpdateNotification

    public void sendRoleUpdateNotification(String theRelId,
                                           Role theNewRole,
                                           List theOldRoleValue)
                                    throws IllegalArgumentException,
                                           RelationNotFoundException

  Sends a notification (RelationNotification) for a role update in the given relation. The notification type is:

  - RelationNotification.RELATION_BASIC_UPDATE if the relation is an object internal to the Relation Service

  - RelationNotification.RELATION_MBEAN_UPDATE if the relation is a MBean added as a relation.

  The source object is the Relation Service itself.

  It is called in relation MBean setRole() (for given role) and setRoles() (for each role) methods (implementation provided in RelationSupport class).

  It is also called in Relation Service setRole() (for given role) and setRoles() (for each role) methods.

  Specified by:
    `sendRoleUpdateNotification` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation identifier of the updated relation
    `theNewRole` - new role (name and new value)
    `theOldRoleValue` - old role value (List of ObjectName objects)
  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - if there is no relation for given relation id

### sendRelationRemovalNotification

    public void sendRelationRemovalNotification(String theRelId,
                                                List theUnregMBeanList)
                                         throws IllegalArgumentException,
                                                RelationNotFoundException

  Sends a notification (RelationNotification) for a relation removal. The notification type is:

  - RelationNotification.RELATION_BASIC_REMOVAL if the relation is an object internal to the Relation Service

  - RelationNotification.RELATION_MBEAN_REMOVAL if the relation is a MBean added as a relation.

  The source object is the Relation Service itself.

  It is called in Relation Service removeRelation() method.

  Specified by:
    `sendRelationRemovalNotification` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation identifier of the updated relation
    `theUnregMBeanList` - List of ObjectNames of MBeans expected to be unregistered due to relation removal (can be null)
  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - if there is no relation for given relation id

### updateRoleMap

    public void updateRoleMap(String theRelId,
                              Role theNewRole,
                              List theOldRoleValue)
                       throws IllegalArgumentException,
                              RelationServiceNotRegisteredException,
                              RelationNotFoundException

  Handles update of the Relation Service role map for the update of given role in given relation.

  It is called in relation MBean setRole() (for given role) and setRoles() (for each role) methods (implementation provided in RelationSupport class).

  It is also called in Relation Service setRole() (for given role) and setRoles() (for each role) methods.

  To allow the Relation Service to maintain the consistency (in case of MBean unregistration) and to be able to perform queries, this method must be called when a role is updated.

  Specified by:
    `updateRoleMap` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation identifier of the updated relation
    `theNewRole` - new role (name and new value)
    `theOldRoleValue` - old role value (List of ObjectName objects)
  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationServiceNotRegisteredException` - if the Relation Service is not registered in the MBean Server
    `RelationNotFoundException` - if no relation for given id.

### removeRelation

    public void removeRelation(String theRelId)
                        throws RelationServiceNotRegisteredException,
                               IllegalArgumentException,
                               RelationNotFoundException

  Removes given relation from the Relation Service.

  A RelationNotification notification is sent, its type being:

  - RelationNotification.RELATION_BASIC_REMOVAL if the relation was only internal to the Relation Service

  - RelationNotification.RELATION_MBEAN_REMOVAL if the relation is registered as an MBean.

  For MBeans referenced in such relation, nothing will be done,

  Specified by:
    `removeRelation` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation id of the relation to be removed
  Throws:
    `RelationServiceNotRegisteredException` - if the Relation Service is not registered in the MBean Server
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - if no relation corresponding to given relation id

### purgeRelations

    public void purgeRelations()
                        throws RelationServiceNotRegisteredException

  Purges the relations.

  Depending on the purgeFlag value, this method is either called automatically when a notification is received for the unregistration of an MBean referenced in a relation (if the flag is set to true), or not (if the flag is set to false).

  In that case it is up to the user to call it to maintain the consistency of the relations. To be kept in mind that if an MBean is unregistered and the purge not done immediately, if the ObjectName is reused and assigned to another MBean referenced in a relation, calling manually this purgeRelations() method will cause trouble, as will consider the ObjectName as corresponding to the unregistered MBean, not seeing the new one.

  The behavior depends on the cardinality of the role where the unregistered MBean is referenced:

  - if removing one MBean reference in the role makes its number of references less than the minimum degree, the relation has to be removed.

  - if the remaining number of references after removing the MBean reference is still in the cardinality range, keep the relation and update it calling its handleMBeanUnregistration() callback.

  Specified by:
    `purgeRelations` in interface `RelationServiceMBean`
  Throws:
    `RelationServiceNotRegisteredException` - if the Relation Service is not registered in the MBean Server.

### findReferencingRelations

    public Map findReferencingRelations(ObjectName theMBeanName,
                                        String theRelTypeName,
                                        String theRoleName)
                                 throws IllegalArgumentException

  Retrieves the relations where a given MBean is referenced.

  This corresponds to the CIM "References" and "ReferenceNames" operations.

  Specified by:
    `findReferencingRelations` in interface `RelationServiceMBean`
  Parameters:
    `theMBeanName` - ObjectName of MBean
    `theRelTypeName` - can be null; if specified, only the relations of that type will be considered in the search. Else all relation types are considered.
    `theRoleName` - can be null; if specified, only the relations where the MBean is referenced in that role will be returned. Else all roles are considered.
  Returns:
    an HashMap, where the keys are the relation ids of the relations where the MBean is referenced, and the value is, for each key, an ArrayList of role names (as an MBean can be referenced in several roles in the same relation).
  Throws:
    `IllegalArgumentException` - if null parameter

### findAssociatedMBeans

    public Map findAssociatedMBeans(ObjectName theMBeanName,
                                    String theRelTypeName,
                                    String theRoleName)
                             throws IllegalArgumentException

  Retrieves the MBeans associated to given one in a relation.

  This corresponds to CIM Associators and AssociatorNames operations.

  Specified by:
    `findAssociatedMBeans` in interface `RelationServiceMBean`
  Parameters:
    `theMBeanName` - ObjectName of MBean
    `theRelTypeName` - can be null; if specified, only the relations of that type will be considered in the search. Else all relation types are considered.
    `theRoleName` - can be null; if specified, only the relations where the MBean is referenced in that role will be considered. Else all roles are considered.
  Returns:
    an HashMap, where the keys are the ObjectNames of the MBeans associated to given MBean, and the value is, for each key, an ArrayList of the relation ids of the relations where the key MBean is associated to given one (as they can be associated in several different relations).
  Throws:
    `IllegalArgumentException` - if null parameter

### findRelationsOfType

    public List findRelationsOfType(String theRelTypeName)
                             throws IllegalArgumentException,
                                    RelationTypeNotFoundException

  Returns the relation ids for relations of the given type.

  Specified by:
    `findRelationsOfType` in interface `RelationServiceMBean`
  Parameters:
    `theRelTypeName` - relation type name
  Returns:
    an ArrayList of relation ids.
  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationTypeNotFoundException` - if there is no relation type with that name.

### getRole

    public List getRole(String theRelId,
                        String theRoleName)
                 throws RelationServiceNotRegisteredException,
                        IllegalArgumentException,
                        RelationNotFoundException,
                        RoleNotFoundException

  Retrieves role value for given role name in given relation.

  Specified by:
    `getRole` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation id
    `theRoleName` - name of role
  Returns:
    the ArrayList of ObjectName objects being the role value
  Throws:
    `RelationServiceNotRegisteredException` - if the Relation Service is not registered
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - if no relation with given id
    `RoleNotFoundException` - if:

    - there is no role with given name

    or

    - the role is not readable.

  See Also:
    `setRole(java.lang.String, javax.management.relation.Role)`

### getRoles

    public RoleResult getRoles(String theRelId,
                               String[] theRoleNameArray)
                        throws RelationServiceNotRegisteredException,
                               IllegalArgumentException,
                               RelationNotFoundException

  Retrieves values of roles with given names in given relation.

  Specified by:
    `getRoles` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation id
    `theRoleNameArray` - array of names of roles to be retrieved
  Returns:
    a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not retrieved).
  Throws:
    `RelationServiceNotRegisteredException` - if the Relation Service is not registered in the MBean Server
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - if no relation with given id
  See Also:
    `setRoles(java.lang.String, javax.management.relation.RoleList)`

### getAllRoles

    public RoleResult getAllRoles(String theRelId)
                           throws IllegalArgumentException,
                                  RelationNotFoundException,
                                  RelationServiceNotRegisteredException

  Returns all roles present in the relation.

  Specified by:
    `getAllRoles` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation id
  Returns:
    a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not readable).
  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - if no relation for given id
    `RelationServiceNotRegisteredException` - if the Relation Service is not registered in the MBean Server

### getRoleCardinality

    public Integer getRoleCardinality(String theRelId,
                                      String theRoleName)
                               throws IllegalArgumentException,
                                      RelationNotFoundException,
                                      RoleNotFoundException

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

  Specified by:
    `getRoleCardinality` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation id
    `theRoleName` - name of role
  Returns:
    the number of currently referenced MBeans in that role
  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - if no relation with given id
    `RoleNotFoundException` - if there is no role with given name

### setRole

    public void setRole(String theRelId,
                        Role theRole)
                 throws RelationServiceNotRegisteredException,
                        IllegalArgumentException,
                        RelationNotFoundException,
                        RoleNotFoundException,
                        InvalidRoleValueException

  Sets the given role in given relation.

  Will check the role according to its corresponding role definition provided in relation's relation type

  The Relation Service will keep track of the change to keep the consistency of relations by handling referenced MBean unregistrations.

  Specified by:
    `setRole` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation id
    `theRole` - role to be set (name and new value)
  Throws:
    `RelationServiceNotRegisteredException` - if the Relation Service is not registered in the MBean Server
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - if no relation with given id
    `RoleNotFoundException` - if the role does not exist or is not writable
    `InvalidRoleValueException` - if value provided for role is not valid:

    - the number of referenced MBeans in given value is less than expected minimum degree

    or

    - the number of referenced MBeans in provided value exceeds expected maximum degree

    or

    - one referenced MBean in the value is not an Object of the MBean class expected for that role

    or

    - an MBean provided for that role does not exist

  See Also:
    `getRole(java.lang.String, java.lang.String)`

### setRoles

    public RoleResult setRoles(String theRelId,
                               RoleList theRoleList)
                        throws RelationServiceNotRegisteredException,
                               IllegalArgumentException,
                               RelationNotFoundException

  Sets the given roles in given relation.

  Will check the role according to its corresponding role definition provided in relation's relation type

  The Relation Service keeps track of the changes to keep the consistency of relations by handling referenced MBean unregistrations.

  Specified by:
    `setRoles` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation id
    `theRoleList` - list of roles to be set
  Returns:
    a RoleResult object, including a RoleList (for roles successfully set) and a RoleUnresolvedList (for roles not set).
  Throws:
    `RelationServiceNotRegisteredException` - if the Relation Service is not registered in the MBean Server
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - if no relation with given id
  See Also:
    `getRoles(java.lang.String, java.lang.String[])`

### getReferencedMBeans

    public Map getReferencedMBeans(String theRelId)
                            throws IllegalArgumentException,
                                   RelationNotFoundException

  Retrieves MBeans referenced in the various roles of the relation.

  Specified by:
    `getReferencedMBeans` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation id
  Returns:
    a HashMap mapping:

    ObjectName -> ArrayList of String (role names)

  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - if no relation for given relation id

### getRelationTypeName

    public String getRelationTypeName(String theRelId)
                               throws IllegalArgumentException,
                                      RelationNotFoundException

  Returns name of associated relation type for given relation.

  Specified by:
    `getRelationTypeName` in interface `RelationServiceMBean`
  Parameters:
    `theRelId` - relation id
  Returns:
    the name of the associated relation type.
  Throws:
    `IllegalArgumentException` - if null parameter
    `RelationNotFoundException` - if no relation for given relation id

### handleNotification

    public void handleNotification(Notification theNtf,
                                   Object theHandback)

  Invoked when a JMX notification occurs. Currently handles notifications for unregistration of MBeans, either referenced in a relation role or being a relation itself.

  Specified by:
    `handleNotification` in interface `NotificationListener`
  Parameters:
    `theNtf` - The notification.
    `theHandback` - An opaque object which helps the listener to associate information regarding the MBean emitter (can be null).

### getNotificationInfo

    public MBeanNotificationInfo[] getNotificationInfo()

  Returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent.

  Specified by:
    `getNotificationInfo` in interface `NotificationBroadcaster`
  Overrides:
    `getNotificationInfo` in class `NotificationBroadcasterSupport`
  Returns:
    the array of possible notifications.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Standard Ed. 5.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.