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/resource/admin/metaMO.xsl |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/opends/resource/admin/metaMO.xsl b/opends/resource/admin/metaMO.xsl
index 7a0aa0d..105a87a 100644
--- a/opends/resource/admin/metaMO.xsl
+++ b/opends/resource/admin/metaMO.xsl
@@ -170,6 +170,25 @@
       <xsl:value-of select="'  }&#xa;'" />
     </xsl:if>
     <!--
+      Register any constraints associated with this managed object definition.
+    -->
+    <xsl:if test="$this/adm:constraint">
+      <xsl:text>&#xa;</xsl:text>
+      <xsl:text>&#xa;</xsl:text>
+      <xsl:text>&#xa;</xsl:text>
+      <xsl:value-of
+        select="'  // Register the constraints associated with this managed object definition.&#xa;'" />
+      <xsl:value-of select="'  static {&#xa;'" />
+      <xsl:for-each select="$this/adm:constraint">
+        <xsl:value-of
+          select="concat('    INSTANCE.registerConstraint(new GenericConstraint(INSTANCE, ', position(), ', ')" />
+        <xsl:apply-templates select="adm:condition/*"
+          mode="compile-condition" />
+        <xsl:value-of select="'));&#xa;'" />
+      </xsl:for-each>
+      <xsl:value-of select="'  }&#xa;'" />
+    </xsl:if>
+    <!--
       Configuration definition singleton getter.
     -->
     <xsl:text>&#xa;</xsl:text>
@@ -1631,6 +1650,10 @@
         <xsl:if test="not(boolean($this/@extends))">
           <import>org.opends.server.admin.TopCfgDefn</import>
         </xsl:if>
+        <xsl:if test="$this/adm:constraint">
+          <import>org.opends.server.admin.GenericConstraint</import>
+          <import>org.opends.server.admin.condition.Conditions</import>
+        </xsl:if>
         <xsl:if
           test="$this-local-properties[@multi-valued='true' or
                                        @read-only='true' or

--
Gitblit v1.10.0