From 8adc446c2a0a898b30831ae835ca1fc0bf529051 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Wed, 13 Jun 2007 22:21:25 +0000
Subject: [PATCH] Add support for tagging managed object definitions so that similar types of managed object can be grouped together. Tagging will enable us to automatically generate more user-friendly documentation and administration tools as a result of them being easier to navigate and search. For example, an administration CLI will be able to split the available set of sub-commands into categories, thus making it easier for administrators to find the sub-command that they need.

---
 opendj-sdk/opends/resource/admin/metaMO.xsl |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/resource/admin/metaMO.xsl b/opendj-sdk/opends/resource/admin/metaMO.xsl
index 8357a48..286c1e8 100644
--- a/opendj-sdk/opends/resource/admin/metaMO.xsl
+++ b/opendj-sdk/opends/resource/admin/metaMO.xsl
@@ -92,6 +92,21 @@
       <xsl:call-template name="generate-enumeration" />
     </xsl:for-each>
     <!--
+      Define application tags if this is the root configuration.
+    -->
+    <xsl:if test="$this-is-root">
+      <xsl:text>&#xa;</xsl:text>
+      <xsl:text>&#xa;</xsl:text>
+      <xsl:text>&#xa;</xsl:text>
+      <xsl:value-of select="'  // Define managed object tags.&#xa;'"/>
+      <xsl:value-of select="'  static {&#xa;'"/>
+      <xsl:for-each select="$this/adm:tag-definition">
+        <xsl:sort select="@name" />
+        <xsl:value-of select="concat('    Tag.define(&quot;', @name, '&quot;);&#xa;')"/>
+      </xsl:for-each>
+      <xsl:value-of select="'  }&#xa;'"/>
+    </xsl:if>
+    <!--
       Generate declarations for properties defined or
       overridden by this managed object.
     -->
@@ -134,6 +149,21 @@
       <xsl:call-template name="generate-relation-constructor" />
     </xsl:for-each>
     <!--
+      Register any tags associated with this managed object definition.
+    -->
+    <xsl:if test="$this/adm:tag">
+      <xsl:text>&#xa;</xsl:text>
+      <xsl:text>&#xa;</xsl:text>
+      <xsl:text>&#xa;</xsl:text>
+      <xsl:value-of select="'  // Register the tags associated with this managed object definition.&#xa;'"/>
+      <xsl:value-of select="'  static {&#xa;'"/>
+      <xsl:for-each select="$this/adm:tag">
+        <xsl:sort select="@name" />
+        <xsl:value-of select="concat('    INSTANCE.registerTag(Tag.valueOf(&quot;', @name, '&quot;));&#xa;')"/>
+      </xsl:for-each>
+      <xsl:value-of select="'  }&#xa;'"/>
+    </xsl:if>
+    <!--
       Configuration definition singleton getter.
     -->
     <xsl:text>&#xa;</xsl:text>
@@ -603,7 +633,8 @@
       </xsl:message>
     </xsl:if>
     <xsl:choose>
-      <xsl:when test="not(adm:default-behavior) or adm:default-behavior/adm:undefined">
+      <xsl:when
+        test="not(adm:default-behavior) or adm:default-behavior/adm:undefined">
         <xsl:value-of
           select="concat('      builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider&lt;', $value-type,'&gt;());&#xa;')" />
       </xsl:when>
@@ -1591,6 +1622,9 @@
                                        @mandatory='true']">
           <import>org.opends.server.admin.PropertyOption</import>
         </xsl:if>
+        <xsl:if test="$this/adm:tag-definition or $this/adm:tag">
+          <import>org.opends.server.admin.Tag</import>
+        </xsl:if>
         <xsl:if
           test="$this-local-properties[adm:default-behavior/adm:undefined or not(adm:default-behavior)]">
           <import>

--
Gitblit v1.10.0