Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.management.relation
Interface Relation

All Known Subinterfaces:
  RelationSupportMBean

All Known Implementing Classes:
  RelationSupport

public interface Relation

This interface is implemented by an MBean that represents a relation.

Relations with only roles can be created by the relation service using a `RelationSupport` object.

More complicated relations have to implemented manually. The `RelationSupport` can be used to help in the implementation.

Any properties or methods must be exposed for management by the implementing MBean.

Version:
  $Revision: 1.3 $
Author:
  Adrian Brock.

Method Summary
`RoleResult` | `getAllRoles()` Retrieves all the roles in this relation.
`Map` | `getReferencedMBeans()` Retrieves MBeans referenced by roles of this relation.
`String` | `getRelationId()` Retrieves the relation id used to identify the relation within the relation service.
`ObjectName` | `getRelationServiceName()` Retrieves the object name of the relation service this relation is registered with.
`String` | `getRelationTypeName()` Retrieves the relation type for this relation.
`List` | `getRole(String roleName)` Retrieves the role for the passed role name.
`Integer` | `getRoleCardinality(String roleName)` Retrieves the number of MBeans in a given role.
`RoleResult` | `getRoles(String[] roleNames)` Retrieves the roles in this relation with the passed names.
`void` | `handleMBeanUnregistration(ObjectName objectName, String roleName)` The relation service will call this service when an MBean referenced in a role is unregistered.
`RoleList` | `retrieveAllRoles()` Retrieve all the roles in this relation without checking the role mode.
`void` | `setRole(Role role)` Sets the passed role for this relation.
`RoleResult` | `setRoles(RoleList roleList)` Sets the roles.

Method Detail

### getRole

    public List getRole(String roleName)
                 throws IllegalArgumentException,
                        RoleNotFoundException,
                        RelationServiceNotRegisteredException

  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.

  Parameters:
    `roleName` - the role name.
  Returns:
    the role.
  Throws:
    `IllegalArgumentException` - for a null role name.
    `RoleNotFoundException` - when there is no such role or it is not readable.
    `RelationServiceNotRegisteredException` - when the relation service is not registered with an MBeanServer.

### getRoles

    public RoleResult getRoles(String[] roleNames)
                        throws IllegalArgumentException,
                               RelationServiceNotRegisteredException

  Retrieves the roles in this relation with the passed names.

  Parameters:
    `roleNames` - an array of role names
  Returns:
    the roles both resolved and unresolved.
  Throws:
    `IllegalArgumentException` - for a null role names.
    `RelationServiceNotRegisteredException` - when the relation service is not registered with an MBeanServer.

### getRoleCardinality

    public Integer getRoleCardinality(String roleName)
                               throws IllegalArgumentException,
                                      RoleNotFoundException

  Retrieves the number of MBeans in a given role.

  Parameters:
    `roleName` - the role name.
  Returns:
    the number of MBeans.
  Throws:
    `IllegalArgumentException` - for a null role name.
    `RoleNotFoundException` - when there is no such role.

### getAllRoles

    public RoleResult getAllRoles()
                           throws RelationServiceNotRegisteredException

  Retrieves all the roles in this relation.

  Returns:
    the roles both resolved and unresolved.
  Throws:
    `RelationServiceNotRegisteredException` - when the relation service is not registered with an MBeanServer.

### retrieveAllRoles

    public RoleList retrieveAllRoles()

  Retrieve all the roles in this relation without checking the role mode.

  Returns:
    the list of roles.

### setRole

    public void setRole(Role role)
                 throws IllegalArgumentException,
                        RoleNotFoundException,
                        RelationTypeNotFoundException,
                        InvalidRoleValueException,
                        RelationServiceNotRegisteredException,
                        RelationNotFoundException

  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.

  Parameters:
    `role` - the new role.
  Throws:
    `IllegalArgumentException` - for a null role.
    `InvalidRoleValueException` - if the role is not valid.
    `RoleNotFoundException` - if the role is not writable. This test is not performed at initialisation.
    `RelationServiceNotRegisteredException` - when the relation service is not registered with an MBeanServer.
    `RelationTypeNotFoundException` - when the relation type has not been registered in the relation service.
    `RelationNotFoundException` - when this method is called for for an MBean not registered with the relation service.

### setRoles

    public RoleResult setRoles(RoleList roleList)
                        throws IllegalArgumentException,
                               RelationServiceNotRegisteredException,
                               RelationTypeNotFoundException,
                               RelationNotFoundException

  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.

  Parameters:
    `roleList` - the new roles.
  Returns:
    the resulting role result.
  Throws:
    `IllegalArgumentException` - for a null role name.
    `RelationServiceNotRegisteredException` - when the relation service is not registered with an MBeanServer.
    `RelationTypeNotFoundException` - when the relation type has not been registered in the relation service.
    `RelationNotFoundException` - when this method is called for for an MBean not registered with the relation service.

### handleMBeanUnregistration

    public void handleMBeanUnregistration(ObjectName objectName,
                                          String roleName)
                                   throws IllegalArgumentException,
                                          RoleNotFoundException,
                                          InvalidRoleValueException,
                                          RelationServiceNotRegisteredException,
                                          RelationTypeNotFoundException,
                                          RelationNotFoundException

  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

  Parameters:
    `objectName` - the object name unregistered.
    `roleName` - the role the containing the object.
  Throws:
    `RoleNotFoundException` - if the role does exist or it is not writable.
    `InvalidRoleValueException` - when the role does not conform to the associated role info.
    `RelationServiceNotRegisteredException` - when the relation service is not registered with an MBeanServer.
    `RelationTypeNotFoundException` - when the relation type has not been registered in the relation service.
    `RelationNotFoundException` - when this method is called for for an MBean not registered with the relation service.
    `IllegalArgumentException`

### getReferencedMBeans

    public Map getReferencedMBeans()

  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.

  Returns:
    the map of object names and their roles.

### getRelationTypeName

    public String getRelationTypeName()

  Retrieves the relation type for this relation.

  Returns:
    the relation type.

### getRelationServiceName

    public ObjectName getRelationServiceName()

  Retrieves the object name of the relation service this relation is registered with.

  Returns:
    the relation service object name.

### getRelationId

    public String getRelationId()

  Retrieves the relation id used to identify the relation within the relation service.

  Returns:
    the unique id.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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