Class 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 Detail

      • 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.