Class RelationDefinition<C extends ConfigurationClient,​S extends Configuration>

  • Type Parameters:
    C - The type of client managed object configuration that this relation definition refers to.
    S - The type of server managed object configuration that this relation definition refers to.
    Direct Known Subclasses:
    InstantiableRelationDefinition, OptionalRelationDefinition, SetRelationDefinition, SingletonRelationDefinition

    public abstract class RelationDefinition<C extends ConfigurationClient,​S extends Configuration>
    extends Object
    Relation definitions define relationships between types of managed objects. In addition they define the ownership model:
    • composition - referenced managed objects are owned by the parent managed object and are deleted when the parent is deleted
    • aggregation - referenced managed objects are not owned by the parent managed object. Instead they are shared by other managed objects.
    Relations define how clients interact with the configuration. For example, clients manage aggregated managed objects in a shared location and attach them to parent managed objects. Composed managed objects, on the other hand, would be created directly beneath the parent managed object and destroyed with it too.

    Within the server, listeners can choose to request notification of managed objects being added or removed from relations.

    In LDAP, compositions are represented as follows:

    • singleton relations (one to one): a referenced managed object is represented using a child entry directly beneath the parent
    • optional relations (one to zero or one): a referenced managed object is represented using a child entry directly beneath the parent
    • instantiable relations (one to many): the relation is represented using a child entry directly beneath the parent. Referenced managed objects are represented using child entries of this "relation entry" and are named by the user
    • set relations (one to many): the relation is represented using a child entry directly beneath the parent. Referenced managed objects are represented using child entries of this "relation entry" whose name is the type of the managed object.
    Whereas, aggregations are represented by storing the DNs of the referenced managed objects in an attribute of the aggregating managed object.
    • Constructor Detail

      • RelationDefinition

        protected RelationDefinition​(RelationDefinition.Common<C,​S> common)
        Create a new managed object relation definition with the specified common fields.
        Parameters:
        common - The common fields of the new relation definition.
    • Method Detail

      • accept

        public abstract <R,​P> R accept​(RelationDefinitionVisitor<R,​P> v,
                                             P p)
        Apply a visitor to this relation definition.
        Type Parameters:
        R - The return type of the visitor's methods.
        P - The type of the additional parameters to the visitor's methods.
        Parameters:
        v - The relation definition visitor.
        p - Optional additional visitor parameter.
        Returns:
        Returns a result as specified by the visitor.
      • getChildDefinition

        public final AbstractManagedObjectDefinition<C,​S> getChildDefinition()
        Get the definition of the child managed object.
        Returns:
        Returns the definition of the child managed object.
      • getDescription

        public final LocalizableMessage getDescription()
        Gets the optional description of this relation definition in the default locale.
        Returns:
        Returns the description of this relation definition in the default locale, or null if there is no description.
      • getDescription

        public final LocalizableMessage getDescription​(Locale locale)
        Gets the optional description of this relation definition in the specified locale.
        Parameters:
        locale - The locale.
        Returns:
        Returns the description of this relation definition in the specified locale, or null if there is no description.
      • getName

        public final String getName()
        Get the name of the relation.
        Returns:
        Returns the name of the relation.
      • getParentDefinition

        public final AbstractManagedObjectDefinition<?,​?> getParentDefinition()
        Get the definition of the parent managed object.
        Returns:
        Returns the definition of the parent managed object.
      • getSynopsis

        public final LocalizableMessage getSynopsis()
        Gets the synopsis of this relation definition in the default locale.
        Returns:
        Returns the synopsis of this relation definition in the default locale.
      • getSynopsis

        public final LocalizableMessage getSynopsis​(Locale locale)
        Gets the synopsis of this relation definition in the specified locale.
        Parameters:
        locale - The locale.
        Returns:
        Returns the synopsis of this relation definition in the specified locale.
      • getUserFriendlyName

        public final LocalizableMessage getUserFriendlyName()
        Gets the user friendly name of this relation definition in the default locale.
        Returns:
        Returns the user friendly name of this relation definition in the default locale.
      • getUserFriendlyName

        public final LocalizableMessage getUserFriendlyName​(Locale locale)
        Gets the user friendly name of this relation definition in the specified locale.
        Parameters:
        locale - The locale.
        Returns:
        Returns the user friendly name of this relation definition in the specified locale.
      • hasOption

        public final boolean hasOption​(RelationOption option)
        Check if the specified option is set for this relation definition.
        Parameters:
        option - The option to test.
        Returns:
        Returns true if the option is set, or false otherwise.
      • toString

        public abstract void toString​(StringBuilder builder)
        Append a string representation of the managed object relation to the provided string builder.
        Parameters:
        builder - The string builder where the string representation should be appended.
      • initialize

        protected void initialize()
                           throws Exception
        Performs any run-time initialization required by this relation definition. This may include resolving managed object paths and property names.
        Throws:
        Exception - If this relation definition could not be initialized.