Class RelationSupport

java.lang.Object
javax.management.relation.RelationSupport
All Implemented Interfaces:
MBeanRegistration, Relation, RelationSupportMBean

public class RelationSupport extends Object implements RelationSupportMBean, MBeanRegistration
A RelationSupport object is used internally by the Relation Service to represent simple relations (only roles, no properties or methods), with an unlimited number of roles, of any relation type. As internal representation, it is not exposed to the user.

RelationSupport class conforms to the design patterns of standard MBean. So the user can decide to instantiate a RelationSupport object himself as a MBean (as it follows the MBean design patterns), to register it in the MBean Server, and then to add it in the Relation Service.

The user can also, when creating his own MBean relation class, have it extending RelationSupport, to retrieve the implementations of required interfaces (see below).

It is also possible to have in a user relation MBean class a member being a RelationSupport object, and to implement the required interfaces by delegating all to this member.

RelationSupport implements the Relation interface (to be handled by the Relation Service).

It implements also the MBeanRegistration interface to be able to retrieve the MBean Server where it is registered (if registered as a MBean) to access to its Relation Service.

Since:
1.5
  • Constructor Summary

    Constructors
    Constructor
    Description
    RelationSupport(String relationId, ObjectName relationServiceName, String relationTypeName, RoleList list)
    Creates a RelationSupport object.
    RelationSupport(String relationId, ObjectName relationServiceName, MBeanServer relationServiceMBeanServer, String relationTypeName, RoleList list)
    Creates a RelationSupport object.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns all roles present in the relation.
    Retrieves MBeans referenced in the various roles of the relation.
    Returns relation identifier (used to uniquely identify the relation inside the Relation Service).
    Returns ObjectName of the Relation Service handling the relation.
    Returns name of associated relation type.
    getRole(String roleName)
    Retrieves role value for given role name.
    Returns the number of MBeans currently referenced in the given role.
    getRoles(String[] roleNameArray)
    Retrieves values of roles with given names.
    void
    Callback used by the Relation Service when a MBean referenced in a role is unregistered.
    Returns an internal flag specifying if the object is still handled by the Relation Service.
    void
    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
    Allows the MBean to perform any operations it needs before being unregistered by the MBean server.
    Allows the MBean to perform any operations it needs before being registered in the MBean Server.
    Returns all roles in the relation without checking read mode.
    void
    Specifies whether this relation is handled by the Relation Service.
    void
    setRole(Role role)
    Sets the given role.
    Sets the given roles.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Creates and returns a copy of this object.
    boolean
    Indicates whether some other object is "equal to" this one.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Finalization is deprecated and subject to removal in a future release.
    final Class<?>
    Returns the runtime class of this Object.
    int
    Returns a hash code value for this object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    Returns a string representation of the object.
    final void
    Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
    final void
    wait(long timeoutMillis)
    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
    final void
    wait(long timeoutMillis, int nanos)
    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  • Constructor Details

    • RelationSupport

      public RelationSupport(String relationId, ObjectName relationServiceName, String relationTypeName, RoleList list) throws InvalidRoleValueException, IllegalArgumentException
      Creates a RelationSupport object.

      This constructor has to be used when the RelationSupport object will be registered as a MBean by the user, or when creating a user relation MBean whose class extends RelationSupport.

      Nothing is done at the Relation Service level, i.e. the RelationSupport object is not added to the RelationService and no checks are performed to see if the provided values are correct. The object is always created, EXCEPT if:

      - any of the required parameters is null.

      - the same name is used for two roles.

      To be handled as a relation, the RelationSupport object has to be added to the Relation Service using the Relation Service method addRelation().

      Parameters:
      relationId - relation identifier, to identify the relation in the Relation Service.

      Expected to be unique in the given Relation Service.

      relationServiceName - ObjectName of the Relation Service where the relation will be registered.

      This parameter is required as it is the Relation Service that is aware of the definition of the relation type of the given relation, so that will be able to check update operations (set).

      relationTypeName - Name of relation type.

      Expected to have been created in the given Relation Service.

      list - list of roles (Role objects) to initialize the relation. Can be null.

      Expected to conform to relation info in associated relation type.

      Throws:
      InvalidRoleValueException - if the same name is used for two roles.
      IllegalArgumentException - if any of the required parameters (relation id, relation service ObjectName, or relation type name) is null.
    • RelationSupport

      public RelationSupport(String relationId, ObjectName relationServiceName, MBeanServer relationServiceMBeanServer, String relationTypeName, RoleList list) throws InvalidRoleValueException, IllegalArgumentException
      Creates a RelationSupport object.

      This constructor has to be used when the user relation MBean implements the interfaces expected to be supported by a relation by delegating to a RelationSupport object.

      This object needs to know the Relation Service expected to handle the relation. So it has to know the MBean Server where the Relation Service is registered.

      According to a limitation, a relation MBean must be registered in the same MBean Server as the Relation Service expected to handle it. So the user relation MBean has to be created and registered, and then the wrapped RelationSupport object can be created within the identified MBean Server.

      Nothing is done at the Relation Service level, i.e. the RelationSupport object is not added to the RelationService and no checks are performed to see if the provided values are correct. The object is always created, EXCEPT if:

      - any of the required parameters is null.

      - the same name is used for two roles.

      To be handled as a relation, the RelationSupport object has to be added to the Relation Service using the Relation Service method addRelation().

      Parameters:
      relationId - relation identifier, to identify the relation in the Relation Service.

      Expected to be unique in the given Relation Service.

      relationServiceName - ObjectName of the Relation Service where the relation will be registered.

      This parameter is required as it is the Relation Service that is aware of the definition of the relation type of the given relation, so that will be able to check update operations (set).

      relationServiceMBeanServer - MBean Server where the wrapping MBean is or will be registered.

      Expected to be the MBean Server where the Relation Service is or will be registered.

      relationTypeName - Name of relation type.

      Expected to have been created in the given Relation Service.

      list - list of roles (Role objects) to initialize the relation. Can be null.

      Expected to conform to relation info in associated relation type.

      Throws:
      InvalidRoleValueException - if the same name is used for two roles.
      IllegalArgumentException - if any of the required parameters (relation id, relation service ObjectName, relation service MBeanServer, or relation type name) is null.
  • Method Details