Class Constraint

  • Direct Known Subclasses:
    GenericConstraint

    public abstract class Constraint
    extends Object
    An interface for enforcing constraints and dependencies between managed objects and their properties. Constraints express relationships between managed objects and their properties, for example:
    • referential integrity: where one managed object references another a constraint can enforce referential integrity. The constraint can prevent creation of references to non-existent managed objects, and also prevent deletion of referenced managed objects
    • property dependencies: for example, when a boolean property is true, one or more additional properties must be specified. This is useful for features like SSL, which when enabled, requires that various SSL related configuration options are specified
    • property constraints: for example, when an upper limit property must not have a value which is less than the lower limit property.
    On the client-side constraints are enforced immediately before a write operation is performed. That is to say, immediately before a new managed object is created, changes to a managed object are applied, or an existing managed object is deleted.
    • Constructor Detail

      • Constraint

        protected Constraint()
        Creates a new constraint.
    • Method Detail

      • getClientConstraintHandlers

        public Collection<ClientConstraintHandler> getClientConstraintHandlers()
        Gets the client-side constraint handlers which will be used to enforce this constraint in client applications. The default implementation is to return an empty set of client constraint handlers.
        Returns:
        Returns the client-side constraint handlers which will be used to enforce this constraint in client applications. The returned collection must not be null but maybe empty (indicating that the constraint can only be enforced on the server-side).
      • getServerConstraintHandlers

        public Collection<ServerConstraintHandler> getServerConstraintHandlers()
        Gets the server-side constraint handlers which will be used to enforce this constraint within the server. The default implementation is to return an empty set of server constraint handlers.
        Returns:
        Returns the server-side constraint handlers which will be used to enforce this constraint within the server. The returned collection must not be null and must not be empty, since constraints must always be enforced on the server.
      • initialize

        protected void initialize()
                           throws Exception
        Initializes this constraint. The default implementation is to do nothing.
        Throws:
        Exception - If this constraint could not be initialized.