From b08bd4dd4b0d4d17d4907c605dba11020cf11922 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 28 Sep 2007 15:47:50 +0000
Subject: [PATCH] Add support for specifying arbitrary constraints in managed object definitions and use it within the LDAP and JMX connection handlers to enforce their SSL/StartTLS settings. This feature will be re-used for other managed object definitions as the need arises.

---
 opends/src/server/org/opends/server/admin/Constraint.java |   41 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/admin/Constraint.java b/opends/src/server/org/opends/server/admin/Constraint.java
index be8e4ca..c23af74 100644
--- a/opends/src/server/org/opends/server/admin/Constraint.java
+++ b/opends/src/server/org/opends/server/admin/Constraint.java
@@ -29,6 +29,7 @@
 
 
 import java.util.Collection;
+import java.util.Collections;
 
 import org.opends.server.admin.client.ClientConstraintHandler;
 import org.opends.server.admin.server.ServerConstraintHandler;
@@ -60,11 +61,22 @@
  * new managed object is created, changes to a managed object are
  * applied, or an existing managed object is deleted.
  */
-public interface Constraint {
+public abstract class Constraint {
+
+  /**
+   * Creates a new constraint.
+   */
+  protected Constraint() {
+    // No implementation required.
+  }
+
+
 
   /**
    * Gets the client-side constraint handlers which will be used to
-   * enforce this constraint in client applications.
+   * enforce this constraint in client applications. The default
+   * implementation is to return an empty set of client constraint
+   * handlers.
    *
    * @return Returns the client-side constraint handlers which will be
    *         used to enforce this constraint in client applications.
@@ -72,13 +84,17 @@
    *         but maybe empty (indicating that the constraint can only
    *         be enforced on the server-side).
    */
-  Collection<ClientConstraintHandler> getClientConstraintHandlers();
+  public Collection<ClientConstraintHandler> getClientConstraintHandlers() {
+    return Collections.emptySet();
+  }
 
 
 
   /**
    * Gets the server-side constraint handlers which will be used to
-   * enforce this constraint within the server.
+   * enforce this constraint within the server. The default
+   * implementation is to return an empty set of server constraint
+   * handlers.
    *
    * @return Returns the server-side constraint handlers which will be
    *         used to enforce this constraint within the server. The
@@ -86,6 +102,21 @@
    *         must not be empty, since constraints must always be
    *         enforced on the server.
    */
-  Collection<ServerConstraintHandler> getServerConstraintHandlers();
+  public Collection<ServerConstraintHandler> getServerConstraintHandlers() {
+    return Collections.emptySet();
+  }
+
+
+
+  /**
+   * Initializes this constraint. The default implementation is to do
+   * nothing.
+   *
+   * @throws Exception
+   *           If this constraint could not be initialized.
+   */
+  protected void initialize() throws Exception {
+    // Default implementation is to do nothing.
+  }
 
 }

--
Gitblit v1.10.0