mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
23.26.2007 feb5d90ec016c99712f19c5485cf7633cd38f111
opends/build.xml
@@ -128,6 +128,11 @@
  <property file="PRODUCT"                                                />
  <!-- Properties for administration framework code generation. -->
  <property name="admin.defn.dir"  location="src/admin/defn" />
  <property name="admin.src.dir"   location="src/admin/generated" />
  <property name="admin.rules.dir" location="resource/admin" />
  <!-- Create a package bundle containing the DSML library. -->
  <target name="dsml" depends="predsml,package"
       description="Build a Directory Server package bundle with DSML.">
@@ -167,13 +172,14 @@
  <!-- Remove all dynamically-generated build files. -->
  <target name="clean"
  <target name="clean" depends="cleanadmin"
       description="Clean up any files generated during the build process">
    <delete dir="${build.dir}"           />
    <delete file="${dynconstants.file}"  />                           <fileset dir="${lib.dir}">
        <include name="*.jar" />
      </fileset>
    <delete file="${dynconstants.file}"  />
    <fileset dir="${lib.dir}">
      <include name="*.jar" />
    </fileset>
  </target>
@@ -282,8 +288,10 @@
    </taskdef>
    <checkcopyrightdates>
      <fileset dir="${basedir}" includes="**/*.java" excludes="build/**/*" />
      <fileset dir="${basedir}" includes="**/*.java" excludes="build/**/*,src/admin/generated/**/*" />
      <fileset dir="${basedir}" includes="**/*.xml" excludes="build/**/*" />
      <fileset dir="${basedir}" includes="**/*.xsd" excludes="build/**/*" />
      <fileset dir="${basedir}" includes="**/*.xsl" excludes="build/**/*" />
      <fileset dir="${basedir}" includes="**/*.html" excludes="build/**/*" />
      <fileset dir="${basedir}" includes="**/*.sh" excludes="build/**/*" />
      <fileset dir="${basedir}" includes="**/*.bat" excludes="build/**/* " />
@@ -299,7 +307,6 @@
  <!-- Check added files to see if any svn:eol-style updates are needed. -->
  <target name="eolstyle" depends="buildtools"
       description="Ensure added files have the correct svn:eol-style" >
@@ -316,8 +323,10 @@
    </taskdef>
    <checkeolstyle>
      <fileset dir="${basedir}" includes="**/*.java" excludes="build/**/*" />
      <fileset dir="${basedir}" includes="**/*.java" excludes="build/**/*,src/admin/generated/**/*" />
      <fileset dir="${basedir}" includes="**/*.xml" excludes="build/**/*" />
      <fileset dir="${basedir}" includes="**/*.xsd" excludes="build/**/*" />
      <fileset dir="${basedir}" includes="**/*.xsl" excludes="build/**/*" />
      <fileset dir="${basedir}" includes="**/*.html" excludes="build/**/*" />
      <fileset dir="${basedir}" includes="**/*.sh" excludes="build/**/*" />
      <fileset dir="${basedir}" includes="**/*.bat" excludes="build/**/* " />
@@ -392,12 +401,12 @@
  <!-- Compile the Directory Server source files. -->
  <target name="compile"
       depends="init,dynamicconstants"
       depends="init,dynamicconstants,compileadmin"
       description="Compile the Directory Server source files.">
    <mkdir dir="${classes.dir}" />
    <javac srcdir="${src.dir}" destdir="${classes.dir}" optimize="true"
    <javac srcdir="${src.dir}:${admin.src.dir}" destdir="${classes.dir}" optimize="true"
         excludes="**/package-info.java"
         debug="on" debuglevel="lines,vars,source" source="1.5" target="1.5"
         deprecation="true" fork="true" memoryInitialSize="${MEM}"
@@ -444,16 +453,16 @@
          description="Compile the Quick Setup source files.">
    <mkdir dir="${quicksetup.classes.dir}" />
   <javac srcdir="${src.dir}" destdir="${quicksetup.classes.dir}"
          optimize="true" debug="on" debuglevel="lines,source" source="1.5"
          target="1.5" deprecation="true" fork="true" memoryInitialSize="${MEM}"
          memoryMaximumSize="${MEM}">
            <include name="**/org/opends/server/util/SetupUtils.java"/>
            <include name="**/org/opends/server/util/DynamicConstants.java"/>
            <include name="**/org/opends/server/types/OperatingSystem.java"/>
            <compilerarg value="-Xlint:all" />
   </javac>
   <javac srcdir="${quicksetup.src.dir}" destdir="${quicksetup.classes.dir}"
    <javac srcdir="${src.dir}" destdir="${quicksetup.classes.dir}"
               optimize="true" debug="on" debuglevel="lines,source" source="1.5"
               target="1.5" deprecation="true" fork="true" memoryInitialSize="${MEM}"
               memoryMaximumSize="${MEM}">
      <include name="**/org/opends/server/util/SetupUtils.java"/>
      <include name="**/org/opends/server/util/DynamicConstants.java"/>
      <include name="**/org/opends/server/types/OperatingSystem.java"/>
      <compilerarg value="-Xlint:all" />
    </javac>
    <javac srcdir="${quicksetup.src.dir}" destdir="${quicksetup.classes.dir}"
         optimize="true" debug="on" debuglevel="lines,source" source="1.5"
         target="1.5" deprecation="true" fork="true" memoryInitialSize="${MEM}"
         memoryMaximumSize="${MEM}">
@@ -524,9 +533,12 @@
    <delete file="${package.dir}/lib/quicksetup.jar" />
    <delete file="${package.dir}/lib/statuspanel.jar" />
    <!-- Regenerate configuration files if necessary -->
    <antcall target="compileadmin" />
    <!-- Recreate the classes directory and recompile into it. -->
    <mkdir dir="${classes.dir}" />
    <javac srcdir="${src.dir}" destdir="${classes.dir}" optimize="true"
    <javac srcdir="${src.dir}:${admin.src.dir}" destdir="${classes.dir}" optimize="true"
         debug="on" debuglevel="lines,source" source="1.5" target="1.5"
         deprecation="true" fork="true" memoryInitialSize="${MEM}"
         memoryMaximumSize="${MEM}">
@@ -545,32 +557,32 @@
    <!-- Recreate the quicksetup classes directory and recompile into it. -->
    <mkdir dir="${quicksetup.classes.dir}" />
   <javac srcdir="${src.dir}" destdir="${quicksetup.classes.dir}"
             optimize="true" debug="on" debuglevel="lines,source" source="1.5"
             target="1.5" deprecation="true" fork="true" memoryInitialSize="${MEM}"
             memoryMaximumSize="${MEM}">
      <include name="**/org/opends/server/util/SetupUtils.java"/>
      <include name="**/org/opends/server/util/DynamicConstants.java"/>
      <include name="**/org/opends/server/types/OperatingSystem.java"/>
      <compilerarg value="-Xlint:all" />
   </javac>
    <javac srcdir="${src.dir}" destdir="${quicksetup.classes.dir}"
                       optimize="true" debug="on" debuglevel="lines,source" source="1.5"
                       target="1.5" deprecation="true" fork="true" memoryInitialSize="${MEM}"
                       memoryMaximumSize="${MEM}">
      <include name="**/org/opends/server/util/SetupUtils.java"/>
      <include name="**/org/opends/server/util/DynamicConstants.java"/>
      <include name="**/org/opends/server/types/OperatingSystem.java"/>
      <compilerarg value="-Xlint:all" />
    </javac>
    <javac srcdir="${quicksetup.src.dir}" destdir="${quicksetup.classes.dir}" optimize="true"
        debug="on" debuglevel="lines,source" source="1.5" target="1.5"
        deprecation="true" fork="true" memoryInitialSize="${MEM}"
        memoryMaximumSize="${MEM}">
        <compilerarg value="-Xlint:all" />
        <classpath>
            <fileset dir="${build.dir}/build-tools">
                <include name="build-tools.jar" />
            </fileset>
            <fileset dir="${pdir}/lib">
                <include name="OpenDS.jar" />
            </fileset>
        </classpath>
      <compilerarg value="-Xlint:all" />
      <classpath>
        <fileset dir="${build.dir}/build-tools">
          <include name="build-tools.jar" />
        </fileset>
        <fileset dir="${pdir}/lib">
          <include name="OpenDS.jar" />
        </fileset>
      </classpath>
    </javac>
    <copy todir="${quicksetup.classes.dir}">
        <fileset dir="${quicksetup.src.dir}"
      <fileset dir="${quicksetup.src.dir}"
            includes="**/*.properties, **/*.gif, **/*.png"/>
    </copy>
@@ -584,22 +596,25 @@
        debug="on" debuglevel="lines,source" source="1.5" target="1.5"
        deprecation="true" fork="true" memoryInitialSize="${MEM}"
        memoryMaximumSize="${MEM}">
        <compilerarg value="-Xlint:all" />
        <classpath>
            <fileset dir="${pdir}/lib">
                <include name="OpenDS.jar" />
            </fileset>
        </classpath>
      <compilerarg value="-Xlint:all" />
      <classpath>
        <fileset dir="${pdir}/lib">
          <include name="OpenDS.jar" />
        </fileset>
      </classpath>
    </javac>
    <copy todir="${statuspanel.classes.dir}">
        <fileset dir="${statuspanel.src.dir}"
      <fileset dir="${statuspanel.src.dir}"
            includes="**/*.properties, **/*.gif, **/*.png"/>
    </copy>
   <!-- Generate the statuspanel.jar file -->
   <jar jarfile="${pdir}/lib/statuspanel.jar"
    <!-- Generate the statuspanel.jar file -->
    <jar jarfile="${pdir}/lib/statuspanel.jar"
        basedir="${statuspanel.classes.dir}" compress="true" index="true" />
    <!-- Regenerate example plugin. -->
    <antcall target="example-plugin" />
  </target>
@@ -617,7 +632,7 @@
    <mkdir dir="${pdir}"                 />
    <mkdir dir="${pdir}/bak"             />
    <mkdir dir="${pdir}/bat"             />
   <mkdir dir="${pdir}/bin"             />
    <mkdir dir="${pdir}/bin"             />
    <mkdir dir="${pdir}/classes"         />
    <mkdir dir="${pdir}/config"          />
    <mkdir dir="${pdir}/config/upgrade"  />
@@ -629,6 +644,7 @@
    <mkdir dir="${pdir}/ldif"            />
    <mkdir dir="${pdir}/legal-notices"   />
    <mkdir dir="${pdir}/lib"             />
    <mkdir dir="${pdir}/lib/extensions"  />
    <mkdir dir="${pdir}/locks"           />
    <mkdir dir="${pdir}/logs"            />
@@ -644,18 +660,18 @@
    <copy todir="${pdir}/lib">
      <fileset file="${lib.dir}/*.jar" />
    </copy>
   <copy todir="${pdir}/lib">
     <fileset file="${lib.dir}/*.exe" />
   </copy>
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bin" excludes="*.bat"
         eol="lf" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bin" includes="*.bat,README_WINDOWS.txt"
         eol="crlf" />
    <copy todir="${pdir}/lib">
      <fileset file="${lib.dir}/*.exe" />
    </copy>
    <antcall target="example-plugin" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bin" excludes="*.bat" eol="lf" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bin" includes="*.bat,README_WINDOWS.txt" eol="crlf" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bat" includes="*.bat"
         eol="crlf" />
    <copy todir="${pdir}/config">
      <fileset file="${config.dir}/*" />
    </copy>
@@ -808,7 +824,7 @@
  <!-- Generate JavaDoc documentation from the source files -->
  <target name="javadoc" depends="dsml"
  <target name="javadoc" depends="dsml,compileadmin"
       description="Generate JavaDoc documentation.">
    <mkdir dir="${javadoc.dir}" />
@@ -830,6 +846,7 @@
      </classpath>
      <packageset dir="${src.dir}" />
      <packageset dir="${admin.src.dir}" />
      <packageset dir="${dsml.src.dir}" />
    </javadoc>
  </target>
@@ -946,14 +963,14 @@
    <antcall target="testinit.checkFailedTestsOnly"/>
  </target>
 <!-- If we were asked to run only the tests that failed,
  <!-- If we were asked to run only the tests that failed,
      then we overwrite the testng.xml that we just generated
      with testng-failed.xml, which TestNG generated. -->
  <target name="testinit.checkFailedTestsOnly" if="test.failures">
    <!-- Ensure that some of the tests failed last time. -->
    <available property="testng-failed.xml.exists"
    <available property="testng-failed.xml.exists"
               file="${unittest.report.dir}/testng-failed.xml"/>
    <fail message="No unit tests failed in the previous run."
    <fail message="No unit tests failed in the previous run."
          unless="testng-failed.xml.exists"/>
    <!-- We replace the 'Failed suite [OpenDS]' with 'OpenDS' so we
@@ -968,7 +985,7 @@
    <copy file="${unittest.report.dir}/testng-failed.xml"
          tofile="${unittest.resource.dir}/testng.xml"
          overwrite="true"/>
    <echo message="Will run the failed unit tests only"/>
  </target>
@@ -1110,7 +1127,7 @@
    <antcall target="testhelp"/>
    <mkdir dir="${unittest.report.dir}" />
    <taskdef resource="testngtasks">
      <classpath>
        <fileset dir="${testng.lib.dir}">
@@ -1149,7 +1166,7 @@
      <fileset dir="${unittest.report.dir}" includes="*"/>
    </delete>
    <!-- Our testng listener will remove this file if all of the
    <!-- Our testng listener will remove this file if all of the
         tests passed.  This allows us to generate the coverage
         report even if the tests failed and still fail the build. -->
    <touch file="${unittest.report.dir}/.tests-failed-marker"/>
@@ -1190,7 +1207,7 @@
    <!-- Our testng listener will create this file if any of the
         tests failed.  This allows us to generate the coverage
         report even if the tests failed. -->
    <available property="testng.tests.failed"
    <available property="testng.tests.failed"
               file="${unittest.report.dir}/.tests-failed-marker"/>
    <!-- Delete all of the report suite sub-directories since we only
@@ -1200,8 +1217,8 @@
    <emma enabled="${coverage.enabled}" >
      <report sourcepath="${src.dir}" >
        <fileset dir="${coverage.data.dir}" >
           <include name="unit.emma"     />
           <include name="metadata.emma" />
          <include name="unit.emma"     />
          <include name="metadata.emma" />
        </fileset>
        <txt  outfile="${coverage.report.dir}/coverage.txt" />
@@ -1279,13 +1296,13 @@
  </target>
    <target name="integration-tests"
  <target name="integration-tests"
            description="Builds the integration tests"
            >
        <ant dir="${functest.testng.dir}" inheritall="false"/>
    </target>
    <ant dir="${functest.testng.dir}" inheritall="false"/>
  </target>
  <target name="buildtools"
        description="Builds the build tools">
@@ -1324,5 +1341,106 @@
    <jar jarfile="${build.dir}/build-tools/build-tools.jar"
         basedir="${buildtools.classes.dir}" compress="true" index="true" />
  </target>
  <!-- Code generation for core administration components. -->
  <target name="compileadmin" depends="validateadmin" description="Code generation for configuration Object.">
    <!-- Generate introspection API for core administration components. -->
    <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/*Configuration.xml" style="${admin.rules.dir}/metaMO.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.java" />
      <param name="base-dir" expression="${admin.defn.dir}" />
    </xslt>
    <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/Package.xml" style="${admin.rules.dir}/package-info.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)\.xml$$" to="\1/meta/package-info.java" />
      <param name="type" expression="meta" />
    </xslt>
    <!-- Generate client API for core administration components. -->
    <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/*Configuration.xml" style="${admin.rules.dir}/clientMO.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/client/\2CfgClient.java" />
      <param name="base-dir" expression="${admin.defn.dir}" />
    </xslt>
    <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/Package.xml" style="${admin.rules.dir}/package-info.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)\.xml$$" to="\1/client/package-info.java" />
      <param name="type" expression="client" />
    </xslt>
    <!-- Generate server API for core administration components. -->
    <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/*Configuration.xml" style="${admin.rules.dir}/serverMO.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/server/\2Cfg.java" />
      <param name="base-dir" expression="${admin.defn.dir}" />
    </xslt>
    <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/Package.xml" style="${admin.rules.dir}/package-info.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)\.xml$$" to="\1/server/package-info.java" />
      <param name="type" expression="server" />
    </xslt>
    <!-- Generate LDAP profile for core administration components. -->
    <mkdir dir="${classes.dir}" />
    <xslt basedir="${admin.defn.dir}" destdir="${classes.dir}/admin/profiles/ldap" includes="**/*Configuration.xml" style="${admin.rules.dir}/ldapMOProfile.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" />
      <param name="base-dir" expression="${admin.defn.dir}" />
    </xslt>
    <!-- Generate manifest file for core administration components. -->
    <tempfile property="admin.temp.dir" destDir="${build.dir}" prefix="tmp" />
    <mkdir dir="${admin.temp.dir}" />
    <xslt basedir="${admin.defn.dir}" destdir="${admin.temp.dir}" extension=".manifest" includes="**/*Configuration.xml" style="${admin.rules.dir}/manifestMO.xsl"/>
    <concat destfile="${classes.dir}/admin/core.manifest">
      <fileset dir="${admin.temp.dir}" includes="**/*.manifest" />
    </concat>
    <delete dir="${admin.temp.dir}" />
  </target>
  <!-- Remove all dynamically-generated build files. -->
  <target name="cleanadmin" description="Clean up any generated source files for admin">
    <delete includeemptydirs="true">
      <fileset dir="${admin.src.dir}" includes="**/*" />
    </delete>
  </target>
  <!-- Validate core administration component XML definition files. -->
  <target name="validateadmin" description="Validate core administration component XML definition files.">
    <schemavalidate>
      <fileset dir="${admin.defn.dir}" includes="**/*.xml" />
      <schema namespace="http://www.opends.org/admin" file="${admin.rules.dir}/admin.xsd"/>
      <schema namespace="http://www.opends.org/admin-ldap" file="${admin.rules.dir}/admin-ldap.xsd"/>
    </schemavalidate>
  </target>
  <!-- Generate example plugin package. -->
  <target name="example-plugin" if="pdir">
    <!-- Create folder hierarchy in temporary directory. -->
    <tempfile property="plugin.temp.dir" destDir="${build.dir}" prefix="tmp"/>
    <mkdir dir="${plugin.temp.dir}/example-plugin" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/src" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/src-generated" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/lib" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/ext" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/resource" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/resource/admin" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/resource/config" />
    <mkdir dir="${plugin.temp.dir}/example-plugin/resource/schema" />
    <copy todir="${plugin.temp.dir}/example-plugin/src">
      <fileset dir="${admin.defn.dir}" includes="**/*.xml" />
    </copy>
    <copy todir="${plugin.temp.dir}/example-plugin/resource/admin">
      <fileset dir="${admin.rules.dir}" excludes="example-plugin/**" />
    </copy>
    <copy todir="${plugin.temp.dir}/example-plugin" file="${admin.rules.dir}/example-plugin/build.xml" />
    <copy todir="${plugin.temp.dir}/example-plugin" file="${admin.rules.dir}/example-plugin/README" />
    <copy todir="${plugin.temp.dir}/example-plugin/resource/schema" file="${admin.rules.dir}/example-plugin/99-example-plugin.ldif" />
    <copy todir="${plugin.temp.dir}/example-plugin/resource/config" file="${admin.rules.dir}/example-plugin/example-plugin.ldif" />
    <copy todir="${plugin.temp.dir}/example-plugin/src/com/example/opends">
      <fileset dir="${admin.rules.dir}/example-plugin" includes="*.java,*.xml" excludes="build.xml" />
    </copy>
    <!-- Package up the plugin in the OpenDS package folder. -->
    <zip destfile="${pdir}/example-plugin.zip">
      <zipfileset dir="${plugin.temp.dir}" filemode="644" dirmode="755" />
    </zip>
    <delete dir="${plugin.temp.dir}" />
  </target>
</project>
opends/resource/admin/abbreviations.xsl
New file
@@ -0,0 +1,52 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    This XSLT file contains a list of acronyms and abbreviations which should
    be converted to upper-case when used in applications (e.g. as Java names).
  -->
  <!--
    Determines whether or not the provided word is a known abbreviation or
    acronym.
    @param value The word.
    @return Returns the string "true" if the word is an abbreviation.
  -->
  <xsl:template name="is-abbreviation">
    <xsl:param name="value" select="/.." />
    <xsl:value-of
      select="$value = 'aci' or $value = 'ip' or $value = 'ssl'
              or $value = 'dn' or $value = 'rdn' or $value = 'jmx'
              or $value = 'smtp' or $value = 'http'  or $value = 'https'
              or $value = 'ldap' or $value = 'ldaps' or $value = 'ldif'
              or $value = 'jdbc' or $value = 'tcp' or $value = 'tls'
              or $value = 'pkcs11' or $value = 'sasl' or $value = 'gssapi'
              or $value = 'md5' " />
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/admin-ldap.xsd
New file
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.opends.org/admin-ldap"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified"
  xmlns:tns="http://www.opends.org/admin-ldap">
  <xsd:annotation>
    <xsd:documentation>
      This schema defines the elements and attributes of the "ldap"
      profile. This profile specifies the relationship between managed
      objects and their representation in LDAP. For example, each
      managed object is associated with an LDAP object class and each
      property is associated with an LDAP attribute. Using this profile
      it should also be possible to generate the LDAP configuration
      schema.
    </xsd:documentation>
  </xsd:annotation>
  <xsd:simpleType name="oid-type">
    <xsd:annotation>
      <xsd:documentation>A numeric OID.</xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:token">
      <xsd:pattern value="([0-9]+(\.[0-9]+)*)|([a-zA-Z][a-zA-Z0-9\-_]*-oid)" />
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:simpleType name="name-type">
    <xsd:annotation>
      <xsd:documentation>
        A LDAP attribute type or object class name.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:token">
      <xsd:pattern value="[a-zA-Z][a-zA-Z0-9\-_]*" />
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:element name="object-class">
    <xsd:annotation>
      <xsd:documentation>
        Defines which LDAP object class a managed object should be
        mapped to.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="oid" type="tns:oid-type">
          <xsd:annotation>
            <xsd:documentation>
              The numeric OID of the LDAP object class.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="name" type="tns:name-type">
          <xsd:annotation>
            <xsd:documentation>
              The name of the LDAP object class.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="superior" type="tns:name-type">
          <xsd:annotation>
            <xsd:documentation>
              The name of the parent LDAP object class.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="attribute">
    <xsd:annotation>
      <xsd:documentation>
        Defines which LDAP attribute a managed object property should be
        mapped to.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="oid" type="tns:oid-type">
          <xsd:annotation>
            <xsd:documentation>
              The numeric OID of the LDAP attribute.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="name" type="tns:name-type">
          <xsd:annotation>
            <xsd:documentation>
              The name of the LDAP attribute.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="rdn-sequence" type="xsd:token">
    <xsd:annotation>
      <xsd:documentation>A sequence of RDNs.</xsd:documentation>
    </xsd:annotation>
  </xsd:element>
</xsd:schema>
opends/resource/admin/admin-preprocessor.xsd
New file
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.opends.org/admin-preprocessor"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:admin="http://www.opends.org/admin"
  elementFormDefault="qualified"
  xmlns:tns="http://www.opends.org/admin-preprocessor">
  <xsd:import namespace="http://www.opends.org/admin"
    schemaLocation="admin.xsd" />
  <xsd:annotation>
    <xsd:documentation>
      This schema defines the elements and attributes which are added to
      managed object definitions and property definitions in the
      "preprocessor" profile.
    </xsd:documentation>
    <xsd:documentation>
      Managed object definitions are annotated by listing the parent
      managed objects which the definition inherits from. This can be
      used to enforce a simple managed object naming scheme where
      sub-definitions use the uppermost definition's name as a suffix.
      For example, "ldap-connection-handler" is derived from
      "connection-handler", and therefore has the suffix
      "-connection-handler". Applications can take advantage of this
      naming schema to shorten sub-definition names where appropriate.
      For example, a CLI which supports creation of connection handlers,
      can use remove the suffix from "ldap-connection-handler" in order
      to derive a "type", in this case "ldap".
    </xsd:documentation>
    <xsd:documentation>
      Each property definition is annotated as follows: firstly a
      "managed-object" element is added defining the name and package of
      the managed object which defines the property (i.e. this will be a
      parent managed object for inherited properties). Secondly, if the
      property is referenced from a Property.xml file, an additional
      "package" element is appended identifying the referenced package.
    </xsd:documentation>
  </xsd:annotation>
  <xsd:element name="managed-object">
    <xsd:annotation>
      <xsd:documentation>
        Specifies the name and package of the managed object definition
        which defines a property definition.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:attribute name="name" type="admin:name-type"
        use="required">
        <xsd:annotation>
          <xsd:documentation>
            The name of the managed object.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
      <xsd:attribute name="package" type="admin:package-type"
        use="required">
        <xsd:annotation>
          <xsd:documentation>
            The name of the package containing the managed object.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="package">
    <xsd:annotation>
      <xsd:documentation>
        This optional element specifies, for referenced property
        definitions (i.e. those defined in a Package.xml file), the name
        of the package defining the definition.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:attribute name="name" type="admin:package-type"
        use="required">
        <xsd:annotation>
          <xsd:documentation>
            The name of the package.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="parent-managed-object">
    <xsd:annotation>
      <xsd:documentation>
        Specifies the name and package of a parent managed object
        definition. Elements are order such that the immediate parent is
        the first node in document order and the last element represents
        the uppermost definition in the inheritance hierarchy.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:attribute name="name" type="admin:name-type"
        use="required">
        <xsd:annotation>
          <xsd:documentation>
            The name of the parent managed object.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
      <xsd:attribute name="package" type="admin:package-type"
        use="required">
        <xsd:annotation>
          <xsd:documentation>
            The name of the package containing the parent managed
            object.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
opends/resource/admin/admin.xsd
New file
@@ -0,0 +1,1490 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.opends.org/admin"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified"
  xmlns:tns="http://www.opends.org/admin">
  <xsd:import namespace="http://www.opends.org/admin-ldap"
    schemaLocation="admin-ldap.xsd" />
  <xsd:import namespace="http://www.opends.org/admin-preprocessor"
    schemaLocation="admin-preprocessor.xsd" />
  <xsd:annotation>
    <xsd:documentation>
      This schema defines the XML schema elements and attributes which
      should be used to specify the server's configuration model.
      Broadly speaking, there are three main components to this schema:
      managed objects, properties, and relations. Using these components
      it is possible to model the server's configuration based on its
      configurable components (managed objects), their configurable
      attributes (properties), and their relationships with other
      configurable components (relations).
    </xsd:documentation>
  </xsd:annotation>
  <xsd:complexType name="managed-object-type">
    <xsd:annotation>
      <xsd:documentation>
        Defines the structure of a configurable component within the
        configuration. A managed object comprises of zero or more
        properties, and zero or more relations with other managed
        objects. A managed object can be abstract, indicating that it
        cannot be instantiated directly, and that it is intended as a
        base definition from which other child managed objects inherit
        their behavior. Conversely, a managed object can be derived from
        a parent managed object definition. In this case, the managed
        object will inherit the properties and relations defined by the
        parent. Multiple levels of inheritance are supported, but
        multiple inheritance is not.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="TODO" minOccurs="0" type="xsd:string"
        maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>
            An annotation specifying remaining work or unsolved problems
            relating to this managed object definition. Its use is
            primarily for development purposes and should not be
            processed by applications.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="synopsis" type="tns:rich-description-type">
        <xsd:annotation>
          <xsd:documentation>
            A brief description of this managed object. The description
            should describe, preferably in one sentence, the purpose of
            this managed object. The synopsis should be suitable for use
            in applications such as tool-tips, CLI help, and the summary
            description in Javadoc. It is possible to embed rich content
            including XHTML markup (this will only be used where
            supported).
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="description" minOccurs="0"
        type="tns:rich-description-type">
        <xsd:annotation>
          <xsd:documentation>
            A detailed description of this managed object. The
            description should describe in detail the purpose of this
            managed object. The description should be suitable for use
            in applications such as manual pages or detailed help. It
            does not need to repeat anything described in the synopsis
            as applications should normally display the two together. It
            is possible to embed rich content including XHTML markup
            (this will only be used where supported).
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="profile" type="tns:profile-type" minOccurs="0"
        maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>
            An annotation relating to this managed object. Annotations
            can define additional information which cannot be directly
            represented using this XML schema. The additional
            information can relate to specific applications such as LDAP
            (e.g. LDAP object classes), CLIs (e.g. sub-command name),
            GUIs (e.g. how properties should be arranged and grouped in
            a window).
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="relation" maxOccurs="unbounded" minOccurs="0"
        type="tns:relation-type">
        <xsd:annotation>
          <xsd:documentation>
            Specifies a composition relationship between this managed
            object and other "child" managed objects. The relationship
            can be a singleton relationship (i.e. one to one), an
            optional relationship (i.e. one to zero or one), or a one to
            many relationship.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:choice minOccurs="0" maxOccurs="unbounded">
        <xsd:element name="property" type="tns:property-type">
          <xsd:annotation>
            <xsd:documentation>
              Defines a configurable property of this managed object. A
              property's value or values affects the behavior of this
              managed object. Various different types of properties are
              supported, for example, strings, integers, etc. A property
              definition must not override a property defined elsewhere
              in this managed object or property inherited from a parent
              definition.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="property-reference"
          type="tns:property-reference-type">
          <xsd:annotation>
            <xsd:documentation>
              A reference to a common property definition defined in a
              package, which should be part of this managed object's
              definition.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="rich-description-type" mixed="true">
    <xsd:annotation>
      <xsd:documentation>
        An internationalized description string which can contain XHTML
        markup.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:choice minOccurs="0" maxOccurs="unbounded">
      <xsd:any namespace="http://www.w3.org/1999/xhtml"
        processContents="lax" />
      <xsd:element name="product-name">
        <xsd:annotation>
          <xsd:documentation>
            The name of the product associated with this definition.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
      <xsd:element name="user-friendly-name">
        <xsd:annotation>
          <xsd:documentation>
            The name of the managed object associated with this
            definition.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
      <xsd:element name="user-friendly-plural-name">
        <xsd:annotation>
          <xsd:documentation>
            The plural name of the managed object associated with this
            definition.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
    </xsd:choice>
  </xsd:complexType>
  <xsd:complexType name="description-type">
    <xsd:annotation>
      <xsd:documentation>
        An internationalized description string which cannot contain
        XHTML markup.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:simpleContent>
      <xsd:extension base="xsd:token" />
    </xsd:simpleContent>
  </xsd:complexType>
  <xsd:complexType name="property-type">
    <xsd:annotation>
      <xsd:documentation>
        Defines a configurable property of a managed object. A
        property's value or values affects the behavior of the
        associated managed object. Various different types of properties
        are supported, for example, strings, integers, etc. A property
        definition must not override a property defined elsewhere in the
        managed object or property inherited from a parent managed
        object.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="TODO" minOccurs="0" type="xsd:string"
        maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>
            An annotation specifying remaining work or unsolved problems
            relating to this property definition. Its use is primarily
            for development purposes and should not be processed by
            applications.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="synopsis" type="tns:rich-description-type">
        <xsd:annotation>
          <xsd:documentation>
            A brief description of this property. The description should
            describe, preferably in one sentence, the purpose of this
            property. It does not need to provide details regarding
            default behavior, syntax, nor how changes take effect (e.g.
            immediately, post-restart, etc). The synopsis should be
            suitable for use in applications such as tool-tips, CLI
            help, and the summary description in Javadoc. It is possible
            to embed rich content including XHTML markup (this will only
            be used where supported).
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="description" minOccurs="0"
        type="tns:rich-description-type">
        <xsd:annotation>
          <xsd:documentation>
            A detailed description of this property. The description
            should describe in detail the purpose of this property. The
            description should be suitable for use in applications such
            as manual pages or detailed help. It does not need to repeat
            anything described in the synopsis as applications should
            normally display the two together. In addition, it does not
            need to provide details regarding default behavior, syntax,
            nor how changes take effect (e.g. immediately, post-restart,
            etc). It is possible to embed rich content including XHTML
            markup (this will only be used where supported).
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="requires-admin-action"
        type="tns:admin-action-type" minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>
            Defines an optional action which administators must perform
            after they have modified this property. By default
            modifications to properties are assumed to take effect
            immediately and require no additional administrative action.
            Developers should be aware that, where feasible, they should
            implement components such that property modifications
            require no additional administrative action. This is
            required in order to minimize server downtime during
            administration and provide a more user-friendly experience.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="default-behavior" type="tns:default-type"
        minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>
            Defines a default behavior for the property when it has no
            values specified. All properties must have a default
            behavior defined unless they are mandatory.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="syntax" type="tns:syntax-type">
        <xsd:annotation>
          <xsd:documentation>
            Defines the syntax of this property. This includes the data
            type used for the property and additional constraints (e.g.
            upper/lower bounds).
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="profile" type="tns:profile-type" minOccurs="0"
        maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>
            An annotation relating to this property. Annotations can
            define additional information which cannot be directly
            represented using this XML schema. The additional
            information can relate to specific applications such as LDAP
            (e.g. LDAP attributes), CLIs (e.g. operand name), GUIs (e.g.
            how properties should be arranged and grouped in a window).
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute name="name" type="tns:name-type" use="required">
      <xsd:annotation>
        <xsd:documentation>
          The name of this property. The name should describe as
          concisely as possible the purpose of this property and should
          be suitable for use in Java method names (e.g. getters and
          setters). The property name should be a string comprising of
          short lower-case words joined with hyphens "-". For example,
          "use-ssl".
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="multi-valued" type="xsd:boolean" use="optional"
      default="false">
      <xsd:annotation>
        <xsd:documentation>
          Indicates whether or not this property is multi-valued. By
          default, properties are single-valued.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="read-only" type="xsd:boolean" use="optional"
      default="false">
      <xsd:annotation>
        <xsd:documentation>
          Indicates whether or not this property is read-only. By
          default, properties are modifiable. Read-only monitoring
          information is a good use-case for read-only properties.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="mandatory" type="xsd:boolean" use="optional"
      default="false">
      <xsd:annotation>
        <xsd:documentation>
          Indicates whether or not this property is mandatory. Mandatory
          properties are those properties which have no sensible default
          behavior and must, therefore, be specified by administrators.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="hidden" type="xsd:boolean" use="optional"
      default="false">
      <xsd:annotation>
        <xsd:documentation>
          Indicates whether or not this property should be hidden from
          client applications. Hidden properties should rarely be used
          but are sometimes required in order to provide functionality
          that needs to be exposed in management APIs but not in
          front-ends such as CLIs.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>
  <xsd:complexType name="property-reference-type">
    <xsd:annotation>
      <xsd:documentation>
        A reference to a common property definition defined in a
        package, which should be part of a managed object's definition.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="requires-admin-action"
        type="tns:admin-action-type" minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>
            Optionally override the administrative action defined in the
            referenced property definition. An administrative action
            defines an optional action which administators must perform
            after they have modified this property. By default
            modifications to properties are assumed to take effect
            immediately and require no additional administrative action.
            Developers should be aware that, where feasible, they should
            implement components such that property modifications
            require no additional administrative action. This is
            required in order to minimize server downtime during
            administration and provide a more user-friendly experience.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="default-behavior" type="tns:default-type"
        minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>
            Optionally override the default behavior defined in the
            referenced property definition. The default behavior is
            applicable when the property has no values specified. All
            properties must have a default behavior defined unless they
            are mandatory.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute name="name" type="tns:name-type" use="required">
      <xsd:annotation>
        <xsd:documentation>
          The name of the referenced property.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="package" type="tns:package-type">
      <xsd:annotation>
        <xsd:documentation>
          The package containing the referenced property. By default,
          the package in which this managed object is defined will be
          used.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>
  <xsd:complexType name="relation-type">
    <xsd:annotation>
      <xsd:documentation>
        Specifies a relationship between a managed object and other
        managed objects. The relationship can be a singleton
        relationship (i.e. one to one), an optional relationship (i.e.
        one to zero or one), or a one to many relationship. Both
        compositions (the default) and aggregations are supported.
        Aggregations are defined by specifying the path to the
        referenced managed objects in the aggregation attribute.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="TODO" minOccurs="0" type="xsd:string"
        maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>
            An annotation specifying remaining work or unsolved problems
            relating to this relation definition. Its use is primarily
            for development purposes and should not be processed by
            applications.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="synopsis" type="tns:rich-description-type"
        minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>
            An optional brief description of this relation. The
            description should describe, preferably in one sentence, the
            purpose of this relation. If a synopsis is not defined this
            relation will inherit the synopsis of the referenced managed
            object. If present, the synopsis should be suitable for use
            in applications such as tool-tips, CLI help, and the summary
            description in Javadoc. It is possible to embed rich content
            including XHTML markup (this will only be used where
            supported).
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="description" minOccurs="0"
        type="tns:rich-description-type">
        <xsd:annotation>
          <xsd:documentation>
            An optional detailed description of this relation. The
            description should describe in detail the purpose of this
            relation. The description should be suitable for use in
            applications such as manual pages or detailed help. It does
            not need to repeat anything described in the synopsis as
            applications should normally display the two together. If a
            description is not defined this relation will inherit the
            description of the referenced managed object. It is possible
            to embed rich content including XHTML markup (this will only
            be used where supported).
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:choice>
        <xsd:element name="one-to-one">
          <xsd:annotation>
            <xsd:documentation>
              Specifies a one to one (singleton) relationship with
              another type of managed object.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType />
        </xsd:element>
        <xsd:element name="one-to-zero-or-one">
          <xsd:annotation>
            <xsd:documentation>
              Specifies a one to zero or one (optional) relationship
              with another type of managed object.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType />
        </xsd:element>
        <xsd:element name="one-to-many">
          <xsd:annotation>
            <xsd:documentation>
              Specifies a one to many (instantiable) relationship with
              another type of managed object.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:attribute name="plural-name" type="tns:name-type"
              use="optional">
              <xsd:annotation>
                <xsd:documentation>
                  Specifies the plural name of this relation if
                  different from the plural name of the referenced
                  managed object type.
                </xsd:documentation>
              </xsd:annotation>
            </xsd:attribute>
          </xsd:complexType>
        </xsd:element>
      </xsd:choice>
      <xsd:sequence>
        <xsd:element name="profile" type="tns:profile-type"
          minOccurs="0" maxOccurs="unbounded">
          <xsd:annotation>
            <xsd:documentation>
              An annotation relating to this relation. Annotations can
              define additional information which cannot be directly
              represented using this XML schema. The additional
              information can relate to specific applications such as
              LDAP (e.g. an LDAP RDN representing the entry beneath
              which managed objects should be located).
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
      </xsd:sequence>
    </xsd:sequence>
    <xsd:attribute name="name" type="tns:name-type" use="required">
      <xsd:annotation>
        <xsd:documentation>
          The name of this relation. The name should describe as
          concisely as possible the purpose of this relation and should
          be suitable for use in Java method names (e.g. getters and
          setters). The property name should be a string comprising of
          short lower-case words joined with hyphens "-". For example,
          "key-manager-provider". Usually the name will correspond to
          the name of the referenced type of managed object. If it this
          is not the case, then the type of referenced managed object
          should be specified using the "managed-object-name" attribute.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="aggregation" type="tns:path-type"
      use="optional">
      <xsd:annotation>
        <xsd:documentation>
          For aggregation relations, the path locating the relation
          beneath which the referenced (aggregated) managed objects can
          be found. If this attribute is not specified, the relation is
          a composition by default.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="managed-object-name" type="tns:name-type"
      use="optional">
      <xsd:annotation>
        <xsd:documentation>
          The type of managed object referenced by this relation if
          different from this relation's name.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="managed-object-package" type="tns:package-type"
      use="optional">
      <xsd:annotation>
        <xsd:documentation>
          The package containing the referenced managed object
          definition if it is not the same as this managed object's
          package.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>
  <xsd:complexType name="admin-action-type">
    <xsd:annotation>
      <xsd:documentation>
        Defines an optional action which administators must perform
        after they have modified a property. By default modifications to
        properties are assumed to take effect immediately and require no
        additional administrative action. Developers should be aware
        that, where feasible, they should implement components such that
        property modifications require no additional administrative
        action. This is required in order to minimize server downtime
        during administration and provide a more user-friendly
        experience.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:choice>
      <xsd:element name="none">
        <xsd:annotation>
          <xsd:documentation>
            Used when no administrator action is required after
            modifications to a property.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
      <xsd:element name="server-restart">
        <xsd:annotation>
          <xsd:documentation>
            Used when modifications to a property require a server
            restart in order to take effect.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
      <xsd:element name="component-restart">
        <xsd:annotation>
          <xsd:documentation>
            Used when modifications to a property require a component
            restart in order to take effect (usually by disabling and
            re-enabling the component).
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
      <xsd:element name="other">
        <xsd:annotation>
          <xsd:documentation>
            Used when modifications to a property require an additional
            administrative action in order to take effect. This should
            be used when neither a server restart nor a component
            restart are applicable.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="synopsis"
              type="tns:rich-description-type">
              <xsd:annotation>
                <xsd:documentation>
                  A brief description of this required administrative
                  action. The description should describe, preferably in
                  one sentence, what additional administrator action is
                  required when this property is modified. If present,
                  the synopsis should be suitable for use in
                  applications such as tool-tips, CLI help, and the
                  summary description in Javadoc. It is possible to
                  embed rich content including XHTML markup (this will
                  only be used where supported).
                </xsd:documentation>
              </xsd:annotation>
            </xsd:element>
            <xsd:element name="profile" type="tns:profile-type"
              minOccurs="0" maxOccurs="unbounded">
              <xsd:annotation>
                <xsd:documentation>
                  An annotation relating to this administrative action.
                  Annotations can define additional information which
                  cannot be directly represented using this XML schema.
                  The additional information can relate to specific
                  applications.
                </xsd:documentation>
              </xsd:annotation>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:choice>
  </xsd:complexType>
  <xsd:complexType name="default-type">
    <xsd:annotation>
      <xsd:documentation>
        Defines a default behavior for a property when it has no values
        specified. All properties must have a default behavior defined
        unless they are mandatory.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:choice>
      <xsd:element name="undefined">
        <xsd:annotation>
          <xsd:documentation>
            Used when a property has no tangible default behavior - its
            default behavior is undefined.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
      <xsd:element name="alias">
        <xsd:annotation>
          <xsd:documentation>
            Used when a property defaults to some special behavior that
            cannot be represented using property values.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="synopsis"
              type="tns:rich-description-type">
              <xsd:annotation>
                <xsd:documentation>
                  A brief description of this default behavior. The
                  description should describe, preferably in one
                  sentence, the default behavior. If present, the
                  synopsis should be suitable for use in applications
                  such as tool-tips, CLI help, and the summary
                  description in Javadoc. It is possible to embed rich
                  content including XHTML markup (this will only be used
                  where supported).
                </xsd:documentation>
              </xsd:annotation>
            </xsd:element>
            <xsd:element name="profile" type="tns:profile-type"
              minOccurs="0" maxOccurs="unbounded">
              <xsd:annotation>
                <xsd:documentation>
                  An annotation relating to this default behavior.
                  Annotations can define additional information which
                  cannot be directly represented using this XML schema.
                  The additional information can relate to specific
                  applications.
                </xsd:documentation>
              </xsd:annotation>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="defined">
        <xsd:annotation>
          <xsd:documentation>
            Used when a property defaults to one or more real values of
            the property.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="value" minOccurs="1"
              maxOccurs="unbounded" type="xsd:string">
              <xsd:annotation>
                <xsd:documentation>
                  The string representation of a value of this property.
                </xsd:documentation>
              </xsd:annotation>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="inherited">
        <xsd:annotation>
          <xsd:documentation>
            Used when a property defaults one or more values taken from
            a property in another managed object.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
          <xsd:choice>
            <xsd:element name="relative">
              <xsd:annotation>
                <xsd:documentation>
                  Used when the managed object providing the default
                  values is located relative to this managed object.
                </xsd:documentation>
              </xsd:annotation>
              <xsd:complexType>
                <xsd:attribute name="offset" use="required">
                  <xsd:annotation>
                    <xsd:documentation>
                      The relative location of the managed object (where
                      0 is this managed object, 1 is the parent, and 2
                      is the grand-parent).
                    </xsd:documentation>
                  </xsd:annotation>
                  <xsd:simpleType>
                    <xsd:restriction base="xsd:integer">
                      <xsd:minInclusive value="0" />
                    </xsd:restriction>
                  </xsd:simpleType>
                </xsd:attribute>
                <xsd:attribute name="property-name" type="tns:name-type"
                  use="required">
                  <xsd:annotation>
                    <xsd:documentation>
                      The name of the property containing the default
                      values.
                    </xsd:documentation>
                  </xsd:annotation>
                </xsd:attribute>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="absolute">
              <xsd:annotation>
                <xsd:documentation>
                  Used when the managed object providing the default
                  values is in a known absolute location.
                </xsd:documentation>
              </xsd:annotation>
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="path">
                    <xsd:annotation>
                      <xsd:documentation>
                        TODO: not sure what form this will take.
                      </xsd:documentation>
                    </xsd:annotation>
                    <xsd:complexType />
                  </xsd:element>
                </xsd:sequence>
                <xsd:attribute name="property-name" type="tns:name-type"
                  use="required">
                  <xsd:annotation>
                    <xsd:documentation>
                      The name of the property containing the default
                      values.
                    </xsd:documentation>
                  </xsd:annotation>
                </xsd:attribute>
              </xsd:complexType>
            </xsd:element>
          </xsd:choice>
        </xsd:complexType>
      </xsd:element>
    </xsd:choice>
  </xsd:complexType>
  <xsd:complexType name="syntax-type">
    <xsd:annotation>
      <xsd:documentation>
        Defines the syntax of a property. This includes the data type
        used for the property and additional constraints on the values
        it contains (e.g. upper/lower bounds).
      </xsd:documentation>
    </xsd:annotation>
    <xsd:choice>
      <xsd:element name="attribute-type">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which contain LDAP attribute type names.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
      <xsd:element name="boolean">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which are best represented using boolean
            on/off type values.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
      <xsd:element name="dn">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which contain LDAP distinguished names.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="base" minOccurs="0" type="xsd:string">
              <xsd:annotation>
                <xsd:documentation>
                  Indicates that values of this property must be
                  immediately subordinate to the specified base DN.
                </xsd:documentation>
              </xsd:annotation>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="oid">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which contain LDAP object identifiers
            (e.g. attribute names, object classes, controls, etc).
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
      <xsd:element name="java-class">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which reference a Java class. These are
            typically used in plugins where the java class property
            identifies a class implementing the plugin's functionality.
            It is possible to restrict the values of this property using
            the instance-of attribute. Note that it is only possible to
            validate values on the server, since client applications
            don't necessarily have the same classes on their class-path.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="instance-of" minOccurs="0"
              maxOccurs="unbounded">
              <xsd:annotation>
                <xsd:documentation>
                  Indicates that values of this property must implement
                  the specified Java interface. Note that it is only
                  possible to perform validation on the server, since
                  client applications don't necessarily have the same
                  classes on their class-path.
                </xsd:documentation>
              </xsd:annotation>
              <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                  <xsd:whiteSpace value="collapse" />
                  <xsd:pattern
                    value="([A-Za-z][A-Za-z0-9_]*\.)*[A-Za-z][A-Za-z0-9_]*" />
                </xsd:restriction>
              </xsd:simpleType>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="integer">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which contain integer values. Where
            appropriate it is possible to provide a description of the
            units for values of this property (e.g. "number of
            threads").
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="unit-synopsis" minOccurs="0"
              type="tns:rich-description-type">
              <xsd:annotation>
                <xsd:documentation>
                  An optional description of the units for this value of
                  this property (e.g. "number of threads"). The
                  description should describe the unit, preferably in
                  one sentence. If present, the description should be
                  suitable for use in applications such as tool-tips,
                  CLI help, and the summary description in Javadoc. It
                  is possible to embed rich content including XHTML
                  markup (this will only be used where supported).
                </xsd:documentation>
              </xsd:annotation>
            </xsd:element>
          </xsd:sequence>
          <xsd:attribute name="allow-unlimited" type="xsd:boolean"
            use="optional" default="true">
            <xsd:annotation>
              <xsd:documentation>
                Indicates whether or not this property supports a
                special value representing infinity. This is useful
                where properties are used to constrain some behavior and
                the administrator wishes to remove the constraint (e.g.
                number of simultaneous client connections).
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
          <xsd:attribute name="lower-limit" type="xsd:integer"
            use="optional" default="0">
            <xsd:annotation>
              <xsd:documentation>
                Indicates a lower limit for this integer property.
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
          <xsd:attribute name="upper-limit" type="xsd:integer"
            use="optional">
            <xsd:annotation>
              <xsd:documentation>
                Indicates an upper limit for this integer property.
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="ip-address">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which contain IP addresses. IPv4 and
            IPv6 address forms are supported. In addition name
            resolution is performed when non-numeric addresses are
            specified.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
      <xsd:element name="ip-address-mask">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which contain IP address masks. IPv4 and
            IPv6 address mask forms are supported.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
      <xsd:element name="size">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which represent a computer storage size.
            Sizes can be specified using both decimal and binary units.
            For example, "1kb" represents 1000 bytes, and "1kib"
            represents 1024 bytes. Values must always specify the unit
            and can included a fractionaly part (e.g. 1.5mb). Both short
            and long unit names are supported (e.g. "kb" and
            "kilobytes").
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
          <xsd:attribute name="allow-unlimited" type="xsd:boolean"
            use="optional" default="false">
            <xsd:annotation>
              <xsd:documentation>
                Indicates whether or not this property supports a
                special value representing infinity. This is useful
                where properties are used to constrain some behavior and
                the administrator wishes to remove the constraint (e.g.
                maximum log size).
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
          <xsd:attribute name="lower-limit" type="xsd:string"
            use="optional" default="0">
            <xsd:annotation>
              <xsd:documentation>
                Indicates a lower limit for this size property.
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
          <xsd:attribute name="upper-limit" type="xsd:string"
            use="optional">
            <xsd:annotation>
              <xsd:documentation>
                Indicates an upper limit for this size property.
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="duration">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which contain a time duration.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
          <xsd:attribute name="base-unit" use="optional" default="s">
            <xsd:annotation>
              <xsd:documentation>
                Specifies the minimum granularity which can be used to
                specify duration property values. For example, if the
                base unit is in seconds then values represented in
                milliseconds will not be permitted. The default base
                unit is seconds.
              </xsd:documentation>
            </xsd:annotation>
            <xsd:simpleType>
              <xsd:restriction base="xsd:string">
                <xsd:enumeration value="ms" />
                <xsd:enumeration value="s" />
                <xsd:enumeration value="m" />
                <xsd:enumeration value="h" />
                <xsd:enumeration value="d" />
                <xsd:enumeration value="w" />
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:attribute>
          <xsd:attribute name="maximum-unit" use="optional">
            <xsd:annotation>
              <xsd:documentation>
                Specifies the biggest duration unit which can be used to
                specify duration property values. Values presented in
                units greater than this unit will not be permitted.
                There is no default maximum unit.
              </xsd:documentation>
            </xsd:annotation>
            <xsd:simpleType>
              <xsd:restriction base="xsd:string">
                <xsd:enumeration value="ms" />
                <xsd:enumeration value="s" />
                <xsd:enumeration value="m" />
                <xsd:enumeration value="h" />
                <xsd:enumeration value="d" />
                <xsd:enumeration value="w" />
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:attribute>
          <xsd:attribute name="allow-unlimited" type="xsd:boolean"
            use="optional" default="false">
            <xsd:annotation>
              <xsd:documentation>
                Indicates whether or not this property supports a
                special value representing infinity. This is useful
                where properties are used to constrain some behavior and
                the administrator wishes to remove the constraint (e.g.
                connection time-out).
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
          <xsd:attribute name="lower-limit" type="xsd:string"
            use="optional" default="0">
            <xsd:annotation>
              <xsd:documentation>
                Indicates a lower limit for this duration property.
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
          <xsd:attribute name="upper-limit" type="xsd:string"
            use="optional">
            <xsd:annotation>
              <xsd:documentation>
                Indicates an upper limit for this duration property.
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="password">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which contain passwords. Values will be
            represented using strings which are then encrypted.
            Typically password properties are write-only and should
            never be displayed in client applications (even during
            creation).
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType />
      </xsd:element>
      <xsd:element name="enumeration">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which contain values taken from a finite
            set of values. There must be at least one possible value
            defined.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="value" minOccurs="1"
              maxOccurs="unbounded">
              <xsd:annotation>
                <xsd:documentation>
                  Defines one of the possible values that this property
                  can contain.
                </xsd:documentation>
              </xsd:annotation>
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="synopsis"
                    type="tns:rich-description-type">
                    <xsd:annotation>
                      <xsd:documentation>
                        A description of this enumeration value. The
                        description should describe the behavior
                        indicated by the value preferably in one
                        sentence. The description should be suitable for
                        use in applications such as tool-tips, CLI help,
                        and the summary description in Javadoc. It is
                        possible to embed rich content including XHTML
                        markup (this will only be used where supported).
                      </xsd:documentation>
                    </xsd:annotation>
                  </xsd:element>
                </xsd:sequence>
                <xsd:attribute name="name" use="required"
                  type="tns:name-type">
                  <xsd:annotation>
                    <xsd:documentation>
                      The name of this enumeration value. The name
                      should describe as concisely as possible the
                      behavior indicated by this value and should be
                      suitable for use in Java source code (e.g.
                      enumerations). The enumeration value name should
                      be a string comprising of short lower-case words
                      joined with hyphens "-". For example, "optional".
                    </xsd:documentation>
                  </xsd:annotation>
                </xsd:attribute>
              </xsd:complexType>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="string">
        <xsd:annotation>
          <xsd:documentation>
            Used for properties which contain string values. It is
            possible to contrain the permitted set of values using a
            regular expression.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="pattern" minOccurs="0">
              <xsd:annotation>
                <xsd:documentation>
                  Constrains the permitted set of values using a regular
                  expression. All values of this property must match the
                  provided regular expression.
                </xsd:documentation>
              </xsd:annotation>
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="regex" type="xsd:string">
                    <xsd:annotation>
                      <xsd:documentation>
                        The regular expression conforming to the syntax
                        supported by the Java "java.util.regex.Pattern"
                        class.
                      </xsd:documentation>
                    </xsd:annotation>
                  </xsd:element>
                  <xsd:element name="synopsis"
                    type="tns:rich-description-type">
                    <xsd:annotation>
                      <xsd:documentation>
                        An description of the regular expression (e.g.
                        "email address"). The description should
                        describe the type of string represented by the
                        regular expression, preferably in one sentence.
                        If present, the description should be suitable
                        for use in applications such as tool-tips, CLI
                        help, and the summary description in Javadoc. It
                        is possible to embed rich content including
                        XHTML markup (this will only be used where
                        supported).
                      </xsd:documentation>
                    </xsd:annotation>
                  </xsd:element>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:choice>
  </xsd:complexType>
  <xsd:simpleType name="name-type">
    <xsd:annotation>
      <xsd:documentation>
        An identifier name comprising of a 1 or more sequences of lower
        case letters or digits separated by a single hyphen '-'. The
        first sequence must begin with a letter.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:token">
      <xsd:pattern value="[a-z][a-z0-9]*(-[a-z0-9]+)*" />
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:simpleType name="package-type">
    <xsd:annotation>
      <xsd:documentation>
        An identifier name comprising of a 1 or more sequences of lower
        case letters or digits separated by a single dot '.'. The first
        sequence must begin with a letter.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:token">
      <xsd:pattern value="[a-z][a-z0-9]*(\.[a-z0-9]+)*" />
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:simpleType name="path-type">
    <xsd:annotation>
      <xsd:documentation>
        A managed object path which can be used to specify the location
        of refererenced managed objects. A managed object path has a
        similar syntax to unix file system paths, and comprises of zero
        or more path elements separated by a forward slash "/". The root
        configuration is referenced using the path "/". Subsequent path
        elements name either a relation or its subordinate named managed
        object (for one-to-many relations). For example, the path
        "/connection-handlers/LDAP connection handler" references the
        LDAP connection handler managed object referenced by the root
        configuration's connection-handlers relation.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="/([^/]+(/[^/]+)*)?"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:complexType name="profile-type">
    <xsd:annotation>
      <xsd:documentation>
        An annotation relating to the associated element. Annotations
        can define additional information which cannot be directly
        represented using this XML schema. The additional information
        can relate to specific applications such as CLIs, GUIs, etc.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:any processContents="strict" maxOccurs="unbounded" />
    </xsd:sequence>
    <xsd:attribute name="name" type="tns:name-type" use="required">
      <xsd:annotation>
        <xsd:documentation>
          The name of this profile e.g. "ldap".
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>
  <xsd:element name="root-managed-object">
    <xsd:annotation>
      <xsd:documentation>
        Defines the root managed object and its relationships with
        top-level managed objects. The root managed object serves as a
        single point of access to the rest of the configuration. It is
        essentially a virtual managed object and has no properties of
        its own, just relationships. There can only be a single root
        managed object defined per configuration model.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:complexContent>
        <xsd:extension base="tns:managed-object-type">
          <xsd:sequence>
            <xsd:element name="product-name">
              <xsd:annotation>
                <xsd:documentation>
                  The name of the product associated with this
                  configuration model.
                </xsd:documentation>
              </xsd:annotation>
              <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                  <xsd:whiteSpace value="collapse" />
                </xsd:restriction>
              </xsd:simpleType>
            </xsd:element>
          </xsd:sequence>
          <xsd:attribute name="name" type="tns:name-type"
            fixed="root">
            <xsd:annotation>
              <xsd:documentation>
                The name of this root managed object, which is always
                "root".
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
          <xsd:attribute name="package" type="tns:package-type"
            fixed="org.opends.server.admin.std">
            <xsd:annotation>
              <xsd:documentation>
                The package containing this root managed object, which
                is always "org.opends.server.admin.std".
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
        </xsd:extension>
      </xsd:complexContent>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="managed-object">
    <xsd:annotation>
      <xsd:documentation>
        Defines the structure of a configurable component within the
        configuration. A managed object comprises of zero or more
        properties, and zero or more relations with other managed
        objects. A managed object can be abstract, indicating that it
        cannot be instantiated directly, and that it is intended as a
        base definition from which other child managed objects inherit
        their behavior. Conversely, a managed object can be derived from
        a parent managed object definition. In this case, the managed
        object will inherit the properties and relations defined by the
        parent. Multiple levels of inheritance are supported, but
        multiple inheritance is not.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:complexContent>
        <xsd:extension base="tns:managed-object-type">
          <xsd:attribute name="name" type="tns:name-type"
            use="required">
            <xsd:annotation>
              <xsd:documentation>
                The name of this managed object. The name should
                describe as concisely as possible the role of this
                managed object and should be suitable for use in Java
                method names (e.g. class names). The managed object name
                should be a string comprising of short lower-case words
                joined with hyphens "-". For example,
                "ldap-connection-handler". NOTE: a managed object name
                must end in the name of the definition's uppermost
                super-type. For example, "ldap-connection-handler" is a
                sub-type of "connection-handler" and therefore ends in
                "-connection-handler".
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
          <xsd:attribute name="plural-name" type="tns:name-type"
            use="required">
            <xsd:annotation>
              <xsd:documentation>
                The plural name of this managed object. The plural name
                should correspond to the singular name defined in the
                "name" attribute and it should be suitable for use in
                Java method names (e.g. getters). The managed object
                plural name should be a string comprising of short
                lower-case words joined with hyphens "-". For example,
                "ldap-connection-handlers".
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
          <xsd:attribute name="package" type="tns:package-type"
            use="required">
            <xsd:annotation>
              <xsd:documentation>
                The package containing this managed object.
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
          <xsd:attribute name="abstract" type="xsd:boolean"
            use="optional" default="false">
            <xsd:annotation>
              <xsd:documentation>
                Indicates whether or not this managed object is
                abstract. Abstract managed objects cannot be
                instantiated directly and are intended for use as base
                definitions for inheritance.
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
          <xsd:attribute name="extends" type="tns:name-type"
            use="optional">
            <xsd:annotation>
              <xsd:documentation>
                Indicates whether or not this managed object is inherits
                from a parent managed object and, if so, the name of the
                parent. If specified, this managed object will inherit
                all of the properties and relations defined in the
                parent managed object.
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
          <xsd:attribute name="parent-package" type="tns:package-type"
            use="optional">
            <xsd:annotation>
              <xsd:documentation>
                The package containing the parent managed object. By
                default, the package in which this managed object is
                defined will be used.
              </xsd:documentation>
            </xsd:annotation>
          </xsd:attribute>
        </xsd:extension>
      </xsd:complexContent>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="package">
    <xsd:annotation>
      <xsd:documentation>
        Defines a common information associated with all managed objects
        defined in the containing package. A package definition
        comprises of a description of the package together with common
        property definitions which can be referenced from within managed
        objects using "property-reference" elements. Sharing property
        definitions in this way makes maintenance easier in situations
        where the property definition needs modifying, since all
        referencing managed objects will automatically inherit the
        changes.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="TODO" minOccurs="0" type="xsd:string"
          maxOccurs="unbounded">
          <xsd:annotation>
            <xsd:documentation>
              An annotation specifying remaining work or unsolved
              problems relating to this package definition. Its use is
              primarily for development purposes and should not be
              processed by applications.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="synopsis" type="tns:rich-description-type">
          <xsd:annotation>
            <xsd:documentation>
              A brief description of this package. The description
              should describe, preferably in one sentence, the purpose
              of this package, for example, the type of managed objects
              it defines. The synopsis should be suitable for use in
              applications such as tool-tips, CLI help, and the summary
              description in Javadoc. It is possible to embed rich
              content including XHTML markup (this will only be used
              where supported).
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="description" minOccurs="0"
          type="tns:rich-description-type">
          <xsd:annotation>
            <xsd:documentation>
              A detailed description of this package. The description
              should describe in detail the purpose of this package. The
              description should be suitable for use in applications
              such as manual pages or detailed help. It does not need to
              repeat anything described in the synopsis as applications
              should normally display the two together. It is possible
              to embed rich content including XHTML markup (this will
              only be used where supported).
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="property" minOccurs="0" maxOccurs="unbounded"
          type="tns:property-type">
          <xsd:annotation>
            <xsd:documentation>
              Defines a common configurable property for this package.
              Managed objects can inherit this property definition by
              referencing it using a "property-reference" element.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
      </xsd:sequence>
      <xsd:attribute name="name" type="tns:package-type"
        use="required">
        <xsd:annotation>
          <xsd:documentation>
            The package containing this package definition.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
opends/resource/admin/clientMO.xsl
New file
@@ -0,0 +1,352 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:admpp="http://www.opends.org/admin-preprocessor"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:import href="java-utilities.xsl" />
  <xsl:import href="preprocessor.xsl" />
  <xsl:import href="property-types.xsl" />
  <xsl:output method="text" encoding="us-ascii" />
  <!--
    Template for generating the interface declaration.
  -->
  <xsl:template name="generate-interface-declaration">
    <xsl:value-of select="'/**&#xa;'" />
    <xsl:call-template name="add-java-comment">
      <xsl:with-param name="indent-text" select="' *'" />
      <xsl:with-param name="content"
        select="concat('A client-side interface for reading and modifying ',
                       $this-ufn, ' settings.')" />
    </xsl:call-template>
    <xsl:value-of select="' * &lt;p&gt;&#xa;'" />
    <xsl:call-template name="add-java-comment">
      <xsl:with-param name="indent-text" select="' *'" />
      <xsl:with-param name="content" select="$this/adm:synopsis" />
    </xsl:call-template>
    <xsl:value-of select="' */&#xa;'" />
    <xsl:value-of
      select="concat('public interface ',
                     $this-java-class,
                     'CfgClient extends ')" />
    <xsl:choose>
      <xsl:when test="boolean($this/@extends)">
        <xsl:value-of select="concat($parent-java-class,'CfgClient ')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'ConfigurationClient '" />
      </xsl:otherwise>
    </xsl:choose>
    <xsl:text>{&#xa;</xsl:text>
  </xsl:template>
  <!--
    Template for generating the configuration definition getter.
  -->
  <xsl:template name="generate-configuration-definition-getter">
    <xsl:value-of
      select="concat('  /**&#xa;',
                       '   * Get the configuration definition associated with this ', $this-ufn, '.&#xa;',
                       '   *&#xa;',
                       '   * @return Returns the configuration definition associated with this ', $this-ufn, '.&#xa;',
                       '   */&#xa;')" />
    <xsl:value-of
      select="concat('  ManagedObjectDefinition&lt;? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg&gt; definition();&#xa;')" />
  </xsl:template>
  <!--
    Template for generating the relation getter declarations.
  -->
  <xsl:template name="generate-relation-declarations">
    <xsl:variable name="name" select="@name" />
    <xsl:variable name="ufn">
      <xsl:call-template name="name-to-ufn">
        <xsl:with-param name="value" select="$name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="java-relation-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="$name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="java-class-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="@managed-object-name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="adm:one-to-one">
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Gets the ', $ufn,'.&#xa;',
                       '   *&#xa;',
                       '   * @return Returns the ', $ufn,'.&#xa;',
                       '   * @throws OperationsException&#xa;',
                       '   *           If the ', $ufn,' could not be read due to some&#xa;',
                       '   *           underlying communication problem.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  ', $java-class-name, 'CfgClient get',
                       $java-relation-name, '() throws OperationsException;&#xa;')" />
      </xsl:when>
      <xsl:when test="adm:one-to-zero-or-one">
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Determines whether or not the ', $ufn,' exists.&#xa;',
                       '   *&#xa;',
                       '   * @return Returns &lt;true&gt; if the ', $ufn,' exists.&#xa;',
                       '   * @throws OperationsException&#xa;',
                       '   *           If the determination could not be made&#xa;',
                       '   *           due to some underlying communication problem.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  boolean has',
                       $java-relation-name, '() throws OperationsException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Gets the ', $ufn,' if it is present.&#xa;',
                       '   *&#xa;',
                       '   * @return Returns the ', $ufn,' if it is present.&#xa;',
                       '   * @throws OperationsException&#xa;',
                       '   *           If the ', $ufn,' does not exist or could not be read&#xa;',
                       '   *           due to some underlying communication problem.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  ', $java-class-name, 'CfgClient get',
                       $java-relation-name, '() throws OperationsException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Creates the ', $ufn,' if it does not exist yet.&#xa;',
                       '   *&#xa;',
                       '   * @param &lt;C&gt;&#xa;',
                       '   *          The type of the ', $ufn,' being added.&#xa;',
                       '   * @param d&#xa;',
                       '   *          The definition of the ', $ufn,' to be created.&#xa;',
                       '   * @param p&#xa;',
                       '   *          A property provider which can be used to initialize&#xa;',
                       '   *          the property values of the new ', $ufn,'.&#xa;',
                       '   * @return Returns the ', $ufn,' instance representing the&#xa;',
                       '   *         ', $ufn,' that was created.&#xa;',
                       '   * @throws OperationsException&#xa;',
                       '   *           If the ', $ufn,' already exists or could not be created&#xa;',
                       '   *           due to some underlying communication problem.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  &lt;C extends ', $java-class-name,'CfgClient&gt; C create', $java-relation-name, '(&#xa;',
                           '      ManagedObjectDefinition&lt;C, ?&gt; d, PropertyProvider p) throws OperationsException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Removes the ', $ufn,' if it exists.&#xa;',
                       '   *&#xa;',
                       '   * @throws OperationsException&#xa;',
                       '   *           If the ', $ufn,' does not exist or could not be removed&#xa;',
                       '   *           due to some underlying communication problem.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  void remove',
                       $java-relation-name, '() throws OperationsException;&#xa;')" />
      </xsl:when>
      <xsl:when test="adm:one-to-many">
        <xsl:variable name="plural-name"
          select="adm:one-to-many/@plural-name" />
        <xsl:variable name="ufpn">
          <xsl:call-template name="name-to-ufn">
            <xsl:with-param name="value" select="$plural-name" />
          </xsl:call-template>
        </xsl:variable>
        <xsl:variable name="java-relation-plural-name">
          <xsl:call-template name="name-to-java">
            <xsl:with-param name="value" select="$plural-name" />
          </xsl:call-template>
        </xsl:variable>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Lists the ', $ufpn,'.&#xa;',
                       '   *&#xa;',
                       '   * @return Returns an array containing the names of the&#xa;',
                       '   *         ', $ufpn,'.&#xa;',
                       '   * @throws OperationsException&#xa;',
                       '   *           If the ', $ufpn,' could not be listed due to some&#xa;',
                       '   *           underlying communication problem.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  String[] list',
                       $java-relation-plural-name, '() throws OperationsException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Gets the named ', $ufn,'.&#xa;',
                       '   *&#xa;',
                       '   * @param name&#xa;',
                       '   *          The name of the ', $ufn,' to retrieve.&#xa;',
                       '   * @return Returns the named ', $ufn,'.&#xa;',
                       '   * @throws OperationsException&#xa;',
                       '   *           If the ', $ufn,' does not exist or could not be read&#xa;',
                       '   *           due to some underlying communication problem.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  ', $java-class-name, 'CfgClient get',
                       $java-relation-name, '(String name) throws OperationsException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Creates a new ', $ufn,'.&#xa;',
                       '   *&#xa;',
                       '   * @param &lt;C&gt;&#xa;',
                       '   *          The type of the ', $ufn,' being added.&#xa;',
                       '   * @param d&#xa;',
                       '   *          The definition of the ', $ufn,' to be created.&#xa;',
                       '   * @param name&#xa;',
                       '   *          The name of the new ', $ufn,'.&#xa;',
                       '   * @param p&#xa;',
                       '   *          A property provider which can be used to initialize&#xa;',
                       '   *          the property values of the new ', $ufn,'.&#xa;',
                       '   * @return Returns a new ', $ufn,' instance representing the&#xa;',
                       '   *         ', $ufn,' that was created.&#xa;',
                       '   * @throws OperationsException&#xa;',
                       '   *           If the ', $ufn,' already exists or could not be created&#xa;',
                       '   *           due to some underlying communication problem.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  &lt;C extends ', $java-class-name,'CfgClient&gt; C create', $java-relation-name, '(&#xa;',
                           '      ManagedObjectDefinition&lt;C, ?&gt; d, String name, PropertyProvider p) throws OperationsException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Removes the named ', $ufn,'.&#xa;',
                       '   *&#xa;',
                       '   * @param name&#xa;',
                       '   *          The name of the ', $ufn,' to remove.&#xa;',
                       '   * @throws OperationsException&#xa;',
                       '   *           If the ', $ufn,' does not exist or could not be removed&#xa;',
                       '   *           due to some underlying communication problem.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  void remove',
                       $java-relation-name, '(String name) throws OperationsException;&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:message terminate="yes">
          <xsl:value-of
            select="concat('Unknown relation type &quot;', local-name(*), '&quot; in relation &quot;', $name, '&quot;.')" />
        </xsl:message>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--
    Main document parsing template.
  -->
  <xsl:template match="/">
    <xsl:call-template name="copyright-notice" />
    <xsl:value-of
      select="concat('package ', $this-package, '.client;&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:call-template name="generate-import-statements">
      <xsl:with-param name="imports">
        <xsl:for-each select="$this-local-properties">
          <xsl:call-template name="get-property-java-imports" />
        </xsl:for-each>
        <xsl:if test="$this-local-properties[@multi-valued='true']">
          <import>java.util.Collection</import>
          <import>java.util.SortedSet</import>
        </xsl:if>
        <xsl:if test="$this-local-properties[not(@read-only='true')]">
          <import>
            org.opends.server.admin.IllegalPropertyValueException
          </import>
        </xsl:if>
        <xsl:if test="$this-local-relations">
          <import>org.opends.server.admin.OperationsException</import>
        </xsl:if>
        <xsl:if
          test="$this-local-relations/adm:one-to-zero-or-one|$this-local-relations/adm:one-to-many">
          <import>org.opends.server.admin.PropertyProvider</import>
        </xsl:if>
        <xsl:choose>
          <xsl:when test="$this/@extends">
            <xsl:if test="$parent-package != $this-package">
              <xsl:element name="import">
                <xsl:value-of
                  select="concat($parent-package, '.client.', $parent-java-class, 'CfgClient')" />
              </xsl:element>
            </xsl:if>
          </xsl:when>
          <xsl:otherwise>
            <import>org.opends.server.admin.ConfigurationClient</import>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:element name="import">
          <xsl:value-of
            select="concat($this-package, '.server.', $this-java-class, 'Cfg')" />
        </xsl:element>
        <import>org.opends.server.admin.ManagedObjectDefinition</import>
      </xsl:with-param>
    </xsl:call-template>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:call-template name="generate-interface-declaration" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:call-template name="generate-configuration-definition-getter" />
    <xsl:for-each select="$this-local-properties">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-property-getter-declaration">
        <xsl:with-param name="interface" select="'client'" />
      </xsl:call-template>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-property-setter-declaration" />
    </xsl:for-each>
    <xsl:for-each select="$this-local-relations">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-relation-declarations" />
    </xsl:for-each>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>}&#xa;</xsl:text>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/example-plugin/99-example-plugin.ldif
New file
@@ -0,0 +1,38 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying information:
#      Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#      Portions Copyright 2007 Sun Microsystems, Inc.
#
#
# This file contains the attribute type and objectclass definitions for use
# with the Directory Server configuration.
dn: cn=schema
objectClass: top
objectClass: ldapSubentry
objectClass: subschema
attributeTypes: ( ds-cfg-example-plugin-message-oid NAME 'ds-cfg-example-plugin-message'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( ds-cfg-example-plugin-oid NAME 'ds-cfg-example-plugin'
  SUP ds-cfg-plugin STRUCTURAL MAY ( ds-cfg-example-plugin-message )
  X-ORIGIN 'OpenDS Directory Server' )
opends/resource/admin/example-plugin/ExamplePlugin.java
New file
@@ -0,0 +1,148 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package com.example.opends;
import static org.opends.server.loggers.Error.logError;
import java.util.List;
import java.util.Set;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.api.plugin.DirectoryServerPlugin;
import org.opends.server.api.plugin.PluginType;
import org.opends.server.api.plugin.StartupPluginResult;
import org.opends.server.config.ConfigException;
import org.opends.server.types.ConfigChangeResult;
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
import org.opends.server.types.ResultCode;
import com.example.opends.server.ExamplePluginCfg;
/**
 * The example plugin implementation class. This plugin will output
 * the configured message to the error log during server start up.
 */
public class ExamplePlugin extends
    DirectoryServerPlugin<ExamplePluginCfg> implements
    ConfigurationChangeListener<ExamplePluginCfg> {
  // The current configuration.
  private ExamplePluginCfg config;
  /**
   * Default constructor.
   */
  public ExamplePlugin() {
    super();
  }
  /**
   * {@inheritDoc}
   */
  @Override()
  public void initializePlugin(Set<PluginType> pluginTypes,
      ExamplePluginCfg configuration)
      throws ConfigException {
    // This plugin may only be used as a server startup plugin.
    for (PluginType t : pluginTypes) {
      switch (t) {
      case STARTUP:
        // This is fine.
        break;
      default:
        throw new ConfigException(-1, "Invalid plugin type " + t
            + " for the example plugin.");
      }
    }
    // Register change listeners. These are not really necessary for
    // this plugin since it is only used during server start-up.
    configuration.addExampleChangeListener(this);
    // Save the configuration.
    this.config = configuration;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public StartupPluginResult doStartup() {
    // Log the provided message.
    logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.NOTICE,
        "Example plugin message '" + config.getMessage() + "'.", 9999);
    return StartupPluginResult.SUCCESS;
  }
  /**
   * {@inheritDoc}
   */
  public ConfigChangeResult applyConfigurationChange(
      ExamplePluginCfg config) {
    // The new configuration has already been validated.
    // Log a message to say that the configuration has changed. This
    // isn't necessary, but we'll do it just to show that the change
    // has taken effect.
    logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.NOTICE,
        "Example plugin message has been changed from '"
            + this.config.getMessage() + "' to '"
            + config.getMessage() + "'.", 9999);
    // Update the configuration.
    this.config = config;
    // Update was successfull, no restart required.
    return new ConfigChangeResult(ResultCode.SUCCESS, false);
  }
  /**
   * {@inheritDoc}
   */
  public boolean isConfigurationChangeAcceptable(
      ExamplePluginCfg config, List<String> messages) {
    // The only thing that can be validated here is the plugin's
    // message. However, it is always going to be valid, so let's
    // always return true.
    return true;
  }
}
opends/resource/admin/example-plugin/ExamplePluginConfiguration.xml
New file
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="example-plugin" plural-name="example-plugins"
  package="com.example.opends" extends="plugin"
  parent-package="org.opends.server.admin.std"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>An example "Hello World" plugin.</adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>ds-cfg-example-plugin-oid</ldap:oid>
      <ldap:name>ds-cfg-example-plugin</ldap:name>
      <ldap:superior>ds-cfg-plugin</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="message">
    <adm:synopsis>The message to be logged.</adm:synopsis>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>Hello World</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>ds-cfg-example-plugin-message-oid</ldap:oid>
        <ldap:name>ds-cfg-example-plugin-message</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/resource/admin/example-plugin/Package.xml
New file
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<adm:package name="com.example.opends"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>Example OpenDS Hello World plugin.</adm:synopsis>
</adm:package>
opends/resource/admin/example-plugin/README
New file
@@ -0,0 +1,48 @@
This folder contains source code for an example "Hello World" style
plugin. It features a plugin which has a configurable message (the
default being "Hello World") which is displayed as a notice message
when an OpenDS instance is started.
In order to build and use this example plugin, perform the following
steps (presumably you are already at step 4):
  1. In the top-level source folder for OpenDS, first build and
     package OpenDS:
     ./build.sh
  2. Next go into the packages folder:
     cd build/package/OpenDS-0.1
  3. Then unzip the example-plugin.zip (in place):
     unzip example-plugin.zip
  4. Go into the example-plugin source folder:
     cd example-plugin
  5. And build the plugin (this requires Ant in your path):
     ant install
  6. This will copy the following files into the parent OpenDS
     installation:
     lib/extensions/example-plugin.jar
     config/example-plugin.ldif
     config/schema/99-example-plugin.ldif
  7. Add the plugin's config to the server configuration. The
     following instruction assumes usage of the Unix 'cat'
     command, but obviously ldapadd can be used:
     cd ../config
     cat example-plugin.ldif >> config.ldif
  8. Start the server and look for the "hello world" notice in the start
     up log:
     cd ..
     ./bin/start-ds
opends/resource/admin/example-plugin/build.xml
New file
@@ -0,0 +1,237 @@
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !
 !      Portions Copyright 2007 Sun Microsystems, Inc.
 ! -->
<project name="Directory Server Extension" basedir="." default="package">
  <description>
    This is the build script for an OpenDS Directory Server extension.
  </description>
  <!-- CONFIGURE: The name of the extension's Jar file. -->
  <property name="pkg.name" value="example-plugin" />
  <!-- CONFIGURE: The description of this extension - used in the Javadoc title. -->
  <property name="pkg.description" value="Example Plugin" />
  <!-- CONFIGURE: The path of the OpenDS installation. -->
  <property name="opends.install.dir" location=".." />
  <!-- General properties - should not need changing. -->
  <property name="build.dir" location="build" />
  <property name="src.dir" location="src" />
  <property name="src.gen.dir" location="src-generated" />
  <property name="lib.dir" location="lib" />
  <property name="ext.dir" location="ext" />
  <property name="resource.dir" location="resource" />
  <property name="admin.dir" location="${resource.dir}/admin" />
  <property name="config.dir" location="${resource.dir}/config" />
  <property name="schema.dir" location="${resource.dir}/schema" />
  <property name="classes.dir" location="${build.dir}/classes" />
  <property name="javadoc.dir" location="${build.dir}/javadoc" />
  <property name="package.dir" location="${build.dir}/package" />
  <property name="jar.file" value="${pkg.name}.jar" />
  <!-- Location of OpenDS components - should not need changing. -->
  <property name="opends.lib.dir" location="${opends.install.dir}/lib" />
  <property name="opends.config.dir" location="${opends.install.dir}/config" />
  <property name="opends.schema.dir" location="${opends.config.dir}/schema" />
  <property name="opends.extensions.dir" location="${opends.lib.dir}/extensions" />
  <!-- Display help information. -->
  <target name="help">
    <echo message="Ant options to control the build:" />
    <echo message="" />
    <echo message="  -Dopends.install.dir=path" />
    <echo message="      The path of the OpenDS installation [default: ${opends.install.dir}]." />
    <echo message="" />
    <echo message="  -Dpkg.name=name" />
    <echo message="      The name of the extension's Jar file [default: ${pkg.name}]." />
    <echo message="" />
    <echo message="  -Dpkg.description=description" />
    <echo message="      The description of this extension - used in the Javadoc title [default: ${pkg.description}]." />
    <echo message="" />
  </target>
  <!-- Clean up any files generated during the build process. -->
  <target name="clean" description="Clean up any files generated during the build process.">
    <delete dir="${build.dir}" />
    <delete includeemptydirs="true">
      <fileset dir="${src.gen.dir}" includes="**/*" />
    </delete>
  </target>
  <!-- Compile the Directory Server extension source files. -->
  <target name="compile" depends="init,compileadmin" description="Compile the Directory Server extension source files.">
    <mkdir dir="${classes.dir}" />
    <javac srcdir="${src.dir}:${src.gen.dir}" destdir="${classes.dir}" optimize="true" excludes="**/package-info.java" debug="on" debuglevel="lines,source" source="1.5" target="1.5" deprecation="true" fork="true" memoryInitialSize="${MEM}" memoryMaximumSize="${MEM}">
      <compilerarg value="-Xlint:all" />
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${opends.lib.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </javac>
  </target>
  <!-- Generate JavaDoc documentation from the source files. -->
  <target name="javadoc" depends="init,compile" description="Generate JavaDoc documentation.">
    <mkdir dir="${javadoc.dir}" />
    <javadoc destdir="${javadoc.dir}" source="1.5" additionalparam="-quiet" linksource="yes" windowtitle="${pkg.description} API Documentation" maxmemory="${MEM}">
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${opends.lib.dir}">
          <include name="*.jar" />
        </fileset>
        <dirset dir="${classes.dir}" />
      </classpath>
      <packageset dir="${src.dir}" />
      <packageset dir="${src.gen.dir}" />
    </javadoc>
  </target>
  <!-- Package the Directory Server extension for distribution. -->
  <target name="package" depends="clean,compile" description="Package the Directory Server extension for distribution.">
    <mkdir dir="${package.dir}" />
    <jar jarfile="${package.dir}/${jar.file}" basedir="${classes.dir}" compress="true" index="true" />
  </target>
  <!-- Install the Directory Server extension in an existing OpenDS installation. -->
  <target name="install" depends="package" description="Install the Directory Server extension in an existing OpenDS installation.">
    <mkdir dir="${opends.lib.dir}" />
    <copy todir="${opends.lib.dir}">
      <fileset file="${lib.dir}/*.jar" />
    </copy>
    <mkdir dir="${opends.extensions.dir}" />
    <copy todir="${opends.extensions.dir}">
      <fileset file="${package.dir}/*.jar" />
    </copy>
    <copy todir="${opends.config.dir}">
      <fileset file="${config.dir}/*.ldif" />
    </copy>
    <copy todir="${opends.schema.dir}">
      <fileset file="${schema.dir}/*.ldif" />
    </copy>
  </target>
  <!-- Perform common initialization common to several targets. -->
  <target name="init">
    <tstamp>
      <format property="timestamp" pattern="yyyyMMddHHmmss" />
    </tstamp>
    <condition property="DEBUG_BUILD" value="false">
      <not>
        <isset property="DEBUG_BUILD" />
      </not>
    </condition>
    <condition property="MEM" value="128M">
      <not>
        <isset property="MEM" />
      </not>
    </condition>
  </target>
  <!-- Compile the Directory Server extension configuration definition files. -->
  <target name="compileadmin" depends="validateadmin" description="Compile the Directory Server extension configuration definition files.">
    <!-- Compile the Directory Server extension configuration meta classes. -->
    <xslt basedir="${src.dir}" destdir="${src.gen.dir}" style="${admin.dir}/metaMO.xsl">
      <include name="**/*Configuration.xml" />
      <exclude name="org/opends/server/admin/std/*.xml" />
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.java" />
      <param name="base-dir" expression="${src.dir}" />
    </xslt>
    <xslt basedir="${src.dir}" destdir="${src.gen.dir}" style="${admin.dir}/package-info.xsl">
      <include name="**/Package.xml" />
      <exclude name="org/opends/server/admin/std/*.xml" />
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)\.xml$$" to="\1/meta/package-info.java" />
      <param name="type" expression="meta" />
    </xslt>
    <!-- Compile the Directory Server extension configuration client classes. -->
    <xslt basedir="${src.dir}" destdir="${src.gen.dir}" style="${admin.dir}/clientMO.xsl">
      <include name="**/*Configuration.xml" />
      <exclude name="org/opends/server/admin/std/*.xml" />
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/client/\2CfgClient.java" />
      <param name="base-dir" expression="${src.dir}" />
    </xslt>
    <xslt basedir="${src.dir}" destdir="${src.gen.dir}" style="${admin.dir}/package-info.xsl">
      <include name="**/Package.xml" />
      <exclude name="org/opends/server/admin/std/*.xml" />
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)\.xml$$" to="\1/client/package-info.java" />
      <param name="type" expression="client" />
    </xslt>
    <!-- Compile the Directory Server extension configuration server classes. -->
    <xslt basedir="${src.dir}" destdir="${src.gen.dir}" style="${admin.dir}/serverMO.xsl">
      <include name="**/*Configuration.xml" />
      <exclude name="org/opends/server/admin/std/*.xml" />
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/server/\2Cfg.java" />
      <param name="base-dir" expression="${src.dir}" />
    </xslt>
    <xslt basedir="${src.dir}" destdir="${src.gen.dir}" style="${admin.dir}/package-info.xsl">
      <include name="**/Package.xml" />
      <exclude name="org/opends/server/admin/std/*.xml" />
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)\.xml$$" to="\1/server/package-info.java" />
      <param name="type" expression="server" />
    </xslt>
    <!-- Compile the Directory Server extension configuration ldap profile property files. -->
    <xslt basedir="${src.dir}" destdir="${classes.dir}/admin/profiles/ldap" style="${admin.dir}/ldapMOProfile.xsl">
      <include name="**/*Configuration.xml" />
      <exclude name="org/opends/server/admin/std/*.xml" />
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" />
      <param name="base-dir" expression="${src.dir}" />
    </xslt>
    <!-- Compile the Directory Server extension configuration manifest file. -->
    <tempfile property="admin.temp.dir" destDir="${classes.dir}" />
    <mkdir dir="${admin.temp.dir}" />
    <xslt basedir="${src.dir}" destdir="${admin.temp.dir}" extension=".manifest" style="${admin.dir}/manifestMO.xsl">
      <include name="**/*Configuration.xml" />
      <exclude name="org/opends/server/admin/std/*.xml" />
    </xslt>
    <concat destfile="${classes.dir}/admin/extension.manifest">
      <fileset dir="${admin.temp.dir}" includes="**/*.manifest" />
    </concat>
    <delete dir="${admin.temp.dir}" />
  </target>
  <!-- Validate the Directory Server extension configuration definitions. -->
  <target name="validateadmin" description="Validate the Directory Server extension configuration definitions.">
    <schemavalidate>
      <fileset dir="${src.dir}" includes="**/*.xml" />
      <schema namespace="http://www.opends.org/admin" file="${admin.dir}/admin.xsd" />
      <schema namespace="http://www.opends.org/admin-ldap" file="${admin.dir}/admin-ldap.xsd" />
    </schemavalidate>
  </target>
</project>
opends/resource/admin/example-plugin/example-plugin.ldif
New file
@@ -0,0 +1,10 @@
dn: cn=Example Plugin,cn=Plugins,cn=config
objectClass: top
objectClass: ds-cfg-plugin
objectClass: ds-cfg-example-plugin
cn: Example Plugin
ds-cfg-plugin-enabled: true
ds-cfg-plugin-class: com.example.opends.ExamplePlugin
ds-cfg-plugin-type: startup
ds-cfg-example-plugin-message: Hello World
opends/resource/admin/example-plugin/package-info.java
New file
@@ -0,0 +1,35 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
/**
 * Example OpenDS Hello World plugin implementation clases.
 * <p>
 * This package contains the classes which implement the example
 * plugin.
 */
package com.example.opends;
opends/resource/admin/java-utilities.xsl
New file
@@ -0,0 +1,236 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:exsl="http://exslt.org/common">
  <!--
    This XSLT file contains utility templates which can be used for any
    generating Java code.
  -->
  <xsl:import href="text-utilities.xsl" />
  <xsl:output method="text" encoding="us-ascii" />
  <!--
    Add a copyright notice to the top of a Java source file.
    TODO: it would be nice to generate the copyright year automatically.
  -->
  <xsl:template name="copyright-notice">
    <xsl:value-of
      select="concat('/*&#xa;',
                     ' * CDDL HEADER START&#xa;',
                     ' *&#xa;',
                     ' * The contents of this file are subject to the terms of the&#xa;',
                     ' * Common Development and Distribution License, Version 1.0 only&#xa;',
                     ' * (the &quot;License&quot;).  You may not use this file except in compliance&#xa;',
                     ' * with the License.&#xa;',
                     ' *&#xa;',
                     ' * You can obtain a copy of the license at&#xa;',
                     ' * trunk/opends/resource/legal-notices/OpenDS.LICENSE&#xa;',
                     ' * or https://OpenDS.dev.java.net/OpenDS.LICENSE.&#xa;',
                     ' * See the License for the specific language governing permissions&#xa;',
                     ' * and limitations under the License.&#xa;',
                     ' *&#xa;',
                     ' * When distributing Covered Code, include this CDDL HEADER in each&#xa;',
                     ' * file and include the License file at&#xa;',
                     ' * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,&#xa;',
                     ' * add the following below this CDDL HEADER, with the fields enclosed&#xa;',
                     ' * by brackets &quot;[]&quot; replaced with your own identifying information:&#xa;',
                     ' *      Portions Copyright [yyyy] [name of copyright owner]&#xa;',
                     ' *&#xa;',
                     ' * CDDL HEADER END&#xa;',
                     ' *&#xa;',
                     ' *&#xa;',
                     ' *      Portions Copyright 2007 Sun Microsystems, Inc.&#xa;',
                     ' */&#xa;')" />
  </xsl:template>
  <!--
    Convert an entity or property ID to a Java mixed-cased name.
    For example, the string "my-string-value" will be converted to
    the string "myStringValue".
    @param value
    The ID string to be converted to a Java name.
  -->
  <xsl:template name="name-to-java">
    <xsl:param name="value" />
    <xsl:if test="string-length($value)">
      <xsl:choose>
        <xsl:when test="contains($value, '-')">
          <xsl:variable name="head"
            select="substring-before($value, '-')" />
          <xsl:variable name="tail"
            select="substring-after($value, '-')" />
          <xsl:call-template name="to-title-case">
            <xsl:with-param name="value" select="$head" />
          </xsl:call-template>
          <xsl:call-template name="name-to-java">
            <xsl:with-param name="value" select="$tail" />
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="to-title-case">
            <xsl:with-param name="value" select="$value" />
          </xsl:call-template>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:if>
  </xsl:template>
  <!--
    Convert an entity or property ID to a Java constant name.
    For example, the string "my-string-value" will be converted to
    the string "MY_STRING_VALUE".
    @param value
    The ID string to be converted to a Java constant.
  -->
  <xsl:template name="name-to-java-constant">
    <xsl:param name="value" />
    <xsl:value-of
      select="translate($value,
                        'abcdefghijklmnopqrstuvwxyz-',
                        'ABCDEFGHIJKLMNOPQRSTUVWXYZ_')" />
  </xsl:template>
  <!--
    Add a Java comment. This template handles two levels of
    indentation: the indentation string for the first line, and a
    second indentation string used for subsequent lines. The template
    will output the content wrapping at the nearest word boundary to
    column 70.
    @param indent-text
    The indentation text used for the first line.
    @param indent-text2
    The indentation text used for all lines except
    the first - defaults to the value of indent-text.
    @param content
    The content to be output in the comment.
  -->
  <xsl:template name="add-java-comment">
    <xsl:param name="indent-text" />
    <xsl:param name="indent-text2" select="$indent-text" />
    <xsl:param name="content" />
    <xsl:call-template name="format-text">
      <xsl:with-param name="indent-text" select="$indent-text" />
      <xsl:with-param name="indent-text2" select="$indent-text2" />
      <xsl:with-param name="wrap-column" select="'70'" />
      <xsl:with-param name="content" select="$content" />
    </xsl:call-template>
  </xsl:template>
  <!--
    Utility template for removing duplicate values from a node-set.
    This template is based on the version published on the XSLT site.
    It is not capable of normalizing nodes - so they must be
    pre-normalized before this template is called.
    @param nodes A node-set containing the duplicate nodes.
  -->
  <xsl:template name="set-distinct">
    <xsl:param name="nodes" select="/.." />
    <xsl:call-template name="_set-distinct">
      <xsl:with-param name="nodes" select="$nodes" />
    </xsl:call-template>
  </xsl:template>
  <!-- set-distinct helper template -->
  <xsl:template name="_set-distinct">
    <xsl:param name="nodes" select="/.." />
    <xsl:param name="distinct" select="/.." />
    <xsl:choose>
      <xsl:when test="$nodes">
        <xsl:variable name="value" select="$nodes[1]" />
        <xsl:choose>
          <xsl:when test="$distinct[. = $value]">
            <xsl:call-template name="_set-distinct">
              <xsl:with-param name="distinct" select="$distinct" />
              <xsl:with-param name="nodes" select="$nodes[position() > 1]" />
            </xsl:call-template>
          </xsl:when>
          <xsl:otherwise>
            <xsl:call-template name="_set-distinct">
              <xsl:with-param name="distinct" select="$distinct | $nodes[1]" />
              <xsl:with-param name="nodes" select="$nodes[position() > 1]" />
            </xsl:call-template>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="$distinct" mode="set-distinct" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- set-distinct helper template -->
  <xsl:template match="node()|@*" mode="set-distinct">
    <xsl:copy-of select="." />
  </xsl:template>
  <!--
    Generate a set of import statements.
    This template takes a result tree fragment as a parameter
    containing elements of the form:
    <import>java.net.InetAddress</import>
    <import>...</import>
    This template will normalize each element and remove duplicates
    before generating the output.
    @param imports The result tree fragment containing the import elements.
  -->
  <xsl:template name="generate-import-statements">
    <xsl:param name="imports" select="/.." />
    <!--
      Normalize the import elements since the set-distinct
      template cannot handle additional whitespace
    -->
    <xsl:variable name="normalized-imports">
      <xsl:for-each select="exsl:node-set($imports)/import">
        <xsl:element name="import">
          <xsl:value-of select="normalize-space()" />
        </xsl:element>
      </xsl:for-each>
    </xsl:variable>
    <!--
      Now remove the duplicates
    -->
    <xsl:variable name="unique">
      <xsl:call-template name="set-distinct">
        <xsl:with-param name="nodes"
          select="exsl:node-set($normalized-imports)/import" />
      </xsl:call-template>
    </xsl:variable>
    <!--
      Now output the import statements
    -->
    <xsl:for-each select="exsl:node-set($unique)/import">
      <xsl:sort select="normalize-space()" />
      <xsl:value-of
        select="concat('import ', normalize-space(),';&#xa;')" />
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/ldapMOProfile.xsl
New file
@@ -0,0 +1,62 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <xsl:import href="java-utilities.xsl" />
  <xsl:import href="preprocessor.xsl" />
  <xsl:import href="property-types.xsl" />
  <xsl:output method="text" encoding="us-ascii" />
  <!--
    Document parsing.
  -->
  <xsl:template match="/">
    <xsl:value-of
      select="concat('objectclass=',
                     normalize-space($this/adm:profile[@name='ldap']/ldap:object-class/ldap:name),
                     '&#xa;')" />
    <xsl:for-each select="$this-all-properties">
      <xsl:sort select="@name" />
      <xsl:value-of
        select="concat('attribute.',
                       normalize-space(@name),
                       '=',
                       normalize-space(adm:profile[@name='ldap']/ldap:attribute/ldap:name),
                       '&#xa;')" />
    </xsl:for-each>
    <xsl:for-each select="$this-all-relations">
      <xsl:sort select="@name" />
      <xsl:value-of
        select="concat('rdn.',
                       normalize-space(@name),
                       '=',
                       normalize-space(adm:profile[@name='ldap']/ldap:rdn-sequence),
                       '&#xa;')" />
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/manifestMO.xsl
New file
@@ -0,0 +1,52 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:import href="java-utilities.xsl" />
  <xsl:output method="text" encoding="us-ascii" />
  <!--
    Main document parsing template.
  -->
  <xsl:template match="/">
    <xsl:choose>
      <xsl:when test="adm:root-managed-object">
        <xsl:value-of
          select="'org.opends.server.admin.std.meta.RootCfgDefn&#xa;'" />
      </xsl:when>
      <xsl:when test="adm:managed-object">
        <xsl:value-of
          select="normalize-space(adm:managed-object/@package)" />
        <xsl:value-of select="'.meta.'" />
        <xsl:call-template name="name-to-java">
          <xsl:with-param name="value"
            select="normalize-space(adm:managed-object/@name)" />
        </xsl:call-template>
        <xsl:value-of select="'CfgDefn&#xa;'" />
      </xsl:when>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/metaMO.xsl
New file
@@ -0,0 +1,1695 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:admpp="http://www.opends.org/admin-preprocessor"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:exsl="http://exslt.org/common">
  <xsl:import href="java-utilities.xsl" />
  <xsl:import href="preprocessor.xsl" />
  <xsl:import href="property-types.xsl" />
  <xsl:output method="text" encoding="us-ascii" />
  <!--
    Template for generating the class declaration.
  -->
  <xsl:template name="generate-meta-class-declaration">
    <xsl:value-of select="'/**&#xa;'" />
    <xsl:call-template name="add-java-comment">
      <xsl:with-param name="indent-text" select="' *'" />
      <xsl:with-param name="content"
        select="concat('An interface for querying the ', $this-ufn,
                       ' managed object definition meta information.')" />
    </xsl:call-template>
    <xsl:value-of select="' * &lt;p&gt;&#xa;'" />
    <xsl:call-template name="add-java-comment">
      <xsl:with-param name="indent-text" select="' *'" />
      <xsl:with-param name="content" select="$this/adm:synopsis" />
    </xsl:call-template>
    <xsl:value-of select="' */&#xa;'" />
    <xsl:value-of
      select="concat('public final class ',
                     $this-java-class,
                     'CfgDefn extends ')" />
    <xsl:choose>
      <xsl:when test="$this-is-abstract">
        <xsl:value-of
          select="concat('AbstractManagedObjectDefinition&lt;',
                         $this-java-class, 'CfgClient, ',
                         $this-java-class, 'Cfg&gt; {&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of
          select="concat('ManagedObjectDefinition&lt;',
                         $this-java-class, 'CfgClient, ',
                         $this-java-class, 'Cfg&gt; {&#xa;')" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--
    Template for generating the meta class body.
  -->
  <xsl:template name="generate-meta-class-body">
    <!--
      Singleton configuration definition instance.
    -->
    <xsl:value-of
      select="concat('  // The singleton configuration definition instance.&#xa;',
                     '  private static final ',
                     $this-java-class ,
                     'CfgDefn INSTANCE = new ', $this-java-class, 'CfgDefn();&#xa;')" />
    <!--
      Generate enumerations defined by this managed object..
    -->
    <xsl:for-each
      select="$this-local-properties[adm:syntax/adm:enumeration]">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-enumeration" />
    </xsl:for-each>
    <!--
      Generate declarations for properties defined or
      overridden by this managed object.
    -->
    <xsl:for-each select="$this-local-properties">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-property-declaration" />
    </xsl:for-each>
    <!--
      Generate declarations for relations.
    -->
    <xsl:for-each select="$this-local-relations">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-relation-declaration" />
    </xsl:for-each>
    <!--
      Generate constructors for properties defined or
      overridden by this managed object.
    -->
    <xsl:for-each select="$this-local-properties">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-property-constructor" />
    </xsl:for-each>
    <!--
      Generate constructors for relations.
    -->
    <xsl:for-each select="$this-local-relations">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-relation-constructor" />
    </xsl:for-each>
    <!--
      Configuration definition singleton getter.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of select="'  /**&#xa;'" />
    <xsl:call-template name="add-java-comment">
      <xsl:with-param name="indent-text" select="'   *'" />
      <xsl:with-param name="content"
        select="concat('Get the ', $this-ufn,' configuration definition singleton.')" />
    </xsl:call-template>
    <xsl:value-of select="'   *&#xa;'" />
    <xsl:call-template name="add-java-comment">
      <xsl:with-param name="indent-text" select="'   *'" />
      <xsl:with-param name="indent-text2" select="'   *        '" />
      <xsl:with-param name="content"
        select="concat('@return Returns the ', $this-ufn,
                     ' configuration definition singleton.')" />
    </xsl:call-template>
    <xsl:value-of select="'   */&#xa;'" />
    <xsl:value-of
      select="concat('  public static ',
                     $this-java-class ,
                     'CfgDefn getInstance() {&#xa;',
                     '    return INSTANCE;&#xa;',
                     '  }&#xa;')" />
    <!--
      Private constructor.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="concat('  /**&#xa;',
                     '   * Private constructor.&#xa;',
                     '   */&#xa;',
                     '  private ',
                     $this-java-class ,
                     'CfgDefn() {&#xa;')" />
    <xsl:choose>
      <xsl:when test="boolean($this/@extends)">
        <xsl:value-of
          select="concat('    super(&quot;',
                         $this/@name,
                         '&quot;, ',
                         $parent-java-class,
                         'CfgDefn.getInstance());&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of
          select="concat('    super(&quot;',
                         $this/@name,
                         '&quot;, null);&#xa;')" />
      </xsl:otherwise>
    </xsl:choose>
    <xsl:value-of select="concat('  }&#xa;')" />
    <!--
      Create configuration view factory methods for non-abstract definitions
    -->
    <xsl:if test="not($this-is-abstract)">
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <!--
        Generate configuration client factory method.
      -->
      <xsl:value-of
        select="concat('  /**&#xa;',
                       '   * {@inheritDoc}&#xa;',
                       '   */&#xa;',
                       '  public ',
                       $this-java-class,
                       'CfgClient createClientConfiguration(&#xa;',
                       '      ManagedObject&lt;? extends ',
                       $this-java-class,
                       'CfgClient&gt; impl) {&#xa;',
                       '    return new ',
                       $this-java-class ,
                       'CfgClientImpl(impl);&#xa;',
                       '  }&#xa;')" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <!--
        Generate configuration server factory method.
      -->
      <xsl:value-of
        select="concat('  /**&#xa;',
                       '   * {@inheritDoc}&#xa;',
                       '   */&#xa;',
                       '  public ',
                       $this-java-class,
                       'Cfg createServerConfiguration(&#xa;',
                       '      ServerManagedObject&lt;? extends ',$this-java-class,'Cfg&gt; impl) {&#xa;',
                       '    return new ',
                       $this-java-class ,
                       'CfgServerImpl(impl);&#xa;',
                       '  }&#xa;')" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <!--
        Generate configuration server class getter..
      -->
      <xsl:value-of
        select="concat('  /**&#xa;',
                       '   * {@inheritDoc}&#xa;',
                       '   */&#xa;',
                       '  public Class&lt;',
                       $this-java-class,
                       'Cfg&gt; getServerConfigurationClass() {&#xa;',
                       '    return ',
                       $this-java-class ,
                       'Cfg.class;&#xa;',
                       '  }&#xa;')" />
    </xsl:if>
    <!--
      Generate property definition getters for local properties.
    -->
    <xsl:for-each select="$this-all-properties">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-property-definition-getter" />
    </xsl:for-each>
    <!--
      Generate relation definition getters for local relations.
    -->
    <xsl:for-each select="$this-all-relations">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-relation-definition-getter" />
    </xsl:for-each>
    <!--
      Managed object class implementations.
    -->
    <xsl:if test="not($this-is-abstract)">
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-client-impl-class" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-server-impl-class" />
    </xsl:if>
  </xsl:template>
  <!--
    Generate managed object client class implementation.
  -->
  <xsl:template name="generate-client-impl-class">
    <!--
      Declaration.
    -->
    <xsl:value-of
      select="concat('  /**&#xa;',
                     '   * Managed object client implementation.&#xa;',
                     '   */&#xa;',
                     '  private static class ',
                     $this-java-class ,
                     'CfgClientImpl implements&#xa;    ',
                     $this-java-class ,
                     'CfgClient {&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
    <!--
      Private instance.
    -->
    <xsl:value-of
      select="concat('    // Private implementation.&#xa;',
                     '    private ManagedObject&lt;? extends ',
                     $this-java-class,
                     'CfgClient&gt; impl;&#xa;')" />
    <!--
      Private constructor.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="concat('    // Private constructor.&#xa;',
                     '    private ',
                     $this-java-class,
                     'CfgClientImpl(&#xa;',
                     '        ManagedObject&lt;? extends ',
                     $this-java-class,
                     'CfgClient&gt; impl) {&#xa;',
                     '      this.impl = impl;&#xa;',
                     '    };&#xa;')" />
    <!--
      Getters/Setters for all properties.
    -->
    <xsl:for-each select="$this-all-properties">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-property-getter">
        <xsl:with-param name="interface" select="'client'" />
      </xsl:call-template>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-property-setter" />
    </xsl:for-each>
    <!--
      Relation methods.
    -->
    <xsl:for-each select="$this-all-relations">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-client-relation-methods" />
    </xsl:for-each>
    <!--
      Managed object definition getter.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="concat('    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;',
                     '    public ManagedObjectDefinition&lt;? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg&gt; definition() {&#xa;',
                     '      return INSTANCE;&#xa;',
                     '    }&#xa;')" />
    <!--
      Property provider view.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="concat('    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;',
                     '    public PropertyProvider properties() {&#xa;',
                     '      return impl;&#xa;',
                     '    }&#xa;')" />
    <!--
      Commit method.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="concat('    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;',
                     '    public void commit() throws OperationsException {&#xa;',
                     '      impl.commit();&#xa;',
                     '    }&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of select="'  }&#xa;'" />
  </xsl:template>
  <!--
    Generate managed object server class implementation.
  -->
  <xsl:template name="generate-server-impl-class">
    <!--
      Declaration.
    -->
    <xsl:value-of
      select="concat('  /**&#xa;',
                     '   * Managed object server implementation.&#xa;',
                     '   */&#xa;',
                     '  private static class ',
                     $this-java-class ,
                     'CfgServerImpl implements&#xa;    ',
                     $this-java-class ,
                     'Cfg {&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
    <!--
      Private instance.
    -->
    <xsl:value-of
      select="concat('    // Private implementation.&#xa;',
                     '    private ServerManagedObject&lt;? extends ', $this-java-class, 'Cfg&gt; impl;&#xa;')" />
    <!--
      Private constructor.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="concat('    // Private constructor.&#xa;',
                     '    private ',
                     $this-java-class,
                     'CfgServerImpl(ServerManagedObject&lt;? extends ', $this-java-class, 'Cfg&gt; impl) {&#xa;',
                     '      this.impl = impl;&#xa;',
                     '    };&#xa;')" />
    <!--
      Generate all the change listener methods - one for each managed
      object in the hierarchy.
    -->
    <xsl:if test="not($this-is-root)">
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-change-listener" />
    </xsl:if>
    <!--
      Getters/Setters for all properties.
    -->
    <xsl:for-each select="$this-all-properties">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-property-getter">
        <xsl:with-param name="interface" select="'server'" />
      </xsl:call-template>
    </xsl:for-each>
    <!--
      Relation methods.
    -->
    <xsl:for-each select="$this-all-relations">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-server-relation-methods" />
    </xsl:for-each>
    <!--
      Configuration definition getter.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="concat('    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;',
                     '    public ManagedObjectDefinition&lt;? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg&gt; definition() {&#xa;',
                     '      return INSTANCE;&#xa;',
                     '    }&#xa;')" />
    <!--
      Property provider view.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="concat('    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;',
                     '    public PropertyProvider properties() {&#xa;',
                     '      return impl;&#xa;',
                     '    }&#xa;')" />
    <!--
      Configuration entry DN getter.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="concat('    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;',
                     '    public DN dn() {&#xa;',
                     '      return impl.getDN();&#xa;',
                     '    }&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of select="'  }&#xa;'" />
  </xsl:template>
  <!--
    Generate a property definition constructor.
  -->
  <xsl:template name="generate-property-declaration">
    <xsl:variable name="java-prop-name">
      <xsl:call-template name="name-to-java-constant">
        <xsl:with-param name="value" select="@name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="type">
      <xsl:call-template name="get-property-definition-type" />
    </xsl:variable>
    <xsl:variable name="generic-type">
      <xsl:call-template name="get-property-definition-generic-type" />
    </xsl:variable>
    <xsl:variable name="pdtype">
      <xsl:choose>
        <xsl:when test="string-length($generic-type) != 0">
          <xsl:value-of
            select="concat($type, '&lt;', $generic-type, '&gt;')" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$type" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:value-of
      select="concat('  // The &quot;',
                     @name,
                     '&quot; property definition.&#xa;',
                     '  private static final ', $pdtype, ' PD_', $java-prop-name, ';&#xa;')" />
  </xsl:template>
  <!--
    Generate a property definition constructor.
  -->
  <xsl:template name="generate-property-constructor">
    <xsl:variable name="java-prop-name">
      <xsl:call-template name="name-to-java-constant">
        <xsl:with-param name="value" select="@name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="type">
      <xsl:call-template name="get-property-definition-type" />
    </xsl:variable>
    <xsl:variable name="generic-type">
      <xsl:call-template name="get-property-definition-generic-type" />
    </xsl:variable>
    <xsl:variable name="value-type">
      <xsl:call-template name="get-property-java-type" />
    </xsl:variable>
    <xsl:value-of
      select="concat('  // Build the &quot;', @name, '&quot; property definition.&#xa;',
                                 '  static {&#xa;')" />
    <xsl:choose>
      <xsl:when test="string-length($generic-type) != 0">
        <xsl:value-of
          select="concat('      ', $type, '.Builder&lt;', $generic-type, '&gt; builder = ', $type, '.createBuilder(&quot;',@name, '&quot;);&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of
          select="concat('      ', $type, '.Builder builder = ', $type, '.createBuilder(&quot;',@name, '&quot;);&#xa;')" />
      </xsl:otherwise>
    </xsl:choose>
    <xsl:if test="string(@multi-valued) = 'true'">
      <xsl:value-of
        select="'      builder.setOption(PropertyOption.MULTI_VALUED);&#xa;'" />
    </xsl:if>
    <xsl:if test="string(@read-only) = 'true'">
      <xsl:value-of
        select="'      builder.setOption(PropertyOption.READ_ONLY);&#xa;'" />
    </xsl:if>
    <xsl:if
      test="adm:requires-admin-action/adm:server-restart|adm:requires-admin-action/adm:component-restart|adm:requires-admin-action/adm:other">
      <xsl:value-of
        select="'      builder.setOption(PropertyOption.REQUIRES_ADMIN_ACTION);&#xa;'" />
    </xsl:if>
    <xsl:if test="string(@mandatory) = 'true'">
      <xsl:value-of
        select="'      builder.setOption(PropertyOption.MANDATORY);&#xa;'" />
    </xsl:if>
    <xsl:if test="string(@hidden) = 'true'">
      <xsl:value-of
        select="'      builder.setOption(PropertyOption.HIDDEN);&#xa;'" />
    </xsl:if>
    <xsl:choose>
      <xsl:when test="string(@mandatory) = 'true'">
        <xsl:value-of
          select="concat('      builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider&lt;', $value-type,'&gt;());&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:if test="not(adm:default-behavior)">
          <xsl:message terminate="yes">
            <xsl:value-of
              select="concat('No default behavior defined for non-mandatory property &quot;', @name,
                         '&quot;.')" />
          </xsl:message>
        </xsl:if>
        <xsl:choose>
          <xsl:when test="adm:default-behavior/adm:undefined">
            <xsl:value-of
              select="concat('      builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider&lt;', $value-type,'&gt;());&#xa;')" />
          </xsl:when>
          <xsl:when test="adm:default-behavior/adm:alias">
            <xsl:value-of
              select="concat('      builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider&lt;', $value-type,'&gt;());&#xa;')" />
          </xsl:when>
          <xsl:when test="adm:default-behavior/adm:defined">
            <xsl:value-of
              select="concat('      DefaultBehaviorProvider&lt;', $value-type,'&gt; provider = ',
                             'new DefinedDefaultBehaviorProvider&lt;', $value-type,'&gt;(')" />
            <xsl:for-each
              select="adm:default-behavior/adm:defined/adm:value">
              <xsl:value-of
                select="concat('&quot;', normalize-space(), '&quot;')" />
              <xsl:if test="position() != last()">
                <xsl:value-of select="', '" />
              </xsl:if>
            </xsl:for-each>
            <xsl:value-of select="');&#xa;'" />
            <xsl:value-of
              select="'      builder.setDefaultBehaviorProvider(provider);&#xa;'" />
          </xsl:when>
          <xsl:when
            test="adm:default-behavior/adm:inherited/adm:relative">
            <xsl:message terminate="yes">
              <xsl:value-of
                select="concat('Relative inherited property defaults not yet implemented (property &quot;', @name,
                         '&quot;).')" />
            </xsl:message>
          </xsl:when>
          <xsl:when
            test="adm:default-behavior/adm:inherited/adm:absolute">
            <xsl:message terminate="yes">
              <xsl:value-of
                select="concat('Absolute inherited property defaults not yet implemented (property &quot;', @name,
                         '&quot;).')" />
            </xsl:message>
          </xsl:when>
          <xsl:otherwise>
            <xsl:message terminate="yes">
              <xsl:value-of
                select="concat('Unrecognized default behavior type for property &quot;', @name,
                         '&quot;.')" />
            </xsl:message>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:call-template name="get-property-definition-ctor" />
    <xsl:value-of
      select="concat('      PD_', $java-prop-name, ' = builder.getInstance();&#xa;')" />
    <xsl:value-of
      select="concat('      INSTANCE.registerPropertyDefinition(PD_', $java-prop-name, ');&#xa;')" />
    <xsl:value-of select="'  }&#xa;'" />
  </xsl:template>
  <!--
    Generate a relation definition declaration.
  -->
  <xsl:template name="generate-relation-declaration">
    <xsl:variable name="relation-name">
      <xsl:choose>
        <xsl:when test="adm:one-to-many">
          <xsl:value-of select="adm:one-to-many/@plural-name" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="@name" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="java-relation-name">
      <xsl:call-template name="name-to-java-constant">
        <xsl:with-param name="value" select="$relation-name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="java-managed-object-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="@managed-object-name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:value-of
      select="concat('  // The &quot;',
                     $relation-name,
                     '&quot; relation definition.&#xa;',
                     '  private static final ')" />
    <xsl:choose>
      <xsl:when test="adm:one-to-one">
        <xsl:text>SingletonRelationDefinition&lt;</xsl:text>
      </xsl:when>
      <xsl:when test="adm:one-to-zero-or-one">
        <xsl:text>OptionalRelationDefinition&lt;</xsl:text>
      </xsl:when>
      <xsl:when test="adm:one-to-many">
        <xsl:text>InstantiableRelationDefinition&lt;</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:message terminate="yes">
          <xsl:value-of
            select="concat('Unknown relation type &quot;', local-name(*), '&quot; in relation &quot;', @name, '&quot;.')" />
        </xsl:message>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:value-of
      select="concat($java-managed-object-name, 'CfgClient, ', $java-managed-object-name, 'Cfg&gt; RD_', $java-relation-name, ';&#xa;')" />
  </xsl:template>
  <!--
    Generate a relation definition constructor.
  -->
  <xsl:template name="generate-relation-constructor">
    <xsl:variable name="relation-name">
      <xsl:choose>
        <xsl:when test="adm:one-to-many">
          <xsl:value-of select="adm:one-to-many/@plural-name" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="@name" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="java-relation-name">
      <xsl:call-template name="name-to-java-constant">
        <xsl:with-param name="value" select="$relation-name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="java-managed-object-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="@managed-object-name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:value-of
      select="concat('  // Build the &quot;', $relation-name, '&quot; relation definition.&#xa;',
                     '  static {&#xa;',
                     '    RD_', $java-relation-name, ' = new ')" />
    <xsl:choose>
      <xsl:when test="adm:one-to-one">
        <xsl:text>SingletonRelationDefinition&lt;</xsl:text>
      </xsl:when>
      <xsl:when test="adm:one-to-zero-or-one">
        <xsl:text>OptionalRelationDefinition&lt;</xsl:text>
      </xsl:when>
      <xsl:when test="adm:one-to-many">
        <xsl:text>InstantiableRelationDefinition&lt;</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:message terminate="yes">
          <xsl:value-of
            select="concat('Unknown relation type &quot;', local-name(*), '&quot; in relation &quot;', @name, '&quot;.')" />
        </xsl:message>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:value-of
      select="concat($java-managed-object-name, 'CfgClient, ', $java-managed-object-name, 'Cfg&gt;(&#xa;',
                     '        INSTANCE, &quot;', @name, '&quot;, ')" />
    <xsl:if test="adm:one-to-many">
      <xsl:value-of
        select="concat('&quot;', adm:one-to-many/@plural-name, '&quot;, ')" />
    </xsl:if>
    <xsl:value-of
      select="concat($java-managed-object-name, 'CfgDefn.getInstance());&#xa;')" />
    <xsl:value-of
      select="concat('    INSTANCE.registerRelationDefinition(RD_', $java-relation-name,');&#xa;')" />
    <xsl:value-of select="'  }&#xa;'" />
  </xsl:template>
  <!--
    Generate a property definition getter for a locally defined
    or overriden property.
  -->
  <xsl:template name="generate-property-definition-getter">
    <xsl:variable name="java-prop-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="@name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="java-prop-name-constant">
      <xsl:call-template name="name-to-java-constant">
        <xsl:with-param name="value" select="@name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="type">
      <xsl:call-template name="get-property-definition-type" />
    </xsl:variable>
    <xsl:variable name="generic-type">
      <xsl:call-template name="get-property-definition-generic-type" />
    </xsl:variable>
    <xsl:variable name="pdtype">
      <xsl:choose>
        <xsl:when test="string-length($generic-type) != 0">
          <xsl:value-of
            select="concat($type, '&lt;', $generic-type, '&gt;')" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$type" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:value-of
      select="concat('  /**&#xa;',
                     '   * Get the &quot;',
                     @name,
                     '&quot; property definition.&#xa;')" />
    <xsl:if test="adm:synopsis">
      <xsl:value-of select="'   * &lt;p&gt;&#xa;'" />
      <xsl:call-template name="add-java-comment">
        <xsl:with-param name="indent-text" select="'   *'" />
        <xsl:with-param name="content" select="adm:synopsis" />
      </xsl:call-template>
    </xsl:if>
    <xsl:if test="adm:description">
      <xsl:value-of select="'   * &lt;p&gt;&#xa;'" />
      <xsl:call-template name="add-java-comment">
        <xsl:with-param name="indent-text" select="'   *'" />
        <xsl:with-param name="content" select="adm:description" />
      </xsl:call-template>
    </xsl:if>
    <xsl:choose>
      <xsl:when
        test="adm:profile[@name='preprocessor']/admpp:managed-object[@name=$this-name and @package=$this-package]">
        <xsl:value-of
          select="concat('   *&#xa;',
                     '   * @return Returns the &quot;',
                     @name,
                     '&quot; property definition.&#xa;',
                     '   */&#xa;',
                     '  public ',
                     $pdtype,
                     ' get',
                     $java-prop-name,
                     'PropertyDefinition() {&#xa;' ,
                     '    return PD_',
                     $java-prop-name-constant ,
                     ';&#xa;' ,
                     '  }&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of
          select="concat('   *&#xa;',
                     '   * @return Returns the &quot;',
                     @name,
                     '&quot; property definition.&#xa;',
                     '   */&#xa;',
                     '  public ',
                     $pdtype,
                     ' get',
                     $java-prop-name,
                     'PropertyDefinition() {&#xa;' ,
                     '    return ',
                     $parent-java-class, 'CfgDefn.getInstance().get',
                     $java-prop-name,
                     'PropertyDefinition();&#xa;',
                     '  }&#xa;')" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--
    Generate a relation definition getter.
  -->
  <xsl:template name="generate-relation-definition-getter">
    <xsl:variable name="relation-name">
      <xsl:choose>
        <xsl:when test="adm:one-to-many">
          <xsl:value-of select="adm:one-to-many/@plural-name" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="@name" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="java-relation-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="$relation-name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="java-relation-name-constant">
      <xsl:call-template name="name-to-java-constant">
        <xsl:with-param name="value" select="$relation-name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:value-of
      select="concat('  /**&#xa;',
                     '   * Get the &quot;',
                     $relation-name,
                     '&quot; relation definition.&#xa;',
                     '   *&#xa;',
                     '   * @return Returns the &quot;',
                     $relation-name,
                     '&quot; relation definition.&#xa;',
                     '   */&#xa;',
                     '  public ')" />
    <xsl:choose>
      <xsl:when test="adm:one-to-one">
        <xsl:text>SingletonRelationDefinition&lt;</xsl:text>
      </xsl:when>
      <xsl:when test="adm:one-to-zero-or-one">
        <xsl:text>OptionalRelationDefinition&lt;</xsl:text>
      </xsl:when>
      <xsl:when test="adm:one-to-many">
        <xsl:text>InstantiableRelationDefinition&lt;</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:message terminate="yes">
          <xsl:value-of
            select="concat('Unknown relation type &quot;', local-name(*), '&quot; in relation &quot;', @name, '&quot;.')" />
        </xsl:message>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:variable name="java-managed-object-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="@managed-object-name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:choose>
      <xsl:when
        test="adm:profile[@name='preprocessor']/admpp:managed-object[@name=$this-name and @package=$this-package]">
        <xsl:value-of
          select="concat($java-managed-object-name, 'CfgClient,',
                     $java-managed-object-name, 'Cfg&gt; get',
                     $java-relation-name,
                     'RelationDefinition() {&#xa;' ,
                     '    return RD_',
                     $java-relation-name-constant,
                     ';&#xa;' ,
                     '  }&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of
          select="concat($java-managed-object-name, 'CfgClient,',
                     $java-managed-object-name, 'Cfg&gt; get',
                     $java-relation-name,
                     'RelationDefinition() {&#xa;' ,
                     '    return ',
                     $parent-java-class, 'CfgDefn.getInstance().get',
                     $java-relation-name,
                     'RelationDefinition();&#xa;',
                     '  }&#xa;')" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--
    Generate a property value getter.
  -->
  <xsl:template name="generate-property-getter">
    <xsl:param name="interface" select="/.." />
    <xsl:variable name="java-prop-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="@name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:value-of
      select="concat('    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;',
                     '    public ')" />
    <xsl:choose>
      <xsl:when test="string(@multi-valued) != 'true'">
        <xsl:choose>
          <xsl:when test="adm:default-behavior/adm:defined">
            <!--
              The method is guaranteed to return a value since there is a
              well-defined default value.
            -->
            <xsl:call-template name="get-property-java-primitive-type" />
          </xsl:when>
          <xsl:when
            test="$interface = 'server' and @mandatory = 'true'">
            <!--
              The method is guaranteed to return a value in the server interface, but
              not necessarily in the client, since the mandatory property might not
              have been created yet.
            -->
            <xsl:call-template name="get-property-java-primitive-type" />
          </xsl:when>
          <xsl:otherwise>
            <xsl:call-template name="get-property-java-type" />
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'SortedSet&lt;'" />
        <xsl:call-template name="get-property-java-type" />
        <xsl:value-of select="'&gt;'" />
      </xsl:otherwise>
    </xsl:choose>
    <xsl:choose>
      <xsl:when test="adm:syntax/adm:boolean">
        <xsl:value-of select="' is'" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="' get'" />
      </xsl:otherwise>
    </xsl:choose>
    <xsl:choose>
      <xsl:when test="string(@multi-valued) != 'true'">
        <xsl:value-of
          select="concat($java-prop-name, '() {&#xa;',
                                     '      return impl.getPropertyValue',
                                     '(INSTANCE.get', $java-prop-name ,
                                     'PropertyDefinition());&#xa;' ,
                                     '    }&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of
          select="concat($java-prop-name, '() {&#xa;',
                                     '      return impl.getPropertyValues',
                                     '(INSTANCE.get', $java-prop-name ,
                                     'PropertyDefinition());&#xa;' ,
                                     '    }&#xa;')" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--
    Generate a property value setter.
  -->
  <xsl:template name="generate-property-setter">
    <xsl:if test="string(@read-only) != 'true'">
      <xsl:variable name="java-prop-name">
        <xsl:call-template name="name-to-java">
          <xsl:with-param name="value" select="@name" />
        </xsl:call-template>
      </xsl:variable>
      <xsl:value-of
        select="concat('    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;',
                     '    public void set',
                     $java-prop-name ,
                     '(')" />
      <xsl:choose>
        <xsl:when test="string(@multi-valued) != 'true'">
          <xsl:choose>
            <xsl:when test="@mandatory = 'true'">
              <xsl:call-template
                name="get-property-java-primitive-type" />
            </xsl:when>
            <xsl:otherwise>
              <xsl:call-template name="get-property-java-type" />
            </xsl:otherwise>
          </xsl:choose>
          <xsl:value-of
            select="concat(' value) {&#xa;' ,
                     '      impl.setPropertyValue(INSTANCE.get',
                     $java-prop-name ,
                     'PropertyDefinition(), value);&#xa;',
                     '    }&#xa;')" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'Collection&lt;'" />
          <xsl:call-template name="get-property-java-type" />
          <xsl:value-of
            select="concat('&gt; values) {&#xa;' ,
                     '      impl.setPropertyValues(INSTANCE.get',
                     $java-prop-name ,
                     'PropertyDefinition(), values);&#xa;',
                     '    }&#xa;')" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:if>
  </xsl:template>
  <!--
    Generate client relation methods.
  -->
  <xsl:template name="generate-client-relation-methods">
    <xsl:variable name="name" select="@name" />
    <xsl:variable name="java-relation-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="$name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="java-class-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="@managed-object-name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="adm:one-to-one">
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public ', $java-class-name, 'CfgClient get',
                         $java-relation-name, '() throws OperationsException {&#xa;',
                         '      return impl.getChild(INSTANCE.get', $java-relation-name,'RelationDefinition()).getConfiguration();&#xa;',
                         '    }&#xa;')" />
      </xsl:when>
      <xsl:when test="adm:one-to-zero-or-one">
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public boolean has',
                         $java-relation-name, '() throws OperationsException {&#xa;',
                         '      return impl.hasChild(INSTANCE.get', $java-relation-name,'RelationDefinition());&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public ', $java-class-name, 'CfgClient get',
                         $java-relation-name, '() throws OperationsException {&#xa;',
                         '      return impl.getChild(INSTANCE.get', $java-relation-name,'RelationDefinition()).getConfiguration();&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public &lt;M extends ', $java-class-name, 'CfgClient&gt; M create',
                         $java-relation-name, '(ManagedObjectDefinition&lt;M, ?&gt; d, PropertyProvider p) throws OperationsException {&#xa;',
                         '      return impl.createChild(INSTANCE.get', $java-relation-name,'RelationDefinition(), d, p).getConfiguration();&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public void remove',
                         $java-relation-name, '() throws OperationsException {&#xa;',
                         '      impl.removeChild(INSTANCE.get', $java-relation-name,'RelationDefinition());&#xa;',
                         '    }&#xa;')" />
      </xsl:when>
      <xsl:when test="adm:one-to-many">
        <xsl:variable name="plural-name"
          select="adm:one-to-many/@plural-name" />
        <xsl:variable name="java-relation-plural-name">
          <xsl:call-template name="name-to-java">
            <xsl:with-param name="value" select="$plural-name" />
          </xsl:call-template>
        </xsl:variable>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public String[] list',
                         $java-relation-plural-name, '() throws OperationsException {&#xa;',
                         '      return impl.listChildren(INSTANCE.get', $java-relation-plural-name,'RelationDefinition());&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public ', $java-class-name, 'CfgClient get',
                         $java-relation-name, '(String name) throws OperationsException {&#xa;',
                         '      return impl.getChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), name).getConfiguration();&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public &lt;M extends ', $java-class-name, 'CfgClient&gt; M create',
                         $java-relation-name, '(ManagedObjectDefinition&lt;M, ?&gt; d, String name, PropertyProvider p) throws OperationsException {&#xa;',
                         '      return impl.createChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), d, name, p).getConfiguration();&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public void remove',
                         $java-relation-name, '(String name) throws OperationsException {&#xa;',
                         '      impl.removeChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), name);&#xa;',
                         '    }&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:message terminate="yes">
          <xsl:value-of
            select="concat('Unknown relation type &quot;', local-name(*), '&quot; in relation &quot;', $name, '&quot;.')" />
        </xsl:message>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--
    Generate server relation methods.
  -->
  <xsl:template name="generate-server-relation-methods">
    <xsl:variable name="name" select="@name" />
    <xsl:variable name="java-relation-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="$name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="java-class-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="@managed-object-name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="adm:one-to-one">
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public ', $java-class-name, 'Cfg get',
                         $java-relation-name, '() throws ConfigException {&#xa;',
                         '      return impl.getChild(INSTANCE.get', $java-relation-name, 'RelationDefinition()).getConfiguration();&#xa;',
                         '    }&#xa;')" />
      </xsl:when>
      <xsl:when test="adm:one-to-zero-or-one">
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public boolean has',
                         $java-relation-name, '() {&#xa;',
                         '      return impl.hasChild(INSTANCE.get', $java-relation-name, 'RelationDefinition());&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public ', $java-class-name, 'Cfg get',
                         $java-relation-name, '() throws ConfigException {&#xa;',
                         '      return impl.getChild(INSTANCE.get', $java-relation-name, 'RelationDefinition()).getConfiguration();&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public void add', $java-relation-name, 'AddListener(&#xa;',
                         '        ConfigurationAddListener&lt;', $java-class-name,'Cfg&gt; listener) throws ConfigException {&#xa;',
                         '      impl.registerAddListener(INSTANCE.get', $java-relation-name, 'RelationDefinition(), listener);&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public void remove', $java-relation-name, 'AddListener(&#xa;',
                         '        ConfigurationAddListener&lt;', $java-class-name,'Cfg&gt; listener) {&#xa;',
                         '      impl.deregisterAddListener(INSTANCE.get', $java-relation-name, 'RelationDefinition(), listener);&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public void add', $java-relation-name, 'DeleteListener(&#xa;',
                         '        ConfigurationDeleteListener&lt;', $java-class-name,'Cfg&gt; listener) throws ConfigException {&#xa;',
                         '      impl.registerDeleteListener(INSTANCE.get', $java-relation-name, 'RelationDefinition(), listener);&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public void remove', $java-relation-name, 'DeleteListener(&#xa;',
                         '        ConfigurationDeleteListener&lt;', $java-class-name,'Cfg&gt; listener) {&#xa;',
                         '      impl.deregisterDeleteListener(INSTANCE.get', $java-relation-name, 'RelationDefinition(), listener);&#xa;',
                         '    }&#xa;')" />
      </xsl:when>
      <xsl:when test="adm:one-to-many">
        <xsl:variable name="plural-name"
          select="adm:one-to-many/@plural-name" />
        <xsl:variable name="java-relation-plural-name">
          <xsl:call-template name="name-to-java">
            <xsl:with-param name="value" select="$plural-name" />
          </xsl:call-template>
        </xsl:variable>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public String[] list',
                         $java-relation-plural-name, '() {&#xa;',
                         '      return impl.listChildren(INSTANCE.get', $java-relation-plural-name,'RelationDefinition());&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public ', $java-class-name, 'Cfg get',
                         $java-relation-name, '(String name) throws ConfigException {&#xa;',
                         '      return impl.getChild(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), name).getConfiguration();&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public void add', $java-relation-name, 'AddListener(&#xa;',
                         '        ConfigurationAddListener&lt;', $java-class-name,'Cfg&gt; listener) throws ConfigException {&#xa;',
                         '      impl.registerAddListener(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), listener);&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public void remove', $java-relation-name, 'AddListener(&#xa;',
                         '        ConfigurationAddListener&lt;', $java-class-name,'Cfg&gt; listener) {&#xa;',
                         '      impl.deregisterAddListener(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), listener);&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public void add', $java-relation-name, 'DeleteListener(&#xa;',
                         '        ConfigurationDeleteListener&lt;', $java-class-name,'Cfg&gt; listener) throws ConfigException {&#xa;',
                         '      impl.registerDeleteListener(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), listener);&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('    /**&#xa;',
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public void remove', $java-relation-name, 'DeleteListener(&#xa;',
                         '        ConfigurationDeleteListener&lt;', $java-class-name,'Cfg&gt; listener) {&#xa;',
                         '      impl.deregisterDeleteListener(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), listener);&#xa;',
                         '    }&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:message terminate="yes">
          <xsl:value-of
            select="concat('Unknown relation type &quot;', local-name(*), '&quot; in relation &quot;', $name, '&quot;.')" />
        </xsl:message>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--
    Generate change listener registration methods.
  -->
  <xsl:template name="generate-change-listener">
    <!--
      Process this managed object.
    -->
    <xsl:variable name="top-name"
      select="$this/adm:profile[@name='preprocessor']/admpp:parent-managed-object[last()]/@name" />
    <xsl:call-template name="generate-change-listener-help">
      <xsl:with-param name="top-name" select="$top-name" />
      <xsl:with-param name="name" select="$this-name" />
    </xsl:call-template>
    <!--
      Process parent hierarchy.
    -->
    <xsl:for-each
      select="$this/adm:profile[@name='preprocessor']/admpp:parent-managed-object">
      <xsl:call-template name="generate-change-listener-help">
        <xsl:with-param name="top-name" select="$top-name" />
        <xsl:with-param name="name" select="@name" />
      </xsl:call-template>
    </xsl:for-each>
  </xsl:template>
  <!--
    Generate a single set of change listener registration methods.
  -->
  <xsl:template name="generate-change-listener-help">
    <xsl:param name="top-name" select="/.." />
    <xsl:param name="name" select="/.." />
    <xsl:variable name="short-name">
      <xsl:choose>
        <xsl:when test="not($top-name) or $top-name = $name">
          <xsl:value-of select="''" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:variable name="top-length"
            select="string-length($top-name)" />
          <xsl:variable name="length" select="string-length($name)" />
          <xsl:variable name="diff" select="$length - $top-length" />
          <xsl:value-of select="substring($name, 1, $diff - 1)" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="java-class">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="$name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="short-java-class">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="$short-name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:value-of
      select="concat('    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;')" />
    <xsl:value-of
      select="concat('    public void add', $short-java-class, 'ChangeListener(&#xa;',
                     '        ConfigurationChangeListener&lt;',$java-class,'Cfg&gt; listener) {&#xa;',
                     '      impl.registerChangeListener(listener);&#xa;',
                     '    }&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="concat('    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;')" />
    <xsl:value-of
      select="concat('    public void remove', $short-java-class, 'ChangeListener(&#xa;',
                     '        ConfigurationChangeListener&lt;',$java-class,'Cfg&gt; listener) {&#xa;',
                     '      impl.deregisterChangeListener(listener);&#xa;',
                     '    }&#xa;')" />
  </xsl:template>
  <!--
    Generate import statements for change-listener
  -->
  <xsl:template name="generate-change-listener-import-statements">
    <!--
      Process this managed object.
    -->
    <xsl:element name="import">
      <xsl:value-of
        select="concat($this-package, '.server.', $this-java-class, 'Cfg')" />
    </xsl:element>
    <!--
      Process parent hierarchy.
    -->
    <xsl:for-each
      select="$this/adm:profile[@name='preprocessor']/admpp:parent-managed-object">
      <xsl:variable name="java-class">
        <xsl:call-template name="name-to-java">
          <xsl:with-param name="value" select="@name" />
        </xsl:call-template>
      </xsl:variable>
      <xsl:element name="import">
        <xsl:value-of
          select="concat(@package, '.server.', $java-class, 'Cfg')" />
      </xsl:element>
    </xsl:for-each>
  </xsl:template>
  <!--
    Generate an enumeration for a locally defined enumerated property.
  -->
  <xsl:template name="generate-enumeration">
    <xsl:value-of
      select="concat('  /**&#xa;',
                     '   * Defines the set of permissable values for the &quot;', @name, '&quot; property.&#xa;')" />
    <xsl:if test="adm:synopsis">
      <xsl:value-of select="'   * &lt;p&gt;&#xa;'" />
      <xsl:call-template name="add-java-comment">
        <xsl:with-param name="indent-text" select="'   *'" />
        <xsl:with-param name="content" select="adm:synopsis" />
      </xsl:call-template>
    </xsl:if>
    <xsl:if test="adm:description">
      <xsl:value-of select="'   * &lt;p&gt;&#xa;'" />
      <xsl:call-template name="add-java-comment">
        <xsl:with-param name="indent-text" select="'   *'" />
        <xsl:with-param name="content" select="adm:description" />
      </xsl:call-template>
    </xsl:if>
    <xsl:value-of
      select="concat('   */&#xa;',
                     '  public static enum ')" />
    <xsl:call-template name="name-to-java">
      <xsl:with-param name="value" select="@name" />
    </xsl:call-template>
    <xsl:value-of select="' {&#xa;'" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:for-each select="adm:syntax/adm:enumeration/adm:value">
      <xsl:sort select="@name" />
      <xsl:value-of select="'    /**&#xa;'" />
      <xsl:call-template name="add-java-comment">
        <xsl:with-param name="indent-text" select="'     *'" />
        <xsl:with-param name="content" select="adm:description" />
      </xsl:call-template>
      <xsl:value-of select="'     */&#xa;'" />
      <xsl:value-of select="'    '" />
      <xsl:call-template name="name-to-java-constant">
        <xsl:with-param name="value" select="@name" />
      </xsl:call-template>
      <xsl:value-of select="concat('(&quot;', @name, '&quot;)')" />
      <xsl:choose>
        <xsl:when test="position() != last()">
          <xsl:value-of select="',&#xa;'" />
          <xsl:text>&#xa;</xsl:text>
          <xsl:text>&#xa;</xsl:text>
          <xsl:text>&#xa;</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="';&#xa;'" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="'    // String representation of the value.&#xa;'" />
    <xsl:value-of select="'    private final String name;&#xa;'" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of select="'    // Private constructor.&#xa;'" />
    <xsl:value-of select="'    private '" />
    <xsl:call-template name="name-to-java">
      <xsl:with-param name="value" select="@name" />
    </xsl:call-template>
    <xsl:value-of
      select="concat('(String name) { this.name = name; }&#xa;',
                     '&#xa;',
                     '&#xa;',
                     '&#xa;',
                     '    /**&#xa;',
                     '     * {@inheritDoc}&#xa;',
                     '     */&#xa;',
                     '    public String toString() { return name; }&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of select="'  }&#xa;'" />
  </xsl:template>
  <!--
    Main document parsing template.
  -->
  <xsl:template match="/">
    <xsl:call-template name="copyright-notice" />
    <xsl:value-of
      select="concat('package ', $this-package, '.meta;&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:call-template name="generate-import-statements">
      <xsl:with-param name="imports">
        <xsl:if
          test="$this-local-properties[@multi-valued='true' or
                                       @read-only='true' or
                                       @hidden='true' or
                                       @mandatory='true']">
          <import>org.opends.server.admin.PropertyOption</import>
        </xsl:if>
        <xsl:if
          test="$this-local-properties/adm:default-behavior/adm:undefined
                | $this-local-properties[@mandatory='true']">
          <import>
            org.opends.server.admin.UndefinedDefaultBehaviorProvider
          </import>
        </xsl:if>
        <xsl:if
          test="$this-local-properties/adm:default-behavior/adm:alias">
          <import>
            org.opends.server.admin.AliasDefaultBehaviorProvider
          </import>
        </xsl:if>
        <xsl:if
          test="$this-local-properties/adm:default-behavior/adm:defined">
          <import>
            org.opends.server.admin.DefinedDefaultBehaviorProvider
          </import>
          <import>
            org.opends.server.admin.DefaultBehaviorProvider
          </import>
        </xsl:if>
        <xsl:element name="import">
          <xsl:value-of
            select="concat($this-package, '.client.', $this-java-class, 'CfgClient')" />
        </xsl:element>
        <xsl:element name="import">
          <xsl:value-of
            select="concat($this-package, '.server.', $this-java-class, 'Cfg')" />
        </xsl:element>
        <xsl:for-each select="$this-inherited-properties">
          <xsl:call-template name="get-property-java-imports" />
        </xsl:for-each>
        <xsl:for-each select="$this-all-properties">
          <xsl:call-template
            name="get-property-definition-java-imports" />
        </xsl:for-each>
        <xsl:for-each select="$this-all-relations">
          <xsl:variable name="java-class-name">
            <xsl:call-template name="name-to-java">
              <xsl:with-param name="value"
                select="@managed-object-name" />
            </xsl:call-template>
          </xsl:variable>
          <xsl:element name="import">
            <xsl:value-of
              select="concat(@managed-object-package, '.client.', $java-class-name, 'CfgClient')" />
          </xsl:element>
          <xsl:element name="import">
            <xsl:value-of
              select="concat(@managed-object-package, '.server.', $java-class-name, 'Cfg')" />
          </xsl:element>
        </xsl:for-each>
        <xsl:choose>
          <xsl:when test="$this-is-abstract">
            <import>
              org.opends.server.admin.AbstractManagedObjectDefinition
            </import>
          </xsl:when>
          <xsl:otherwise>
            <import>
              org.opends.server.admin.ManagedObjectDefinition
            </import>
            <import>org.opends.server.admin.PropertyProvider</import>
            <import>org.opends.server.admin.OperationsException</import>
            <import>
              org.opends.server.admin.client.ManagedObject
            </import>
            <import>
              org.opends.server.admin.server.ServerManagedObject
            </import>
            <xsl:if test="not($this-is-root)">
              <import>
                org.opends.server.admin.server.ConfigurationChangeListener
              </import>
              <xsl:call-template
                name="generate-change-listener-import-statements" />
            </xsl:if>
            <import>org.opends.server.types.DN</import>
            <xsl:if test="$this-all-relations/adm:one-to-many">
              <import>
                org.opends.server.admin.InstantiableRelationDefinition
              </import>
              <import>
                org.opends.server.admin.server.ConfigurationAddListener
              </import>
              <import>
                org.opends.server.admin.server.ConfigurationDeleteListener
              </import>
              <import>org.opends.server.config.ConfigException</import>
            </xsl:if>
            <xsl:if test="$this-all-relations/adm:one-to-zero-or-one">
              <import>
                org.opends.server.admin.OptionalRelationDefinition
              </import>
              <import>
                org.opends.server.admin.server.ConfigurationAddListener
              </import>
              <import>
                org.opends.server.admin.server.ConfigurationDeleteListener
              </import>
              <import>org.opends.server.config.ConfigException</import>
            </xsl:if>
            <xsl:if test="$this-all-relations/adm:one-to-one">
              <import>
                org.opends.server.admin.SingletonRelationDefinition
              </import>
              <import>org.opends.server.config.ConfigException</import>
            </xsl:if>
            <xsl:if test="$this-all-properties[@multi-valued='true']">
              <import>java.util.SortedSet</import>
              <import>java.util.Collection</import>
            </xsl:if>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="$this/@extends">
          <xsl:if test="$parent-package != $this-package">
            <xsl:element name="import">
              <xsl:value-of
                select="concat($parent-package, '.meta.', $parent-java-class, 'CfgDefn')" />
            </xsl:element>
          </xsl:if>
        </xsl:if>
      </xsl:with-param>
    </xsl:call-template>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:call-template name="generate-meta-class-declaration" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:call-template name="generate-meta-class-body" />
    <xsl:text>}&#xa;</xsl:text>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/package-info.xsl
New file
@@ -0,0 +1,94 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:import href="java-utilities.xsl" />
  <xsl:output method="text" encoding="us-ascii" />
  <!--
    Global parameter: the sub-package name. Either 'meta', 'client', or 'server'.
  -->
  <xsl:param name="type" select="'.'" />
  <!--
    Main document parsing template.
  -->
  <xsl:template match="/">
    <xsl:call-template name="copyright-notice" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of select="'/**&#xa;'" />
    <xsl:choose>
      <xsl:when test="$type='meta'">
        <xsl:call-template name="add-java-comment">
          <xsl:with-param name="indent-text" select="' *'" />
          <xsl:with-param name="content"
            select="concat('Provides introspection interfaces for the ',
                           normalize-space(adm:package/adm:synopsis),
                           ' This package provides programmatic access to ',
                           'information about the managed objects, their ',
                           'properties, their relationships with other ',
                           'managed objects, and their inheritance model.')" />
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$type='client'">
        <xsl:call-template name="add-java-comment">
          <xsl:with-param name="indent-text" select="' *'" />
          <xsl:with-param name="content"
            select="concat('Provides client-side interfaces for querying ',
                           'and managing the ',
                           normalize-space(adm:package/adm:synopsis),
                           ' Applications can use the interfaces defined ',
                           'within this package to retrieve, list, create, ',
                           'and remove managed objects, as well as query ',
                           'and update their properties.')" />
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$type='server'">
        <xsl:call-template name="add-java-comment">
          <xsl:with-param name="indent-text" select="' *'" />
          <xsl:with-param name="content"
            select="concat('Provides server-side interfaces for accessing ',
                           'the ', normalize-space(adm:package/adm:synopsis),
                           ' Components within the server can use the ',
                           'interfaces defined within this package to query ',
                           'the properties of the managed objects and ',
                           'register to be notified when managed objects are ',
                           'added, removed, or modified.')" />
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:message terminate="yes">
          <xsl:value-of
            select="concat('Invalid package-info sub-package name: ', $type)" />
        </xsl:message>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:value-of select="' */&#xa;'" />
    <xsl:value-of
      select="concat('package ', adm:package/@name, '.', $type, ';&#xa;')" />
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/preprocessor.xsl
New file
@@ -0,0 +1,902 @@
<!-- CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:admpp="http://www.opends.org/admin-preprocessor"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:exsl="http://exslt.org/common">
  <xsl:import href="java-utilities.xsl" />
  <xsl:output method="xml" indent="yes" />
  <!--
    Global parameter: the absolute path of the base directory where
    XML managed object definitions can be found.
  -->
  <xsl:param name="base-dir" select="'.'" />
  <!--
    Get an absolute URI from a package, object name, and suffix.
  -->
  <xsl:template name="get-uri">
    <xsl:param name="package" select="/.." />
    <xsl:param name="name" select="/.." />
    <xsl:param name="suffix" select="'.xml'" />
    <!--
      Convert the package name to a relative path.
    -->
    <xsl:variable name="rpath" select="translate($package, '.', '/')" />
    <!--
      Convert the managed object name to a file name.
    -->
    <xsl:variable name="java-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="$name" />
      </xsl:call-template>
    </xsl:variable>
    <!--
      Get the absolute path.
    -->
    <xsl:value-of
      select="concat($base-dir, '/', $rpath, '/', $java-name, $suffix)" />
  </xsl:template>
  <!--
    Get the URI of the named package definition.
  -->
  <xsl:template name="get-package-uri">
    <xsl:param name="package" select="/.." />
    <xsl:call-template name="get-uri">
      <xsl:with-param name="package" select="$package" />
      <xsl:with-param name="name" select="'package'" />
    </xsl:call-template>
  </xsl:template>
  <!--
    Get the URI of the named managed object definition.
  -->
  <xsl:template name="get-managed-object-uri">
    <xsl:param name="package" select="/.." />
    <xsl:param name="name" select="/.." />
    <xsl:call-template name="get-uri">
      <xsl:with-param name="package" select="$package" />
      <xsl:with-param name="name"
        select="concat($name, '-configuration')" />
    </xsl:call-template>
  </xsl:template>
  <!--
    Pre-process the current managed object element.
  -->
  <xsl:template name="pre-process-managed-object">
    <xsl:if test="not(adm:root-managed-object | adm:managed-object)">
      <xsl:message terminate="yes">
        <xsl:value-of select="'No managed object definition found.'" />
      </xsl:message>
    </xsl:if>
    <xsl:apply-templates
      select="adm:root-managed-object | adm:managed-object"
      mode="pre-process" />
  </xsl:template>
  <!--
    Pre-process a managed object definition: pull in the managed object's
    inherited property definitions and relations.
  -->
  <xsl:template match="adm:managed-object" mode="pre-process">
    <xsl:if test="not(@name)">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="'Managed object definition does not specify managed object name.'" />
      </xsl:message>
    </xsl:if>
    <xsl:if test="not(@package)">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="'Managed object definition does not specify managed object package.'" />
      </xsl:message>
    </xsl:if>
    <xsl:variable name="parent-name" select="@extends" />
    <xsl:variable name="parent-package">
      <!--
        The parent package defaults to this managed object's package.
      -->
      <xsl:choose>
        <xsl:when test="@parent-package">
          <xsl:value-of select="@parent-package" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="@package" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <!--
      Get this managed object's hierarchy if there is one.
    -->
    <xsl:variable name="_hierarchy">
      <xsl:if test="$parent-name">
        <xsl:variable name="uri">
          <xsl:call-template name="get-managed-object-uri">
            <xsl:with-param name="package" select="$parent-package" />
            <xsl:with-param name="name" select="$parent-name" />
          </xsl:call-template>
        </xsl:variable>
        <xsl:if test="not(document($uri)/adm:managed-object)">
          <xsl:message terminate="yes">
            <xsl:value-of
              select="concat('No managed object definition found in ', $uri, '.')" />
          </xsl:message>
        </xsl:if>
        <xsl:if
          test="not(document($uri)/adm:managed-object[@name=$parent-name and @package=$parent-package])">
          <xsl:message terminate="yes">
            <xsl:value-of
              select="concat('Managed object definition found in ', $uri, ' but it did not define a managed object ', $parent-name, ' in package ', $parent-package, '.')" />
          </xsl:message>
        </xsl:if>
        <xsl:apply-templates select="document($uri)/adm:managed-object"
          mode="pre-process" />
      </xsl:if>
    </xsl:variable>
    <xsl:variable name="hierarchy" select="exsl:node-set($_hierarchy)" />
    <!--
      Now pre-process this managed object.
    -->
    <xsl:copy>
      <!--
        Shallow copy this element and its attributes.
      -->
      <xsl:copy-of select="@*" />
      <!--
        Pre-process this managed object's elements.
      -->
      <xsl:apply-templates
        select="adm:TODO|adm:synopsis|adm:description|adm:profile"
        mode="pre-process">
        <xsl:with-param name="moname" select="@name" />
        <xsl:with-param name="mopackage" select="@package" />
        <xsl:with-param name="hierarchy" select="$hierarchy" />
      </xsl:apply-templates>
      <!--
        Add a pre-processor element defining this managed object's uppermost
        definition.
      -->
      <xsl:if test="$parent-name">
        <xsl:element name="adm:profile">
          <xsl:attribute name="name">
            <xsl:value-of select="'preprocessor'" />
          </xsl:attribute>
          <xsl:element name="admpp:parent-managed-object">
            <xsl:attribute name="name">
              <xsl:value-of select="$parent-name" />
            </xsl:attribute>
            <xsl:attribute name="package">
              <xsl:value-of select="$parent-package" />
            </xsl:attribute>
          </xsl:element>
          <xsl:copy-of
            select="$hierarchy/adm:managed-object/adm:profile[@name='preprocessor']/admpp:parent-managed-object" />
        </xsl:element>
      </xsl:if>
      <!--
        Copy all inherited relations.
      -->
      <xsl:copy-of select="$hierarchy/adm:managed-object/adm:relation" />
      <!--
        Copy all local relations.
      -->
      <xsl:apply-templates select="adm:relation" mode="pre-process">
        <xsl:with-param name="moname" select="@name" />
        <xsl:with-param name="mopackage" select="@package" />
        <xsl:with-param name="hierarchy" select="$hierarchy" />
      </xsl:apply-templates>
      <!--
        Copy all inherited properties.
      -->
      <xsl:copy-of select="$hierarchy/adm:managed-object/adm:property" />
      <!--
        Copy all local properties.
      -->
      <xsl:apply-templates select="adm:property|adm:property-reference"
        mode="pre-process">
        <xsl:with-param name="moname" select="@name" />
        <xsl:with-param name="mopackage" select="@package" />
        <xsl:with-param name="hierarchy" select="$hierarchy" />
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
  <!--
    Pre-process a managed object definition: pull in the managed object's
    inherited property definitions and relations.
  -->
  <xsl:template match="adm:root-managed-object" mode="pre-process">
    <!--
      Now pre-process this root managed object.
      By definition it has no hierarchy.
    -->
    <xsl:copy>
      <!--
        Shallow copy this element and its attributes.
      -->
      <xsl:copy-of select="@*" />
      <!--
        Pre-process this managed object's elements.
      -->
      <xsl:apply-templates mode="pre-process">
        <xsl:with-param name="moname" select="'root'" />
        <xsl:with-param name="mopackage"
          select="'org.opends.server.admin.std'" />
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
  <!--
    Pre-process a property definition by adding a "preprocessor" profile
    which contains information about where the property was defined.
  -->
  <xsl:template match="adm:property" mode="pre-process">
    <xsl:param name="mopackage" select="/.." />
    <xsl:param name="moname" select="/.." />
    <xsl:param name="hierarchy" select="/.." />
    <!--
      Make sure that this property does not have the same name as another
      property or reference in this managed object.
    -->
    <xsl:variable name="name" select="@name" />
    <xsl:if
      test="../adm:property[@name=$name][2] |
            ../adm:property-reference[@name=$name]">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="concat('Property definition ', @name, ' is already defined in this managed object')" />
      </xsl:message>
    </xsl:if>
    <!--
      Make sure that this property does not override an existing property.
    -->
    <xsl:if
      test="$hierarchy/adm:managed-object/adm:property[@name=$name]">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="concat('Property definition ', @name, ' is already defined in a parent managed object')" />
      </xsl:message>
    </xsl:if>
    <xsl:copy>
      <!--
        Shallow copy this element and its attributes.
      -->
      <xsl:copy-of select="@*" />
      <!--
        Apply templates to subordinate elements (e.g. descriptions).
      -->
      <xsl:apply-templates mode="pre-process">
        <xsl:with-param name="mopackage" select="$mopackage" />
        <xsl:with-param name="moname" select="$moname" />
        <xsl:with-param name="hierarchy" select="$hierarchy" />
      </xsl:apply-templates>
      <!--
        Now append the preprocessor profile.
      -->
      <xsl:element name="adm:profile">
        <xsl:attribute name="name">
          <xsl:value-of select="'preprocessor'" />
        </xsl:attribute>
        <xsl:element name="admpp:managed-object">
          <xsl:attribute name="name">
            <xsl:value-of select="$moname" />
          </xsl:attribute>
          <xsl:attribute name="package">
            <xsl:value-of select="$mopackage" />
          </xsl:attribute>
        </xsl:element>
      </xsl:element>
    </xsl:copy>
  </xsl:template>
  <!--
    Pre-process a property reference pulling in the referenced property
    definition and by adding a "preprocessor" profile which contains
    information about where the property was defined.
  -->
  <xsl:template match="adm:property-reference" mode="pre-process">
    <xsl:param name="mopackage" select="/.." />
    <xsl:param name="moname" select="/.." />
    <xsl:param name="hierarchy" />
    <!--
      Make sure that this property reference does not have the same name as another
      property or reference in this managed object.
    -->
    <xsl:variable name="name" select="@name" />
    <xsl:if
      test="../adm:property[@name=$name] |
            ../adm:property-reference[@name=$name][2]">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="concat('Property definition ', @name, ' is already defined in this managed object')" />
      </xsl:message>
    </xsl:if>
    <!--
      Make sure that this property does not override an existing property.
    -->
    <xsl:if
      test="$hierarchy/adm:managed-object/adm:property[@name=$name]">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="concat('Property reference ', @name, ' is already defined in a parent managed object')" />
      </xsl:message>
    </xsl:if>
    <!--
      Determine the package containing the reference property definition.
    -->
    <xsl:variable name="package">
      <xsl:choose>
        <xsl:when test="@package">
          <xsl:value-of select="@package" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$mopackage" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <!--
      Get the referenced package.
    -->
    <xsl:variable name="uri">
      <xsl:call-template name="get-package-uri">
        <xsl:with-param name="package" select="$package" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:if test="not(document($uri)/adm:package)">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="concat('No package definition found in ', $uri, '.')" />
      </xsl:message>
    </xsl:if>
    <xsl:if test="not(document($uri)/adm:package[@name=$package])">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="concat('Package definition found in ', $uri, ' but it did not define package ', $package, '.')" />
      </xsl:message>
    </xsl:if>
    <xsl:if
      test="not(document($uri)/adm:package[@name=$package]/adm:property[@name=$name])">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="concat('Referenced property definition &quot;', $name,
                           '&quot; not found in package definition &quot;', $package,
                           '&quot;.')" />
      </xsl:message>
    </xsl:if>
    <!--
      Copy the referenced property definition taking care to override
      the default behavior and admin action if required.
    -->
    <xsl:variable name="property"
      select="document($uri)/adm:package[@name=$package]/adm:property[@name=$name]" />
    <xsl:element name="adm:property">
      <xsl:copy-of select="$property/@*" />
      <xsl:apply-templates
        select="$property/adm:TODO | $property/adm:synopsis | $property/adm:description"
        mode="pre-process">
        <xsl:with-param name="mopackage" select="$mopackage" />
        <xsl:with-param name="moname" select="$moname" />
        <xsl:with-param name="hierarchy" select="$hierarchy" />
      </xsl:apply-templates>
      <xsl:choose>
        <xsl:when test="adm:requires-admin-action">
          <xsl:apply-templates select="adm:requires-admin-action"
            mode="pre-process">
            <xsl:with-param name="mopackage" select="$mopackage" />
            <xsl:with-param name="moname" select="$moname" />
            <xsl:with-param name="hierarchy" select="$hierarchy" />
          </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates
            select="$property/adm:requires-admin-action"
            mode="pre-process">
            <xsl:with-param name="mopackage" select="$mopackage" />
            <xsl:with-param name="moname" select="$moname" />
            <xsl:with-param name="hierarchy" select="$hierarchy" />
          </xsl:apply-templates>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:choose>
        <xsl:when test="adm:default-behavior">
          <xsl:apply-templates select="adm:default-behavior"
            mode="pre-process">
            <xsl:with-param name="mopackage" select="$mopackage" />
            <xsl:with-param name="moname" select="$moname" />
            <xsl:with-param name="hierarchy" select="$hierarchy" />
          </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="$property/adm:default-behavior"
            mode="pre-process">
            <xsl:with-param name="mopackage" select="$mopackage" />
            <xsl:with-param name="moname" select="$moname" />
            <xsl:with-param name="hierarchy" select="$hierarchy" />
          </xsl:apply-templates>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates
        select="$property/adm:syntax | $property/adm:profile"
        mode="pre-process">
        <xsl:with-param name="mopackage" select="$mopackage" />
        <xsl:with-param name="moname" select="$moname" />
        <xsl:with-param name="hierarchy" select="$hierarchy" />
      </xsl:apply-templates>
      <!--
        Now append the preprocessor profile.
      -->
      <xsl:element name="adm:profile">
        <xsl:attribute name="name">
          <xsl:value-of select="'preprocessor'" />
        </xsl:attribute>
        <xsl:element name="admpp:managed-object">
          <xsl:attribute name="name">
            <xsl:value-of select="$moname" />
          </xsl:attribute>
          <xsl:attribute name="package">
            <xsl:value-of select="$mopackage" />
          </xsl:attribute>
        </xsl:element>
        <xsl:element name="admpp:package">
          <xsl:attribute name="name">
            <xsl:value-of select="$package" />
          </xsl:attribute>
        </xsl:element>
      </xsl:element>
    </xsl:element>
  </xsl:template>
  <!--
    Pre-process a relation, merging information from the referenced
    managed object where required, and by adding a "preprocessor" profile
    which contains information about where the relation was defined.
  -->
  <xsl:template match="adm:relation" mode="pre-process">
    <xsl:param name="mopackage" select="/.." />
    <xsl:param name="moname" select="/.." />
    <xsl:param name="hierarchy" select="/.." />
    <!--
      Determine the name of the relation.
    -->
    <xsl:variable name="name" select="@name" />
    <!--
      Make sure that this relation does not override an existing relation.
    -->
    <xsl:if
      test="$hierarchy/adm:managed-object/adm:relation[@name=$name]">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="concat('Relation ', $name, ' is already defined in a parent managed object.')" />
      </xsl:message>
    </xsl:if>
    <!--
      Make sure that this relation is not already defined in this managed object.
    -->
    <xsl:if test="../adm:relation[@name=$name][2]">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="concat('Relation ', $name, ' is already defined in this managed object.')" />
      </xsl:message>
    </xsl:if>
    <!--
      Now get the referenced managed object.
    -->
    <xsl:variable name="mname">
      <xsl:choose>
        <xsl:when test="not(@managed-object-name)">
          <xsl:value-of select="$name" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="@managed-object-name" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="mpackage">
      <xsl:choose>
        <xsl:when test="not(@managed-object-package)">
          <xsl:value-of select="$mopackage" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="@managed-object-package" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="uri">
      <xsl:call-template name="get-managed-object-uri">
        <xsl:with-param name="name" select="$mname" />
        <xsl:with-param name="package" select="$mpackage" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="managed-object"
      select="document($uri)/adm:managed-object[@name=$mname]" />
    <xsl:if test="not($managed-object)">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="concat('Managed object definition &quot;', $mname, '&quot; not found in ', $uri, '.')" />
      </xsl:message>
    </xsl:if>
    <!--
      Now merge the relation.
    -->
    <xsl:copy>
      <xsl:copy-of select="@*" />
      <!--
        Add missing attribute managed-object-name if it is not provided.
      -->
      <xsl:if test="not(@managed-object-name)">
        <xsl:attribute name="managed-object-name">
          <xsl:value-of select="$mname" />
        </xsl:attribute>
      </xsl:if>
      <!--
        Add missing attribute managed-object-package if it is not provided.
      -->
      <xsl:if test="not(@managed-object-package)">
        <xsl:attribute name="managed-object-package">
          <xsl:value-of select="$mpackage" />
        </xsl:attribute>
      </xsl:if>
      <!--
        Copy TODO element.
      -->
      <xsl:copy-of select="adm:TODO" />
      <!--
        Copy synopsis element from referenced managed object if it is undefined.
      -->
      <xsl:choose>
        <xsl:when test="adm:synopsis">
          <xsl:apply-templates select="adm:synopsis"
            mode="merge-relation">
            <xsl:with-param name="managed-object"
              select="$managed-object" />
          </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="$managed-object/adm:synopsis"
            mode="merge-relation">
            <xsl:with-param name="managed-object"
              select="$managed-object" />
          </xsl:apply-templates>
        </xsl:otherwise>
      </xsl:choose>
      <!--
        Copy description element from referenced managed object if it is undefined.
      -->
      <xsl:choose>
        <xsl:when test="adm:description">
          <xsl:apply-templates select="adm:description"
            mode="merge-relation">
            <xsl:with-param name="managed-object"
              select="$managed-object" />
          </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="$managed-object/adm:description"
            mode="merge-relation">
            <xsl:with-param name="managed-object"
              select="$managed-object" />
          </xsl:apply-templates>
        </xsl:otherwise>
      </xsl:choose>
      <!--
        Merge remaining elements.
      -->
      <xsl:apply-templates
        select="*[not(self::adm:TODO|self::adm:synopsis|self::adm:description)]"
        mode="merge-relation">
        <xsl:with-param name="managed-object" select="$managed-object" />
      </xsl:apply-templates>
      <!--
        Now append the preprocessor profile.
      -->
      <xsl:element name="adm:profile">
        <xsl:attribute name="name">
          <xsl:value-of select="'preprocessor'" />
        </xsl:attribute>
        <xsl:element name="admpp:managed-object">
          <xsl:attribute name="name">
            <xsl:value-of select="$moname" />
          </xsl:attribute>
          <xsl:attribute name="package">
            <xsl:value-of select="$mopackage" />
          </xsl:attribute>
        </xsl:element>
      </xsl:element>
    </xsl:copy>
  </xsl:template>
  <!--
    Default template for merging relations.
  -->
  <xsl:template match="*|comment()" mode="merge-relation">
    <xsl:param name="managed-object" select="/.." />
    <xsl:copy>
      <xsl:copy-of select="@*" />
      <xsl:apply-templates mode="merge-relation">
        <xsl:with-param name="managed-object" select="$managed-object" />
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
  <!--
    Merge a one-to-many relation.
  -->
  <xsl:template match="adm:one-to-many" mode="merge-relation">
    <xsl:param name="managed-object" select="/.." />
    <xsl:copy>
      <xsl:copy-of select="@*" />
      <!--
        Add missing plural name attribute if not present.
      -->
      <xsl:if test="not(@plural-name)">
        <xsl:attribute name="plural-name">
          <xsl:value-of select="$managed-object/@plural-name" />
        </xsl:attribute>
      </xsl:if>
      <xsl:apply-templates mode="merge-relation">
        <xsl:with-param name="managed-object" select="$managed-object" />
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
  <!--
    Process a rich-description element in a relation.
  -->
  <xsl:template match="adm:synopsis|adm:description"
    mode="merge-relation">
    <xsl:param name="managed-object" select="/.." />
    <xsl:copy>
      <!--
        Shallow copy.
      -->
      <xsl:copy-of select="@*" />
      <xsl:apply-templates mode="rich-description">
        <xsl:with-param name="ufn">
          <xsl:call-template name="name-to-ufn">
            <xsl:with-param name="value" select="$managed-object/@name" />
          </xsl:call-template>
        </xsl:with-param>
        <xsl:with-param name="ufpn">
          <xsl:call-template name="name-to-ufn">
            <xsl:with-param name="value"
              select="$managed-object/@plural-name" />
          </xsl:call-template>
        </xsl:with-param>
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
  <!--
    Process a rich-description element.
  -->
  <xsl:template
    match="adm:synopsis|adm:description|adm:unit-description"
    mode="pre-process">
    <xsl:copy>
      <!--
        Shallow copy.
      -->
      <xsl:copy-of select="@*" />
      <xsl:apply-templates mode="rich-description">
        <xsl:with-param name="ufn" select="$this-ufn" />
        <xsl:with-param name="ufpn" select="$this-ufpn" />
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
  <!--
    Process a user-friendly-name element.
  -->
  <xsl:template match="adm:user-friendly-name"
    mode="rich-description">
    <xsl:param name="ufn" select="/.." />
    <xsl:value-of select="$ufn" />
  </xsl:template>
  <!--
    Process a user-friendly-plural-name element.
  -->
  <xsl:template match="adm:user-friendly-plural-name"
    mode="rich-description">
    <xsl:param name="ufpn" select="/.." />
    <xsl:value-of select="$ufpn" />
  </xsl:template>
  <!--
    Process a product-name element.
  -->
  <xsl:template match="adm:product-name" mode="rich-description">
    <xsl:value-of select="$product-name" />
  </xsl:template>
  <!--
    Default template for rich descriptions.
  -->
  <xsl:template match="*|comment()" mode="rich-description">
    <xsl:param name="ufn" select="/.." />
    <xsl:param name="ufpn" select="/.." />
    <xsl:copy>
      <xsl:copy-of select="@*" />
      <xsl:apply-templates mode="rich-description">
        <xsl:with-param name="ufn" select="$ufn" />
        <xsl:with-param name="ufpn" select="$ufpn" />
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
  <!--
    Default template for pre-processing.
  -->
  <xsl:template match="*|comment()" mode="pre-process">
    <xsl:param name="mopackage" select="/.." />
    <xsl:param name="moname" select="/.." />
    <xsl:param name="hierarchy" />
    <xsl:copy>
      <xsl:copy-of select="@*" />
      <xsl:apply-templates mode="pre-process">
        <xsl:with-param name="mopackage" select="$mopackage" />
        <xsl:with-param name="moname" select="$moname" />
        <xsl:with-param name="hierarchy" select="$hierarchy" />
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
  <!--
    Useful variables relating to the current managed object.
  -->
  <!--
    Product name.
    FIXME: should get this from the root configuration but for some
    reason we get a circular dependency error when constructing
    the URI in JDK1.6.
  -->
  <xsl:variable name="product-name" select="'OpenDS Directory Server'" />
  <xsl:variable name="this-name">
    <xsl:choose>
      <xsl:when test="/adm:managed-object">
        <xsl:value-of select="/adm:managed-object/@name" />
      </xsl:when>
      <xsl:otherwise>
        <!--
          Must be the root configuration.
        -->
        <xsl:value-of select="'root'" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="this-plural-name">
    <xsl:choose>
      <xsl:when test="/adm:managed-object">
        <xsl:value-of select="/adm:managed-object/@plural-name" />
      </xsl:when>
      <xsl:otherwise>
        <!--
          Must be the root configuration - the plural form should never
          be required as this is a singleton. We'll define it for
          consistency.
        -->
        <xsl:value-of select="'roots'" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="this-ufn">
    <xsl:call-template name="name-to-ufn">
      <xsl:with-param name="value" select="$this-name" />
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="this-ufpn">
    <xsl:call-template name="name-to-ufn">
      <xsl:with-param name="value" select="$this-plural-name" />
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="_this">
    <xsl:call-template name="pre-process-managed-object" />
  </xsl:variable>
  <xsl:variable name="_this_tmp" select="exsl:node-set($_this)" />
  <xsl:variable name="this"
    select="$_this_tmp/adm:managed-object | $_this_tmp/adm:root-managed-object" />
  <xsl:variable name="this-is-abstract"
    select="boolean(string($this/@abstract) = 'true')" />
  <xsl:variable name="this-is-root"
    select="not(local-name($this) = 'managed-object')" />
  <xsl:variable name="this-package">
    <xsl:choose>
      <xsl:when test="not($this-is-root)">
        <xsl:value-of select="$this/@package" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'org.opends.server.admin.std'" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="this-java-class">
    <xsl:call-template name="name-to-java">
      <xsl:with-param name="value" select="$this-name" />
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="this-short-name">
    <xsl:variable name="top-name"
      select="$this/adm:profile[@name='preprocessor']/admpp:parent-managed-object[last()]/@name" />
    <xsl:choose>
      <xsl:when test="$this-is-root">
        <xsl:value-of select="''" />
      </xsl:when>
      <xsl:when test="not($top-name)">
        <xsl:value-of select="''" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:variable name="top-length"
          select="string-length($top-name)" />
        <xsl:variable name="this-length"
          select="string-length($this-name)" />
        <xsl:variable name="diff" select="$this-length - $top-length" />
        <xsl:variable name="start"
          select="substring($this-name, 1, $diff - 1)" />
        <xsl:variable name="middle"
          select="substring($this-name, $diff, 1)" />
        <xsl:variable name="end"
          select="substring($this-name, $diff + 1, $top-length)" />
        <xsl:if test="$middle != '-' or $end != $top-name">
          <xsl:message terminate="yes">
            <xsl:value-of
              select="concat('The managed object ', $this-name, ' should end with ', $top-name)" />
          </xsl:message>
        </xsl:if>
        <xsl:value-of select="$start" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="this-short-java-class">
    <xsl:call-template name="name-to-java">
      <xsl:with-param name="value" select="$this-short-name" />
    </xsl:call-template>
  </xsl:variable>
  <!--
    Useful variables relating to the parent managed object.
  -->
  <xsl:variable name="parent-name" select="$this/@extends" />
  <xsl:variable name="parent-package">
    <xsl:choose>
      <xsl:when test="$this/@parent-package">
        <xsl:value-of select="$this/@parent-package" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$this-package" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="parent-java-class">
    <xsl:call-template name="name-to-java">
      <xsl:with-param name="value" select="$parent-name" />
    </xsl:call-template>
  </xsl:variable>
  <!--
    Useful variables relating to managed object's relations.
  -->
  <xsl:variable name="this-local-relations"
    select="$this/adm:relation[adm:profile[@name='preprocessor']/admpp:managed-object[@name=$this-name and @package=$this-package]]" />
  <xsl:variable name="this-inherited-relations"
    select="$this/adm:relation[adm:profile[@name='preprocessor']/admpp:managed-object[not(@name=$this-name and @package=$this-package)]]" />
  <xsl:variable name="this-all-relations" select="$this/adm:relation" />
  <!--
    Useful variables relating to managed object's properties.
  -->
  <xsl:variable name="this-local-properties"
    select="$this/adm:property[adm:profile[@name='preprocessor']/admpp:managed-object[@name=$this-name and @package=$this-package]]" />
  <xsl:variable name="this-inherited-properties"
    select="$this/adm:property[adm:profile[@name='preprocessor']/admpp:managed-object[not(@name=$this-name and @package=$this-package)]]" />
  <xsl:variable name="this-all-properties" select="$this/adm:property" />
  <!--
    Default rule for testing.
  -->
  <xsl:template match="/">
    <xsl:copy-of select="$this" />
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types.xsl
New file
@@ -0,0 +1,335 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    WARNING: when new property types are defined, they must be
    included here.
    These stylesheets are included and NOT imported so that they
    have the same import precedence as the default rules.
  -->
  <xsl:include href="property-types/attribute-type.xsl" />
  <xsl:include href="property-types/boolean.xsl" />
  <xsl:include href="property-types/dn.xsl" />
  <xsl:include href="property-types/duration.xsl" />
  <xsl:include href="property-types/enumeration.xsl" />
  <xsl:include href="property-types/integer.xsl" />
  <xsl:include href="property-types/ip-address-mask.xsl" />
  <xsl:include href="property-types/ip-address.xsl" />
  <xsl:include href="property-types/java-class.xsl" />
  <xsl:include href="property-types/oid.xsl" />
  <xsl:include href="property-types/password.xsl" />
  <xsl:include href="property-types/size.xsl" />
  <xsl:include href="property-types/string.xsl" />
  <!--
    Default rules applicable to each property type.
    Property type stylesheets should override these where necessary.
  -->
  <!--
    Get the Java object-based type associated with a property syntax.
    By default property values are represented using strings.
  -->
  <xsl:template match="*" mode="java-value-type">
    <xsl:value-of select="'String'" />
  </xsl:template>
  <!--
    Get the Java primitive type, if applicable, associated with a
    property syntax.
    By default property values are represented using the type defined by
    java-value-type.
  -->
  <xsl:template match="*" mode="java-value-primitive-type">
    <xsl:apply-templates select="." mode="java-value-type" />
  </xsl:template>
  <!--
    Generate import elements represesenting the import statements
    required by values of the property.
    By default property values are represented using strings which
    don't require an import statement - so do nothing.
  -->
  <xsl:template match="*" mode="java-value-imports" />
  <!--
    Generate the Java definition type used to define the property.
    By default properties are defined using string property
    definitions.
  -->
  <xsl:template match="*" mode="java-definition-type">
    <xsl:value-of select="'StringPropertyDefinition'" />
  </xsl:template>
  <!--
    Generate import elements represesenting the import statements
    required by the property's definition and its values.
    By default assume that the definition type is in
    org.opends.server.admin and is derived directly from the
    java-definition-type (might not be the case for parameterized
    types. In addition pull in the value imports.
  -->
  <xsl:template match="*" mode="java-definition-imports">
    <xsl:element name="import">
      <xsl:value-of select="'org.opends.server.admin.'" />
      <xsl:apply-templates select="." mode="java-definition-type" />
    </xsl:element>
    <xsl:apply-templates select="." mode="java-value-imports" />
  </xsl:template>
  <!--
    If the property definition is generic, get the generic type. Otherwise,
    do nothing.
    Default: do nothing.
  -->
  <xsl:template match="*" mode="java-definition-generic-type" />
  <!--
    Generate property definition specific constructor setters.
    By default, do nothing.
  -->
  <xsl:template match="*" mode="java-definition-ctor" />
  <!--
    Wrapper templates which can be called directly instead of
    requiring the more indirect and less readable apply-templates
    mechanism.
  -->
  <!--
    Get the Java imports required for a property's values.
  -->
  <xsl:template name="get-property-java-imports">
    <xsl:apply-templates select="adm:syntax/*"
      mode="java-value-imports" />
  </xsl:template>
  <!--
    Get the Java imports required for a property's definition.
  -->
  <xsl:template name="get-property-definition-java-imports">
    <xsl:apply-templates select="adm:syntax/*"
      mode="java-definition-imports" />
  </xsl:template>
  <!--
    Get the Java object-based type associated with a property syntax.
  -->
  <xsl:template name="get-property-java-type">
    <xsl:apply-templates select="adm:syntax/*" mode="java-value-type" />
  </xsl:template>
  <!--
    Get the Java primitive type, if applicable, associated with a
    property syntax.
  -->
  <xsl:template name="get-property-java-primitive-type">
    <xsl:apply-templates select="adm:syntax/*"
      mode="java-value-primitive-type" />
  </xsl:template>
  <!--
    Get the property definition type associated with a
    property syntax.
  -->
  <xsl:template name="get-property-definition-type">
    <xsl:apply-templates select="adm:syntax/*"
      mode="java-definition-type" />
  </xsl:template>
  <!--
    If the property definition is generic, get the generic type. Otherwise,
    do nothing.
  -->
  <xsl:template name="get-property-definition-generic-type">
    <xsl:apply-templates select="adm:syntax/*"
      mode="java-definition-generic-type" />
  </xsl:template>
  <!--
    Generate property definition specific constructor setters.
  -->
  <xsl:template name="get-property-definition-ctor">
    <xsl:apply-templates select="adm:syntax/*"
      mode="java-definition-ctor" />
  </xsl:template>
  <!--
    Generate the property getter declarations.
  -->
  <xsl:template name="generate-property-getter-declaration">
    <xsl:param name="interface" select="/.." />
    <xsl:variable name="name" select="@name" />
    <xsl:variable name="java-property-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="$name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:value-of
      select="concat('  /**&#xa;',
                     '   * Get the &quot;', $name,'&quot; property.&#xa;')" />
    <xsl:if test="adm:synopsis">
      <xsl:value-of select="'   * &lt;p&gt;&#xa;'" />
      <xsl:call-template name="add-java-comment">
        <xsl:with-param name="indent-text" select="'   *'" />
        <xsl:with-param name="content" select="adm:synopsis" />
      </xsl:call-template>
    </xsl:if>
    <xsl:if test="adm:description">
      <xsl:value-of select="'   * &lt;p&gt;&#xa;'" />
      <xsl:call-template name="add-java-comment">
        <xsl:with-param name="indent-text" select="'   *'" />
        <xsl:with-param name="content" select="adm:description" />
      </xsl:call-template>
    </xsl:if>
    <xsl:choose>
      <xsl:when test="string(@multi-valued) != 'true'">
        <xsl:value-of
          select="concat('   *&#xa;',
                     '   * @return Returns the value of the &quot;', $name,'&quot; property.&#xa;',
                     '   */&#xa;')" />
        <xsl:value-of select="'  '" />
        <xsl:choose>
          <xsl:when test="adm:default-behavior/adm:defined">
            <!--
              The method is guaranteed to return a value since there is a
              well-defined default value.
            -->
            <xsl:call-template name="get-property-java-primitive-type" />
          </xsl:when>
          <xsl:when
            test="$interface = 'server' and @mandatory = 'true'">
            <!--
              The method is guaranteed to return a value in the server interface, but
              not necessarily in the client, since the mandatory property might not
              have been created yet.
            -->
            <xsl:call-template name="get-property-java-primitive-type" />
          </xsl:when>
          <xsl:otherwise>
            <xsl:call-template name="get-property-java-type" />
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of
          select="concat('   *&#xa;',
                     '   * @return Returns the values of the &quot;', $name,'&quot; property.&#xa;',
                     '   */&#xa;')" />
        <xsl:value-of select="'  SortedSet&lt;'" />
        <xsl:call-template name="get-property-java-type" />
        <xsl:value-of select="'&gt;'" />
      </xsl:otherwise>
    </xsl:choose>
    <xsl:choose>
      <xsl:when test="adm:syntax/adm:boolean">
        <xsl:value-of select="' is'" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="' get'" />
      </xsl:otherwise>
    </xsl:choose>
    <xsl:value-of
      select="concat($java-property-name,
                                 '();&#xa;')" />
  </xsl:template>
  <!--
    Generate the property setter declarations.
  -->
  <xsl:template name="generate-property-setter-declaration">
    <xsl:if test="string(@read-only) != 'true'">
      <xsl:variable name="name" select="@name" />
      <xsl:variable name="java-property-name">
        <xsl:call-template name="name-to-java">
          <xsl:with-param name="value" select="$name" />
        </xsl:call-template>
      </xsl:variable>
      <xsl:value-of
        select="concat('  /**&#xa;',
                     '   * Set the &quot;', $name, '&quot; property.&#xa;')" />
      <xsl:if test="adm:synopsis">
        <xsl:value-of select="'   * &lt;p&gt;&#xa;'" />
        <xsl:call-template name="add-java-comment">
          <xsl:with-param name="indent-text" select="'   *'" />
          <xsl:with-param name="content" select="adm:synopsis" />
        </xsl:call-template>
      </xsl:if>
      <xsl:if test="adm:description">
        <xsl:value-of select="'   * &lt;p&gt;&#xa;'" />
        <xsl:call-template name="add-java-comment">
          <xsl:with-param name="indent-text" select="'   *'" />
          <xsl:with-param name="content" select="adm:description" />
        </xsl:call-template>
      </xsl:if>
      <xsl:choose>
        <xsl:when test="string(@multi-valued) != 'true'">
          <xsl:value-of
            select="concat('   *&#xa;',
                     '   * @param value The value of the &quot;', $name, '&quot; property.&#xa;',
                     '   * @throws IllegalPropertyValueException&#xa;',
                     '   *           If the new value is invalid.&#xa;',
                     '   *&#xa;',
                     '   */&#xa;',
                     '  void set', $java-property-name, '(')" />
          <xsl:choose>
            <xsl:when test="@mandatory = 'true'">
              <xsl:call-template
                name="get-property-java-primitive-type" />
            </xsl:when>
            <xsl:otherwise>
              <xsl:call-template name="get-property-java-type" />
            </xsl:otherwise>
          </xsl:choose>
          <xsl:value-of
            select="' value) throws IllegalPropertyValueException;&#xa;'" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of
            select="concat('   *&#xa;',
                     '   * @param values The values of the &quot;', $name, '&quot; property.&#xa;',
                     '   * @throws IllegalPropertyValueException&#xa;',
                     '   *           If one or more of the new values are invalid.&#xa;',
                     '   *&#xa;',
                     '   */&#xa;',
                     '  void set', $java-property-name, '(Collection&lt;')" />
          <xsl:call-template name="get-property-java-type" />
          <xsl:value-of
            select="'&gt; values) throws IllegalPropertyValueException;&#xa;'" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/attribute-type.xsl
New file
@@ -0,0 +1,42 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing attribute type properties.
  -->
  <xsl:template match="adm:attribute-type" mode="java-value-imports">
    <import>org.opends.server.types.AttributeType</import>
  </xsl:template>
  <xsl:template match="adm:attribute-type" mode="java-value-type">
    <xsl:value-of select="'AttributeType'" />
  </xsl:template>
  <xsl:template match="adm:attribute-type"
    mode="java-definition-type">
    <xsl:value-of select="'AttributeTypePropertyDefinition'" />
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/boolean.xsl
New file
@@ -0,0 +1,41 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing boolean properties.
  -->
  <xsl:template match="adm:boolean" mode="java-value-type">
    <xsl:value-of select="'Boolean'" />
  </xsl:template>
  <xsl:template match="adm:boolean" mode="java-value-primitive-type">
    <xsl:value-of select="'boolean'" />
  </xsl:template>
  <xsl:template match="adm:boolean" mode="java-definition-type">
    <xsl:value-of select="'BooleanPropertyDefinition'" />
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/dn.xsl
New file
@@ -0,0 +1,48 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing DN properties.
  -->
  <xsl:template match="adm:dn" mode="java-value-imports">
    <import>org.opends.server.types.DN</import>
  </xsl:template>
  <xsl:template match="adm:dn" mode="java-value-type">
    <xsl:value-of select="'DN'" />
  </xsl:template>
  <xsl:template match="adm:dn" mode="java-definition-type">
    <xsl:value-of select="'DNPropertyDefinition'" />
  </xsl:template>
  <xsl:template match="adm:dn" mode="java-definition-ctor">
    <xsl:if test="adm:base">
      <xsl:value-of
        select="concat('      builder.setBaseDN(&quot;',
                       normalize-space(adm:base), '&quot;);&#xa;')" />
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/duration.xsl
New file
@@ -0,0 +1,68 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing duration properties.
  -->
  <xsl:template match="adm:duration" mode="java-value-type">
    <xsl:value-of select="'Long'" />
  </xsl:template>
  <xsl:template match="adm:duration" mode="java-value-primitive-type">
    <xsl:value-of select="'long'" />
  </xsl:template>
  <xsl:template match="adm:duration" mode="java-definition-type">
    <xsl:value-of select="'DurationPropertyDefinition'" />
  </xsl:template>
  <xsl:template match="adm:duration" mode="java-definition-ctor">
    <xsl:if test="boolean(@allow-unlimited)">
      <xsl:value-of
        select="concat('      builder.setAllowUnlimited(',
                       @allow-unlimited, ');&#xa;')" />
    </xsl:if>
    <xsl:if test="boolean(@base-unit)">
      <xsl:value-of
        select="concat('      builder.setBaseUnit(&quot;',
                       @base-unit, '&quot;);&#xa;')" />
    </xsl:if>
    <xsl:if test="boolean(@maximum-unit)">
      <xsl:value-of
        select="concat('      builder.setMaximumUnit(&quot;',
                       @maximum-unit, '&quot;);&#xa;')" />
    </xsl:if>
    <xsl:if test="boolean(@upper-limit)">
      <xsl:value-of
        select="concat('      builder.setUpperLimit(',
                       @upper-limit, 'L);&#xa;')" />
    </xsl:if>
    <xsl:if test="boolean(@lower-limit)">
      <xsl:value-of
        select="concat('      builder.setLowerLimit(',
                       @lower-limit, 'L);&#xa;')" />
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/enumeration.xsl
New file
@@ -0,0 +1,86 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:admpp="http://www.opends.org/admin-preprocessor"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing enumeration properties.
  -->
  <xsl:template match="adm:enumeration" mode="java-value-imports">
    <xsl:variable name="pp"
      select="../../adm:profile[@name='preprocessor']" />
    <xsl:element name="import">
      <xsl:choose>
        <xsl:when test="$pp/admpp:package">
          <xsl:value-of select="concat($pp/admpp:package/@name, '.')" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of
            select="concat($pp/admpp:managed-object/@package, '.meta.')" />
          <xsl:call-template name="name-to-java">
            <xsl:with-param name="value"
              select="$pp/admpp:managed-object/@name" />
          </xsl:call-template>
          <xsl:value-of select="'CfgDefn.'" />
        </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="." mode="java-value-type" />
    </xsl:element>
  </xsl:template>
  <xsl:template match="adm:enumeration"
    mode="java-definition-imports">
    <xsl:element name="import">
      <xsl:value-of
        select="'org.opends.server.admin.EnumPropertyDefinition'" />
    </xsl:element>
    <xsl:variable name="pp"
      select="../../adm:profile[@name='preprocessor']" />
    <xsl:if test="$pp/admpp:package">
      <xsl:element name="import">
        <xsl:value-of select="concat($pp/admpp:package/@name, '.')" />
        <xsl:apply-templates select="." mode="java-value-type" />
      </xsl:element>
    </xsl:if>
  </xsl:template>
  <xsl:template match="adm:enumeration" mode="java-value-type">
    <xsl:call-template name="name-to-java">
      <xsl:with-param name="value" select="../../@name" />
    </xsl:call-template>
  </xsl:template>
  <xsl:template match="adm:enumeration" mode="java-definition-type">
    <xsl:value-of select="'EnumPropertyDefinition'" />
  </xsl:template>
  <xsl:template match="adm:enumeration"
    mode="java-definition-generic-type">
    <xsl:apply-templates select="." mode="java-value-type" />
  </xsl:template>
  <xsl:template match="adm:enumeration" mode="java-definition-ctor">
    <xsl:value-of select="'      builder.setEnumClass('" />
    <xsl:apply-templates select="." mode="java-value-type" />
    <xsl:value-of select="'.class);&#xa;'" />
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/integer.xsl
New file
@@ -0,0 +1,58 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing integer properties.
  -->
  <xsl:template match="adm:integer" mode="java-value-type">
    <xsl:value-of select="'Integer'" />
  </xsl:template>
  <xsl:template match="adm:integer" mode="java-value-primitive-type">
    <xsl:value-of select="'int'" />
  </xsl:template>
  <xsl:template match="adm:integer" mode="java-definition-type">
    <xsl:value-of select="'IntegerPropertyDefinition'" />
  </xsl:template>
  <xsl:template match="adm:integer" mode="java-definition-ctor">
    <xsl:if test="boolean(@allow-unlimited)">
      <xsl:value-of
        select="concat('      builder.setAllowUnlimited(',
                       @allow-unlimited, ');&#xa;')" />
    </xsl:if>
    <xsl:if test="boolean(@upper-limit)">
      <xsl:value-of
        select="concat('      builder.setUpperLimit(',
                       @upper-limit, ');&#xa;')" />
    </xsl:if>
    <xsl:if test="boolean(@lower-limit)">
      <xsl:value-of
        select="concat('      builder.setLowerLimit(',
                       @lower-limit, ');&#xa;')" />
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/ip-address-mask.xsl
New file
@@ -0,0 +1,41 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing IP address mask properties.
  -->
  <xsl:template match="adm:ip-address-mask" mode="java-value-imports">
    <import>org.opends.server.types.AddressMask</import>
  </xsl:template>
  <xsl:template match="adm:ip-address-mask" mode="java-value-type">
    <xsl:value-of select="'AddressMask'" />
  </xsl:template>
  <xsl:template match="adm:ip-address-mask" mode="java-definition-type">
    <xsl:value-of select="'IPAddressMaskPropertyDefinition'" />
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/ip-address.xsl
New file
@@ -0,0 +1,41 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing IP address properties.
  -->
  <xsl:template match="adm:ip-address" mode="java-value-imports">
    <import>java.net.InetAddress</import>
  </xsl:template>
  <xsl:template match="adm:ip-address" mode="java-value-type">
    <xsl:value-of select="'InetAddress'" />
  </xsl:template>
  <xsl:template match="adm:ip-address" mode="java-definition-type">
    <xsl:value-of select="'IPAddressPropertyDefinition'" />
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/java-class.xsl
New file
@@ -0,0 +1,52 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing java class properties.
  -->
  <xsl:template match="adm:java-class" mode="java-value-type">
    <xsl:value-of select="'String'" />
  </xsl:template>
  <xsl:template match="adm:java-class" mode="java-definition-type">
    <xsl:value-of select="'ClassPropertyDefinition'" />
  </xsl:template>
  <xsl:template match="adm:java-class" mode="java-definition-ctor">
    <xsl:for-each select="adm:instance-of">
      <!--
        The first instance of element added to the definition
        will become the primary type for the class. This first
        element is guaranteed to be the first instance-of field
        appearing in the property's definition heirarchy working
        up from the bottom.
      -->
      <xsl:value-of
        select="concat('      builder.addInstanceOf(&quot;',
                       normalize-space(), '&quot;);&#xa;')" />
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/oid.xsl
New file
@@ -0,0 +1,38 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing OID properties.
  -->
  <xsl:template match="adm:oid" mode="java-value-type">
    <xsl:value-of select="'String'" />
  </xsl:template>
  <xsl:template match="adm:oid" mode="java-definition-type">
    <xsl:value-of select="'StringPropertyDefinition'" />
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/password.xsl
New file
@@ -0,0 +1,38 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing password properties.
  -->
  <xsl:template match="adm:password" mode="java-value-type">
    <xsl:value-of select="'String'" />
  </xsl:template>
  <xsl:template match="adm:password" mode="java-definition-type">
    <xsl:value-of select="'StringPropertyDefinition'" />
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/size.xsl
New file
@@ -0,0 +1,58 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing size properties.
  -->
  <xsl:template match="adm:size" mode="java-value-type">
    <xsl:value-of select="'Long'" />
  </xsl:template>
  <xsl:template match="adm:size" mode="java-value-primitive-type">
    <xsl:value-of select="'long'" />
  </xsl:template>
  <xsl:template match="adm:size" mode="java-definition-type">
    <xsl:value-of select="'SizePropertyDefinition'" />
  </xsl:template>
  <xsl:template match="adm:size" mode="java-definition-ctor">
    <xsl:if test="boolean(@allow-unlimited)">
      <xsl:value-of
        select="concat('      builder.setAllowUnlimited(',
                       @allow-unlimited, ');&#xa;')" />
    </xsl:if>
    <xsl:if test="boolean(@upper-limit)">
      <xsl:value-of
        select="concat('      builder.setUpperLimit(&quot;',
                       @upper-limit, '&quot;);&#xa;')" />
    </xsl:if>
    <xsl:if test="boolean(@lower-limit)">
      <xsl:value-of
        select="concat('      builder.setLowerLimit(&quot;',
                       @lower-limit, '&quot;);&#xa;')" />
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/property-types/string.xsl
New file
@@ -0,0 +1,38 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    Templates for processing string properties.
  -->
  <xsl:template match="adm:string" mode="java-value-type">
    <xsl:value-of select="'String'" />
  </xsl:template>
  <xsl:template match="adm:string" mode="java-definition-type">
    <xsl:value-of select="'StringPropertyDefinition'" />
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/serverMO.xsl
New file
@@ -0,0 +1,423 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
  xmlns:admpp="http://www.opends.org/admin-preprocessor"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:import href="java-utilities.xsl" />
  <xsl:import href="preprocessor.xsl" />
  <xsl:import href="property-types.xsl" />
  <xsl:output method="text" encoding="us-ascii" />
  <!--
    Template for generating the interface declaration.
  -->
  <xsl:template name="generate-interface-declaration">
    <xsl:value-of select="'/**&#xa;'" />
    <xsl:call-template name="add-java-comment">
      <xsl:with-param name="indent-text" select="' *'" />
      <xsl:with-param name="content"
        select="concat('A server-side interface for querying ', $this-ufn,
                       ' settings.')" />
    </xsl:call-template>
    <xsl:value-of select="' * &lt;p&gt;&#xa;'" />
    <xsl:call-template name="add-java-comment">
      <xsl:with-param name="indent-text" select="' *'" />
      <xsl:with-param name="content" select="$this/adm:synopsis" />
    </xsl:call-template>
    <xsl:value-of select="' */&#xa;'" />
    <xsl:value-of
      select="concat('public interface ',
                                   $this-java-class ,
                                   'Cfg extends ')" />
    <xsl:choose>
      <xsl:when test="boolean($this/@extends)">
        <xsl:value-of select="concat($parent-java-class,'Cfg ')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'Configuration '" />
      </xsl:otherwise>
    </xsl:choose>
    <xsl:text>{&#xa;</xsl:text>
  </xsl:template>
  <!--
    Template for generating the configuration definition getter.
  -->
  <xsl:template name="generate-configuration-definition-getter">
    <xsl:value-of
      select="concat('  /**&#xa;',
                       '   * Get the configuration definition associated with this ', $this-ufn, '.&#xa;',
                       '   *&#xa;',
                       '   * @return Returns the configuration definition associated with this ', $this-ufn, '.&#xa;',
                       '   */&#xa;')" />
    <xsl:value-of
      select="concat('  ManagedObjectDefinition&lt;? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg&gt; definition();&#xa;')" />
  </xsl:template>
  <!--
    Template for generating the change listener declaration.
  -->
  <xsl:template name="generate-change-listener-declaration">
    <xsl:value-of
      select="concat('  /**&#xa;',
                       '   * Register to be notified when this ', $this-ufn,' is changed.&#xa;',
                       '   *&#xa;',
                       '   * @param listener&#xa;',
                       '   *          The ', $this-ufn,' configuration change listener.&#xa;',
                       '   */&#xa;')" />
    <xsl:value-of
      select="concat('  void add', $this-short-java-class,
                       'ChangeListener(ConfigurationChangeListener&lt;',
                       $this-java-class,'Cfg&gt; listener);&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
      select="concat('  /**&#xa;',
                       '   * Deregister an existing ', $this-ufn,' configuration change listener.&#xa;',
                       '   *&#xa;',
                       '   * @param listener&#xa;',
                       '   *          The ', $this-ufn,' configuration change listener.&#xa;',
                       '   */&#xa;')" />
    <xsl:value-of
      select="concat('  void remove', $this-short-java-class,
                       'ChangeListener(ConfigurationChangeListener&lt;',
                       $this-java-class,'Cfg&gt; listener);&#xa;')" />
  </xsl:template>
  <!--
    Template for generating the relation getter declarations.
  -->
  <xsl:template name="generate-relation-declarations">
    <xsl:variable name="name" select="@name" />
    <xsl:variable name="ufn">
      <xsl:call-template name="name-to-ufn">
        <xsl:with-param name="value" select="$name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="java-relation-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="$name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="java-class-name">
      <xsl:call-template name="name-to-java">
        <xsl:with-param name="value" select="@managed-object-name" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="adm:one-to-one">
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Gets the ', $ufn,'.&#xa;',
                       '   *&#xa;',
                       '   * @return Returns the ', $ufn,'.&#xa;',
                       '   * @throws ConfigException&#xa;',
                       '   *           If the ', $ufn,' could not be found or it could not&#xa;',
                       '   *           be successfully decoded.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  ', $java-class-name, 'Cfg get',
                       $java-relation-name, '() throws ConfigException;&#xa;')" />
      </xsl:when>
      <xsl:when test="adm:one-to-zero-or-one">
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Determines whether or not the ', $ufn,' exists.&#xa;',
                       '   *&#xa;',
                       '   * @return Returns &lt;true&gt; if the ', $ufn,' exists.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  boolean has',
                       $java-relation-name, '();&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Gets the ', $ufn,' if it is present.&#xa;',
                       '   *&#xa;',
                       '   * @return Returns the ', $ufn,' if it is present.&#xa;',
                       '   * @throws ConfigException&#xa;',
                       '   *           If the ', $ufn,' does not exist or it could not&#xa;',
                       '   *           be successfully decoded.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  ', $java-class-name, 'Cfg get',
                       $java-relation-name, '() throws ConfigException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Registers to be notified when the ', $ufn,' is added.&#xa;',
                       '   *&#xa;',
                       '   * @param listener&#xa;',
                       '   *          The ', $ufn,' configuration add listener.&#xa;',
                       '   * @throws ConfigException&#xa;',
                       '   *          If the add listener could not be registered.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  void add', $java-relation-name,
                       'AddListener(ConfigurationAddListener&lt;',
                       $java-class-name,'Cfg&gt; listener) throws ConfigException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Deregisters an existing ', $ufn,' configuration add listener.&#xa;',
                       '   *&#xa;',
                       '   * @param listener&#xa;',
                       '   *          The ', $ufn,' configuration add listener.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  void remove', $java-relation-name,
                       'AddListener(ConfigurationAddListener&lt;',
                       $java-class-name,'Cfg&gt; listener);&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Registers to be notified the ', $ufn,' is deleted.&#xa;',
                       '   *&#xa;',
                       '   * @param listener&#xa;',
                       '   *          The ', $ufn,' configuration delete listener.&#xa;',
                       '   * @throws ConfigException&#xa;',
                       '   *          If the delete listener could not be registered.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  void add', $java-relation-name,
                       'DeleteListener(ConfigurationDeleteListener&lt;',
                       $java-class-name,'Cfg&gt; listener) throws ConfigException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Deregisters an existing ', $ufn,' configuration delete listener.&#xa;',
                       '   *&#xa;',
                       '   * @param listener&#xa;',
                       '   *          The ', $ufn,' configuration delete listener.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  void remove', $java-relation-name,
                       'DeleteListener(ConfigurationDeleteListener&lt;',
                       $java-class-name,'Cfg&gt; listener);&#xa;')" />
      </xsl:when>
      <xsl:when test="adm:one-to-many">
        <xsl:variable name="plural-name"
          select="adm:one-to-many/@plural-name" />
        <xsl:variable name="ufpn">
          <xsl:call-template name="name-to-ufn">
            <xsl:with-param name="value" select="$plural-name" />
          </xsl:call-template>
        </xsl:variable>
        <xsl:variable name="java-relation-plural-name">
          <xsl:call-template name="name-to-java">
            <xsl:with-param name="value" select="$plural-name" />
          </xsl:call-template>
        </xsl:variable>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Lists the ', $ufpn, '.&#xa;',
                       '   *&#xa;',
                       '   * @return Returns an array containing the names of the&#xa;',
                       '   *         ', $ufpn,'.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  String[] list', $java-relation-plural-name, '();&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Gets the named ', $ufn,'.&#xa;',
                       '   *&#xa;',
                       '   * @param name&#xa;',
                       '   *          The name of the ',$ufn,' to retrieve.&#xa;',
                       '   * @return Returns the named ', $ufn,'.&#xa;',
                       '   * @throws ConfigException&#xa;',
                       '   *           If the ', $ufn,' could not be found or it&#xa;',
                       '   *           could not be successfully decoded.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  ', $java-class-name, 'Cfg get',
                       $java-relation-name, '(String name) throws ConfigException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Registers to be notified when new ', $ufpn,' are added.&#xa;',
                       '   *&#xa;',
                       '   * @param listener&#xa;',
                       '   *          The ', $ufn,' configuration add listener.&#xa;',
                       '   * @throws ConfigException&#xa;',
                       '   *          If the add listener could not be registered.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  void add', $java-relation-name,
                       'AddListener(ConfigurationAddListener&lt;',
                       $java-class-name,'Cfg&gt; listener) throws ConfigException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Deregisters an existing ', $ufn,' configuration add listener.&#xa;',
                       '   *&#xa;',
                       '   * @param listener&#xa;',
                       '   *          The ', $ufn,' configuration add listener.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  void remove', $java-relation-name,
                       'AddListener(ConfigurationAddListener&lt;',
                       $java-class-name,'Cfg&gt; listener);&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Registers to be notified when existing ', $ufpn,' are deleted.&#xa;',
                       '   *&#xa;',
                       '   * @param listener&#xa;',
                       '   *          The ', $ufn,' configuration delete listener.&#xa;',
                       '   * @throws ConfigException&#xa;',
                       '   *          If the delete listener could not be registered.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  void add', $java-relation-name,
                       'DeleteListener(ConfigurationDeleteListener&lt;',
                       $java-class-name,'Cfg&gt; listener) throws ConfigException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of
          select="concat('  /**&#xa;',
                       '   * Deregisters an existing ', $ufn,' configuration delete listener.&#xa;',
                       '   *&#xa;',
                       '   * @param listener&#xa;',
                       '   *          The ', $ufn,' configuration delete listener.&#xa;',
                       '   */&#xa;')" />
        <xsl:value-of
          select="concat('  void remove', $java-relation-name,
                       'DeleteListener(ConfigurationDeleteListener&lt;',
                       $java-class-name,'Cfg&gt; listener);&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:message terminate="yes">
          <xsl:value-of
            select="concat('Unknown relation type &quot;', local-name(*), '&quot; in relation &quot;', $name, '&quot;.')" />
        </xsl:message>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--
    Main document parsing template.
  -->
  <xsl:template match="/">
    <xsl:call-template name="copyright-notice" />
    <xsl:value-of
      select="concat('package ', $this-package, '.server;&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:call-template name="generate-import-statements">
      <xsl:with-param name="imports">
        <xsl:element name="import">
          <xsl:value-of
            select="concat($this-package, '.client.', $this-java-class, 'CfgClient')" />
        </xsl:element>
        <xsl:for-each select="$this-local-properties">
          <xsl:call-template name="get-property-java-imports" />
        </xsl:for-each>
        <xsl:if test="$this-local-properties[@multi-valued='true']">
          <import>java.util.SortedSet</import>
        </xsl:if>
        <xsl:choose>
          <xsl:when test="$this/@extends">
            <xsl:if test="$parent-package != $this-package">
              <xsl:element name="import">
                <xsl:value-of
                  select="concat($parent-package, '.server.', $parent-java-class, 'Cfg')" />
              </xsl:element>
            </xsl:if>
          </xsl:when>
          <xsl:otherwise>
            <import>org.opends.server.admin.Configuration</import>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="not($this-is-root)">
          <import>
            org.opends.server.admin.server.ConfigurationChangeListener
          </import>
        </xsl:if>
        <xsl:if test="$this-local-relations">
          <import>org.opends.server.config.ConfigException</import>
        </xsl:if>
        <xsl:if
          test="$this-local-relations/adm:one-to-zero-or-one|$this-local-relations/adm:one-to-many">
          <import>
            org.opends.server.admin.server.ConfigurationAddListener
          </import>
          <import>
            org.opends.server.admin.server.ConfigurationDeleteListener
          </import>
        </xsl:if>
        <import>org.opends.server.admin.ManagedObjectDefinition</import>
      </xsl:with-param>
    </xsl:call-template>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:call-template name="generate-interface-declaration" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:call-template name="generate-configuration-definition-getter" />
    <xsl:if test="not($this-is-root)">
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-change-listener-declaration" />
    </xsl:if>
    <xsl:for-each select="$this-local-properties">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-property-getter-declaration">
        <xsl:with-param name="interface" select="'server'" />
      </xsl:call-template>
    </xsl:for-each>
    <xsl:for-each select="$this-local-relations">
      <xsl:sort select="@name" />
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-relation-declarations" />
    </xsl:for-each>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>}&#xa;</xsl:text>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/text-utilities.xsl
New file
@@ -0,0 +1,187 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    This XSLT file contains generic templates which can be used for any
    application.
  -->
  <xsl:import href="abbreviations.xsl" />
  <xsl:output method="text" encoding="us-ascii" />
  <!--
    Format a block of text. This template handles two levels of
    indentation: the indentation string for the first line, and a
    second indentation string used for subsequent lines. The template
    will output the content wrapping at the nearest word boundary to
    the specified column.
    @param indent-text
    The indentation text used for the first line.
    @param indent-text2
    The indentation text used for all lines except
    the first - defaults to the value of indent-text.
    @param content
    The text to be formatted.
    @param wrap-column
    The text column before which text should be word
    wrapped.
  -->
  <xsl:template name="format-text">
    <xsl:param name="indent-text" />
    <xsl:param name="indent-text2" select="$indent-text" />
    <xsl:param name="wrap-column" />
    <xsl:param name="content" />
    <xsl:value-of select="$indent-text" />
    <xsl:call-template name="format-text-help">
      <xsl:with-param name="indent-text" select="$indent-text2" />
      <xsl:with-param name="wrap-column" select="$wrap-column" />
      <xsl:with-param name="content" select="normalize-space($content)" />
      <xsl:with-param name="column"
        select="string-length($indent-text) + 1" />
    </xsl:call-template>
    <xsl:text>&#xa;</xsl:text>
  </xsl:template>
  <!--
    PRIVATE implementation template for format-text.
  -->
  <xsl:template name="format-text-help">
    <xsl:param name="indent-text" />
    <xsl:param name="wrap-column" />
    <xsl:param name="content" />
    <xsl:param name="column" />
    <xsl:variable name="head" select="substring-before($content, ' ')" />
    <xsl:variable name="tail" select="substring-after($content, ' ')" />
    <xsl:if test="string-length($content)">
      <xsl:choose>
        <xsl:when test="string-length($head) = 0">
          <xsl:if
            test="(string-length($content) + $column) > $wrap-column">
            <xsl:text>&#xa;</xsl:text>
            <xsl:value-of select="$indent-text" />
          </xsl:if>
          <xsl:value-of select="' '" />
          <xsl:value-of select="$content" />
        </xsl:when>
        <xsl:when
          test="(string-length($head) + $column) > $wrap-column">
          <xsl:text>&#xa;</xsl:text>
          <xsl:value-of select="$indent-text" />
          <xsl:value-of select="' '" />
          <xsl:value-of select="$head" />
          <xsl:call-template name="format-text-help">
            <xsl:with-param name="indent-text" select="$indent-text" />
            <xsl:with-param name="wrap-column" select="$wrap-column" />
            <xsl:with-param name="content" select="$tail" />
            <xsl:with-param name="column"
              select="string-length($indent-text) + string-length($head) + 1" />
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="concat(' ', $head)" />
          <xsl:call-template name="format-text-help">
            <xsl:with-param name="indent-text" select="$indent-text" />
            <xsl:with-param name="wrap-column" select="$wrap-column" />
            <xsl:with-param name="content" select="$tail" />
            <xsl:with-param name="column"
              select="$column + string-length($head) + 1" />
          </xsl:call-template>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:if>
  </xsl:template>
  <!--
    Convert a string to title-case or, if the string is a known
    abbreviation, convert it to upper-case. For example, the string
    "hello" will be converted to the string "Hello", but the string
    "ldap" will be converted to "LDAP".
    @param value
    The string to be converted to title-case.
  -->
  <xsl:template name="to-title-case">
    <xsl:param name="value" />
    <xsl:variable name="is-abbreviation">
      <xsl:call-template name="is-abbreviation">
        <xsl:with-param name="value" select="$value" />
      </xsl:call-template>
    </xsl:variable>
    <xsl:choose>
      <!-- Convert common abbreviations to uppercase -->
      <xsl:when test="$is-abbreviation = 'true'">
        <xsl:value-of
          select="translate($value,
                            'abcdefghijklmnopqrstuvwxyz',
                            'ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:variable name="first" select="substring($value, 1, 1)" />
        <xsl:variable name="remainder" select="substring($value, 2)" />
        <xsl:variable name="first-upper"
          select="translate($first,
                            'abcdefghijklmnopqrstuvwxyz',
                            'ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
        <xsl:value-of select="concat($first-upper, $remainder)" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--
    Convert an entity or property ID to a user friendly mixed-cased
    name. For example, the string "my-string-value" will be converted to
    the string "My String Value".
    @param value
    The ID string to be converted to a Java name.
  -->
  <xsl:template name="name-to-ufn">
    <xsl:param name="value" select="/.." />
    <xsl:if test="string-length($value)">
      <xsl:choose>
        <xsl:when test="contains($value, '-')">
          <xsl:variable name="head"
            select="substring-before($value, '-')" />
          <xsl:variable name="tail"
            select="substring-after($value, '-')" />
          <xsl:call-template name="to-title-case">
            <xsl:with-param name="value" select="$head" />
          </xsl:call-template>
          <xsl:value-of select="' '" />
          <xsl:call-template name="name-to-ufn">
            <xsl:with-param name="value" select="$tail" />
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="to-title-case">
            <xsl:with-param name="value" select="$value" />
          </xsl:call-template>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/xml.xsd
New file
@@ -0,0 +1,146 @@
<?xml version="1.0"?>
<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en">
 <xs:annotation>
  <xs:documentation>
   See http://www.w3.org/XML/1998/namespace.html and
   http://www.w3.org/TR/REC-xml for information about this namespace.
    This schema document describes the XML namespace, in a form
    suitable for import by other schema documents.
    Note that local names in this namespace are intended to be defined
    only by the World Wide Web Consortium or its subgroups.  The
    following names are currently defined in this namespace and should
    not be used with conflicting semantics by any Working Group,
    specification, or document instance:
    base (as an attribute name): denotes an attribute whose value
         provides a URI to be used as the base for interpreting any
         relative URIs in the scope of the element on which it
         appears; its value is inherited.  This name is reserved
         by virtue of its definition in the XML Base specification.
    id   (as an attribute name): denotes an attribute whose value
         should be interpreted as if declared to be of type ID.
         The xml:id specification is not yet a W3C Recommendation,
         but this attribute is included here to facilitate experimentation
         with the mechanisms it proposes.  Note that it is _not_ included
         in the specialAttrs attribute group.
    lang (as an attribute name): denotes an attribute whose value
         is a language code for the natural language of the content of
         any element; its value is inherited.  This name is reserved
         by virtue of its definition in the XML specification.
    space (as an attribute name): denotes an attribute whose
         value is a keyword indicating what whitespace processing
         discipline is intended for the content of the element; its
         value is inherited.  This name is reserved by virtue of its
         definition in the XML specification.
    Father (in any context at all): denotes Jon Bosak, the chair of
         the original XML Working Group.  This name is reserved by
         the following decision of the W3C XML Plenary and
         XML Coordination groups:
             In appreciation for his vision, leadership and dedication
             the W3C XML Plenary on this 10th day of February, 2000
             reserves for Jon Bosak in perpetuity the XML name
             xml:Father
  </xs:documentation>
 </xs:annotation>
 <xs:annotation>
  <xs:documentation>This schema defines attributes and an attribute group
        suitable for use by
        schemas wishing to allow xml:base, xml:lang, xml:space or xml:id
        attributes on elements they define.
        To enable this, such a schema must import this schema
        for the XML namespace, e.g. as follows:
        &lt;schema . . .&gt;
         . . .
         &lt;import namespace="http://www.w3.org/XML/1998/namespace"
                    schemaLocation="http://www.w3.org/2001/xml.xsd"/&gt;
        Subsequently, qualified reference to any of the attributes
        or the group defined below will have the desired effect, e.g.
        &lt;type . . .&gt;
         . . .
         &lt;attributeGroup ref="xml:specialAttrs"/&gt;
         will define a type which will schema-validate an instance
         element with any of those attributes</xs:documentation>
 </xs:annotation>
 <xs:annotation>
  <xs:documentation>In keeping with the XML Schema WG's standard versioning
   policy, this schema document will persist at
   http://www.w3.org/2005/08/xml.xsd.
   At the date of issue it can also be found at
   http://www.w3.org/2001/xml.xsd.
   The schema document at that URI may however change in the future,
   in order to remain compatible with the latest version of XML Schema
   itself, or with the XML namespace itself.  In other words, if the XML
   Schema or XML namespaces change, the version of this document at
   http://www.w3.org/2001/xml.xsd will change
   accordingly; the version at
   http://www.w3.org/2005/08/xml.xsd will not change.
  </xs:documentation>
 </xs:annotation>
 <xs:attribute name="lang">
  <xs:annotation>
   <xs:documentation>Attempting to install the relevant ISO 2- and 3-letter
         codes as the enumerated possible values is probably never
         going to be a realistic possibility.  See
         RFC 3066 at http://www.ietf.org/rfc/rfc3066.txt and the IANA registry
         at http://www.iana.org/assignments/lang-tag-apps.htm for
         further information.
         The union allows for the 'un-declaration' of xml:lang with
         the empty string.</xs:documentation>
  </xs:annotation>
  <xs:simpleType>
   <xs:union memberTypes="xs:language">
    <xs:simpleType>
     <xs:restriction base="xs:string">
      <xs:enumeration value=""/>
     </xs:restriction>
    </xs:simpleType>
   </xs:union>
  </xs:simpleType>
 </xs:attribute>
 <xs:attribute name="space">
  <xs:simpleType>
   <xs:restriction base="xs:NCName">
    <xs:enumeration value="default"/>
    <xs:enumeration value="preserve"/>
   </xs:restriction>
  </xs:simpleType>
 </xs:attribute>
 <xs:attribute name="base" type="xs:anyURI">
  <xs:annotation>
   <xs:documentation>See http://www.w3.org/TR/xmlbase/ for
                     information about this attribute.</xs:documentation>
  </xs:annotation>
 </xs:attribute>
 <xs:attribute name="id" type="xs:ID">
  <xs:annotation>
   <xs:documentation>See http://www.w3.org/TR/xml-id/ for
                     information about this attribute.</xs:documentation>
  </xs:annotation>
 </xs:attribute>
 <xs:attributeGroup name="specialAttrs">
  <xs:attribute ref="xml:base"/>
  <xs:attribute ref="xml:lang"/>
  <xs:attribute ref="xml:space"/>
 </xs:attributeGroup>
</xs:schema>
opends/src/admin/defn/org/opends/server/admin/std/CertificateMapperConfiguration.xml
New file
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="certificate-mapper"
  plural-name="certificate-mappers"
  package="org.opends.server.admin.std"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    <adm:user-friendly-plural-name />
    are responsible for establishing a mapping between a client certificate and
    the entry for the user that corresponds to that certificate.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.12</ldap:oid>
      <ldap:name>ds-cfg-certificate-mapper</ldap:name>
      <ldap:superior>top</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="enabled" mandatory="true">
    <adm:synopsis>
      Indicate whether the
      <adm:user-friendly-name />
      is enabled for use.
    </adm:synopsis>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.20</ldap:oid>
        <ldap:name>ds-cfg-certificate-mapper-enabled</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="mapper-class" mandatory="true">
    <adm:synopsis>
      The fully-qualified name of the Java class that provides the
      <adm:user-friendly-name />
      implementation.
    </adm:synopsis>
    <adm:syntax>
      <adm:java-class>
        <adm:instance-of>
          org.opends.server.api.CertificateMapper
        </adm:instance-of>
      </adm:java-class>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.19</ldap:oid>
        <ldap:name>ds-cfg-certificate-mapper-class</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/ConnectionHandlerConfiguration.xml
New file
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="connection-handler"
  plural-name="connection-handlers"
  package="org.opends.server.admin.std" abstract="true"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    <adm:user-friendly-plural-name />
    are responsible for handling all interaction with the clients,
    including accepting the connections, reading requests, and sending
    responses.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.13</ldap:oid>
      <ldap:name>ds-cfg-connection-handler</ldap:name>
      <ldap:superior>top</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="enabled" mandatory="true">
    <adm:synopsis>
      Indicate whether the
      <adm:user-friendly-name />
      is enabled for use.
    </adm:synopsis>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.24</ldap:oid>
        <ldap:name>ds-cfg-connection-handler-enabled</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="java-implementation-class" mandatory="true">
    <adm:synopsis>
      The fully-qualified name of the Java class that provides the
      <adm:user-friendly-name />
      implementation.
    </adm:synopsis>
    <adm:syntax>
      <adm:java-class>
        <adm:instance-of>
          org.opends.server.api.ConnectionHandler
        </adm:instance-of>
      </adm:java-class>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.23</ldap:oid>
        <ldap:name>ds-cfg-connection-handler-class</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="allowed-clients" multi-valued="true">
    <adm:synopsis>
      This property specifies a set of address masks that may be used to
      determine the addresses of the clients that are allowed to
      establish connections to this connection handler.
    </adm:synopsis>
    <adm:description>
      Changes to this configuration attribute will take effect
      immediately but will not interfere with connections that may
      already be established.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          All clients with addresses that do not match an address on the
          deny list will be allowed.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:ip-address-mask />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.6</ldap:oid>
        <ldap:name>ds-cfg-allowed-client</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="denied-clients" multi-valued="true">
    <adm:synopsis>
      This property specifies a set of address masks that may be used to
      determine the addresses of the clients that are not allowed to
      establish connections to this connection handler.
    </adm:synopsis>
    <adm:description>
      If both allowed and denied client masks are defined and a client
      connection matches one or more masks in both lists, then the
      connection will be denied. If only a denied list is specified,
      then any client not matching a mask in that list will be allowed.
      Changes to this configuration attribute will take effect
      immediately but will not interfere with connections that may
      already be established.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          All clients with addresses that do match an address on the
          allow list will be allowed.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:ip-address-mask />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.32</ldap:oid>
        <ldap:name>ds-cfg-denied-client</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/CramMD5SASLMechanismHandlerConfiguration.xml
New file
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<adm:managed-object name="cram-md5-sasl-mechanism-handler"
  plural-name="cram-md5-sasl-mechanism-handlers"
  package="org.opends.server.admin.std" extends="sasl-mechanism-handler"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    is used to perform all processing related to SASL CRAM-MD5 authentication.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.46</ldap:oid>
      <ldap:name>ds-cfg-cram-md5-sasl-mechanism-handler</ldap:name>
      <ldap:superior>ds-cfg-sasl-mechanism-handler</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="identity-mapper-dn" mandatory="true">
    <adm:synopsis>
      Specifies the DN of the identity mapper to use.
    </adm:synopsis>
    <adm:description>
      Specifies the DN of the configuration entry for the identity mapper that
      should be used to match the client authentication ID to a user entry.
    </adm:description>
    <adm:syntax>
      <adm:dn>
        <adm:base>cn=identity mappers,cn=config</adm:base>
      </adm:dn>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.148</ldap:oid>
        <ldap:name>ds-cfg-identity-mapper-dn</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/DigestMD5SASLMechanismHandlerConfiguration.xml
New file
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<adm:managed-object name="digest-md5-sasl-mechanism-handler"
  plural-name="digest-md5-sasl-mechanism-handlers"
  package="org.opends.server.admin.std" extends="sasl-mechanism-handler"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    is used to perform all processing related to SASL DIGEST-MD5
    authentication.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.47</ldap:oid>
      <ldap:name>ds-cfg-digest-md5-sasl-mechanism-handler</ldap:name>
      <ldap:superior>ds-cfg-sasl-mechanism-handler</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="realm" mandatory="false">
    <adm:synopsis>
      The realm that should be used for DIGEST-MD5 authentication.
    </adm:synopsis>
    <adm:description>
      Specifies the realm that should be used by the server for DIGEST-MD5
      authentication.  If this is not provided, then the server will default
      to using a set of realm names that correspond to the defined suffixes.
      Changes to this configuration attribute will take effect immediately.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          The server will default to a set of realm names that correspond to the
          defined suffixes.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.86</ldap:oid>
        <ldap:name>ds-cfg-realm</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="identity-mapper-dn" mandatory="true">
    <adm:synopsis>
      Specifies the DN of the identity mapper to use.
    </adm:synopsis>
    <adm:description>
      Specifies the DN of the configuration entry for the identity mapper that
      should be used to match client authentication and authorization IDs to
      user entries.
    </adm:description>
    <adm:syntax>
      <adm:dn>
        <adm:base>cn=identity mappers,cn=config</adm:base>
      </adm:dn>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.148</ldap:oid>
        <ldap:name>ds-cfg-identity-mapper-dn</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/ExactMatchIdentityMapperConfiguration.xml
New file
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="exact-match-identity-mapper"
  plural-name="exact-match-identity-mappers"
  package="org.opends.server.admin.std" extends="identity-mapper"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    maps an identifier string to user entries by searching for the entry
    containing a specified attribute whose value is the provided identifer.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.45</ldap:oid>
      <ldap:name>ds-cfg-exact-match-identity-mapper</ldap:name>
      <ldap:superior>ds-cfg-identity-mapper</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="match-attribute" mandatory="true" multi-valued="true">
    <adm:synopsis>
      Specifies the attribute to use to perform the mapping.
    </adm:synopsis>
    <adm:description>
      Specifies the name or OID of the attribute whose value should exactly
      match the ID string provided to this identity mapper.  At least one
      value must be provided.  All values must refer to the name or OID of an
      attribute type defined in the Directory Server schema.  If multiple
      attribute type names or OIDs are provided, then at least one of those
      attributes must contain the provided ID string value in exactly one
      entry.
    </adm:description>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.146</ldap:oid>
        <ldap:name>ds-cfg-match-attribute</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="match-base-dn" mandatory="false" multi-valued="true">
    <adm:synopsis>
      Specifies the set of base DNs below which to search for users.
    </adm:synopsis>
    <adm:description>
      Specifies the base DN(s) that should be used when performing searches to
      map the provided ID string to a user entry.  If no values are provided,
      then the server will search below all public naming contexts.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          The server will search below all public naming contexts.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:dn />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.147</ldap:oid>
        <ldap:name>ds-cfg-match-base-dn</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/ExternalSASLMechanismHandlerConfiguration.xml
New file
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<adm:managed-object name="external-sasl-mechanism-handler"
  plural-name="external-sasl-mechanism-handlers"
  package="org.opends.server.admin.std" extends="sasl-mechanism-handler"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    is used to perform all processing related to SASL EXTERNAL authentication.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.44</ldap:oid>
      <ldap:name>ds-cfg-external-sasl-mechanism-handler</ldap:name>
      <ldap:superior>ds-cfg-sasl-mechanism-handler</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="certificate-validation-policy" mandatory="true">
    <adm:synopsis>
      Indicates whether to attempt to validate the peer certificate against a
      value held in the user's entry.
    </adm:synopsis>
    <adm:description>
      Indicates whether the SASL EXTERNAL mechanism handler should attempt to
      validate the peer certificate against a certificate in the corresponding
      user's entry.  The value must be one of "true" (which will always
      attempt to validate the certificate and will fail if no certificates are
      present), "false" (which will never attempt to validate the peer
      certificate), and "ifpresent" (which will validate the peer certificate
      if there are one or more certificates in the user's entry, but will not
      fail if there are no certificates in the entry.  Changes to this
      configuration attribute will take effect immediately.
    </adm:description>
    <adm:syntax>
      <adm:enumeration>
        <adm:value name="always">
          <adm:synopsis>
            Always require the peer certificate to be present in the user's
            entry.
          </adm:synopsis>
        </adm:value>
        <adm:value name="ifpresent">
          <adm:synopsis>
            If the user's entry contains one or more certificates, require that
            one of them match the peer certificate.
          </adm:synopsis>
        </adm:value>
        <adm:value name="never">
          <adm:synopsis>
            Do not look for the peer certificate to be present in the user's
            entry.
          </adm:synopsis>
        </adm:value>
      </adm:enumeration>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.22</ldap:oid>
        <ldap:name>ds-cfg-client-certificate-validation-policy</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="certificate-attribute" mandatory="false">
    <adm:synopsis>
      Specifies the attribute that should hold user certificates.
    </adm:synopsis>
    <adm:description>
      Specifies the name of the attribute that will be used to hold the
      certificate information in user entries for the purpose of validation.
      This must specify the name of a valid attribute type defined in the
      server schema.  Changes to this configuration attribute will take effect
      immediately.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>userCertificate</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.18</ldap:oid>
        <ldap:name>ds-cfg-certificate-attribute</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="certificate-mapper-dn" mandatory="true">
    <adm:synopsis>
      Specifies the DN of the certificate mapper to use.
    </adm:synopsis>
    <adm:description>
      Specifies the DN of the configuration entry for the certificate mapper
      that should be used to match client certificates to user entries.
    </adm:description>
    <adm:syntax>
      <adm:dn>
        <adm:base>cn=certificate mappers,cn=config</adm:base>
      </adm:dn>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.309</ldap:oid>
        <ldap:name>ds-cfg-certificate-mapper-dn</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/FileBasedKeyManagerConfiguration.xml
New file
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="file-based-key-manager"
  plural-name="file-based-key-managers"
  package="org.opends.server.admin.std" extends="key-manager"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:TODO>
    The key manager must be able to get a pin from somewhere. It looks
    in property, then an environment variable, then a file, and finally
    in a configuration attribute. At least one must be present. Can we
    express this ordering and this "at least one" constraint? Perhaps
    support a "one-of" element which can be used to group a set of
    properties.
  </adm:TODO>
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    provider accesses key information in a file on the local filesystem.
    Multiple file formats may be supported, depending on the providers
    supported by the underlying Java runtime.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.20</ldap:oid>
      <ldap:name>ds-cfg-file-based-key-manager-provider</ldap:name>
      <ldap:superior>ds-cfg-key-manager-provider</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="key-store-file" mandatory="true">
    <adm:TODO>Should use a file-based property definition?</adm:TODO>
    <adm:synopsis>
      Specifies the path to the file containing the private key
      information. It may be an absolute path, or a path that is
      relative to the
      <adm:product-name />
      instance root.
    </adm:synopsis>
    <adm:description>
      Changes to this configuration attribute will take effect the next
      time that the key manager is accessed.
    </adm:description>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.50</ldap:oid>
        <ldap:name>ds-cfg-key-store-file</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="key-store-type">
    <adm:TODO>
      Can we restrict this to an enumeration? How can the client guess
      which values are possible? What is the default value?
    </adm:TODO>
    <adm:synopsis>
      Specifies the format for the data in the key store file.
    </adm:synopsis>
    <adm:description>
      Valid values should always include 'JKS' and 'PKCS12', but
      different implementations may allow other values as well. If no
      value is provided, then the JVM-default value will be used.
      Changes to this configuration attribute will take effect the next
      time that the key manager is accessed.
    </adm:description>
    <adm:default-behavior>
      <adm:undefined />
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.55</ldap:oid>
        <ldap:name>ds-cfg-key-store-type</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property-reference name="key-store-pin" />
  <adm:property-reference name="key-store-pin-property" />
  <adm:property-reference name="key-store-pin-environment-variable" />
  <adm:property-reference name="key-store-pin-file" />
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/FingerprintCertificateMapperConfiguration.xml
New file
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="fingerprint-certificate-mapper"
  plural-name="fingerprint-certificate-mappers"
  package="org.opends.server.admin.std" extends="certificate-mapper"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    maps client certificates to user entries by looking for the MD5 or SHA1
    fingerprint in a specified attribute of user entries.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.86</ldap:oid>
      <ldap:name>ds-cfg-fingerprint-certificate-mapper</ldap:name>
      <ldap:superior>ds-cfg-certificate-mapper</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="fingerprint-attribute" mandatory="true">
    <adm:synopsis>
      Specifies the attribute in which to look for the fingerprint.
    </adm:synopsis>
    <adm:description>
      Specifies the name or OID of the attribute whose value should exactly
      match the MD5 or SHA1 representation of the certificate fingerprint.
    </adm:description>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.317</ldap:oid>
        <ldap:name>ds-cfg-certificate-fingerprint-attribute-type</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="fingerprint-algorithm" mandatory="true">
    <adm:synopsis>
      Specifies the certificate fingerprint algorithm.
    </adm:synopsis>
    <adm:description>
      Specifies the name of the digest algorithm that should be used to
      compute the fingerprint of client certificates.  The value must be either
      "MD5" or "SHA1".
    </adm:description>
    <adm:syntax>
      <adm:enumeration>
        <adm:value name="md5">
          <adm:synopsis>
            Use the MD5 digest algorithm to compute certificate fingerprints.
          </adm:synopsis>
        </adm:value>
        <adm:value name="sha1">
          <adm:synopsis>
            Use the SHA-1 digest algorithm to compute certificate fingerprints.
          </adm:synopsis>
        </adm:value>
      </adm:enumeration>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.318</ldap:oid>
        <ldap:name>ds-cfg-certificate-fingerprint-algorithm</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="user-base-dn" mandatory="false" multi-valued="true">
    <adm:synopsis>
      Specifies the set of base DNs below which to search for users.
    </adm:synopsis>
    <adm:description>
      Specifies the base DN(s) that should be used when performing searches to
      map the client certificate to a user entry.  If no values are provided,
      then the server will search below all public naming contexts.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          The server will perform the search in all public naming contexts.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:dn />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.313</ldap:oid>
        <ldap:name>ds-cfg-certificate-user-base-dn</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/GSSAPISASLMechanismHandlerConfiguration.xml
New file
@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<adm:managed-object name="gssapi-sasl-mechanism-handler"
  plural-name="gssapi-sasl-mechanism-handlers"
  package="org.opends.server.admin.std" extends="sasl-mechanism-handler"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    is used to perform all processing related to SASL GSSAPI authentication
    using Kerberos V5.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.48</ldap:oid>
      <ldap:name>ds-cfg-gssapi-sasl-mechanism-handler</ldap:name>
      <ldap:superior>ds-cfg-sasl-mechanism-handler</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="realm" mandatory="false">
    <adm:synopsis>
      Specifies the realm that should be used for GSSAPI authentication.
    </adm:synopsis>
    <adm:description>
      Specifies the realm that should be used by the server for GSSAPI
      authentication.  If this is not provided, then the server will attempt to
      determine the realm from the Kerberos configuration of the underlying
      system.  Changes to this configuration attribute will take effect
      immediately.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          The server will attempt to determine the realm from the underlying
          system configuration.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.86</ldap:oid>
        <ldap:name>ds-cfg-realm</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="kdc-address" mandatory="false">
    <adm:synopsis>
      Specifies the address of the KDC that should be used for Kerberos
      processing.
    </adm:synopsis>
    <adm:description>
      Specifies the address of the KDC that should be used for Kerberos
      processing.  If provided, this should be a fully-qualified DNS-resolvable
      name.  If this is not provided, then the server will attempt to determine
      the KDC address from the Kerberos configuration of the underlying system.
      Changes to this configuration attribute will take effect immediately.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          The server will attempt to determine the KDC address from the
          underlying system configuration.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.45</ldap:oid>
        <ldap:name>ds-cfg-kdc-address</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="keytab" mandatory="false">
    <adm:synopsis>
      Specifies the path to the keytab file that should be used for Kerberos
      processing.
    </adm:synopsis>
    <adm:description>
      Specifies the path to the keytab file that should be used for Kerberos
      processing.  If provided, this should be either an absolute path or one
      that is relative to the server instance root.  If this is not provided,
      then the server will attempt to use the default keytab from the
      underlying system configuration.  Changes to this configuration attribute
      will take effect immediately.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          The server will attempt to use the system-wide default keytab.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.46</ldap:oid>
        <ldap:name>ds-cfg-keytab</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="server-fqdn" mandatory="false">
    <adm:synopsis>
      Specifies the fully-qualified domain name for the system.
    </adm:synopsis>
    <adm:description>
      Specifies the DNS-resolvable fully-qualified domain name for the system.
      If this is not provided, then the server will attempt to determine this
      dynamically.  Changes to this configuration attribute will take effect
      immediately.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          The server will attempt to dynamically determine the fully-qualified
          domain name.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.115</ldap:oid>
        <ldap:name>ds-cfg-server-fqdn</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="identity-mapper-dn" mandatory="true">
    <adm:synopsis>
      Specifies the DN of the identity mapper to use.
    </adm:synopsis>
    <adm:description>
      Specifies the DN of the configuration entry for the identity mapper that
      should be used to match the Kerberos principal to a user entry.
    </adm:description>
    <adm:syntax>
      <adm:dn>
        <adm:base>cn=identity mappers,cn=config</adm:base>
      </adm:dn>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.148</ldap:oid>
        <ldap:name>ds-cfg-identity-mapper-dn</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/GlobalConfiguration.xml
New file
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<adm:managed-object name="global" plural-name="globals"
  package="org.opends.server.admin.std"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The global configuration contains properties that affect the overall
    operation of the
    <adm:product-name />
    .
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.13</ldap:oid>
      <ldap:name>ds-cfg-root-config</ldap:name>
      <ldap:superior>top</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="check-schema" mandatory="true">
    <adm:synopsis>
      Indicates whether schema enforcement is active.
    </adm:synopsis>
    <adm:description>
      This property indicates whether the
      <adm:product-name />
      should ensure that all operations result in entries that are valid
      according to the defined server schema. It is strongly recommended
      that this option be left enabled to prevent the inadvertent
      addition of invalid data into the server.
    </adm:description>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.24</ldap:oid>
        <ldap:name>ds-cfg-check-schema</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/IdentityMapperConfiguration.xml
New file
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="identity-mapper"
  plural-name="identity-mappers"
  package="org.opends.server.admin.std" abstract="true"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    <adm:user-friendly-plural-name />
    are responsible for establishing a mapping between an identifier string and
    the entry for the user that corresponds to that identifier.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.55</ldap:oid>
      <ldap:name>ds-cfg-identity-mapper</ldap:name>
      <ldap:superior>top</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="enabled" mandatory="true">
    <adm:synopsis>
      Indicate whether the
      <adm:user-friendly-name />
      is enabled for use.
    </adm:synopsis>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.145</ldap:oid>
        <ldap:name>ds-cfg-identity-mapper-enabled</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="mapper-class" mandatory="true">
    <adm:synopsis>
      The fully-qualified name of the Java class that provides the
      <adm:user-friendly-name />
      implementation.
    </adm:synopsis>
    <adm:syntax>
      <adm:java-class>
        <adm:instance-of>
          org.opends.server.api.IdentityMapper
        </adm:instance-of>
      </adm:java-class>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.144</ldap:oid>
        <ldap:name>ds-cfg-identity-mapper-class</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/JMXConnectionHandlerConfiguration.xml
New file
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="jmx-connection-handler"
  plural-name="jmx-connection-handlers"
  package="org.opends.server.admin.std" extends="connection-handler"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    is used to interact with clients using the Java Management
    Extensions (JMX) protocol.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.63</ldap:oid>
      <ldap:name>ds-cfg-jmx-connection-handler</ldap:name>
      <ldap:superior>ds-cfg-connection-handler</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property-reference name="listen-port" />
  <adm:property-reference name="use-ssl" />
  <adm:property-reference name="ssl-cert-nickname" />
  <adm:property-reference name="key-manager-provider-dn" />
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/KeyManagerConfiguration.xml
New file
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="key-manager" plural-name="key-managers"
  package="org.opends.server.admin.std" abstract="true"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    <adm:user-friendly-plural-name />
    are responsible for managing the key material which is used to
    authenticate an SSL connection to its peer.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.19</ldap:oid>
      <ldap:name>ds-cfg-key-manager-provider</ldap:name>
      <ldap:superior>top</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="enabled" mandatory="true">
    <adm:synopsis>
      Indicate whether the
      <adm:user-friendly-name />
      is enabled for use.
    </adm:synopsis>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.49</ldap:oid>
        <ldap:name>ds-cfg-key-manager-provider-enabled</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="java-implementation-class" mandatory="true">
    <adm:synopsis>
      The fully-qualified name of the Java class that should to provide
      the
      <adm:user-friendly-name />
      implementation.
    </adm:synopsis>
    <adm:syntax>
      <adm:java-class>
        <adm:instance-of>
          org.opends.server.api.KeyManagerProvider
        </adm:instance-of>
      </adm:java-class>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.48</ldap:oid>
        <ldap:name>ds-cfg-key-manager-provider-class</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/LDAPConnectionHandlerConfiguration.xml
New file
@@ -0,0 +1,460 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="ldap-connection-handler"
  plural-name="ldap-connection-handlers"
  package="org.opends.server.admin.std" extends="connection-handler"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    is used to interact with clients using LDAP. In particular, it
    provides full support for LDAPv3 and limited support for LDAPv2.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.14</ldap:oid>
      <ldap:name>ds-cfg-ldap-connection-handler</ldap:name>
      <ldap:superior>ds-cfg-connection-handler</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property-reference name="listen-port" />
  <adm:property-reference name="use-ssl" />
  <adm:property-reference name="ssl-cert-nickname" />
  <adm:property-reference name="key-manager-provider-dn" />
  <adm:property-reference name="trust-manager-provider-dn" />
  <adm:property name="listen-addresses" multi-valued="true">
    <adm:synopsis>
      Specifies the address or set of addresses on which this
      <adm:user-friendly-name />
      should listen for connections from LDAP clients.
    </adm:synopsis>
    <adm:description>
      Multiple addresses may be provided as separate values for this
      attribute. If no values are provided, then the
      <adm:user-friendly-name />
      will listen on all interfaces.
    </adm:description>
    <adm:requires-admin-action>
      <adm:component-restart />
    </adm:requires-admin-action>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>0.0.0.0</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:ip-address />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.56</ldap:oid>
        <ldap:name>ds-cfg-listen-address</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="allow-ldap-v2">
    <adm:synopsis>
      Indicates whether connections from LDAPv2 clients will be allowed.
    </adm:synopsis>
    <adm:description>
      If LDAPv2 clients will be allowed, then only a minimal degree of
      special support will be provided for them to ensure that
      LDAPv3-specific protocol elements (e.g., Configuration Guide 25
      controls, extended response messages, intermediate response
      messages, referrals, etc.) are not sent to an LDAPv2 client.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>true</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.7</ldap:oid>
        <ldap:name>ds-cfg-allow-ldapv2</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="keep-stats">
    <adm:synopsis>
      Indicates whether the
      <adm:user-friendly-name />
      should keep statistics.
    </adm:synopsis>
    <adm:description>
      If enabled, the
      <adm:user-friendly-name />
      will maintain statistics about the number and types of operations
      requested over LDAP and the amount of data sent and received.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>true</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.47</ldap:oid>
        <ldap:name>ds-cfg-keep-stats</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="use-tcp-keep-alive">
    <adm:synopsis>
      Indicates whether the
      <adm:user-friendly-name />
      should use TCP keep-alive.
    </adm:synopsis>
    <adm:description>
      If enabled, the SO_KEEPALIVE socket option to indicate that TCP
      keepalive messages should periodically be sent to the client to
      verify that the associated connection is still valid. This may
      also help prevent cases in which intermediate network hardware
      could silently drop an otherwise idle client connection, provided
      that the keepalive interval configured in the underlying operating
      system is smaller than the timeout enforced by the network
      hardware.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>true</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.138</ldap:oid>
        <ldap:name>ds-cfg-use-tcp-keepalive</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="use-tcp-no-delay">
    <adm:synopsis>
      Indicates whether the
      <adm:user-friendly-name />
      should use TCP no-delay.
    </adm:synopsis>
    <adm:description>
      If enabled, the TCP_NODELAY socket option will be used to ensure
      that response messages to the client are sent immediately rather
      than potentially waiting to determine whether additional response
      messages can be sent in the same packet. In most cases, using the
      TCP_NODELAY socket option will provide better performance and
      lower response times, but disabling it may help for some cases in
      which the server will send a large number of entries to a client
      in response to a search request.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>true</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.139</ldap:oid>
        <ldap:name>ds-cfg-use-tcp-nodelay</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="allow-tcp-reuse-address">
    <adm:synopsis>
      Indicates whether the
      <adm:user-friendly-name />
      should reuse socket descriptors.
    </adm:synopsis>
    <adm:description>
      If enabled, the SO_REUSEADDR socket option will be used on the
      server listen socket to potentially allow the reuse of socket
      descriptors for clients in a TIME_WAIT state. This may help the
      server avoid temporarily running out of socket descriptors in
      cases in which a very large number of short-lived connections have
      been established from the same client system.
    </adm:description>
    <adm:requires-admin-action>
      <adm:component-restart />
    </adm:requires-admin-action>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>true</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.9</ldap:oid>
        <ldap:name>ds-cfg-allow-tcp-reuse-address</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="send-rejection-notice">
    <adm:synopsis>
      Indicates whether the
      <adm:user-friendly-name />
      should send a notice of disconnection extended response message to
      the client if a new connection is rejected for some reason.
    </adm:synopsis>
    <adm:description>
      The extended response message may provide an explanation
      indicating the reason that the connection was rejected.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>true</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.114</ldap:oid>
        <ldap:name>ds-cfg-send-rejection-notice</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="max-request-size">
    <adm:synopsis>
      Specifies the size of the largest LDAP request message that will
      be allowed by this
      <adm:user-friendly-name />
      .
    </adm:synopsis>
    <adm:description>
      This property is analogous to the maxBERSize configuration
      attribute of the Sun Java System Directory Server. This can help
      prevent denial-of-service attacks by clients that indicate they
      will send extremely large requests to the server causing it to
      attempt to allocate large amounts of memory.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>5mib</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:size upper-limit="2147483647b"></adm:size>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.67</ldap:oid>
        <ldap:name>ds-cfg-max-request-size</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="num-request-handlers">
    <adm:synopsis>
      Specifies the number of request handlers that will be used to read
      requests from clients.
    </adm:synopsis>
    <adm:description>
      The
      <adm:user-friendly-name />
      uses one thread to accept new connections from clients, but uses
      one or more additional threads to read requests from existing
      client connections. This can help ensure that new requests are
      read efficiently and that the connection handler itself does not
      become a bottleneck when the server is under heavy load from many
      clients at the same time.
    </adm:description>
    <adm:requires-admin-action>
      <adm:component-restart />
    </adm:requires-admin-action>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>1</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:integer lower-limit="1" />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.72</ldap:oid>
        <ldap:name>ds-cfg-num-request-handlers</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="allow-start-tls">
    <adm:synopsis>
      Indicates whether clients will be allowed to use StartTLS.
    </adm:synopsis>
    <adm:description>
      If enabled, the
      <adm:user-friendly-name />
      will allow clients to use the StartTLS extended operation to
      initiate secure communication over an otherwise insecure channel.
      Note that this will only be allowed if the
      <adm:user-friendly-name />
      is not configured to use SSL, and if the server is configured with
      a valid key manager provider and a valid trust manager provider.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>true</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.8</ldap:oid>
        <ldap:name>ds-cfg-allow-start-tls</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="ssl-client-auth-policy">
    <adm:synopsis>
      Specifies the policy that the
      <adm:user-friendly-name />
      should use regarding client SSL certificates.
    </adm:synopsis>
    <adm:description>
      This is only applicable if clients are allowed to use SSL.
    </adm:description>
    <adm:requires-admin-action>
      <adm:component-restart />
    </adm:requires-admin-action>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>optional</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:enumeration>
        <adm:value name="disabled">
          <adm:synopsis>
            Clients will not be required to provide their own
            certificates when performing SSL negotiation.
          </adm:synopsis>
        </adm:value>
        <adm:value name="optional">
          <adm:synopsis>
            Clients will be requested to provide their own certificates
            when performing SSL negotiation, but will still accept the
            connection even if the client does not provide a
            certificate.
          </adm:synopsis>
        </adm:value>
        <adm:value name="required">
          <adm:synopsis>
            Clients will be required to provide their own certificates
            when performing SSL negotiation, and will be refused access
            if the do not provide a certificate.
          </adm:synopsis>
        </adm:value>
      </adm:enumeration>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.119</ldap:oid>
        <ldap:name>ds-cfg-ssl-client-auth-policy</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="accept-backlog">
    <adm:synopsis>
      Specifies the maximum number of pending connection attempts that
      will be allowed to queue up in the accept backlog before the
      server starts rejecting new connection attempts.
    </adm:synopsis>
    <adm:description>
      This is primarily an issue for cases in which a large number of
      connections are established to the server in a very short period
      of time (e.g., a benchmark utility that creates a large number of
      client threads that each have their own connection to the server)
      and the connection handler is unable to keep up with the rate at
      which the new connections are established.
    </adm:description>
    <adm:requires-admin-action>
      <adm:component-restart />
    </adm:requires-admin-action>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>128</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:integer lower-limit="1">
        <adm:unit-synopsis>connections</adm:unit-synopsis>
      </adm:integer>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.153</ldap:oid>
        <ldap:name>ds-cfg-accept-backlog</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="ssl-protocols" multi-valued="true">
    <adm:TODO>No LDAP OID is assigned for this yet!</adm:TODO>
    <adm:synopsis>
      Specifies the names of the SSL protocols that will be allowed for
      use in SSL or StartTLS communication.
    </adm:synopsis>
    <adm:description>
      Changes to this configuration attribute will take immediately but
      will only impact new SSL/TLS-based sessions created after the
      change.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          Uses the default set of SSL protocols provided by the server's
          JVM.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.9999</ldap:oid>
        <ldap:name>ds-cfg-ssl-protocols</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="ssl-cipher-suites" multi-valued="true">
    <adm:TODO>No LDAP OID is assigned for this yet!</adm:TODO>
    <adm:synopsis>
      Specifies the names of the SSL cipher suites that will be allowed
      for use in SSL or StartTLS communication.
    </adm:synopsis>
    <adm:description>
      Changes to this configuration attribute will take immediately but
      will only impact new SSL/TLS-based sessions created after the
      change.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          Uses the default set of SSL cipher suites provided by the
          server's JVM.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.9999</ldap:oid>
        <ldap:name>ds-cfg-ssl-protocols</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/LengthBasedPasswordValidatorConfiguration.xml
New file
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<adm:managed-object name="length-based-password-validator"
  plural-name="length-based-password-validators"
  package="org.opends.server.admin.std" extends="password-validator"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    is used to determine whether a proposed password is acceptable based on
    whether the number of characters it contains falls within an acceptable
    range of values.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.59</ldap:oid>
      <ldap:name>ds-cfg-length-based-password-validator</ldap:name>
      <ldap:superior>ds-cfg-password-validator</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="maximum-password-length" mandatory="false">
    <adm:synopsis>
      Specifies the maximum number of characters that may be included in a
      proposed password.
    </adm:synopsis>
    <adm:description>
      Specifies the maximum number of characters that may be included in a
      proposed password.  A value of zero indicates that there will be no
      upper bound enforced.  Changes to this configuration attribute will take
      effect immediately.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>0</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:integer lower-limit="0" />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.168</ldap:oid>
        <ldap:name>ds-cfg-maximum-password-length</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="minimum-password-length" mandatory="false">
    <adm:synopsis>
      Specifies the minimum number of characters that must be included in a
      proposed password.
    </adm:synopsis>
    <adm:description>
      Specifies the minimum number of characters that must be included in a
      proposed password.  A value of zero indicates that there will be no
      lower bound enforced.  Changes to this configuration attribute will take
      effect immediately.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>1</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:integer lower-limit="0" />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.169</ldap:oid>
        <ldap:name>ds-cfg-minimum-password-length</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/PKCS11KeyManagerConfiguration.xml
New file
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="pkcs11-key-manager"
  plural-name="pkcs11-key-managers"
  package="org.opends.server.admin.std" extends="key-manager"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:TODO>
    The key manager must be able to get a pin from somewhere. It looks
    in property, then an environment variable, then a file, and finally
    in a configuration attribute. At least one must be present. Can we
    express this ordering and this "at least one" constraint? Perhaps
    support a "one-of" element which can be used to group a set of
    properties.
  </adm:TODO>
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    provider provides the ability for the server to access the private
    key information through the PKCS11 interface. This standard
    interface is used by cryptographic accelerators and hardware
    security modules.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.21</ldap:oid>
      <ldap:name>ds-cfg-pkcs11-key-manager-provider</ldap:name>
      <ldap:superior>ds-cfg-key-manager-provider</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property-reference name="key-store-pin" />
  <adm:property-reference name="key-store-pin-property" />
  <adm:property-reference name="key-store-pin-environment-variable" />
  <adm:property-reference name="key-store-pin-file" />
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/Package.xml
New file
@@ -0,0 +1,245 @@
<?xml version="1.0" encoding="UTF-8"?>
<adm:package name="org.opends.server.admin.std"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    Core OpenDS Directory Server administrative components.
  </adm:synopsis>
  <adm:property name="listen-port" mandatory="true">
    <adm:synopsis>
      Specifies the port number on which the
      <adm:user-friendly-name />
      will listen for connections from clients.
    </adm:synopsis>
    <adm:description>
      Only a single port number may be provided.
    </adm:description>
    <adm:requires-admin-action>
      <adm:component-restart />
    </adm:requires-admin-action>
    <adm:syntax>
      <adm:integer lower-limit="1" upper-limit="65535" />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.57</ldap:oid>
        <ldap:name>ds-cfg-listen-port</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="use-ssl">
    <adm:synopsis>
      Indicates whether the
      <adm:user-friendly-name />
      should use SSL.
    </adm:synopsis>
    <adm:description>
      If enabled, the
      <adm:user-friendly-name />
      will use SSL to encrypt communication with the clients.
    </adm:description>
    <adm:requires-admin-action>
      <adm:component-restart />
    </adm:requires-admin-action>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>false</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.137</ldap:oid>
        <ldap:name>ds-cfg-use-ssl</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="ssl-cert-nickname">
    <adm:TODO>Need a better default description.</adm:TODO>
    <adm:synopsis>
      Specifies the nickname (also called the alias) of the certificate
      that the
      <adm:user-friendly-name />
      should use when performing SSL communication.
    </adm:synopsis>
    <adm:description>
      This is only applicable when the
      <adm:user-friendly-name />
      is configured to use SSL.
    </adm:description>
    <adm:requires-admin-action>
      <adm:component-restart />
    </adm:requires-admin-action>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          Let the server decide.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:string></adm:string>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.120</ldap:oid>
        <ldap:name>ds-cfg-ssl-cert-nickname</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="key-store-pin">
    <adm:synopsis>
      Specifies the clear-text PIN needed to access the
      <adm:user-friendly-name />
      .
    </adm:synopsis>
    <adm:description>
      Changes to this configuration attribute will take effect the next
      time that the key manager is accessed.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>jks</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.51</ldap:oid>
        <ldap:name>ds-cfg-key-store-pin</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="key-store-pin-property">
    <adm:TODO>Better syntax for property name?</adm:TODO>
    <adm:synopsis>
      Specifies the name of the Java property that contains the
      clear-text PIN needed to access the
      <adm:user-friendly-name />
      .
    </adm:synopsis>
    <adm:description>
      Changes to this configuration attribute will take effect the next
      time that the key manager is accessed.
    </adm:description>
    <adm:default-behavior>
      <adm:undefined />
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.54</ldap:oid>
        <ldap:name>ds-cfg-key-store-pin-property</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="key-store-pin-environment-variable">
    <adm:synopsis>
      Specifies the name of the environment variable that contains the
      clear-text PIN needed to access the
      <adm:user-friendly-name />
      .
    </adm:synopsis>
    <adm:description>
      Changes to this configuration attribute will take effect the next
      time that the key manager is accessed.
    </adm:description>
    <adm:default-behavior>
      <adm:undefined />
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.52</ldap:oid>
        <ldap:name>ds-cfg-key-store-pin-environment-variable</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="key-store-pin-file">
    <adm:TODO>Should use a file-based property definition?</adm:TODO>
    <adm:synopsis>
      Specifies the path to the text file whose only contents should be
      a single line containing the clear-text PIN needed to access the
      <adm:user-friendly-name />
      .
    </adm:synopsis>
    <adm:description>
      Changes to this configuration attribute will take effect the next
      time that the key manager is accessed.
    </adm:description>
    <adm:default-behavior>
      <adm:undefined />
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.53</ldap:oid>
        <ldap:name>ds-cfg-key-store-pin-file</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="key-manager-provider-dn">
    <adm:synopsis>
      Specifies the DN of the configuration entry for the key manager
      provider that should be used with this
      <adm:user-friendly-name />
      .
    </adm:synopsis>
    <adm:description>
      Changes to this attribute will take effect immediately, but only
      for subsequent attempts to access the key manager provider for
      associated client connections.
    </adm:description>
    <adm:default-behavior>
      <adm:undefined />
    </adm:default-behavior>
    <adm:syntax>
      <adm:dn>
        <adm:base>cn=key manager providers,cn=config</adm:base>
      </adm:dn>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.310</ldap:oid>
        <ldap:name>ds-cfg-key-manager-provider-dn</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="trust-manager-provider-dn">
    <adm:synopsis>
      Specifies the DN of the configuration entry for the trust manager
      provider that should be used with this
      <adm:user-friendly-name />
      .
    </adm:synopsis>
    <adm:description>
      Changes to this attribute will take effect immediately, but only
      for subsequent attempts to access the trust manager provider for
      associated client connections.
    </adm:description>
    <adm:default-behavior>
      <adm:undefined />
    </adm:default-behavior>
    <adm:syntax>
      <adm:dn>
        <adm:base>cn=trust manager providers,cn=config</adm:base>
      </adm:dn>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.311</ldap:oid>
        <ldap:name>ds-cfg-trust-manager-provider-dn</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:package>
opends/src/admin/defn/org/opends/server/admin/std/PasswordValidatorConfiguration.xml
New file
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="password-validator" plural-name="password-validators"
  package="org.opends.server.admin.std"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    <adm:user-friendly-plural-name />
    are responsible for determining whether proposed passwords are acceptable
    for use.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.36</ldap:oid>
      <ldap:name>ds-cfg-password-validator</ldap:name>
      <ldap:superior>top</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="enabled" mandatory="true">
    <adm:synopsis>
      Indicate whether the
      <adm:user-friendly-name />
      is enabled for use.
    </adm:synopsis>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.78</ldap:oid>
        <ldap:name>ds-cfg-password-validator-enabled</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="validator-class" mandatory="true">
    <adm:synopsis>
      The fully-qualified name of the Java class that provides the
      <adm:user-friendly-name />
      implementation.
    </adm:synopsis>
    <adm:syntax>
      <adm:java-class>
        <adm:instance-of>
          org.opends.server.api.PasswordValidator
        </adm:instance-of>
      </adm:java-class>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.77</ldap:oid>
        <ldap:name>ds-cfg-password-validator-class</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/PlainSASLMechanismHandlerConfiguration.xml
New file
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<adm:managed-object name="plain-sasl-mechanism-handler"
  plural-name="plain-sasl-mechanism-handlers"
  package="org.opends.server.admin.std" extends="sasl-mechanism-handler"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    is used to perform all processing related to SASL PLAIN authentication.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.45</ldap:oid>
      <ldap:name>ds-cfg-plain-sasl-mechanism-handler</ldap:name>
      <ldap:superior>ds-cfg-sasl-mechanism-handler</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="identity-mapper-dn" mandatory="true">
    <adm:synopsis>
      Specifies the DN of the identity mapper to use.
    </adm:synopsis>
    <adm:description>
      Specifies the DN of the configuration entry for the identity mapper that
      should be used to match client authentication and authorization IDs to
      user entries.
    </adm:description>
    <adm:syntax>
      <adm:dn>
        <adm:base>cn=identity mappers,cn=config</adm:base>
      </adm:dn>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.148</ldap:oid>
        <ldap:name>ds-cfg-identity-mapper-dn</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/PluginConfiguration.xml
New file
@@ -0,0 +1,309 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="plugin"
  plural-name="plugins"
  package="org.opends.server.admin.std" abstract="false"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    <adm:user-friendly-plural-name />
    provide a mechanism for executing custom code at specified points in
    operation processing and in the course of other events like connection
    establishment and termination, server startup and shutdown, and LDIF import
    and export.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.37</ldap:oid>
      <ldap:name>ds-cfg-plugin</ldap:name>
      <ldap:superior>top</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="enabled" mandatory="true">
    <adm:synopsis>
      Indicate whether the
      <adm:user-friendly-name />
      is enabled for use.
    </adm:synopsis>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.80</ldap:oid>
        <ldap:name>ds-cfg-plugin-enabled</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="plugin-class" mandatory="true">
    <adm:synopsis>
      The fully-qualified name of the Java class that provides the
      <adm:user-friendly-name />
      implementation.
    </adm:synopsis>
    <adm:syntax>
      <adm:java-class>
        <adm:instance-of>
          org.opends.server.api.plugin.DirectoryServerPlugin
        </adm:instance-of>
      </adm:java-class>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.79</ldap:oid>
        <ldap:name>ds-cfg-plugin-class</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="plugin-type" mandatory="true" multi-valued="true">
    <adm:synopsis>
      The plugin types, which define the conditions under which this plugin
      should be invoked.
    </adm:synopsis>
    <adm:syntax>
      <adm:enumeration>
        <adm:value name="startup">
          <adm:synopsis>
            Invoked during the Directory Server startup process.
          </adm:synopsis>
        </adm:value>
        <adm:value name="shutdown">
          <adm:synopsis>
            Invoked during a graceful Directory Server shutdown.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postconnect">
          <adm:synopsis>
            Invoked whenever a new connection is established to the server.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postdisconnect">
          <adm:synopsis>
            Invoked whenever an existing connection is terminated (by either
            the client or the server).
          </adm:synopsis>
        </adm:value>
        <adm:value name="ldifimport">
          <adm:synopsis>
            Invoked for each entry read during an LDIF import.
          </adm:synopsis>
        </adm:value>
        <adm:value name="ldifexport">
          <adm:synopsis>
            Invoked for each operation to be written during an LDIF export.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preparseabandon">
          <adm:synopsis>
            Invoked prior to parsing an abandon request.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preparseadd">
          <adm:synopsis>
            Invoked prior to parsing an add request.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preparsebind">
          <adm:synopsis>
            Invoked prior to parsing a bind request.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preparsecompare">
          <adm:synopsis>
            Invoked prior to parsing a compare request.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preparsedelete">
          <adm:synopsis>
            Invoked prior to parsing a delete request.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preparseextended">
          <adm:synopsis>
            Invoked prior to parsing an extended request.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preparsemodify">
          <adm:synopsis>
            Invoked prior to parsing a modify request.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preparsemodifydn">
          <adm:synopsis>
            Invoked prior to parsing a modify DN request.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preparsesearch">
          <adm:synopsis>
            Invoked prior to parsing a search request.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preparseunbind">
          <adm:synopsis>
            Invoked prior to parsing an unbind request.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preoperationadd">
          <adm:synopsis>
            Invoked prior to performing the core add processing.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preoperationbind">
          <adm:synopsis>
            Invoked prior to performing the core bind processing.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preoperationcompare">
          <adm:synopsis>
            Invoked prior to performing the core compare processing.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preoperationdelete">
          <adm:synopsis>
            Invoked prior to performing the core delete processing.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preoperationextended">
          <adm:synopsis>
            Invoked prior to performing the core extended processing.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preoperationmodify">
          <adm:synopsis>
            Invoked prior to performing the core modify processing.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preoperationmodifydn">
          <adm:synopsis>
            Invoked prior to performing the core modify DN processing.
          </adm:synopsis>
        </adm:value>
        <adm:value name="preoperationsearch">
          <adm:synopsis>
            Invoked prior to performing the core search processing.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postoperationabandon">
          <adm:synopsis>
            Invoked after completing the abandon processing.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postoperationadd">
          <adm:synopsis>
            Invoked after completing the core add processing but before sending
            the response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postoperationbind">
          <adm:synopsis>
            Invoked after completing the core bind processing but before
            sending the response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postoperationcompare">
          <adm:synopsis>
            Invoked after completing the core compare processing but before
            sending the response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postoperationdelete">
          <adm:synopsis>
            Invoked after completing the core delete processing but before
            sending the response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postoperationextended">
          <adm:synopsis>
            Invoked after completing the core extended processing but before
            sending the response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postoperationmodify">
          <adm:synopsis>
            Invoked after completing the core modify processing but before
            sending the response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postoperationmodifydn">
          <adm:synopsis>
            Invoked after completing the core modify DN processing but before
            sending the response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postoperationsearch">
          <adm:synopsis>
            Invoked after completing the core search processing but before
            sending the response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postoperationunbind">
          <adm:synopsis>
            Invoked after completing the unbind processing.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postresponseadd">
          <adm:synopsis>
            Invoked after sending the add response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postresponsebind">
          <adm:synopsis>
            Invoked after sending the bind response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postresponsecompare">
          <adm:synopsis>
            Invoked after sending the compare response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postresponsedelete">
          <adm:synopsis>
            Invoked after sending the delete response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postresponseextended">
          <adm:synopsis>
            Invoked after sending the extended response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postresponsemodify">
          <adm:synopsis>
            Invoked after sending the modify response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postresponsemodifydn">
          <adm:synopsis>
            Invoked after sending the modify DN response to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="postresponsesearch">
          <adm:synopsis>
            Invoked after sending the search result done message to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="searchresultentry">
          <adm:synopsis>
            Invoked before sending a search result entry to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="searchresultreference">
          <adm:synopsis>
            Invoked before sending a search result reference to the client.
          </adm:synopsis>
        </adm:value>
        <adm:value name="intermediateresponse">
          <adm:synopsis>
            Invoked before sending an intermediate repsonse message to the
            client.
          </adm:synopsis>
        </adm:value>
      </adm:enumeration>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.81</ldap:oid>
        <ldap:name>ds-cfg-plugin-type</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/ProfilerPluginConfiguration.xml
New file
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<adm:managed-object name="profiler-plugin"
  plural-name="profiler-plugins"
  package="org.opends.server.admin.std" extends="plugin"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    is used to capture profiling information about operations performed inside
    the JVM while the Directory Server is running.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.38</ldap:oid>
      <ldap:name>ds-cfg-profiler-plugin</ldap:name>
      <ldap:superior>ds-cfg-plugin</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="profile-sample-interval" mandatory="true">
    <adm:synopsis>
      Specifies the profiler sample interval.
    </adm:synopsis>
    <adm:description>
      Specifies the sample interval that should be used when capturing
      profiling information in the server.  Changes to this configuration
      attribute will take effect the next time the profiler is started.
    </adm:description>
    <adm:syntax>
      <adm:duration lower-limit="1" base-unit="ms" />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.85</ldap:oid>
        <ldap:name>ds-cfg-profile-sample-interval</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="profile-directory" mandatory="true">
    <adm:synopsis>
      Specifies the directory for writing profile information.
    </adm:synopsis>
    <adm:description>
      Specifies the path to the directory into which profile information will
      be written.  The directory must exist and the Directory Server must have
      permission to create new files in it.  Changes to this configuration
      attribute will take effect immediately.
    </adm:description>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.83</ldap:oid>
        <ldap:name>ds-cfg-profile-directory</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="enable-profiling-on-startup" mandatory="true">
    <adm:synopsis>
      Indicates whether to automatically begin capturing profile data when the
      server is started.
    </adm:synopsis>
    <adm:description>
      Indicates whether the profiler plugin should start collecting data
      automatically when the Directory Server is started.  This will only be
      read when the server is started, and any changes will take effect on the
      next restart.
    </adm:description>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.33</ldap:oid>
        <ldap:name>ds-cfg-enable-profiling-on-startup</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="profile-action" mandatory="false">
    <adm:synopsis>
      Specifies the action that should be taken by the profiler.
    </adm:synopsis>
    <adm:description>
      Specifies the action that should be taken by the profiler.  A value of
      "start" will cause the profiler thread to start collecting data if it is
      not already active.  A value of "stop" will cause the profiler thread to
      stop collecting data and write it do disk, and a value of "cancel" will
      cause the profiler thread to stop collecting data and discard anything
      that has been captured.  These operations will occur immediately.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>none</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:enumeration>
        <adm:value name="none">
          <adm:synopsis>
            Do not take any action.
          </adm:synopsis>
        </adm:value>
        <adm:value name="start">
          <adm:synopsis>
            Start collecting profile data.
          </adm:synopsis>
        </adm:value>
        <adm:value name="stop">
          <adm:synopsis>
            Stop collecting profile data and write what has been captured to
            a file in the profile directory.
          </adm:synopsis>
        </adm:value>
        <adm:value name="cancel">
          <adm:synopsis>
            Stop collecting profile data and discard what has been captured.
          </adm:synopsis>
        </adm:value>
      </adm:enumeration>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.82</ldap:oid>
        <ldap:name>ds-cfg-profile-action</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/RootConfiguration.xml
New file
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<adm:root-managed-object xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The root configuration provides an entry point to the rest of the
    <adm:product-name />
    configuration.
  </adm:synopsis>
  <adm:relation name="global-configuration"
    managed-object-name="global">
    <adm:one-to-one />
    <adm:profile name="ldap">
      <ldap:rdn-sequence>cn=config</ldap:rdn-sequence>
    </adm:profile>
  </adm:relation>
  <adm:relation name="connection-handler">
    <adm:one-to-many />
    <adm:profile name="ldap">
      <ldap:rdn-sequence>
        cn=connection handlers, cn=config
      </ldap:rdn-sequence>
    </adm:profile>
  </adm:relation>
  <adm:relation name="identity-mapper">
    <adm:one-to-many />
    <adm:profile name="ldap">
      <ldap:rdn-sequence>
        cn=Identity Mappers,cn=config
      </ldap:rdn-sequence>
    </adm:profile>
  </adm:relation>
  <adm:relation name="certificate-mapper">
    <adm:one-to-many />
    <adm:profile name="ldap">
      <ldap:rdn-sequence>
        cn=Certificate Mappers,cn=config
      </ldap:rdn-sequence>
    </adm:profile>
  </adm:relation>
  <adm:relation name="sasl-mechanism-handler">
    <adm:one-to-many />
    <adm:profile name="ldap">
      <ldap:rdn-sequence>
        cn=SASL Mechanisms,cn=config
      </ldap:rdn-sequence>
    </adm:profile>
  </adm:relation>
  <adm:relation name="password-validator">
    <adm:one-to-many />
    <adm:profile name="ldap">
      <ldap:rdn-sequence>
        cn=Password Validators,cn=config
      </ldap:rdn-sequence>
    </adm:profile>
  </adm:relation>
  <adm:relation name="plugin">
    <adm:one-to-many />
    <adm:profile name="ldap">
      <ldap:rdn-sequence>
        cn=Plugins,cn=config
      </ldap:rdn-sequence>
    </adm:profile>
  </adm:relation>
  <adm:product-name>OpenDS Directory Server</adm:product-name>
</adm:root-managed-object>
opends/src/admin/defn/org/opends/server/admin/std/SASLMechanismHandlerConfiguration.xml
New file
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="sasl-mechanism-handler"
  plural-name="sasl-mechanism-handlers"
  package="org.opends.server.admin.std"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    <adm:user-friendly-plural-name />
    are responsible for the processing associated with SASL bind operations.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.43</ldap:oid>
      <ldap:name>ds-cfg-sasl-mechanism-handler</ldap:name>
      <ldap:superior>top</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="enabled" mandatory="true">
    <adm:synopsis>
      Indicate whether the
      <adm:user-friendly-name />
      is enabled for use.
    </adm:synopsis>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.112</ldap:oid>
        <ldap:name>ds-cfg-sasl-mechanism-handler-enabled</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="handler-class" mandatory="true">
    <adm:synopsis>
      The fully-qualified name of the Java class that provides the
      <adm:user-friendly-name />
      implementation.
    </adm:synopsis>
    <adm:syntax>
      <adm:java-class>
        <adm:instance-of>
          org.opends.server.api.SASLMechanismHandler
        </adm:instance-of>
      </adm:java-class>
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.111</ldap:oid>
        <ldap:name>ds-cfg-sasl-mechanism-handler-class</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/SubjectAttributeToUserAttributeCertificateMapperConfiguration.xml
New file
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="subject-attribute-to-user-attribute-certificate-mapper"
  plural-name="subject-attribute-to-user-attribute-certificate-mappers"
  package="org.opends.server.admin.std" extends="certificate-mapper"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    maps client certificates to user entries by mapping the values of
    attributes contained in the certificate subject to attributes contained in
    user entries.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.84</ldap:oid>
      <ldap:name>ds-cfg-subject-attribute-to-user-attribute-certificate-mapper</ldap:name>
      <ldap:superior>ds-cfg-certificate-mapper</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="subject-attribute-mapping" mandatory="true"
    multi-valued="true">
    <adm:synopsis>
      Specifies a mapping between certificate attributes and user attributes.
    </adm:synopsis>
    <adm:description>
      Specifies a mapping between certificate attributes and user attributes.
      Each value should be in the form "certattr:userattr" where certattr is
      the name of the attribute in the certificate subject and userattr is the
      name of the corresponding attribute in user entries.  There may be
      multiple mappings defined, and when performing the mapping values for all
      attributes present in the certificate subject that have mappings defined
      must be present in the corresponding user entries.
    </adm:description>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.315</ldap:oid>
        <ldap:name>ds-cfg-certificate-subject-attribute-mapping</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="user-base-dn" mandatory="false" multi-valued="true">
    <adm:synopsis>
      Specifies the set of base DNs below which to search for users.
    </adm:synopsis>
    <adm:description>
      Specifies the base DN(s) that should be used when performing searches to
      map the client certificate to a user entry.  If no values are provided,
      then the server will search below all public naming contexts.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          The server will perform the search in all public naming contexts.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:dn />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.313</ldap:oid>
        <ldap:name>ds-cfg-certificate-user-base-dn</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/admin/defn/org/opends/server/admin/std/SubjectDNToUserAttributeCertificateMapperConfiguration.xml
New file
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<adm:managed-object name="subject-dn-to-user-attribute-certificate-mapper"
  plural-name="subject-dn-to-user-attribute-certificate-mappers"
  package="org.opends.server.admin.std" extends="certificate-mapper"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <adm:synopsis>
    The
    <adm:user-friendly-name />
    maps client certificates to user entries by looking for the certificate
    subject DN in a specified attribute of user entries.
  </adm:synopsis>
  <adm:profile name="ldap">
    <ldap:object-class>
      <ldap:oid>1.3.6.1.4.1.26027.1.2.84</ldap:oid>
      <ldap:name>ds-cfg-subject-dn-to-user-attribute-certificate-mapper</ldap:name>
      <ldap:superior>ds-cfg-certificate-mapper</ldap:superior>
    </ldap:object-class>
  </adm:profile>
  <adm:property name="subject-attribute" mandatory="true">
    <adm:synopsis>
      Specifies the attribute in which to look for the subject DN.
    </adm:synopsis>
    <adm:description>
      Specifies the name or OID of the attribute whose value should exactly
      match the certificate subject DN.
    </adm:description>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.312</ldap:oid>
        <ldap:name>ds-cfg-certificate-subject-attribute-type</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="user-base-dn" mandatory="false" multi-valued="true">
    <adm:synopsis>
      Specifies the set of base DNs below which to search for users.
    </adm:synopsis>
    <adm:description>
      Specifies the base DN(s) that should be used when performing searches to
      map the client certificate to a user entry.  If no values are provided,
      then the server will search below all public naming contexts.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          The server will perform the search in all public naming contexts.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:dn />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:oid>1.3.6.1.4.1.26027.1.1.313</ldap:oid>
        <ldap:name>ds-cfg-certificate-user-base-dn</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
</adm:managed-object>
opends/src/server/org/opends/server/admin/AbsoluteInheritedDefaultBehaviorProvider.java
New file
@@ -0,0 +1,99 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A default behavior provider which retrieves default values from a managed
 * object in an abolute location. It should be used by properties which inherit
 * their default value(s) from properties held in an other managed object.
 *
 * @param <T>
 *          The type of values represented by this provider.
 */
public final class AbsoluteInheritedDefaultBehaviorProvider<T> implements
    DefaultBehaviorProvider<T> {
  // The absolute path to the managed object containing the property.
  private final ManagedObjectPath path;
  // The name of the property containing the inherited default values.
  private final String propertyName;
  /**
   * Create an absolute inherited default behavior provider associated with the
   * managed object at the specified absolute location.
   *
   * @param path
   *          The absolute location of the managed object.
   * @param propertyName
   *          The name of the property containing the inherited default values.
   */
  public AbsoluteInheritedDefaultBehaviorProvider(ManagedObjectPath path,
      String propertyName) {
    this.path = path;
    this.propertyName = propertyName;
  }
  /**
   * {@inheritDoc}
   */
  public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
    return v.visitAbsoluteInherited(this, p);
  }
  /**
   * Get the absolute path of the managed object containing the property which
   * has the default values.
   *
   * @return Returns the absolute path of the managed object containing the
   *         property which has the default values.
   */
  public ManagedObjectPath getManagedObjectPath() {
    return path;
  }
  /**
   * Get the name of the property containing the inherited default values.
   *
   * @return Returns the name of the property containing the inherited default
   *         values.
   */
  public String getPropertyName() {
    return propertyName;
  }
}
opends/src/server/org/opends/server/admin/AbstractManagedObjectDefinition.java
New file
@@ -0,0 +1,418 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.opends.server.admin.DefinitionDecodingException.Reason;
/**
 * Defines the structure of an abstract managed object. Abstract managed objects
 * cannot be instantiated.
 * <p>
 * Applications can query a managed object definition in order to determine the
 * overall configuration model of an application.
 *
 * @param <C>
 *          The type of client managed object configuration that this definition
 *          represents.
 * @param <S>
 *          The type of server managed object configuration that this definition
 *          represents.
 */
public abstract class AbstractManagedObjectDefinition
    <C extends ConfigurationClient, S extends Configuration> {
  // The name of the definition.
  private final String name;
  // The parent managed object definition if applicable.
  private final AbstractManagedObjectDefinition<? super C, ? super S> parent;
  // The set of property definitions applicable to this managed object
  // definition.
  private final Map<String, PropertyDefinition<?>> propertyDefinitions;
  // The set of relation definitions applicable to this managed object
  // definition.
  private final Map<String, RelationDefinition<?, ?>> relationDefinitions;
  // The set of managed object definitions which inherit from this definition.
  private final Map<String,
    AbstractManagedObjectDefinition<? extends C, ? extends S>> children;
  /**
   * Create a new abstract managed object definition.
   *
   * @param name
   *          The name of the definition.
   * @param parent
   *          The parent definition, or <code>null</code> if there is no
   *          parent.
   */
  protected AbstractManagedObjectDefinition(String name,
      AbstractManagedObjectDefinition<? super C, ? super S> parent) {
    this.name = name;
    this.parent = parent;
    // If we have a parent definition then inherit its features.
    if (parent != null) {
      this.propertyDefinitions = new HashMap<String, PropertyDefinition<?>>(
          parent.propertyDefinitions);
      this.relationDefinitions = new HashMap<String, RelationDefinition<?,?>>(
          parent.relationDefinitions);
      parent.children.put(name, this);
    } else {
      this.propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
      this.relationDefinitions = new HashMap<String, RelationDefinition<?,?>>();
    }
    this.children = new HashMap<String,
      AbstractManagedObjectDefinition<? extends C, ? extends S>>();
  }
  /**
   * Get the named child managed object definition which inherits from this
   * managed object definition.
   *
   * @param name
   *          The name of the managed object definition sub-type.
   * @return Returns the named child managed object definition which inherits
   *         from this managed object definition.
   * @throws IllegalArgumentException
   *           If the specified managed object definition name was null or empty
   *           or if the requested subordinate managed object definition was not
   *           found.
   */
  public final AbstractManagedObjectDefinition<? extends C, ? extends S>
      getChild(String name) throws IllegalArgumentException {
    if ((name == null) || (name.length() == 0)) {
      throw new IllegalArgumentException("null or empty managed object name");
    }
    AbstractManagedObjectDefinition<? extends C, ? extends S> d = children
        .get(name);
    if (d == null) {
      throw new IllegalArgumentException("managed object definition \"" + name
          + "\" not found");
    }
    return d;
  }
  /**
   * Get all the child managed object definitions which inherit from
   * this managed object definition.
   *
   * @return Returns an unmodifiable collection containing all the
   *         subordinate managed object definitions which inherit from
   *         this managed object definition.
   */
  public final Collection<AbstractManagedObjectDefinition
      <? extends C, ? extends S>> getChildren() {
    return Collections.unmodifiableCollection(children.values());
  }
  /**
   * Get the name of the definition.
   *
   * @return Returns the name of the definition.
   */
  public final String getName() {
    return name;
  }
  /**
   * Get the parent managed object definition, if applicable.
   *
   * @return Returns the parent of this managed object definition, or
   *         <code>null</code> if this definition does not have a parent.
   */
  public final AbstractManagedObjectDefinition<? super C,
      ? super S> getParent() {
    return parent;
  }
  /**
   * Get the specified property definition associated with this type of managed
   * object.
   *
   * @param name
   *          The name of the property definition to be retrieved.
   * @return Returns the specified property definition associated with this type
   *         of managed object.
   * @throws IllegalArgumentException
   *           If the specified property name was null or empty or if the
   *           requested property definition was not found.
   */
  public final PropertyDefinition getPropertyDefinition(String name)
      throws IllegalArgumentException {
    if ((name == null) || (name.length() == 0)) {
      throw new IllegalArgumentException("null or empty property name");
    }
    PropertyDefinition d = propertyDefinitions.get(name);
    if (d == null) {
      throw new IllegalArgumentException("property definition \"" + name
          + "\" not found");
    }
    return d;
  }
  /**
   * Get all the property definitions associated with this type of
   * managed object.
   *
   * @return Returns an unmodifiable collection containing all the
   *         property definitions associated with this type of managed
   *         object.
   */
  public final Collection<PropertyDefinition<?>> getPropertyDefinitions() {
    return Collections.unmodifiableCollection(propertyDefinitions
        .values());
  }
  /**
   * Get the specified relation definition associated with this type of managed
   * object.
   *
   * @param name
   *          The name of the relation definition to be retrieved.
   * @return Returns the specified relation definition associated with this type
   *         of managed object.
   * @throws IllegalArgumentException
   *           If the specified relation name was null or empty or if the
   *           requested relation definition was not found.
   */
  public final RelationDefinition getRelationDefinition(String name)
      throws IllegalArgumentException {
    if ((name == null) || (name.length() == 0)) {
      throw new IllegalArgumentException("null or empty relation name");
    }
    RelationDefinition d = relationDefinitions.get(name);
    if (d == null) {
      throw new IllegalArgumentException("relation definition \"" + name
          + "\" not found");
    }
    return d;
  }
  /**
   * Get all the relation definitions associated with this type of
   * managed object.
   *
   * @return Returns an unmodifiable collection containing all the
   *         relation definitions associated with this type of managed
   *         object.
   */
  public final Collection<RelationDefinition<?,?>> getRelationDefinitions() {
    return Collections.unmodifiableCollection(relationDefinitions
        .values());
  }
  /**
   * Determine whether there are any child managed object definitions which
   * inherit from this managed object definition.
   *
   * @return Returns <code>true</code> if this type of managed object has any
   *         child managed object definitions, <code>false</code> otherwise.
   */
  public final boolean hasChildren() {
    return !children.isEmpty();
  }
  /**
   * Determine whether this type of managed object has any property definitions.
   *
   * @return Returns <code>true</code> if this type of managed object has any
   *         property definitions, <code>false</code> otherwise.
   */
  public final boolean hasPropertyDefinitions() {
    return !propertyDefinitions.isEmpty();
  }
  /**
   * Determine whether this type of managed object has any relation definitions.
   *
   * @return Returns <code>true</code> if this type of managed object has any
   *         relation definitions, <code>false</code> otherwise.
   */
  public final boolean hasRelationDefinitions() {
    return !relationDefinitions.isEmpty();
  }
  /**
   * Register a property definition with the managed object definition,
   * overriding any existing property definition with the same name.
   * <p>
   * This method <b>must not</b> be called by applications.
   *
   * @param d
   *          The property definition to be registered.
   */
  public final void registerPropertyDefinition(PropertyDefinition d) {
    String name = d.getName();
    propertyDefinitions.put(name, d);
  }
  /**
   * Register a relation definition with the managed object definition,
   * overriding any existing relation definition with the same name.
   * <p>
   * This method <b>must not</b> be called by applications.
   *
   * @param d
   *          The relation definition to be registered.
   */
  public final void registerRelationDefinition(RelationDefinition d) {
    String name = d.getName();
    relationDefinitions.put(name, d);
  }
  /**
   * Finds a sub-type of this managed object definition which most closely
   * corresponds to the matching criteria of the provided definition resolver.
   *
   * @param r
   *          The definition resolver.
   * @return Returns the sub-type of this managed object definition which most
   *         closely corresponds to the matching criteria of the provided
   *         definition resolver.
   * @throws DefinitionDecodingException
   *           If no matching sub-type could be found or if the resolved
   *           definition was abstract.
   * @see DefinitionResolver
   */
  @SuppressWarnings("unchecked")
  public final ManagedObjectDefinition<? extends C, ? extends S>
      resolveManagedObjectDefinition(
      DefinitionResolver r) throws DefinitionDecodingException {
    AbstractManagedObjectDefinition<? extends C, ? extends S> rd;
    rd = resolveManagedObjectDefinitionAux(this, r);
    if (rd == null) {
      // Unable to resolve the definition.
      throw new DefinitionDecodingException(Reason.WRONG_TYPE_INFORMATION);
    } else if (rd instanceof ManagedObjectDefinition) {
      return (ManagedObjectDefinition<? extends C, ? extends S>) rd;
    } else {
      // Resolved definition was abstract.
      throw new DefinitionDecodingException(Reason.ABSTRACT_TYPE_INFORMATION);
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public final String toString() {
    StringBuilder builder = new StringBuilder();
    toString(builder);
    return builder.toString();
  }
  /**
   * Append a string representation of the managed object definition to the
   * provided string builder.
   *
   * @param builder
   *          The string builder where the string representation should be
   *          appended.
   */
  public final void toString(StringBuilder builder) {
    builder.append(getName());
  }
  // Recursively descend definition hierarchy to find the best match definition.
  private AbstractManagedObjectDefinition<? extends C, ? extends S>
      resolveManagedObjectDefinitionAux(
      AbstractManagedObjectDefinition<? extends C, ? extends S> d,
      DefinitionResolver r) {
    if (!r.matches(d)) {
      return null;
    }
    for (AbstractManagedObjectDefinition<? extends C, ? extends S> child : d
        .getChildren()) {
      AbstractManagedObjectDefinition<? extends C, ? extends S> rd =
        resolveManagedObjectDefinitionAux(child, r);
      if (rd != null) {
        return rd;
      }
    }
    return d;
  }
}
opends/src/server/org/opends/server/admin/AbstractPropertyDefinition.java
New file
@@ -0,0 +1,357 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.EnumSet;
import java.util.Set;
/**
 * Skeleton property definition implementation.
 *
 * @param <T>
 *          The data-type of values of the property.
 */
public abstract class AbstractPropertyDefinition<T> implements
    PropertyDefinition<T> {
  /**
   * An interface for incrementally constructing property definitions.
   *
   * @param <T>
   *          The data-type of values of the property.
   * @param <D>
   *          The type of property definition constructed by this builder.
   */
  protected abstract static class AbstractBuilder<T,
      D extends PropertyDefinition<T>> {
    // The name of this property definition.
    private final String propertyName;
    // The options applicable to this definition.
    private final EnumSet<PropertyOption> options;
    // The default behavior provider.
    private DefaultBehaviorProvider<T> defaultBehavior;
    /**
     * Create a property definition builder.
     *
     * @param propertyName
     *          The property name.
     */
    protected AbstractBuilder(String propertyName) {
      this.propertyName = propertyName;
      this.options = EnumSet.noneOf(PropertyOption.class);
      this.defaultBehavior = new UndefinedDefaultBehaviorProvider<T>();
    }
    /**
     * Construct a property definition based on the properties of this builder.
     *
     * @return The new property definition.
     */
    public final D getInstance() {
      return buildInstance(propertyName, options, defaultBehavior);
    }
    /**
     * Set the default behavior provider.
     *
     * @param defaultBehavior
     *          The default behavior provider.
     */
    public final void setDefaultBehaviorProvider(
        DefaultBehaviorProvider<T> defaultBehavior) {
      ensureNotNull(defaultBehavior);
      this.defaultBehavior = defaultBehavior;
    }
    /**
     * Add a property definition option.
     *
     * @param option
     *          The property option.
     */
    public final void setOption(PropertyOption option) {
      ensureNotNull(option);
      options.add(option);
    }
    /**
     * Build a property definition based on the properties of this builder.
     *
     * @param propertyName
     *          The property name.
     * @param options
     *          Options applicable to this definition.
     * @param defaultBehavior
     *          The default behavior provider.
     * @return The new property definition.
     */
    protected abstract D buildInstance(String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<T> defaultBehavior);
  }
  // The property name.
  private final String propertyName;
  // The property value class.
  private final Class<T> theClass;
  // Options applicable to this definition.
  private final Set<PropertyOption> options;
  // The default behavior provider.
  private final DefaultBehaviorProvider<T> defaultBehavior;
  /**
   * Create a property definition.
   *
   * @param theClass
   *          The property value class.
   * @param propertyName
   *          The property name.
   * @param options
   *          Options applicable to this definition.
   * @param defaultBehavior
   *          The default behavior provider.
   */
  protected AbstractPropertyDefinition(Class<T> theClass, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<T> defaultBehavior) {
    ensureNotNull(theClass, propertyName, options, defaultBehavior);
    this.theClass = theClass;
    this.propertyName = propertyName;
    this.options = EnumSet.copyOf(options);
    this.defaultBehavior = defaultBehavior;
  }
  /**
   * {@inheritDoc}
   */
  public abstract <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p);
  /**
   * {@inheritDoc}
   */
  public final T castValue(Object object) throws ClassCastException {
    return theClass.cast(object);
  }
  /**
   * {@inheritDoc}
   * <p>
   * This default implementation normalizes both values using
   * {@link #normalizeValue(Object)} and then performs a case-sensitive string
   * comparison.
   */
  public int compare(T o1, T o2) {
    ensureNotNull(o1, o2);
    String s1 = normalizeValue(o1);
    String s2 = normalizeValue(o2);
    return s1.compareTo(s2);
  }
  /**
   * {@inheritDoc}
   */
  public int compareTo(PropertyDefinition<?> o) {
    int rc = getName().compareTo(o.getName());
    if (rc == 0) {
      // TODO: see comment in equals().
      rc = getClass().getName().compareTo(o.getClass().getName());
    }
    return rc;
  }
  /**
   * {@inheritDoc}
   */
  public abstract T decodeValue(String value)
      throws IllegalPropertyValueStringException;
  /**
   * {@inheritDoc}
   * <p>
   * This default implementation simply returns invokes the
   * {@link Object#toString()} method on the provided value.
   */
  public String encodeValue(T value) throws IllegalPropertyValueException {
    ensureNotNull(value);
    return value.toString();
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    } else if (obj instanceof PropertyDefinition) {
      PropertyDefinition other = (PropertyDefinition) obj;
      if (getName().equals(other.getName())) {
        // TODO: this isn't quite right - should be comparing the value types
        // not the definition type. It's ok for now though.
        if (getClass().equals(other.getClass())) {
          return true;
        }
      }
      return false;
    } else {
      return false;
    }
  }
  /**
   * {@inheritDoc}
   */
  public DefaultBehaviorProvider<T> getDefaultBehaviorProvider() {
    return defaultBehavior;
  }
  /**
   * {@inheritDoc}
   */
  public final String getName() {
    return propertyName;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public int hashCode() {
    // TODO: see comment in equals().
    int rc = 17 + getName().hashCode();
    return 37 * rc + getClass().hashCode();
  }
  /**
   * {@inheritDoc}
   */
  public final boolean hasOption(PropertyOption option) {
    return options.contains(option);
  }
  /**
   * {@inheritDoc}
   * <p>
   * This default implementation simply returns the string representation of the
   * provided value. Sub-classes might want to override this method if this
   * behavior is insufficient (for example, a string property definition might
   * strip white-space and convert characters to lower-case).
   */
  public String normalizeValue(T value) throws IllegalPropertyValueException {
    ensureNotNull(value);
    return encodeValue(value);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public final String toString() {
    StringBuilder builder = new StringBuilder();
    toString(builder);
    return builder.toString();
  }
  /**
   * {@inheritDoc}
   * <p>
   * This simple implementation just outputs the propertyName of the property
   * definition. Sub-classes should override this method to provide more
   * complete string representations.
   */
  public void toString(StringBuilder builder) {
    builder.append(propertyName);
  }
  /**
   * {@inheritDoc}
   */
  public abstract void validateValue(T value)
      throws IllegalPropertyValueException;
}
opends/src/server/org/opends/server/admin/AbstractPropertyDefinitionVisitor.java
New file
@@ -0,0 +1,172 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A skeletal implementation of a property definition visitor. Each
 * <code>visitXXX</code> method is provided with a default
 * implementation which calls
 * {@link #visitUnknown(PropertyDefinition, Object)}. Sub-classes can
 * override any or all of the methods to provide their own
 * type-specific behavior.
 *
 * @param <R>
 *          The return type of this visitor's methods. Use
 *          {@link java.lang.Void} for visitors that do not need to
 *          return results.
 * @param <P>
 *          The type of the additional parameter to this visitor's
 *          methods. Use {@link java.lang.Void} for visitors that do
 *          not need an additional parameter.
 */
public abstract class AbstractPropertyDefinitionVisitor<R, P>
    implements PropertyDefinitionVisitor<R, P> {
  /**
   * Default constructor.
   */
  protected AbstractPropertyDefinitionVisitor() {
    // No implementation required.
  }
  /**
   * {@inheritDoc}
   */
  public R visitAttributeType(AttributeTypePropertyDefinition d, P p) {
    return visitUnknown(d, p);
  }
  /**
   * {@inheritDoc}
   */
  public R visitBoolean(BooleanPropertyDefinition d, P p) {
    return visitUnknown(d, p);
  }
  /**
   * {@inheritDoc}
   */
  public R visitClass(ClassPropertyDefinition d, P p) {
    return visitUnknown(d, p);
  }
  /**
   * {@inheritDoc}
   */
  public R visitDN(DNPropertyDefinition d, P p) {
    return visitUnknown(d, p);
  }
  /**
   * {@inheritDoc}
   */
  public R visitDuration(DurationPropertyDefinition d, P p) {
    return visitUnknown(d, p);
  }
  /**
   * {@inheritDoc}
   */
  public R visitInteger(IntegerPropertyDefinition d, P p) {
    return visitUnknown(d, p);
  }
  /**
   * {@inheritDoc}
   */
  public R visitIPAddress(IPAddressPropertyDefinition d, P p) {
    return visitUnknown(d, p);
  }
  /**
   * {@inheritDoc}
   */
  public R visitIPAddressMask(IPAddressMaskPropertyDefinition d, P p) {
    return visitUnknown(d, p);
  }
  /**
   * {@inheritDoc}
   */
  public R visitSize(SizePropertyDefinition d, P p) {
    return visitUnknown(d, p);
  }
  /**
   * {@inheritDoc}
   */
  public R visitString(StringPropertyDefinition d, P p) {
    return visitUnknown(d, p);
  }
  /**
   * {@inheritDoc}
   * <p>
   * The default implementation of this method is throw an
   * {@link UnknownPropertyDefinitionException}. Sub-classes can
   * override this method with their own default behavior.
   */
  public R visitUnknown(PropertyDefinition d, P p)
      throws UnknownPropertyDefinitionException {
    throw new UnknownPropertyDefinitionException(d, p);
  }
  /**
   * {@inheritDoc}
   */
  public R visitEnum(EnumPropertyDefinition<?> d, P p) {
    return visitUnknown(d, p);
  }
}
opends/src/server/org/opends/server/admin/AdminClassLoaderProvider.java
New file
@@ -0,0 +1,560 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.loggers.Error.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.debugMessage;
import static org.opends.server.messages.AdminMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import org.opends.server.admin.std.meta.RootConfigurationDefinition;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
import org.opends.server.types.InitializationException;
/**
 * Manages the class loader which should be used for loading
 * configuration definition classes and associated extensions.
 * <p>
 * For extensions which define their own extended configuration
 * definitions, the class loader will make sure that the configuration
 * definition classes are loaded and initialized.
 */
public final class AdminClassLoaderProvider {
  /**
   * Private URLClassLoader implementation. This is only required so
   * that we can provide access to the addURL method.
   */
  private static final class MyURLClassLoader extends URLClassLoader {
    /**
     * Create a class loader with the default parent class loader.
     */
    public MyURLClassLoader() {
      super(new URL[0]);
    }
    /**
     * Create a class loader with the provided parent class loader.
     *
     * @param parent
     *          The parent class loader.
     */
    public MyURLClassLoader(ClassLoader parent) {
      super(new URL[0], parent);
    }
    /**
     * Add a Jar file to this class loader.
     *
     * @param jarFile
     *          The name of the Jar file.
     * @throws MalformedURLException
     *           If a protocol handler for the URL could not be found,
     *           or if some other error occurred while constructing
     *           the URL.
     * @throws SecurityException
     *           If a required system property value cannot be
     *           accessed.
     */
    public void addJarFile(File jarFile) throws SecurityException,
        MalformedURLException {
      addURL(jarFile.toURI().toURL());
    }
  }
  // The name of the manifest file listing the core configuration
  // definition classes.
  private static final String CORE_MANIFEST = "core.manifest";
  // The name of the manifest file listing a extension's configuration
  // definition classes.
  private static final String EXTENSION_MANIFEST = "extension.manifest";
  // The name of the lib directory.
  private static final String LIB_DIR = "lib";
  // The name of the extensions directory.
  private static final String EXTENSIONS_DIR = "extensions";
  // The singleton instance.
  private static final AdminClassLoaderProvider INSTANCE =
    new AdminClassLoaderProvider();
  /**
   * Gets the application-wide administration framework class loader.
   *
   * @return Returns the application-wide administration framework
   *         class loader.
   */
  public static AdminClassLoaderProvider getInstance() {
    return INSTANCE;
  }
  // Flag indicating whether one-off initialization has been
  // performed.
  private boolean initialized = false;
  // Set of registered Jar files.
  private Set<File> jarFiles = new HashSet<File>();
  // Underlying class loader used to load classes and resources.
  //
  // We contain a reference to the URLClassLoader rather than
  // sub-class it so that it is possible to replace the loader at
  // run-time. For example, when removing or replacing extension Jar
  // files (the URLClassLoader only supports adding new
  // URLs, not removal).
  private MyURLClassLoader loader = new MyURLClassLoader();
  // Private constructor.
  private AdminClassLoaderProvider() {
    // No additional implementation required.
  }
  /**
   * Add the named extensions to this class loader.
   *
   * @param extensions
   *          The names of the extensions to be loaded.
   * @throws InitializationException
   *           If one of the extensions could not be loaded and
   *           initialized.
   * @throws IllegalStateException
   *           If this class loader provider has not been initialized.
   */
  public synchronized void addExtension(File... extensions)
      throws InitializationException, IllegalStateException {
    if (!initialized) {
      throw new IllegalStateException(
          "The class loader provider is not initialized");
    }
    // First add the Jar files to the class loader.
    List<JarFile> jars = new LinkedList<JarFile>();
    for (File extension : extensions) {
      if (jarFiles.contains(extension)) {
        // Skip this file as it is already loaded.
        continue;
      }
      // Attempt to load it.
      jars.add(loadJarFile(extension));
      // Register the Jar file with the class loader.
      try {
        loader.addJarFile(extension);
      } catch (Exception e) {
        if (debugEnabled()) {
          debugCaught(DebugLogLevel.ERROR, e);
        }
        int msgID = MSGID_ADMIN_CANNOT_OPEN_JAR_FILE;
        String message = getMessage(msgID, extension.getName(), extension
            .getParent(), stackTraceToSingleLineString(e));
        throw new InitializationException(msgID, message);
      }
      jarFiles.add(extension);
    }
    // Now forcefully load the configuration definition classes.
    for (JarFile jar : jars) {
      initializeExtension(jar);
    }
  }
  /**
   * Gets the class loader which should be used for loading classes
   * and resources.
   *
   * @return Returns the class loader which should be used for loading
   *         classes and resources.
   * @throws IllegalStateException
   *           If this class loader provider has not been initialized.
   */
  public synchronized ClassLoader getClassLoader()
      throws IllegalStateException {
    if (!initialized) {
      throw new IllegalStateException(
          "The class loader provider is not initialized");
    }
    return loader;
  }
  /**
   * Initialize this class loader provider using the default parent
   * class loader.
   *
   * @throws InitializationException
   *           If the administration class loader could not initialize
   *           successfully.
   * @throws IllegalStateException
   *           If this class loader provider is already initialized.
   */
  public synchronized void initialize()
      throws InitializationException, IllegalStateException {
    initialize(null);
  }
  /**
   * Initialize this class loader provider using the provided parent
   * class loader.
   *
   * @param parent
   *          The parent class loader.
   * @throws InitializationException
   *           If the administration class loader could not initialize
   *           successfully.
   * @throws IllegalStateException
   *           If this class loader provider is already initialized.
   */
  public synchronized void initialize(ClassLoader parent)
      throws InitializationException, IllegalStateException {
    if (initialized) {
      throw new IllegalStateException(
          "The class loader provider is already initialized");
    }
    // Prevent multiple initialization.
    initialized = true;
    // Create the new loader.
    if (parent == null) {
      loader = new MyURLClassLoader();
    } else {
      loader = new MyURLClassLoader(parent);
    }
    // Forcefully load all configuration definition classes in
    // OpenDS.jar.
    initializeCoreComponents();
    // Put extensions jars into the class loader and load all
    // configuration definition classes in that they contain.
    initializeAllExtensions();
  }
  /**
   * Put extensions jars into the class loader and load all configuration
   * definition classes in that they contain.
   *
   * @throws InitializationException
   *           If the extensions folder could not be accessed or if a
   *           extension jar file could not be accessed or if one of the
   *           configuration definition classes could not be
   *           initialized.
   */
  private void initializeAllExtensions() throws InitializationException {
    File libPath = new File(DirectoryServer.getServerRoot(), LIB_DIR);
    File extensionsPath = new File(libPath, EXTENSIONS_DIR);
    try {
      if (!extensionsPath.exists()) {
        // The extensions directory does not exist. This is not a
        // critical problem.
        int msgID = MSGID_ADMIN_NO_EXTENSIONS_DIR;
        String message = getMessage(msgID, extensionsPath);
        logError(ErrorLogCategory.EXTENSIONS,
            ErrorLogSeverity.MILD_ERROR, message, msgID);
        return;
      }
      if (!extensionsPath.isDirectory()) {
        // The extensions directory is not a directory. This is more
        // critical.
        int msgID = MSGID_ADMIN_EXTENSIONS_DIR_NOT_DIRECTORY;
        String message = getMessage(msgID, extensionsPath);
        throw new InitializationException(msgID, message);
      }
      // Get each extension file name.
      FileFilter filter = new FileFilter() {
        /**
         * Must be a Jar file.
         */
        public boolean accept(File pathname) {
          if (!pathname.isFile()) {
            return false;
          }
          String name = pathname.getName();
          return name.endsWith(".jar");
        }
      };
      // Add and initialize the extensions.
      addExtension(extensionsPath.listFiles(filter));
    } catch (InitializationException e) {
      if (debugEnabled()) {
        debugCaught(DebugLogLevel.ERROR, e);
      }
      throw e;
    } catch (Exception e) {
      if (debugEnabled()) {
        debugCaught(DebugLogLevel.ERROR, e);
      }
      int msgID = MSGID_ADMIN_EXTENSIONS_CANNOT_LIST_FILES;
      String message = getMessage(msgID, extensionsPath,
          stackTraceToSingleLineString(e));
      throw new InitializationException(msgID, message, e);
    }
  }
  /**
   * Make sure all core configuration definitions are loaded.
   *
   * @throws InitializationException
   *           If the core manifest file could not be read or if one
   *           of the configuration definition classes could not be
   *           initialized.
   */
  private void initializeCoreComponents()
      throws InitializationException {
    InputStream is = RootConfigurationDefinition.class
        .getResourceAsStream("/admin/" + CORE_MANIFEST);
    if (is == null) {
      int msgID = MSGID_ADMIN_CANNOT_FIND_CORE_MANIFEST;
      String message = getMessage(msgID, CORE_MANIFEST);
      throw new InitializationException(msgID, message);
    }
    try {
      loadDefinitionClasses(is);
    } catch (IOException e) {
      if (debugEnabled()) {
        debugCaught(DebugLogLevel.ERROR, e);
      }
      int msgID = MSGID_ADMIN_CANNOT_READ_CORE_MANIFEST;
      String message = getMessage(msgID, CORE_MANIFEST,
          stackTraceToSingleLineString(e));
      throw new InitializationException(msgID, message);
    } catch (Exception e) {
      if (debugEnabled()) {
        debugCaught(DebugLogLevel.ERROR, e);
      }
      int msgID = MSGID_ADMIN_CANNOT_LOAD_CLASS_FROM_CORE_MANIFEST;
      String message = getMessage(msgID, CORE_MANIFEST,
          stackTraceToSingleLineString(e));
      throw new InitializationException(msgID, message);
    }
  }
  /**
   * Make sure all the configuration definition classes in a extension
   * are loaded.
   *
   * @param jarFile
   *          The extension's Jar file.
   * @throws InitializationException
   *           If the extension jar file could not be accessed or if one
   *           of the configuration definition classes could not be
   *           initialized.
   */
  private void initializeExtension(JarFile jarFile)
      throws InitializationException {
    JarEntry entry = jarFile.getJarEntry("admin/" + EXTENSION_MANIFEST);
    if (entry != null) {
      InputStream is;
      try {
        is = jarFile.getInputStream(entry);
      } catch (Exception e) {
        if (debugEnabled()) {
          debugCaught(DebugLogLevel.ERROR, e);
        }
        int msgID = MSGID_ADMIN_CANNOT_READ_EXTENSION_MANIFEST;
        String message = getMessage(msgID, EXTENSION_MANIFEST, jarFile
            .getName(), stackTraceToSingleLineString(e));
        throw new InitializationException(msgID, message);
      }
      try {
        loadDefinitionClasses(is);
      } catch (IOException e) {
        if (debugEnabled()) {
          debugCaught(DebugLogLevel.ERROR, e);
        }
        int msgID = MSGID_ADMIN_CANNOT_READ_EXTENSION_MANIFEST;
        String message = getMessage(msgID, EXTENSION_MANIFEST, jarFile
            .getName(), stackTraceToSingleLineString(e));
        throw new InitializationException(msgID, message);
      } catch (Exception e) {
        if (debugEnabled()) {
          debugCaught(DebugLogLevel.ERROR, e);
        }
        int msgID = MSGID_ADMIN_CANNOT_LOAD_CLASS_FROM_EXTENSION_MANIFEST;
        String message = getMessage(msgID, EXTENSION_MANIFEST, jarFile
            .getName(), stackTraceToSingleLineString(e));
        throw new InitializationException(msgID, message);
      }
    }
  }
  /**
   * Forcefully load configuration definition classes named in a
   * manifest file.
   *
   * @param is
   *          The manifest file input stream.
   * @throws IOException
   *           If an IO error occurred whilst reading the manifest
   *           file.
   * @throws ClassNotFoundException
   *           If an IO error occurred whilst reading the manifest
   *           file.
   * @throws LinkageError
   *           If the linkage fails.
   * @throws ExceptionInInitializerError
   *           If the initialization provoked by this method fails.
   */
  private void loadDefinitionClasses(InputStream is)
      throws IOException, ClassNotFoundException, LinkageError,
      ExceptionInInitializerError {
    BufferedReader reader = new BufferedReader(new InputStreamReader(
        is));
    while (true) {
      String className = reader.readLine();
      // Break out when the end of the manifest is reached.
      if (className == null) {
        break;
      }
      // Skip blank lines.
      className = className.trim();
      if (className.length() == 0) {
        continue;
      }
      // Skip lines beginning with #.
      if (className.startsWith("#")) {
        continue;
      }
      debugMessage(DebugLogLevel.INFO, "Loading class " + className);
      // Use the underlying loader.
      Class.forName(className, true, loader);
    }
  }
  /**
   * Load the named Jar file.
   *
   * @param jar
   *          The name of the Jar file to load.
   * @return Returns the loaded Jar file.
   * @throws InitializationException
   *           If the Jar file could not be loaded.
   */
  private JarFile loadJarFile(File jar)
      throws InitializationException {
    JarFile jarFile;
    try {
      // Load the extension jar file.
      jarFile = new JarFile(jar);
    } catch (Exception e) {
      if (debugEnabled()) {
        debugCaught(DebugLogLevel.ERROR, e);
      }
      int msgID = MSGID_ADMIN_CANNOT_OPEN_JAR_FILE;
      String message = getMessage(msgID, jar.getName(), jar
          .getParent(), stackTraceToSingleLineString(e));
      throw new InitializationException(msgID, message);
    }
    return jarFile;
  }
}
opends/src/server/org/opends/server/admin/AdminException.java
New file
@@ -0,0 +1,81 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Exceptions thrown when interacting with administration framework.
 */
public abstract class AdminException extends Exception {
  /**
   * Create an admin exception.
   */
  protected AdminException() {
    // No implementation required.
  }
  /**
   * Create an admin exception with a cause.
   *
   * @param cause
   *          The cause.
   */
  protected AdminException(Throwable cause) {
    super(cause);
  }
  /**
   * Create an admin exception with a message and cause.
   *
   * @param message
   *          The message.
   * @param cause
   *          The cause.
   */
  protected AdminException(String message, Throwable cause) {
    super(message, cause);
  }
  /**
   * Create an admin exception with a message.
   *
   * @param message
   *          The message.
   */
  protected AdminException(String message) {
    super(message);
  }
}
opends/src/server/org/opends/server/admin/AdminRuntimeException.java
New file
@@ -0,0 +1,82 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Exceptions thrown when interacting with administration framework that
 * applications are not expected to catch.
 */
public abstract class AdminRuntimeException extends RuntimeException {
  /**
   * Create an admin runtime exception.
   */
  protected AdminRuntimeException() {
    // No implementation required.
  }
  /**
   * Create an admin runtime exception with a cause.
   *
   * @param cause
   *          The cause.
   */
  protected AdminRuntimeException(Throwable cause) {
    super(cause);
  }
  /**
   * Create an admin runtime exception with a message and cause.
   *
   * @param message
   *          The message.
   * @param cause
   *          The cause.
   */
  protected AdminRuntimeException(String message, Throwable cause) {
    super(message, cause);
  }
  /**
   * Create an admin runtime exception with a message.
   *
   * @param message
   *          The message.
   */
  protected AdminRuntimeException(String message) {
    super(message);
  }
}
opends/src/server/org/opends/server/admin/AggregationRelationDefinition.java
New file
@@ -0,0 +1,190 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.util.Validator.ensureNotNull;
/**
 * A managed object aggregation relationship definition.
 *
 * @param <C>
 *          The type of client managed object configuration that this
 *          relation definition refers to.
 * @param <S>
 *          The type of server managed object configuration that this
 *          relation definition refers to.
 */
public final class AggregationRelationDefinition
    <C extends ConfigurationClient, S extends Configuration>
    extends RelationDefinition<C, S> {
  // The plural name of the relation.
  private final String pluralName;
  // The path identifying the location of the referenced managed
  // objects.
  private final ManagedObjectPath path;
  // The minimum number of referenced managed objects.
  private final int minOccurs;
  // The maximum number of referenced managed objects.
  private final int maxOccurs;
  /**
   * Create a new aggregation managed object relation definition.
   *
   * @param pd
   *          The parent managed object definition.
   * @param name
   *          The name of this relation.
   * @param pluralName
   *          The plural name of the relation.
   * @param cd
   *          The child managed object definition.
   * @param path
   *          The path identifying the location of the referenced
   *          managed objects.
   * @param minOccurs
   *          The minimum number of referenced managed objects.
   * @param maxOccurs
   *          The maximum number of referenced managed objects (or
   *          zero if there is no upper limit).
   * @throws IllegalArgumentException
   *           If minOccurs is less than zero or maxOccurs is less
   *           than minOccurs.
   */
  public AggregationRelationDefinition(
      AbstractManagedObjectDefinition<?, ?> pd, String name, String pluralName,
      AbstractManagedObjectDefinition<C, S> cd,
      ManagedObjectPath path, int minOccurs, int maxOccurs)
      throws IllegalArgumentException {
    super(pd, name, cd);
    ensureNotNull(path);
    if (minOccurs < 0) {
      throw new IllegalArgumentException(
          "minOccurs is less than zero");
    }
    if (maxOccurs != 0 && maxOccurs < minOccurs) {
      throw new IllegalArgumentException(
          "maxOccurs is less than minOccurs");
    }
    this.pluralName = pluralName;
    this.path = path;
    this.minOccurs = minOccurs;
    this.maxOccurs = maxOccurs;
  }
  /**
   * Get the plural name of the relation.
   *
   * @return Returns the plural name of the relation.
   */
  public final String getPluralName() {
    return pluralName;
  }
  /**
   * Get the path identifying the location of the referenced managed
   * objects.
   *
   * @return Returns the path identifying the location of the
   *         referenced managed objects.
   */
  public ManagedObjectPath getPath() {
    return path;
  }
  /**
   * Get the minimum number of referenced managed objects.
   *
   * @return Returns the minimum number of referenced managed objects.
   */
  public int getMinOccurs() {
    return minOccurs;
  }
  /**
   * Get the maximum number of referenced managed objects.
   *
   * @return Returns the maximum number of referenced managed objects
   *         (or zero if there is no upper limit).
   */
  public int getMaxOccurs() {
    return maxOccurs;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public final void toString(StringBuilder builder) {
    builder.append("name=");
    builder.append(getName());
    builder.append(" type=aggregation parent=");
    builder.append(getParentDefinition().getName());
    builder.append(" child=");
    builder.append(getChildDefinition().getName());
    builder.append(" minOccurs=");
    builder.append(minOccurs);
    if (maxOccurs != 0) {
      builder.append(" maxOccurs=");
      builder.append(maxOccurs);
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p) {
    return v.visitAggregation(this, p);
  }
}
opends/src/server/org/opends/server/admin/AliasDefaultBehaviorProvider.java
New file
@@ -0,0 +1,61 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A default behavior provider which indicates special behavior. It should be
 * used by properties which have a default behavior which cannot be directly
 * represented using real values of the property. For example, a property
 * containing a set of user names might default to "all users" when no values
 * are provided. This meaning cannot be represented using a finite set of
 * values.
 *
 * @param <T>
 *          The type of values represented by this provider.
 */
public final class AliasDefaultBehaviorProvider<T> implements
    DefaultBehaviorProvider<T> {
  /**
   * Create an alias default behavior provider.
   */
  public AliasDefaultBehaviorProvider() {
    // No implementation required.
  }
  /**
   * {@inheritDoc}
   */
  public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
    return v.visitAlias(this, p);
  }
}
opends/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java
New file
@@ -0,0 +1,193 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.EnumSet;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.AttributeType;
/**
 * Attribute type property definition.
 */
public final class AttributeTypePropertyDefinition extends
    AbstractPropertyDefinition<AttributeType> {
  /**
   * An interface for incrementally constructing attribute type
   * property definitions.
   */
  public static class Builder extends
      AbstractBuilder<AttributeType, AttributeTypePropertyDefinition> {
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    }
    /**
     * {@inheritDoc}
     */
    @Override
    protected AttributeTypePropertyDefinition buildInstance(
        String propertyName, EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<AttributeType> defaultBehavior) {
      return new AttributeTypePropertyDefinition(propertyName,
          options, defaultBehavior);
    }
  }
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = 4622133184170201490L;
  // Flag indicating whether or not attribute type names should be
  // validated against the schema.
  private static boolean isCheckSchema = true;
  /**
   * Create a attribute type property definition builder.
   *
   * @param propertyName
   *          The property name.
   * @return Returns the new attribute type property definition
   *         builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  }
  /**
   * Determines whether or not attribute type names should be
   * validated against the schema.
   *
   * @return Returns <code>true</code> if attribute type names
   *         should be validated against the schema.
   */
  public static boolean isCheckSchema() {
    return isCheckSchema;
  }
  /**
   * Specify whether or not attribute type names should be validated
   * against the schema.
   * <p>
   * By default validation is switched on.
   *
   * @param value
   *          <code>true</code> if attribute type names should be
   *          validated against the schema.
   */
  public static void setCheckSchema(boolean value) {
    isCheckSchema = value;
  }
  // Private constructor.
  private AttributeTypePropertyDefinition(String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<AttributeType> defaultBehavior) {
    super(AttributeType.class, propertyName, options,
        defaultBehavior);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
    return v.visitAttributeType(this, p);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public int compare(AttributeType o1, AttributeType o2) {
    return o1.getNameOrOID().compareToIgnoreCase(o2.getNameOrOID());
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public AttributeType decodeValue(String value)
      throws IllegalPropertyValueStringException {
    ensureNotNull(value);
    String name = value.trim().toLowerCase();
    AttributeType type = DirectoryServer.getAttributeType(name,
        !isCheckSchema);
    if (type == null) {
      throw new IllegalPropertyValueStringException(this, value);
    } else {
      try {
        validateValue(type);
        return type;
      } catch (IllegalPropertyValueException e) {
        throw new IllegalPropertyValueStringException(this, value);
      }
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void validateValue(AttributeType value)
      throws IllegalPropertyValueException {
    ensureNotNull(value);
    // No implementation required.
  }
}
opends/src/server/org/opends/server/admin/BooleanPropertyDefinition.java
New file
@@ -0,0 +1,177 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
/**
 * Boolean property definition.
 */
public final class BooleanPropertyDefinition extends
    AbstractPropertyDefinition<Boolean> {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = -3615113733243221668L;
  /**
   * Mapping used for parsing boolean values. This mapping is more flexible than
   * the standard boolean string parser and supports common true/false synonyms
   * used in configuration.
   */
  private static final Map<String, Boolean> VALUE_MAP;
  static {
    VALUE_MAP = new HashMap<String, Boolean>();
    VALUE_MAP.put("0", Boolean.FALSE);
    VALUE_MAP.put("no", Boolean.FALSE);
    VALUE_MAP.put("off", Boolean.FALSE);
    VALUE_MAP.put("false", Boolean.FALSE);
    VALUE_MAP.put("disable", Boolean.FALSE);
    VALUE_MAP.put("disabled", Boolean.FALSE);
    VALUE_MAP.put("1", Boolean.TRUE);
    VALUE_MAP.put("yes", Boolean.TRUE);
    VALUE_MAP.put("on", Boolean.TRUE);
    VALUE_MAP.put("true", Boolean.TRUE);
    VALUE_MAP.put("enable", Boolean.TRUE);
    VALUE_MAP.put("enabled", Boolean.TRUE);
  }
  /**
   * An interface for incrementally constructing boolean property definitions.
   */
  public static class Builder extends
      AbstractBuilder<Boolean, BooleanPropertyDefinition> {
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    }
    /**
     * {@inheritDoc}
     */
    @Override
    protected BooleanPropertyDefinition buildInstance(String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<Boolean> defaultBehavior) {
      return new BooleanPropertyDefinition(propertyName, options,
          defaultBehavior);
    }
  }
  /**
   * Create a boolean property definition builder.
   *
   * @param propertyName
   *          The property name.
   * @return Returns the new boolean property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  }
  // Private constructor.
  private BooleanPropertyDefinition(String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<Boolean> defaultBehavior) {
    super(Boolean.class, propertyName, options, defaultBehavior);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void validateValue(Boolean value)
      throws IllegalPropertyValueException {
    ensureNotNull(value);
    // No additional validation required.
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public Boolean decodeValue(String value)
      throws IllegalPropertyValueStringException {
    ensureNotNull(value);
    String nvalue = value.trim().toLowerCase();
    Boolean b = VALUE_MAP.get(nvalue);
    if (b == null) {
      throw new IllegalPropertyValueStringException(this, value);
    } else {
      return b;
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
    return v.visitBoolean(this, p);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public int compare(Boolean o1, Boolean o2) {
    return o1.compareTo(o2);
  }
}
opends/src/server/org/opends/server/admin/ClassLoaderProvider.java
New file
@@ -0,0 +1,637 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.loggers.Error.logError;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.messages.AdminMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
import org.opends.server.types.InitializationException;
import org.opends.server.util.Validator;
/**
 * Manages the class loader which should be used for loading
 * configuration definition classes and associated extensions.
 * <p>
 * For extensions which define their own extended configuration
 * definitions, the class loader will make sure that the configuration
 * definition classes are loaded and initialized.
 * <p>
 * Initially the class loader provider is disabled, and calls to the
 * {@link #getClassLoader()} will return the system default class
 * loader.
 * <p>
 * Applications <b>MUST NOT</b> maintain persistent references to the
 * class loader as it can change at run-time.
 */
public final class ClassLoaderProvider {
  /**
   * Private URLClassLoader implementation. This is only required so
   * that we can provide access to the addURL method.
   */
  private static final class MyURLClassLoader extends URLClassLoader {
    /**
     * Create a class loader with the default parent class loader.
     */
    public MyURLClassLoader() {
      super(new URL[0]);
    }
    /**
     * Create a class loader with the provided parent class loader.
     *
     * @param parent
     *          The parent class loader.
     */
    public MyURLClassLoader(ClassLoader parent) {
      super(new URL[0], parent);
    }
    /**
     * Add a Jar file to this class loader.
     *
     * @param jarFile
     *          The name of the Jar file.
     * @throws MalformedURLException
     *           If a protocol handler for the URL could not be found,
     *           or if some other error occurred while constructing
     *           the URL.
     * @throws SecurityException
     *           If a required system property value cannot be
     *           accessed.
     */
    public void addJarFile(File jarFile) throws SecurityException,
        MalformedURLException {
      addURL(jarFile.toURI().toURL());
    }
  }
  // The name of the manifest file listing the core configuration
  // definition classes.
  private static final String CORE_MANIFEST = "core.manifest";
  // The name of the manifest file listing a extension's configuration
  // definition classes.
  private static final String EXTENSION_MANIFEST = "extension.manifest";
  // The name of the lib directory.
  private static final String LIB_DIR = "lib";
  // The name of the extensions directory.
  private static final String EXTENSIONS_DIR = "extensions";
  // The singleton instance.
  private static final ClassLoaderProvider INSTANCE = new ClassLoaderProvider();
  /**
   * Get the single application wide class loader provider instance.
   *
   * @return Returns the single application wide class loader provider
   *         instance.
   */
  public static ClassLoaderProvider getInstance() {
    return INSTANCE;
  }
  // Set of registered Jar files.
  private Set<File> jarFiles = new HashSet<File>();
  // Underlying class loader used to load classes and resources (null
  // if disabled).
  //
  // We contain a reference to the URLClassLoader rather than
  // sub-class it so that it is possible to replace the loader at
  // run-time. For example, when removing or replacing extension Jar
  // files (the URLClassLoader only supports adding new
  // URLs, not removal).
  private MyURLClassLoader loader = null;
  // Private constructor.
  private ClassLoaderProvider() {
    // No implementation required.
  }
  /**
   * Add the named extensions to this class loader provider.
   *
   * @param extensions
   *          The names of the extensions to be loaded. The names
   *          should not contain any path elements and must be located
   *          within the extensions folder.
   * @throws InitializationException
   *           If one of the extensions could not be loaded and
   *           initialized.
   * @throws IllegalStateException
   *           If this class loader provider is disabled.
   * @throws IllegalArgumentException
   *           If one of the extension names was not a single relative
   *           path name element or was an absolute path.
   */
  public synchronized void addExtension(String... extensions)
      throws InitializationException, IllegalStateException,
      IllegalArgumentException {
    Validator.ensureNotNull(extensions);
    if (loader == null) {
      throw new IllegalStateException(
          "Class loader provider is disabled.");
    }
    File libPath = new File(DirectoryServer.getServerRoot(), LIB_DIR);
    File extensionsPath = new File(libPath, EXTENSIONS_DIR);
    ArrayList<File> files = new ArrayList<File>(extensions.length);
    for (String extension : extensions) {
      File file = new File(extensionsPath, extension);
      // For security reasons we need to make sure that the file name
      // passed in did not contain any path elements and names a file
      // in the extensions folder.
      // Can handle potential null parent.
      if (!extensionsPath.equals(file.getParentFile())) {
        throw new IllegalArgumentException("Illegal file name: "
            + extension);
      }
      // The file is valid.
      files.add(file);
    }
    // Add the extensions.
    addExtension(files.toArray(new File[files.size()]));
  }
  /**
   * Disable this class loader provider and removed any registered
   * extensions.
   *
   * @throws IllegalStateException
   *           If this class loader provider is already disabled.
   */
  public synchronized void disable() throws IllegalStateException {
    if (loader == null) {
      throw new IllegalStateException(
          "Class loader provider already disabled.");
    }
    loader = null;
    jarFiles = new HashSet<File>();
  }
  /**
   * Enable this class loader provider using the default parent class
   * loader.
   *
   * @throws InitializationException
   *           If the class loader provider could not initialize
   *           successfully.
   * @throws IllegalStateException
   *           If this class loader provider is already enabled.
   */
  public synchronized void enable() throws InitializationException,
      IllegalStateException {
    enable(null);
  }
  /**
   * Enable this class loader provider using the provided parent class
   * loader.
   *
   * @param parent
   *          The parent class loader.
   * @throws InitializationException
   *           If the class loader provider could not initialize
   *           successfully.
   * @throws IllegalStateException
   *           If this class loader provider is already enabled.
   */
  public synchronized void enable(ClassLoader parent)
      throws InitializationException, IllegalStateException {
    if (loader != null) {
      throw new IllegalStateException(
          "Class loader provider already enabled.");
    }
    if (parent != null) {
      loader = new MyURLClassLoader(parent);
    } else {
      loader = new MyURLClassLoader();
    }
    // Forcefully load all configuration definition classes in
    // OpenDS.jar.
    initializeCoreComponents();
    // Put extensions jars into the class loader and load all
    // configuration definition classes in that they contain.
    initializeAllExtensions();
  }
  /**
   * Gets the class loader which should be used for loading classes
   * and resources. When this class loader provider is disabled, the
   * system default class loader will be returned by default.
   * <p>
   * Applications <b>MUST NOT</b> maintain persistent references to
   * the class loader as it can change at run-time.
   *
   * @return Returns the class loader which should be used for loading
   *         classes and resources.
   */
  public synchronized ClassLoader getClassLoader() {
    if (loader != null) {
      return loader;
    } else {
      return ClassLoader.getSystemClassLoader();
    }
  }
  /**
   * Indicates whether this class loader provider is enabled.
   *
   * @return Returns <code>true</code> if this class loader provider
   *         is enabled.
   */
  public synchronized boolean isEnabled() {
    return loader != null;
  }
  /**
   * Add the named extensions to this class loader.
   *
   * @param extensions
   *          The names of the extensions to be loaded.
   * @throws InitializationException
   *           If one of the extensions could not be loaded and
   *           initialized.
   */
  private synchronized void addExtension(File... extensions)
      throws InitializationException {
    // First add the Jar files to the class loader.
    List<JarFile> jars = new LinkedList<JarFile>();
    for (File extension : extensions) {
      if (jarFiles.contains(extension)) {
        // Skip this file as it is already loaded.
        continue;
      }
      // Attempt to load it.
      jars.add(loadJarFile(extension));
      // Register the Jar file with the class loader.
      try {
        loader.addJarFile(extension);
      } catch (Exception e) {
        if (debugEnabled()) {
          debugCaught(DebugLogLevel.ERROR, e);
        }
        int msgID = MSGID_ADMIN_CANNOT_OPEN_JAR_FILE;
        String message = getMessage(msgID, extension.getName(),
            extension.getParent(), stackTraceToSingleLineString(e));
        throw new InitializationException(msgID, message);
      }
      jarFiles.add(extension);
    }
    // Now forcefully load the configuration definition classes.
    for (JarFile jar : jars) {
      initializeExtension(jar);
    }
  }
  /**
   * Put extensions jars into the class loader and load all
   * configuration definition classes in that they contain.
   *
   * @throws InitializationException
   *           If the extensions folder could not be accessed or if a
   *           extension jar file could not be accessed or if one of
   *           the configuration definition classes could not be
   *           initialized.
   */
  private void initializeAllExtensions()
      throws InitializationException {
    File libPath = new File(DirectoryServer.getServerRoot(), LIB_DIR);
    File extensionsPath = new File(libPath, EXTENSIONS_DIR);
    try {
      if (!extensionsPath.exists()) {
        // The extensions directory does not exist. This is not a
        // critical problem.
        int msgID = MSGID_ADMIN_NO_EXTENSIONS_DIR;
        String message = getMessage(msgID, extensionsPath);
        logError(ErrorLogCategory.EXTENSIONS,
            ErrorLogSeverity.MILD_ERROR, message, msgID);
        return;
      }
      if (!extensionsPath.isDirectory()) {
        // The extensions directory is not a directory. This is more
        // critical.
        int msgID = MSGID_ADMIN_EXTENSIONS_DIR_NOT_DIRECTORY;
        String message = getMessage(msgID, extensionsPath);
        throw new InitializationException(msgID, message);
      }
      // Get each extension file name.
      FileFilter filter = new FileFilter() {
        /**
         * Must be a Jar file.
         */
        public boolean accept(File pathname) {
          if (!pathname.isFile()) {
            return false;
          }
          String name = pathname.getName();
          return name.endsWith(".jar");
        }
      };
      // Add and initialize the extensions.
      addExtension(extensionsPath.listFiles(filter));
    } catch (InitializationException e) {
      if (debugEnabled()) {
        debugCaught(DebugLogLevel.ERROR, e);
      }
      throw e;
    } catch (Exception e) {
      if (debugEnabled()) {
        debugCaught(DebugLogLevel.ERROR, e);
      }
      int msgID = MSGID_ADMIN_EXTENSIONS_CANNOT_LIST_FILES;
      String message = getMessage(msgID, extensionsPath,
          stackTraceToSingleLineString(e));
      throw new InitializationException(msgID, message, e);
    }
  }
  /**
   * Make sure all core configuration definitions are loaded.
   *
   * @throws InitializationException
   *           If the core manifest file could not be read or if one
   *           of the configuration definition classes could not be
   *           initialized.
   */
  private void initializeCoreComponents()
      throws InitializationException {
    InputStream is = RootCfgDefn.class.getResourceAsStream("/admin/"
        + CORE_MANIFEST);
    if (is == null) {
      int msgID = MSGID_ADMIN_CANNOT_FIND_CORE_MANIFEST;
      String message = getMessage(msgID, CORE_MANIFEST);
      throw new InitializationException(msgID, message);
    }
    try {
      loadDefinitionClasses(is);
    } catch (IOException e) {
      if (debugEnabled()) {
        debugCaught(DebugLogLevel.ERROR, e);
      }
      int msgID = MSGID_ADMIN_CANNOT_READ_CORE_MANIFEST;
      String message = getMessage(msgID, CORE_MANIFEST,
          stackTraceToSingleLineString(e));
      throw new InitializationException(msgID, message);
    } catch (Exception e) {
      if (debugEnabled()) {
        debugCaught(DebugLogLevel.ERROR, e);
      }
      int msgID = MSGID_ADMIN_CANNOT_LOAD_CLASS_FROM_CORE_MANIFEST;
      String message = getMessage(msgID, CORE_MANIFEST,
          stackTraceToSingleLineString(e));
      throw new InitializationException(msgID, message);
    }
  }
  /**
   * Make sure all the configuration definition classes in a extension
   * are loaded.
   *
   * @param jarFile
   *          The extension's Jar file.
   * @throws InitializationException
   *           If the extension jar file could not be accessed or if
   *           one of the configuration definition classes could not
   *           be initialized.
   */
  private void initializeExtension(JarFile jarFile)
      throws InitializationException {
    JarEntry entry = jarFile.getJarEntry("admin/"
        + EXTENSION_MANIFEST);
    if (entry != null) {
      InputStream is;
      try {
        is = jarFile.getInputStream(entry);
      } catch (Exception e) {
        if (debugEnabled()) {
          debugCaught(DebugLogLevel.ERROR, e);
        }
        int msgID = MSGID_ADMIN_CANNOT_READ_EXTENSION_MANIFEST;
        String message = getMessage(msgID, EXTENSION_MANIFEST,
            jarFile.getName(), stackTraceToSingleLineString(e));
        throw new InitializationException(msgID, message);
      }
      try {
        loadDefinitionClasses(is);
      } catch (IOException e) {
        if (debugEnabled()) {
          debugCaught(DebugLogLevel.ERROR, e);
        }
        int msgID = MSGID_ADMIN_CANNOT_READ_EXTENSION_MANIFEST;
        String message = getMessage(msgID, EXTENSION_MANIFEST,
            jarFile.getName(), stackTraceToSingleLineString(e));
        throw new InitializationException(msgID, message);
      } catch (Exception e) {
        if (debugEnabled()) {
          debugCaught(DebugLogLevel.ERROR, e);
        }
        int msgID = MSGID_ADMIN_CANNOT_LOAD_CLASS_FROM_EXTENSION_MANIFEST;
        String message = getMessage(msgID, EXTENSION_MANIFEST,
            jarFile.getName(), stackTraceToSingleLineString(e));
        throw new InitializationException(msgID, message);
      }
    }
  }
  /**
   * Forcefully load configuration definition classes named in a
   * manifest file.
   *
   * @param is
   *          The manifest file input stream.
   * @throws IOException
   *           If an IO error occurred whilst reading the manifest
   *           file.
   * @throws ClassNotFoundException
   *           If an IO error occurred whilst reading the manifest
   *           file.
   * @throws LinkageError
   *           If the linkage fails.
   * @throws ExceptionInInitializerError
   *           If the initialization provoked by this method fails.
   */
  private void loadDefinitionClasses(InputStream is)
      throws IOException, ClassNotFoundException, LinkageError,
      ExceptionInInitializerError {
    BufferedReader reader = new BufferedReader(new InputStreamReader(
        is));
    while (true) {
      String className = reader.readLine();
      // Break out when the end of the manifest is reached.
      if (className == null) {
        break;
      }
      // Skip blank lines.
      className = className.trim();
      if (className.length() == 0) {
        continue;
      }
      // Skip lines beginning with #.
      if (className.startsWith("#")) {
        continue;
      }
      debugMessage(DebugLogLevel.INFO, "Loading class " + className);
      // Use the underlying loader.
      Class.forName(className, true, loader);
    }
  }
  /**
   * Load the named Jar file.
   *
   * @param jar
   *          The name of the Jar file to load.
   * @return Returns the loaded Jar file.
   * @throws InitializationException
   *           If the Jar file could not be loaded.
   */
  private JarFile loadJarFile(File jar)
      throws InitializationException {
    JarFile jarFile;
    try {
      // Load the extension jar file.
      jarFile = new JarFile(jar);
    } catch (Exception e) {
      if (debugEnabled()) {
        debugCaught(DebugLogLevel.ERROR, e);
      }
      int msgID = MSGID_ADMIN_CANNOT_OPEN_JAR_FILE;
      String message = getMessage(msgID, jar.getName(), jar
          .getParent(), stackTraceToSingleLineString(e));
      throw new InitializationException(msgID, message);
    }
    return jarFile;
  }
}
opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java
New file
@@ -0,0 +1,370 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.Collections;
import java.util.EnumSet;
import java.util.LinkedList;
import java.util.List;
/**
 * Class property definition.
 * <p>
 * A class property definition defines a property whose values
 * represent a Java class. It is possible to restrict the type of java
 * class by specifying "instance of" constraints.
 * <p>
 * Note that in a client/server environment, the client is probably
 * not capable of validating the Java class (e.g. it will not be able
 * to load it nor have access to the interfaces it is supposed to
 * implement). For this reason, it is possible to switch off
 * validation in the client by calling the static method
 * {@link #setAllowClassValidation(boolean)}.
 */
public final class ClassPropertyDefinition extends
    AbstractPropertyDefinition<String> {
  /**
   * An interface for incrementally constructing class property
   * definitions.
   */
  public static class Builder extends
      AbstractBuilder<String, ClassPropertyDefinition> {
    // List of interfaces which property values must implement.
    private List<String> instanceOfInterfaces;
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
      this.instanceOfInterfaces = new LinkedList<String>();
    }
    /**
     * Add an class name which property values must implement.
     *
     * @param className
     *          The name of a class which property values must
     *          implement.
     */
    public final void addInstanceOf(String className) {
      ensureNotNull(className);
      // Do some basic checks to make sure the string representation
      // is valid.
      String value = className.trim();
      if (!value.matches(CLASS_RE)) {
        throw new IllegalArgumentException("\"" + value
            + "\" is not a valid Java class name");
      }
      // If possible try and load the class in order to perform
      // additional
      // validation.
      if (isAllowClassValidation()) {
        // Check that the class can be loaded so that validation can
        // be
        // performed.
        try {
          loadClass(value);
        } catch (ClassNotFoundException e) {
          // TODO: can we do something better here?
          throw new RuntimeException(e);
        }
      }
      instanceOfInterfaces.add(value);
    }
    /**
     * {@inheritDoc}
     */
    @Override
    protected ClassPropertyDefinition buildInstance(
        String propertyName, EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<String> defaultBehavior) {
      return new ClassPropertyDefinition(propertyName, options,
          defaultBehavior, instanceOfInterfaces);
    }
  }
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = -7775867133238274392L;
  // Regular expression for validating class names.
  private static final String CLASS_RE =
    "^([A-Za-z]+[A-Za-z0-9_]*)*(\\.[A-Za-z]+[A-Za-z0-9_]*)"
      + "*([\\$][A-Za-z0-9_]+)*$";
  // Flag indicating whether class property values should be
  // validated.
  private static boolean allowClassValidation = true;
  /**
   * Create a class property definition builder.
   *
   * @param propertyName
   *          The property name.
   * @return Returns the new class property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  }
  /**
   * Determine whether or not class property definitions should
   * validate class name property values. Validation involves checking
   * that the class exists and that it implements the required
   * interfaces.
   *
   * @return Returns <code>true</code> if class property definitions
   *         should validate class name property values.
   */
  public static boolean isAllowClassValidation() {
    return allowClassValidation;
  }
  /**
   * Specify whether or not class property definitions should validate
   * class name property values. Validation involves checking that the
   * class exists and that it implements the required interfaces.
   * <p>
   * By default validation is switched on.
   *
   * @param value
   *          <code>true</code> if class property definitions should
   *          validate class name property values.
   */
  public static void setAllowClassValidation(boolean value) {
    allowClassValidation = value;
  }
  // Load a named class.
  private static Class<?> loadClass(String className)
      throws ClassNotFoundException, LinkageError {
    return Class.forName(className, true, ClassLoaderProvider
        .getInstance().getClassLoader());
  }
  // List of interfaces which property values must implement.
  private final List<String> instanceOfInterfaces;
  // Private constructor.
  private ClassPropertyDefinition(String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<String> defaultBehavior,
      List<String> instanceOfInterfaces) {
    super(String.class, propertyName, options, defaultBehavior);
    this.instanceOfInterfaces = Collections
        .unmodifiableList(new LinkedList<String>(instanceOfInterfaces));
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
    return v.visitClass(this, p);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String decodeValue(String value)
      throws IllegalPropertyValueStringException {
    ensureNotNull(value);
    try {
      validateValue(value);
    } catch (IllegalPropertyValueException e) {
      throw new IllegalPropertyValueStringException(this, value);
    }
    return value;
  }
  /**
   * Get an unmodifiable list of classes which values of this property
   * must implement.
   *
   * @return Returns an unmodifiable list of classes which values of
   *         this property must implement.
   */
  public List<String> getInstanceOfInterface() {
    return instanceOfInterfaces;
  }
  /**
   * Validate and load the named class, and cast it to a subclass of
   * the specified class.
   *
   * @param <T>
   *          The requested type.
   * @param className
   *          The name of the class to validate and load.
   * @param instanceOf
   *          The class representing the requested type.
   * @return Returns the named class cast to a subclass of the
   *         specified class.
   * @throws IllegalPropertyValueException
   *           If the named class was invalid, could not be loaded, or
   *           did not implement the required interfaces.
   * @throws ClassCastException
   *           If the referenced class does not implement the
   *           requested type.
   */
  public <T> Class<? extends T> loadClass(String className,
      Class<T> instanceOf) throws IllegalPropertyValueException,
      ClassCastException {
    ensureNotNull(className, instanceOf);
    // Make sure that the named class is valid.
    validateClassName(className);
    Class<?> theClass = validateClassInterfaces(className);
    // Cast it to the required type.
    return theClass.asSubclass(instanceOf);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String normalizeValue(String value)
      throws IllegalPropertyValueException {
    ensureNotNull(value);
    return value.trim();
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void validateValue(String value)
      throws IllegalPropertyValueException {
    ensureNotNull(value);
    // Always make sure the name is a valid class name.
    validateClassName(value);
    // If additional validation is enabled then attempt to load the
    // class and
    // check the interfaces that it implements/extends.
    if (allowClassValidation) {
      validateClassInterfaces(value);
    }
  }
  // Make sure that named class implements the interfaces named by
  // this
  // definition.
  private Class<?> validateClassInterfaces(String className)
      throws IllegalPropertyValueException {
    String nvalue = className.trim();
    Class<?> theClass;
    try {
      theClass = loadClass(nvalue);
    } catch (Exception e) {
      // If the class cannot be loaded then it is an invalid value.
      throw new IllegalPropertyValueException(this, className);
    }
    for (String i : instanceOfInterfaces) {
      try {
        Class<?> instanceOfClass = loadClass(i);
        if (!instanceOfClass.isAssignableFrom(theClass)) {
          throw new IllegalPropertyValueException(this, className);
        }
      } catch (Exception e) {
        // Should not happen because the class was validated when the
        // property
        // definition was constructed.
        throw new IllegalPropertyValueException(this, className);
      }
    }
    return theClass;
  }
  // Do some basic checks to make sure the string representation is
  // valid.
  private void validateClassName(String className)
      throws IllegalPropertyValueException {
    String nvalue = className.trim();
    if (!nvalue.matches(CLASS_RE)) {
      throw new IllegalPropertyValueException(this, className);
    }
  }
}
opends/src/server/org/opends/server/admin/Configuration.java
New file
@@ -0,0 +1,70 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import org.opends.server.types.DN;
/**
 * A common base interface for all server managed object
 * configurations.
 */
public interface Configuration {
  /**
   * Get the DN of the LDAP entry associated with this configuration.
   *
   * @return Returns the DN of the LDAP entry associated with this
   *         configuration.
   */
  DN dn();
  /**
   * Get the configuration definition associated with this
   * configuration.
   *
   * @return Returns the configuration definition associated with this
   *         configuration.
   */
  ManagedObjectDefinition<? extends ConfigurationClient,
      ? extends Configuration> definition();
  /**
   * Get a property provider view of this configuration.
   *
   * @return Returns a property provider view of this configuration.
   */
  PropertyProvider properties();
}
opends/src/server/org/opends/server/admin/ConfigurationClient.java
New file
@@ -0,0 +1,69 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A common base interface for all managed object configuration
 * clients.
 */
public interface ConfigurationClient {
  /**
   * Get the configuration definition associated with this
   * configuration.
   *
   * @return Returns the configuration definition associated with this
   *         configuration.
   */
  ManagedObjectDefinition<? extends ConfigurationClient,
      ? extends Configuration> definition();
  /**
   * Get a property provider view of this configuration.
   *
   * @return Returns a property provider view of this configuration.
   */
  PropertyProvider properties();
  /**
   * Commit any changes made to this configuration client.
   *
   * @throws OperationsException
   *           If the changes to this configuration client could not
   *           be committed due to some underlying communication
   *           problem.
   */
  void commit() throws OperationsException;
}
opends/src/server/org/opends/server/admin/DNPropertyDefinition.java
New file
@@ -0,0 +1,227 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.EnumSet;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
/**
 * DN property definition.
 */
public final class DNPropertyDefinition extends
    AbstractPropertyDefinition<DN> {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = -380704355977504890L;
  // Optional base DN which all valid values must be immediately
  // subordinate to.
  private final DN baseDN;
  /**
   * An interface for incrementally constructing DN property
   * definitions.
   */
  public static class Builder extends
      AbstractBuilder<DN, DNPropertyDefinition> {
    // Optional base DN which all valid values must be immediately
    // subordinate to.
    private DN baseDN = null;
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    }
    /**
     * Set the base DN which all valid values must be immediately
     * subordinate to. By default there is no based DN.
     *
     * @param baseDN
     *          The string representation of the base DN.
     * @throws IllegalArgumentException
     *           If the provided string is not a valid DN string
     *           representation.
     */
    public void setBaseDN(String baseDN)
        throws IllegalArgumentException {
      if (baseDN == null) {
        setBaseDN((DN) null);
      } else {
        try {
          setBaseDN(DN.decode(baseDN));
        } catch (DirectoryException e) {
          throw new IllegalArgumentException(e);
        }
      }
    }
    /**
     * Set the base DN which all valid values must be immediately
     * subordinate to. By default there is no based DN.
     *
     * @param baseDN
     *          The base DN.
     */
    public void setBaseDN(DN baseDN) {
      this.baseDN = baseDN;
    }
    /**
     * {@inheritDoc}
     */
    @Override
    protected DNPropertyDefinition buildInstance(String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<DN> defaultBehavior) {
      return new DNPropertyDefinition(propertyName, options,
          defaultBehavior, baseDN);
    }
  }
  /**
   * Create a DN property definition builder.
   *
   * @param propertyName
   *          The property name.
   * @return Returns the new boolean property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  }
  // Private constructor.
  private DNPropertyDefinition(String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<DN> defaultBehavior, DN baseDN) {
    super(DN.class, propertyName, options, defaultBehavior);
    this.baseDN = baseDN;
  }
  /**
   * Get the base DN which all valid values must be immediately
   * subordinate to, or <code>null</code> if there is no based DN.
   *
   * @return Returns the base DN which all valid values must be
   *         immediately subordinate to.
   */
  public DN getBaseDN() {
    return baseDN;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void validateValue(DN value)
      throws IllegalPropertyValueException {
    ensureNotNull(value);
    if (baseDN != null) {
      DN parent = value.getParent();
      if (parent == null) {
        parent = DN.nullDN();
      }
      if (!parent.equals(baseDN)) {
        throw new IllegalPropertyValueException(this, value);
      }
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public DN decodeValue(String value)
      throws IllegalPropertyValueStringException {
    ensureNotNull(value);
    try {
      DN dn = DN.decode(value);
      validateValue(dn);
      return dn;
    } catch (DirectoryException e) {
      throw new IllegalPropertyValueStringException(this, value);
    } catch (IllegalPropertyValueException e) {
      throw new IllegalPropertyValueStringException(this, value);
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
    return v.visitDN(this, p);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public int compare(DN o1, DN o2) {
    return o1.compareTo(o2);
  }
}
opends/src/server/org/opends/server/admin/DecodingException.java
New file
@@ -0,0 +1,52 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * The requested managed object was found but it could not be decoded.
 */
public abstract class DecodingException extends OperationsException {
  /**
   * Create a decoding exception.
   */
  protected DecodingException() {
    // No implementation required.
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public abstract String getMessage();
}
opends/src/server/org/opends/server/admin/DefaultBehaviorPropertyValueException.java
New file
@@ -0,0 +1,93 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Thrown to indicate that a property's default values were invalid.
 */
public class DefaultBehaviorPropertyValueException extends PropertyException {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = 8653244240567431537L;
  // The underlying property exception that caused this exception
  private final PropertyException cause;
  /**
   * Create a new default behavior property value exception.
   *
   * @param d
   *          The property definition.
   * @param cause
   *          The property exception that caused this exception.
   */
  public DefaultBehaviorPropertyValueException(PropertyDefinition d,
      PropertyException cause) {
    super(d);
    this.cause = cause;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public Throwable getCause() {
    return cause;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String getMessage() {
    return "The default values could not be determined "
        + "for the property \"" + getPropertyDefinition().getName() + "\"";
  }
  /**
   * Get the property exception that caused this exception.
   *
   * @return Returns the property exception that caused this exception.
   */
  public final PropertyException getPropertyException() {
    return cause;
  }
}
opends/src/server/org/opends/server/admin/DefaultBehaviorProvider.java
New file
@@ -0,0 +1,73 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * An interface for determining the default behavior of a property. A property
 * exhibits default behavior when it has no values defined. There are four
 * different types of default behavior:
 * <ol>
 * <li>there is no default behavior - e.g. leaving a "description" unset has
 * no side-effects. This default behavior is represented using the
 * {@link UndefinedDefaultBehaviorProvider} implementation
 * <li>the property defaults to one or more real values of the property. This
 * default behavior is represented using the
 * {@link DefinedDefaultBehaviorProvider} implementation
 * <li>the property defaults to some special behavior that cannot be
 * represented using real property values. This default behavior is represented
 * using the {@link AliasDefaultBehaviorProvider} implementation
 * <li>the property inherits its values from property held in another managed
 * object (e.g. the parent managed object). This default behavior is
 * represented using the {@link AbsoluteInheritedDefaultBehaviorProvider} and
 * {@link RelativeInheritedDefaultBehaviorProvider} implementations.
 * </ol>
 * An application can perform actions based on the type of the default behavior
 * by implementing the {@link DefaultBehaviorProviderVisitor} interface.
 *
 * @param <T>
 *          The type of values represented by this provider.
 */
public interface DefaultBehaviorProvider<T> {
  /**
   * Apply a visitor to this default behavior provider.
   *
   * @param <R>
   *          The return type of the visitor's methods.
   * @param <P>
   *          The type of the additional parameters to the visitor's methods.
   * @param v
   *          The default behavior visitor.
   * @param p
   *          Optional additional visitor parameter.
   * @return Returns a result as specified by the visitor.
   */
  <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p);
}
opends/src/server/org/opends/server/admin/DefaultBehaviorProviderVisitor.java
New file
@@ -0,0 +1,116 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A visitor of default behavior providers, in the style of the visitor design
 * pattern. Classes implementing this interface can query default behavior
 * providers in a type-safe manner when the kind of default behavior provider
 * is unknown at compile time. When a visitor is passed to a default behavior
 * provider's accept method, the corresponding visit method most applicable to
 * that default behavior provider is invoked.
 *
 * @param <T>
 *          The type of values represented by the default value provider.
 * @param <R>
 *          The return type of this visitor's methods. Use
 *          {@link java.lang.Void} for visitors that do not need to return
 *          results.
 * @param <P>
 *          The type of the additional parameter to this visitor's methods. Use
 *          {@link java.lang.Void} for visitors that do not need an additional
 *          parameter.
 */
public interface DefaultBehaviorProviderVisitor<T, R, P> {
  /**
   * Visit an absolute inherited default behavior provider.
   *
   * @param d
   *          The absolute inherited default behavior provider to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitAbsoluteInherited(AbsoluteInheritedDefaultBehaviorProvider<T> d, P p);
  /**
   * Visit an alias default behavior provider.
   *
   * @param d
   *          The alias default behavior provider to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitAlias(AliasDefaultBehaviorProvider<T> d, P p);
  /**
   * Visit an defined default behavior provider.
   *
   * @param d
   *          The defined default behavior provider to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitDefined(DefinedDefaultBehaviorProvider<T> d, P p);
  /**
   * Visit a relative inherited default behavior provider.
   *
   * @param d
   *          The relative inherited default behavior provider to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitRelativeInherited(RelativeInheritedDefaultBehaviorProvider<T> d, P p);
  /**
   * Visit an undefined default behavior provider.
   *
   * @param d
   *          The undefined default behavior provider to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitUndefined(UndefinedDefaultBehaviorProvider<T> d, P p);
}
opends/src/server/org/opends/server/admin/DefinedDefaultBehaviorProvider.java
New file
@@ -0,0 +1,93 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
/**
 * A default behavior provider which represents a well-defined set of default
 * values. It should be used by properties which have default value(s) which are
 * valid value(s) according to the constraints of the property's definition.
 *
 * @param <T>
 *          The type of values represented by this provider.
 */
public final class DefinedDefaultBehaviorProvider<T> implements
    DefaultBehaviorProvider<T> {
  // The collection of default values.
  private final Collection<String> values;
  /**
   * Create a new defined default behavior provider associated with the
   * specified list of values.
   *
   * @param values
   *          The list of values (must be non-<code>null</code> and not
   *          empty) in their string representation.
   * @throws IllegalArgumentException
   *           If the list of values was <code>null</code> or empty.
   */
  public DefinedDefaultBehaviorProvider(String... values)
      throws IllegalArgumentException {
    if (values == null || values.length == 0) {
      throw new IllegalArgumentException(
          "Null or empty list of default values");
    }
    this.values = Arrays.asList(values);
  }
  /**
   * {@inheritDoc}
   */
  public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
    return v.visitDefined(this, p);
  }
  /**
   * Get a copy of the default values.
   *
   * @return Returns a newly allocated collection containing a copy of the
   *         default values.
   */
  public Collection<String> getDefaultValues() {
    return new ArrayList<String>(values);
  }
}
opends/src/server/org/opends/server/admin/DefinitionDecodingException.java
New file
@@ -0,0 +1,125 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * The requested managed object was found but its type could not be
 * determined.
 */
public class DefinitionDecodingException extends DecodingException {
  /**
   * Version ID required by serializable classes.
   */
  private static final long serialVersionUID = 3459033551415663416L;
  /**
   * An enumeration defining the reasons why the definition could not be
   * resolved.
   */
  public static enum Reason {
    /**
     * The managed object could be found but did not contain any type
     * information (eg missing object classes in LDAP).
     */
    NO_TYPE_INFORMATION(
        "The managed object could be found but did not contain any"
            + " type information (e.g. missing object classes in LDAP)."),
    /**
     * The managed object could be found but did not contain the expected type
     * information (eg incorrect object classes in LDAP).
     */
    WRONG_TYPE_INFORMATION(
        "The managed object could be found but did not contain the"
            + " expected type information (e.g. incorrect object"
            + " classes in LDAP)."),
    /**
     * The managed object could be found but its type resolved to an abstract
     * managed object definition.
     */
    ABSTRACT_TYPE_INFORMATION(
        "The managed object could be found but its type resolved to an"
            + " abstract managed object definition.");
    // Simple description of this reason for debugging.
    private String msg;
    // Private constructor.
    private Reason(String msg) {
      this.msg = msg;
    }
  }
  // The reason why the definition could not be determined.
  private final Reason reason;
  /**
   * Create a new definition decoding exception.
   *
   * @param reason
   *          The reason why the definition could not be determined.
   */
  public DefinitionDecodingException(Reason reason) {
    this.reason = reason;
  }
  /**
   * Get the reason why the definition could not be determined.
   *
   * @return Returns the reason why the definition could not be determined.
   */
  public Reason getReason() {
    return reason;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String getMessage() {
    return reason.msg;
  }
}
opends/src/server/org/opends/server/admin/DefinitionResolver.java
New file
@@ -0,0 +1,72 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * This interface is used to determine the "best match" managed object
 * definition in a definition hierarchy.
 * <p>
 * Managed object definitions, like Java classes, are arranged in an
 * inheritance hierarchy. When managed objects are decoded (e.g. from
 * LDAP entries), the driver implementation is provided with an
 * "expected managed object definition". However, the actual decoded
 * managed object is often an instance of a sub-type of this
 * definition. For example, when decoding a connection handler managed
 * object, the actual type can never be a connection handler because
 * it is an abstract managed object type. Instead, the decoded managed
 * object must be a "concrete" sub-type: an LDAP connection handler or
 * JMX connection handler.
 * <p>
 * This resolution process is coordinated by the
 * <code>resolveManagedObjectDefinition</code> method in managed
 * object definitions, where it is passed a
 * <code>DefinitionResolver</code> implementation. The
 * <code>resolveManagedObjectDefinition</code> method takes care of
 * recursively descending through the definition hierarchy and invokes
 * the {@link #matches(AbstractManagedObjectDefinition)} method
 * against each potential sub-type. It is the job of the resolver to
 * indicate whether the provided managed object definition is a
 * candidate definition. For example, the LDAP driver provides a
 * definition resolver which uses the decoded LDAP entry's object
 * classes to determine the final appropriate managed object
 * definition.
 */
public interface DefinitionResolver {
  /**
   * Determines whether or not the provided managed object definition matches
   * this resolver's criteria.
   *
   * @param d
   *          The managed object definition.
   * @return Returns <code>true</code> if the the provided managed object
   *         definition matches this resolver's criteria.
   */
  boolean matches(AbstractManagedObjectDefinition<?, ?> d);
}
opends/src/server/org/opends/server/admin/DurationPropertyDefinition.java
New file
@@ -0,0 +1,579 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.EnumSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * Duration property definition.
 * <p>
 * A duration property definition comprises of:
 * <ul>
 * <li>a <i>base unit</i> - specifies the minimum granularity which
 * can be used to specify duration property values. For example, if
 * the base unit is in seconds then values represented in milliseconds
 * will not be permitted. The default base unit is seconds
 * <li>an optional <i>maximum unit</i> - specifies the biggest
 * duration unit which can be used to specify duration property
 * values. Values presented in units greater than this unit will not
 * be permitted. There is no default maximum unit
 * <li><i>lower limit</i> - specifies the smallest duration
 * permitted by the property. The default lower limit is 0 and can
 * never be less than 0
 * <li>an optional <i>upper limit</i> - specifies the biggest
 * duration permitted by the property. By default, there is no upper
 * limit
 * <li>support for <i>unlimited</i> durations - when permitted users
 * can specify "unlimited" durations. These are represented using the
 * decoded value, -1, or the encoded string value "unlimited". By
 * default, unlimited durations are not permitted. In addition, it is
 * not possible to define an upper limit and support unlimited values.
 * </ul>
 * Decoded values are represented using <code>long</code> values in
 * the base unit defined for the duration property definition.
 */
public final class DurationPropertyDefinition extends
    AbstractPropertyDefinition<Long> {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = -1491050690542547075L;
  // String used to represent unlimited durations.
  private static final String UNLIMITED = "unlimited";
  // The base unit for this property definition (values including
  // limits are specified in this unit).
  private final DurationUnit baseUnit;
  // The optional maximum unit for this property definition.
  private final DurationUnit maximumUnit;
  // The lower limit of the property value.
  private final long lowerLimit;
  // The optional upper limit of the property value.
  private final Long upperLimit;
  // Indicates whether this property allows the use of the "unlimited"
  // duration value (represented using a -1L or the string
  // "unlimited").
  private final boolean allowUnlimited;
  /**
   * An interface for incrementally constructing duration property
   * definitions.
   */
  public static class Builder extends
      AbstractBuilder<Long, DurationPropertyDefinition> {
    // The base unit for this property definition (values including
    // limits are specified in this unit).
    private DurationUnit baseUnit = DurationUnit.SECONDS;
    // The optional maximum unit for this property definition.
    private DurationUnit maximumUnit = null;
    // The lower limit of the property value.
    private long lowerLimit = 0L;
    // The optional upper limit of the property value.
    private Long upperLimit = null;
    // Indicates whether this property allows the use of the
    // "unlimited" duration value (represented using a -1L or the
    // string "unlimited").
    private boolean allowUnlimited = false;
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    }
    /**
     * Set the base unit for this property definition (values
     * including limits are specified in this unit). By default a
     * duration property definition uses seconds.
     *
     * @param unit
     *          The string representation of the base unit (must not
     *          be <code>null</code>).
     * @throws IllegalArgumentException
     *           If the provided unit name did not correspond to a
     *           known duration unit, or if the base unit is bigger
     *           than the maximum unit.
     */
    public final void setBaseUnit(String unit)
        throws IllegalArgumentException {
      ensureNotNull(unit);
      setBaseUnit(DurationUnit.getUnit(unit));
    }
    /**
     * Set the base unit for this property definition (values
     * including limits are specified in this unit). By default a
     * duration property definition uses seconds.
     *
     * @param unit
     *          The base unit (must not be <code>null</code>).
     * @throws IllegalArgumentException
     *           If the provided base unit is bigger than the maximum
     *           unit.
     */
    public final void setBaseUnit(DurationUnit unit)
        throws IllegalArgumentException {
      ensureNotNull(unit);
      // Make sure that the base unit is not bigger than the maximum
      // unit.
      if (maximumUnit != null) {
        if (unit.getDuration() > maximumUnit.getDuration()) {
          throw new IllegalArgumentException(
              "Base unit greater than maximum unit");
        }
      }
      this.baseUnit = unit;
    }
    /**
     * Set the maximum unit for this property definition. By default
     * there is no maximum unit.
     *
     * @param unit
     *          The string representation of the maximum unit, or
     *          <code>null</code> if there should not be a maximum
     *          unit.
     * @throws IllegalArgumentException
     *           If the provided unit name did not correspond to a
     *           known duration unit, or if the maximum unit is
     *           smaller than the base unit.
     */
    public final void setMaximumUnit(String unit)
        throws IllegalArgumentException {
      if (unit == null) {
        setMaximumUnit((DurationUnit) null);
      } else {
        setMaximumUnit(DurationUnit.getUnit(unit));
      }
    }
    /**
     * Set the maximum unit for this property definition. By default
     * there is no maximum unit.
     *
     * @param unit
     *          The maximum unit, or <code>null</code> if there
     *          should not be a maximum unit.
     * @throws IllegalArgumentException
     *           If the provided maximum unit is smaller than the base
     *           unit.
     */
    public final void setMaximumUnit(DurationUnit unit)
        throws IllegalArgumentException {
      if (unit != null) {
        // Make sure that the maximum unit is not smaller than the
        // base unit.
        if (unit.getDuration() < baseUnit.getDuration()) {
          throw new IllegalArgumentException(
              "Maximum unit smaller than base unit");
        }
      }
      this.maximumUnit = unit;
    }
    /**
     * Set the lower limit.
     *
     * @param lowerLimit
     *          The new lower limit (must be >= 0).
     * @throws IllegalArgumentException
     *           If a negative lower limit was specified, or the lower
     *           limit is greater than the upper limit.
     */
    public final void setLowerLimit(long lowerLimit)
        throws IllegalArgumentException {
      if (lowerLimit < 0) {
        throw new IllegalArgumentException("Negative lower limit");
      }
      if (upperLimit != null && lowerLimit > upperLimit) {
        throw new IllegalArgumentException(
            "Lower limit greater than upper limit");
      }
      this.lowerLimit = lowerLimit;
    }
    /**
     * Set the upper limit.
     *
     * @param upperLimit
     *          The new upper limit or <code>null</code> if there is
     *          no upper limit.
     * @throws IllegalArgumentException
     *           If a negative upper limit was specified, or the lower
     *           limit is greater than the upper limit or unlimited
     *           durations are permitted.
     */
    public final void setUpperLimit(Long upperLimit)
        throws IllegalArgumentException {
      if (upperLimit != null) {
        if (upperLimit < 0) {
          throw new IllegalArgumentException("Negative upper limit");
        }
        if (lowerLimit > upperLimit) {
          throw new IllegalArgumentException(
              "Lower limit greater than upper limit");
        }
        if (allowUnlimited) {
          throw new IllegalArgumentException(
              "Upper limit specified when unlimited durations are permitted");
        }
      }
      this.upperLimit = upperLimit;
    }
    /**
     * Specify whether or not this property definition will allow
     * unlimited values (default is false).
     *
     * @param allowUnlimited
     *          <code>true</code> if the property will allow
     *          unlimited values, or <code>false</code> otherwise.
     * @throws IllegalArgumentException
     *           If unlimited values are to be permitted but there is
     *           an upper limit specified.
     */
    public final void setAllowUnlimited(boolean allowUnlimited)
        throws IllegalArgumentException {
      if (allowUnlimited && upperLimit != null) {
        throw new IllegalArgumentException(
            "Upper limit specified when unlimited durations are permitted");
      }
      this.allowUnlimited = allowUnlimited;
    }
    /**
     * {@inheritDoc}
     */
    @Override
    protected DurationPropertyDefinition buildInstance(
        String propertyName, EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<Long> defaultBehavior) {
      return new DurationPropertyDefinition(propertyName, options,
          defaultBehavior, baseUnit, maximumUnit, lowerLimit,
          upperLimit, allowUnlimited);
    }
  }
  /**
   * Create a duration property definition builder.
   *
   * @param propertyName
   *          The property name.
   * @return Returns the new integer property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  }
  // Private constructor.
  private DurationPropertyDefinition(String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<Long> defaultBehavior,
      DurationUnit baseUnit, DurationUnit maximumUnit,
      Long lowerLimit, Long upperLimit, boolean allowUnlimited) {
    super(Long.class, propertyName, options, defaultBehavior);
    this.baseUnit = baseUnit;
    this.maximumUnit = maximumUnit;
    this.lowerLimit = lowerLimit;
    this.upperLimit = upperLimit;
    this.allowUnlimited = allowUnlimited;
  }
  /**
   * Get the base unit for this property definition (values including
   * limits are specified in this unit).
   *
   * @return Returns the base unit for this property definition
   *         (values including limits are specified in this unit).
   */
  public DurationUnit getBaseUnit() {
    return baseUnit;
  }
  /**
   * Get the maximum unit for this property definition if specified.
   *
   * @return Returns the maximum unit for this property definition, or
   *         <code>null</code> if there is no maximum unit.
   */
  public DurationUnit getMaximumUnit() {
    return maximumUnit;
  }
  /**
   * Get the lower limit.
   *
   * @return Returns the lower limit.
   */
  public long getLowerLimit() {
    return lowerLimit;
  }
  /**
   * Get the upper limit.
   *
   * @return Returns the upper limit or <code>null</code> if there
   *         is no upper limit.
   */
  public Long getUpperLimit() {
    return upperLimit;
  }
  /**
   * Determine whether this property allows unlimited durations.
   *
   * @return Returns <code>true</code> if this this property allows
   *         unlimited durations.
   */
  public boolean isAllowUnlimited() {
    return allowUnlimited;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void validateValue(Long value)
      throws IllegalPropertyValueException {
    ensureNotNull(value);
    if (!allowUnlimited && value < lowerLimit) {
      throw new IllegalPropertyValueException(this, value);
      // unlimited allowed
    } else if (value >= 0 && value < lowerLimit) {
      throw new IllegalPropertyValueException(this, value);
    }
    if ((upperLimit != null) && (value > upperLimit)) {
      throw new IllegalPropertyValueException(this, value);
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String encodeValue(Long value)
      throws IllegalPropertyValueException {
    ensureNotNull(value);
    // Make sure that we correctly encode negative values as
    // "unlimited".
    if (allowUnlimited) {
      if (value < 0) {
        return UNLIMITED;
      }
    }
    // Encode the size value using the base unit.
    StringBuilder builder = new StringBuilder();
    builder.append(value);
    builder.append(baseUnit.toString());
    return builder.toString();
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public Long decodeValue(String value)
      throws IllegalPropertyValueStringException {
    ensureNotNull(value);
    // First check for the special "unlimited" value when necessary.
    if (allowUnlimited) {
      if (value.trim().equalsIgnoreCase(UNLIMITED)) {
        return -1L;
      }
    }
    // Value must be a floating point number followed by a unit.
    Pattern p = Pattern
        .compile("^\\s*(\\d+(\\.\\d*)?)\\s*(\\w+)\\s*$");
    Matcher m = p.matcher(value);
    if (!m.matches()) {
      throw new IllegalPropertyValueStringException(this, value);
    }
    // Group 1 is the float.
    double d;
    try {
      d = Double.valueOf(m.group(1));
    } catch (NumberFormatException e) {
      throw new IllegalPropertyValueStringException(this, value);
    }
    // Group 3 is the unit.
    DurationUnit u;
    try {
      u = DurationUnit.getUnit(m.group(3));
    } catch (IllegalArgumentException e) {
      throw new IllegalPropertyValueStringException(this, value);
    }
    // Check the unit is in range.
    if (u.getDuration() < baseUnit.getDuration()) {
      throw new IllegalPropertyValueStringException(this, value);
    }
    if (maximumUnit != null) {
      if (u.getDuration() > maximumUnit.getDuration()) {
        throw new IllegalPropertyValueStringException(this, value);
      }
    }
    // Convert the value a long in the property's required unit.
    Long i = (long) u.getDuration(d, baseUnit);
    try {
      validateValue(i);
    } catch (IllegalPropertyValueException e) {
      throw new IllegalPropertyValueStringException(this, value);
    }
    return i;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
    return v.visitDuration(this, p);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void toString(StringBuilder builder) {
    super.toString(builder);
    builder.append(" baseUnit=");
    builder.append(baseUnit);
    if (maximumUnit != null) {
      builder.append(" maximumUnit=");
      builder.append(maximumUnit);
    }
    builder.append(" lowerLimit=");
    builder.append(lowerLimit);
    if (upperLimit != null) {
      builder.append(" upperLimit=");
      builder.append(upperLimit);
    }
    builder.append(" allowUnlimited=");
    builder.append(allowUnlimited);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public int compare(Long o1, Long o2) {
    return o1.compareTo(o2);
  }
}
opends/src/server/org/opends/server/admin/DurationUnit.java
New file
@@ -0,0 +1,218 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import java.util.HashMap;
import java.util.Map;
/**
 * This enumeration defines various duration units.
 */
public enum DurationUnit {
  /**
   * A millisecond unit.
   */
  MILLI_SECONDS(1L, "ms", "milliseconds"),
  /**
   * A second unit.
   */
  SECONDS(1000L, "s", "seconds"),
  /**
   * A minute unit.
   */
  MINUTES((long) 60 * 1000, "m", "minutes"),
  /**
   * An hour unit.
   */
  HOURS((long) 60 * 60 * 1000, "h", "hours"),
  /**
   * A day unit.
   */
  DAYS((long) 24 * 60 * 60 * 1000, "d", "days"),
  /**
   * A week unit.
   */
  WEEKS((long) 7 * 24 * 60 * 60 * 1000, "w", "weeks");
  // A lookup table for resolving a unit from its name.
  private static final Map<String, DurationUnit> nameToUnit;
  static {
    nameToUnit = new HashMap<String, DurationUnit>();
    for (DurationUnit unit : DurationUnit.values()) {
      nameToUnit.put(unit.shortName, unit);
      nameToUnit.put(unit.longName, unit);
    }
  }
  // The size of the unit in milli-seconds.
  private final long sz;
  // The abbreviation of the unit.
  private final String shortName;
  // The long name of the unit.
  private final String longName;
  // Private constructor.
  private DurationUnit(long sz, String shortName, String longName) {
    this.sz = sz;
    this.shortName = shortName;
    this.longName = longName;
  }
  /**
   * Get the unit corresponding to the provided unit name.
   *
   * @param s
   *          The name of the unit. Can be the abbreviated or long name and can
   *          contain white space and mixed case characters.
   * @return Returns the unit corresponding to the provided unit name.
   * @throws IllegalArgumentException
   *           If the provided name did not correspond to a known duration unit.
   */
  public static DurationUnit getUnit(String s) throws IllegalArgumentException {
    DurationUnit unit = nameToUnit.get(s.trim().toLowerCase());
    if (unit == null) {
      throw new IllegalArgumentException("Illegal duration unit \"" + s + "\"");
    }
    return unit;
  }
  /**
   * Get the abbreviated name of this unit.
   *
   * @return Returns the abbreviated name of this unit.
   */
  public String getShortName() {
    return shortName;
  }
  /**
   * Get the long name of this unit.
   *
   * @return Returns the long name of this unit.
   */
  public String getLongName() {
    return longName;
  }
  /**
   * Get the number of milli-seconds that this unit represents.
   *
   * @return Returns the number of milli-seconds that this unit represents.
   */
  public long getDuration() {
    return sz;
  }
  /**
   * Converts the specified duration in this unit to milli-seconds.
   *
   * @param duration
   *          The duration.
   * @return Returns the number of milli-seconds that the duration represents.
   */
  public long getDuration(double duration) {
    return (long) (sz * duration);
  }
  /**
   * Converts a duration in this unit to the specified unit.
   *
   * @param duration
   *          The duration.
   * @param unit
   *          The required unit.
   * @return Returns a value representing the duration in the specified unit.
   */
  public double getDuration(double duration, DurationUnit unit) {
    return (sz * duration) / unit.sz;
  }
  /**
   * Get the best-fit unit for the specified duration in this unit. For example,
   * if this unit is minutes and the duration 120 is provided, then the best fit
   * unit is hours: 2h. Similarly, if the duration is 0.5, then the best fit
   * unit will by seconds: 30s.
   *
   * @param duration
   *          The duration.
   * @return Returns the best-fit unit for the specified duration in this unit.
   */
  public DurationUnit getBestFitUnit(double duration) {
    for (DurationUnit unit :
            new DurationUnit[]{WEEKS, DAYS, HOURS, MINUTES, SECONDS}) {
      double v = getDuration(duration, unit);
      if (Double.isInfinite(v) || Double.isNaN(v) || v == 0) {
        return this;
      }
      if (v >= 1 && Math.floor(v) == Math.ceil(v)) {
        return unit;
      }
    }
    return MILLI_SECONDS;
  }
  /**
   * {@inheritDoc}
   * <p>
   * This implementation returns the abbreviated name of this duration unit.
   */
  @Override
  public String toString() {
    return shortName;
  }
}
opends/src/server/org/opends/server/admin/EnumPropertyDefinition.java
New file
@@ -0,0 +1,216 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
/**
 * Enumeration property definition.
 *
 * @param <E>
 *          The enumeration that should be used for values of this
 *          property definition.
 */
public final class EnumPropertyDefinition<E extends Enum<E>> extends
    AbstractPropertyDefinition<E> {
  /**
   * An interface for incrementally constructing enumeration property
   * definitions.
   *
   * @param <E>
   *          The enumeration that should be used for values of this
   *          property definition.
   */
  public static class Builder<E extends Enum<E>> extends
      AbstractBuilder<E, EnumPropertyDefinition<E>> {
    // The enumeration class.
    private Class<E> enumClass;
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
      this.enumClass = null;
    }
    /**
     * Set the enumeration class which should be used for values of
     * this property definition.
     *
     * @param enumClass
     *          The enumeration class which should be used for values
     *          of this property definition.
     */
    public final void setEnumClass(Class<E> enumClass) {
      this.enumClass = enumClass;
    }
    /**
     * {@inheritDoc}
     */
    @Override
    protected EnumPropertyDefinition<E> buildInstance(
        String propertyName, EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<E> defaultBehavior) {
      // Make sure that the enumeration class has been defined.
      if (enumClass == null) {
        throw new IllegalStateException("Enumeration class undefined");
      }
      return new EnumPropertyDefinition<E>(propertyName, options,
          defaultBehavior, enumClass);
    }
  }
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = 338458138694686844L;
  /**
   * Create an enumeration property definition builder.
   *
   * @param <E>
   *          The enumeration that should be used for values of this
   *          property definition.
   * @param propertyName
   *          The property name.
   * @return Returns the new enumeration property definition builder.
   */
  public static <E extends Enum<E>> Builder<E> createBuilder(
      String propertyName) {
    return new Builder<E>(propertyName);
  }
  // The enumeration class.
  private final Class<E> enumClass;
  // Map used for decoding values.
  private final Map<String, E> decodeMap;
  // Private constructor.
  private EnumPropertyDefinition(String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<E> defaultBehavior, Class<E> enumClass) {
    super(enumClass, propertyName, options, defaultBehavior);
    this.enumClass = enumClass;
    // Initialize the decoding map.
    this.decodeMap = new HashMap<String, E>();
    for (E value : EnumSet.<E> allOf(enumClass)) {
      String s = value.toString().trim().toLowerCase();
      this.decodeMap.put(s, value);
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
    return v.visitEnum(this, p);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public E decodeValue(String value)
      throws IllegalPropertyValueStringException {
    ensureNotNull(value);
    String nvalue = value.trim().toLowerCase();
    E eValue = decodeMap.get(nvalue);
    if (eValue == null) {
      throw new IllegalPropertyValueStringException(this, value);
    } else {
      return eValue;
    }
  }
  /**
   * Get the enumeration class used for values of this property.
   *
   * @return Returns the enumeration class used for values of this
   *         property.
   */
  public Class<E> getEnumClass() {
    return enumClass;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String normalizeValue(E value)
      throws IllegalPropertyValueException {
    ensureNotNull(value);
    return value.toString().trim().toLowerCase();
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void validateValue(E value)
      throws IllegalPropertyValueException {
    ensureNotNull(value);
    // No additional validation required.
  }
}
opends/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java
New file
@@ -0,0 +1,153 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.EnumSet;
import org.opends.server.config.ConfigException;
import org.opends.server.types.AddressMask;
/**
 * IP address mask property definition.
 */
public final class IPAddressMaskPropertyDefinition extends
    AbstractPropertyDefinition<AddressMask> {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = -6641292526738863824L;
  /**
   * An interface for incrementally constructing IP address mask property
   * definitions.
   */
  public static class Builder extends
      AbstractBuilder<AddressMask, IPAddressMaskPropertyDefinition> {
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    }
    /**
     * {@inheritDoc}
     */
    @Override
    protected IPAddressMaskPropertyDefinition buildInstance(
        String propertyName, EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<AddressMask> defaultBehavior) {
      return new IPAddressMaskPropertyDefinition(propertyName, options,
          defaultBehavior);
    }
  }
  /**
   * Create a IP address mask property definition builder.
   *
   * @param propertyName
   *          The property name.
   * @return Returns the new IP address mask property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  }
  // Private constructor.
  private IPAddressMaskPropertyDefinition(String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<AddressMask> defaultBehavior) {
    super(AddressMask.class, propertyName, options, defaultBehavior);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void validateValue(AddressMask value)
      throws IllegalPropertyValueException {
    ensureNotNull(value);
    // No additional validation required.
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public AddressMask decodeValue(String value)
      throws IllegalPropertyValueStringException {
    ensureNotNull(value);
    try {
      return AddressMask.decode(value);
    } catch (ConfigException e) {
      // TODO: it would be nice to throw the cause.
      throw new IllegalPropertyValueStringException(this, value);
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
    return v.visitIPAddressMask(this, p);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public int compare(AddressMask o1, AddressMask o2) {
    return o1.toString().compareTo(o2.toString());
  }
}
opends/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java
New file
@@ -0,0 +1,152 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.util.Validator.ensureNotNull;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.EnumSet;
/**
 * IP address property definition.
 */
public final class IPAddressPropertyDefinition extends
    AbstractPropertyDefinition<InetAddress> {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = -6641292526738863824L;
  /**
   * An interface for incrementally constructing IP address property
   * definitions.
   */
  public static class Builder extends
      AbstractBuilder<InetAddress, IPAddressPropertyDefinition> {
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    }
    /**
     * {@inheritDoc}
     */
    @Override
    protected IPAddressPropertyDefinition buildInstance(String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<InetAddress> defaultBehavior) {
      return new IPAddressPropertyDefinition(propertyName, options,
          defaultBehavior);
    }
  }
  /**
   * Create a IP address property definition builder.
   *
   * @param propertyName
   *          The property name.
   * @return Returns the new IP address property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  }
  // Private constructor.
  private IPAddressPropertyDefinition(String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<InetAddress> defaultBehavior) {
    super(InetAddress.class, propertyName, options, defaultBehavior);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void validateValue(InetAddress value)
      throws IllegalPropertyValueException {
    ensureNotNull(value);
    // No additional validation required.
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public InetAddress decodeValue(String value)
      throws IllegalPropertyValueStringException {
    ensureNotNull(value);
    try {
      return InetAddress.getByName(value);
    } catch (UnknownHostException e) {
      // TODO: it would be nice to throw the cause.
      throw new IllegalPropertyValueStringException(this, value);
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
    return v.visitIPAddress(this, p);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public int compare(InetAddress o1, InetAddress o2) {
    return o1.getHostAddress().compareTo(o2.getHostAddress());
  }
}
opends/src/server/org/opends/server/admin/IllegalPropertyValueException.java
New file
@@ -0,0 +1,84 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Thrown to indicate that a property value was invalid according to its
 * associated property definition.
 */
public class IllegalPropertyValueException extends PropertyException {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = -3145632074909281823L;
  // The illegal property value.
  private final Object value;
  /**
   * Create a new illegal property value exception.
   *
   * @param d
   *          The property definition.
   * @param value
   *          The illegal property value.
   */
  public IllegalPropertyValueException(PropertyDefinition d, Object value) {
    super(d);
    this.value = value;
  }
  /**
   * Get the illegal property value that caused the exception.
   *
   * @return Returns the illegal property value.
   */
  public final Object getIllegalValue() {
    return value;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String getMessage() {
    return "The value \"" + String.valueOf(value)
        + "\" is not a valid value for the property \""
        + getPropertyDefinition().getName() + "\"";
  }
}
opends/src/server/org/opends/server/admin/IllegalPropertyValueStringException.java
New file
@@ -0,0 +1,85 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Thrown to indicate that a property value string was invalid according to its
 * associated property definition.
 */
public class IllegalPropertyValueStringException extends PropertyException {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = -3145632074909281823L;
  // The illegal property value string.
  private final String value;
  /**
   * Create a new illegal property value string exception.
   *
   * @param d
   *          The property definition.
   * @param value
   *          The illegal property value string.
   */
  public IllegalPropertyValueStringException(PropertyDefinition d,
      String value) {
    super(d);
    this.value = value;
  }
  /**
   * Get the illegal property value string that caused the exception.
   *
   * @return Returns the illegal property value string.
   */
  public final String getIllegalValueString() {
    return value;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String getMessage() {
    return "The string value \"" + String.valueOf(value)
        + "\" is not a valid value for the property \""
        + getPropertyDefinition().getName() + "\"";
  }
}
opends/src/server/org/opends/server/admin/InheritedDefaultValueException.java
New file
@@ -0,0 +1,97 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Thrown to indicate that a property's inherited default values could not be
 * determined due to some underlying operations exception which occurred when
 * attempting to retrieve them.
 */
public class InheritedDefaultValueException extends PropertyException {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = 7228186032995472371L;
  // The operations exception that caused default value look up to fail.
  private final OperationsException cause;
  /**
   * Create a new inherited default value exception.
   *
   * @param d
   *          The property definition.
   * @param cause
   *          The operations exception that caused default value look up to
   *          fail.
   */
  public InheritedDefaultValueException(PropertyDefinition d,
      OperationsException cause) {
    super(d);
    this.cause = cause;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public Throwable getCause() {
    return cause;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String getMessage() {
    return "The inherited default values could not be determined "
        + "for the property \"" + getPropertyDefinition().getName() + "\"";
  }
  /**
   * Get the operations exception that caused default value look up to fail.
   *
   * @return Returns the operations exception that caused default value look up
   *         to fail.
   */
  public final OperationsException getOperationsException() {
    return cause;
  }
}
opends/src/server/org/opends/server/admin/InheritedDefaultValueProvider.java
New file
@@ -0,0 +1,71 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import java.util.Collection;
/**
 * An interface for retrieving inherited default property values.
 */
public interface InheritedDefaultValueProvider {
  /**
   * Get the path of the managed object which should be used as the base for
   * determining parent managed objects.
   *
   * @return Returns the path of the managed object which should be used as the
   *         base for determining parent managed objects.
   */
  ManagedObjectPath getManagedObjectPath();
  /**
   * Retrieves the values of a property from a managed object at the specified
   * location.
   *
   * @param path
   *          The location of the managed object containing the property.
   * @param propertyName
   *          The name of the property containing the default values.
   * @return Returns the values of a property from a managed object at the
   *         specified location.
   * @throws OperationsException
   *           If the managed object could not be read due to some underlying
   *           communication problem.
   * @throws PropertyNotFoundException
   *           If the property name was not recognized.
   */
  Collection<?> getDefaultPropertyValues(ManagedObjectPath path,
      String propertyName) throws OperationsException,
      PropertyNotFoundException;
}
opends/src/server/org/opends/server/admin/InstantiableRelationDefinition.java
New file
@@ -0,0 +1,107 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A managed object composite relationship definition which represents
 * a composition of zero or more managed objects.
 *
 * @param <C>
 *          The type of client managed object configuration that this
 *          relation definition refers to.
 * @param <S>
 *          The type of server managed object configuration that this
 *          relation definition refers to.
 */
public final class InstantiableRelationDefinition
    <C extends ConfigurationClient, S extends Configuration>
    extends RelationDefinition<C, S> {
  // The plural name of the relation.
  private final String pluralName;
  /**
   * Create a new instantiable managed object relation definition.
   *
   * @param pd
   *          The parent managed object definition.
   * @param name
   *          The name of the relation.
   * @param pluralName
   *          The plural name of the relation.
   * @param cd
   *          The child managed object definition.
   */
  public InstantiableRelationDefinition(
      AbstractManagedObjectDefinition<?, ?> pd, String name, String pluralName,
      AbstractManagedObjectDefinition<C, S> cd) {
    super(pd, name, cd);
    this.pluralName = pluralName;
  }
  /**
   * Get the plural name of the relation.
   *
   * @return Returns the plural name of the relation.
   */
  public final String getPluralName() {
    return pluralName;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public final void toString(StringBuilder builder) {
    builder.append("name=");
    builder.append(getName());
    builder.append(" type=composition parent=");
    builder.append(getParentDefinition().getName());
    builder.append(" child=");
    builder.append(getChildDefinition().getName());
    builder.append(" minOccurs=0");
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p) {
    return v.visitInstantiable(this, p);
  }
}
opends/src/server/org/opends/server/admin/IntegerPropertyDefinition.java
New file
@@ -0,0 +1,338 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.EnumSet;
/**
 * Integer property definition.
 * <p>
 * All values must be zero or positive and within the lower/upper limit
 * constraints. Support is provided for "unlimited" values. These are
 * represented using a negative value or using the string "unlimited".
 */
public final class IntegerPropertyDefinition extends
    AbstractPropertyDefinition<Integer> {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = 2819904868308720588L;
  // String used to represent unlimited.
  private static final String UNLIMITED = "unlimited";
  // The lower limit of the property value.
  private final int lowerLimit;
  // The optional upper limit of the property value.
  private final Integer upperLimit;
  // Indicates whether this property allows the use of the "unlimited" value
  // (represented using a -1 or the string "unlimited").
  private final boolean allowUnlimited;
  /**
   * An interface for incrementally constructing integer property definitions.
   */
  public static class Builder extends
      AbstractBuilder<Integer, IntegerPropertyDefinition> {
    // The lower limit of the property value.
    private int lowerLimit = 0;
    // The optional upper limit of the property value.
    private Integer upperLimit = null;
    // Indicates whether this property allows the use of the "unlimited" value
    // (represented using a -1 or the string "unlimited").
    private boolean allowUnlimited = false;
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    }
    /**
     * Set the lower limit.
     *
     * @param lowerLimit
     *          The new lower limit (must be >= 0).
     * @throws IllegalArgumentException
     *           If a negative lower limit was specified or the lower limit is
     *           greater than the upper limit.
     */
    public final void setLowerLimit(int lowerLimit)
        throws IllegalArgumentException {
      if (lowerLimit < 0) {
        throw new IllegalArgumentException("Negative lower limit");
      }
      if (upperLimit != null && lowerLimit > upperLimit) {
        throw new IllegalArgumentException(
            "Lower limit greater than upper limit");
      }
      this.lowerLimit = lowerLimit;
    }
    /**
     * Set the upper limit.
     *
     * @param upperLimit
     *          The new upper limit or <code>null</code> if there is no upper
     *          limit.
     */
    public final void setUpperLimit(Integer upperLimit) {
      if (upperLimit != null) {
        if (upperLimit < 0) {
          throw new IllegalArgumentException("Negative lower limit");
        }
        if (lowerLimit > upperLimit) {
          throw new IllegalArgumentException(
              "Lower limit greater than upper limit");
        }
      }
      this.upperLimit = upperLimit;
    }
    /**
     * Specify whether or not this property definition will allow unlimited
     * values (default is false).
     *
     * @param allowUnlimited
     *          <code>true</code> if the property will allow unlimited values,
     *          or <code>false</code> otherwise.
     */
    public final void setAllowUnlimited(boolean allowUnlimited) {
      this.allowUnlimited = allowUnlimited;
    }
    /**
     * {@inheritDoc}
     */
    @Override
    protected IntegerPropertyDefinition buildInstance(String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<Integer> defaultBehavior) {
      return new IntegerPropertyDefinition(propertyName, options,
          defaultBehavior, lowerLimit, upperLimit, allowUnlimited);
    }
  }
  /**
   * Create an integer property definition builder.
   *
   * @param propertyName
   *          The property name.
   * @return Returns the new integer property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  }
  // Private constructor.
  private IntegerPropertyDefinition(String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<Integer> defaultBehavior, int lowerLimit,
      Integer upperLimit, boolean allowUnlimited) {
    super(Integer.class, propertyName, options, defaultBehavior);
    this.lowerLimit = lowerLimit;
    this.upperLimit = upperLimit;
    this.allowUnlimited = allowUnlimited;
  }
  /**
   * Get the lower limit.
   *
   * @return Returns the lower limit.
   */
  public int getLowerLimit() {
    return lowerLimit;
  }
  /**
   * Get the upper limit.
   *
   * @return Returns the upper limit or <code>null</code> if there is no upper
   *         limit.
   */
  public Integer getUpperLimit() {
    return upperLimit;
  }
  /**
   * Determine whether this property allows unlimited values.
   *
   * @return Returns <code>true</code> if this this property allows unlimited
   *         values.
   */
  public boolean isAllowUnlimited() {
    return allowUnlimited;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void validateValue(Integer value)
      throws IllegalPropertyValueException {
    ensureNotNull(value);
    if (!allowUnlimited && value < lowerLimit) {
      throw new IllegalPropertyValueException(this, value);
    // unlimited allowed
    } else if (value >= 0 && value < lowerLimit) {
      throw new IllegalPropertyValueException(this, value);
    }
    if ((upperLimit != null) && (value > upperLimit)) {
      throw new IllegalPropertyValueException(this, value);
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String encodeValue(Integer value)
          throws IllegalPropertyValueException {
    ensureNotNull(value);
    // Make sure that we correctly encode negative values as "unlimited".
    if (allowUnlimited) {
      if (value < 0) {
        return UNLIMITED;
      }
    }
    return value.toString();
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public Integer decodeValue(String value)
      throws IllegalPropertyValueStringException {
    ensureNotNull(value);
    if (allowUnlimited) {
      if (value.trim().equalsIgnoreCase(UNLIMITED)) {
        return -1;
      }
    }
    Integer i;
    try {
      i = Integer.valueOf(value);
    } catch (NumberFormatException e) {
      throw new IllegalPropertyValueStringException(this, value);
    }
    try {
      validateValue(i);
    } catch (IllegalPropertyValueException e) {
      throw new IllegalPropertyValueStringException(this, value);
    }
    return i;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
    return v.visitInteger(this, p);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void toString(StringBuilder builder) {
    super.toString(builder);
    builder.append(" lowerLimit=");
    builder.append(lowerLimit);
    if (upperLimit != null) {
      builder.append(" upperLimit=");
      builder.append(upperLimit);
    }
    builder.append(" allowUnlimited=");
    builder.append(allowUnlimited);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public int compare(Integer o1, Integer o2) {
    return o1.compareTo(o2);
  }
}
opends/src/server/org/opends/server/admin/LDAPProfile.java
New file
@@ -0,0 +1,200 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
/**
 * This class is used to map configuration elements to their LDAP schema names.
 */
public final class LDAPProfile {
  // The singleton instance.
  private static final LDAPProfile INSTANCE = new LDAPProfile();
  // The LDAP profile property table.
  private final ManagedObjectDefinitionResource resource;
  /**
   * Get the global LDAP profile instance.
   *
   * @return Returns the global LDAP profile instance.
   */
  public static LDAPProfile getInstance() {
    return INSTANCE;
  }
  // Private constructor.
  private LDAPProfile() {
    this.resource = ManagedObjectDefinitionResource.createForProfile("ldap");
  }
  /**
   * Gets the LDAP RDN attribute type for child entries of an instantiable
   * relation.
   *
   * @param r
   *          The instantiable relation.
   * @return Returns the LDAP RDN attribute type for child entries of an
   *         instantiable relation.
   */
  public String getInstantiableRelationChildRDNType(
      InstantiableRelationDefinition<?, ?> r) {
    // For now, assume always "cn".
    return "cn";
  }
  /**
   * Gets the LDAP object classes associated with an instantiable relation
   * branch. The branch is the parent entry of child managed objects.
   *
   * @param r
   *          The instantiable relation.
   * @return Returns the LDAP object classes associated with an instantiable
   *         relation branch.
   */
  public List<String> getInstantiableRelationObjectClasses(
      InstantiableRelationDefinition<?, ?> r) {
    return Arrays.asList(new String[] { "top", "ds-cfg-branch" });
  }
  /**
   * Get an LDAP RDN sequence associatied with a relation.
   *
   * @param r
   *          The relation.
   * @return Returns the LDAP RDN sequence associatied with a relation.
   */
  public String getRelationRDNSequence(RelationDefinition<?, ?> r) {
    return resource.getString(r.getParentDefinition(), "rdn." + r.getName());
  }
  /**
   * Get an LDAP filter string which can be used to search for entries matching
   * the specified definition.
   *
   * @param d
   *          The managed object definition.
   * @return Returns the LDAP filter.
   */
  public String getFilter(AbstractManagedObjectDefinition<?, ?> d) {
    StringBuilder builder = new StringBuilder();
    builder.append("(ObjectClass=");
    builder.append(getObjectClass(d));
    builder.append(')');
    return builder.toString();
  }
  /**
   * Get the principle object class associated with the specified definition.
   *
   * @param d
   *          The managed object definition.
   * @return Returns the principle object class associated with the specified
   *         definition.
   */
  public String getObjectClass(AbstractManagedObjectDefinition<?, ?> d) {
    return resource.getString(d, "objectclass");
  }
  /**
   * Get all the object classes associated with the specified definition.
   * <p>
   * The returned list is ordered such that the uppermost object classes appear
   * first (e.g. top).
   *
   * @param d
   *          The managed object definition.
   * @return Returns all the object classes associated with the specified
   *         definition.
   */
  public List<String> getObjectClasses(
      AbstractManagedObjectDefinition<?, ?> d) {
    LinkedList<String> objectClasses = new LinkedList<String>();
    Set<String> s = new HashSet<String>();
    // Add the object classes from the parent hierarchy.
    while (d != null) {
      String oc = getObjectClass(d);
      if (!s.contains(oc)) {
        objectClasses.addFirst(oc);
        s.add(oc);
      }
      d = d.getParent();
    }
    // Make sure that we have top.
    if (!s.contains("top")) {
      objectClasses.addFirst("top");
    }
    return objectClasses;
  }
  /**
   * Get the name of the LDAP attribute associated with the specified property
   * definition.
   *
   * @param d
   *          The managed object definition.
   * @param pd
   *          The property definition.
   * @return Returns the name of the LDAP attribute associated with the
   *         specified property definition.
   */
  public String getAttributeName(ManagedObjectDefinition<?, ?> d,
      PropertyDefinition<?> pd) {
    return resource.getString(d, "attribute." + pd.getName());
  }
}
opends/src/server/org/opends/server/admin/ManagedObjectAlreadyExistsException.java
New file
@@ -0,0 +1,75 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A managed object could not be created because there is an existing managed
 * object with the same name.
 */
public final class ManagedObjectAlreadyExistsException extends
    OperationsException {
  /**
   * Version ID required by serializable classes.
   */
  private static final long serialVersionUID = -2344653674171609366L;
  // Simple description of this exception for debugging.
  private static final String MSG = "A managed object could not be created"
      + " because there is an existing managed object with the same name";
  // The name of the managed object that could not be created.
  private final String name;
  /**
   * Create a managed object already exists exception with the duplicate name.
   *
   * @param name
   *          The name of the managed object that could not be created.
   */
  public ManagedObjectAlreadyExistsException(String name) {
    super(MSG);
    this.name = name;
  }
  /**
   * Get the name of the managed object that could not be created.
   *
   * @return Returns the name of the managed object that could not be created.
   */
  public String getName() {
    return name;
  }
}
opends/src/server/org/opends/server/admin/ManagedObjectDefinition.java
New file
@@ -0,0 +1,105 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.server.ServerManagedObject;
/**
 * Defines the structure of a managed object which can be
 * instantiated.
 *
 * @param <C>
 *          The type of client managed object configuration that this
 *          definition represents.
 * @param <S>
 *          The type of server managed object configuration that this
 *          definition represents.
 */
public abstract class ManagedObjectDefinition
    <C extends ConfigurationClient, S extends Configuration>
    extends AbstractManagedObjectDefinition<C, S> {
  /**
   * Create a new managed object definition.
   *
   * @param name
   *          The name of the definition.
   * @param parent
   *          The parent definition, or <code>null</code> if there
   *          is no parent.
   */
  protected ManagedObjectDefinition(String name,
      AbstractManagedObjectDefinition<? super C, ? super S> parent) {
    super(name, parent);
  }
  /**
   * Creates a client configuration view of the provided managed
   * object. Modifications made to the underlying managed object will
   * be reflected in the client configuration view and vice versa.
   *
   * @param managedObject
   *          The managed object.
   * @return Returns a client configuration view of the provided
   *         managed object.
   */
  public abstract C createClientConfiguration(
      ManagedObject<? extends C> managedObject);
  /**
   * Creates a server configuration view of the provided server
   * managed object.
   *
   * @param managedObject
   *          The server managed object.
   * @return Returns a server configuration view of the provided
   *         server managed object.
   */
  public abstract S createServerConfiguration(
      ServerManagedObject<? extends S> managedObject);
  /**
   * Gets the server configuration class instance associated with this
   * managed object definition.
   *
   * @return Returns the server configuration class instance
   *         associated with this managed object definition.
   */
  public abstract Class<S> getServerConfigurationClass();
}
opends/src/server/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java
New file
@@ -0,0 +1,211 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
 * A class for retrieving internationalized resource properties
 * associated with a managed object definition.
 */
public final class ManagedObjectDefinitionI18NResource {
  // Mapping from definition to resource bundle.
  private final Map<AbstractManagedObjectDefinition, ResourceBundle> resources;
  // The resource name prefix.
  private final String prefix;
  /**
   * Creates a new internationalized resource instance which can be
   * used to retrieve the localized descriptions for the managed
   * objects and their associated properties and relations.
   *
   * @return Returns the I18N resource instance.
   */
  public static ManagedObjectDefinitionI18NResource create() {
    return new ManagedObjectDefinitionI18NResource("admin.messages");
  }
  /**
   * Creates a new internationalized resource instance for the named
   * profile.
   *
   * @param profile
   *          The name of the profile.
   * @return Returns the I18N resource instance for the named profile.
   */
  public static ManagedObjectDefinitionI18NResource createForProfile(
      String profile) {
    return new ManagedObjectDefinitionI18NResource("admin.profiles."
        + profile);
  }
  // Private constructor.
  private ManagedObjectDefinitionI18NResource(String prefix) {
    this.resources =
      new HashMap<AbstractManagedObjectDefinition, ResourceBundle>();
    this.prefix = prefix;
  }
  /**
   * Get the internationalized message associated with the specified
   * key in the default locale.
   *
   * @param d
   *          The managed object definition.
   * @param key
   *          The resource key.
   * @return Returns the internationalized message associated with the
   *         specified key in the default locale.
   * @throws MissingResourceException
   *           If the key was not found.
   */
  public String getMessage(AbstractManagedObjectDefinition d,
      String key) throws MissingResourceException {
    return getMessage(d, key, Locale.getDefault(), (String[]) null);
  }
  /**
   * Get the parameterized internationalized message associated with
   * the specified key in the default locale.
   *
   * @param d
   *          The managed object definition.
   * @param key
   *          The resource key.
   * @param args
   *          Arguments that should be inserted into the retrieved
   *          message.
   * @return Returns the internationalized message associated with the
   *         specified key in the default locale.
   * @throws MissingResourceException
   *           If the key was not found.
   */
  public String getMessage(AbstractManagedObjectDefinition d,
      String key, String... args) throws MissingResourceException {
    return getMessage(d, key, Locale.getDefault(), args);
  }
  /**
   * Get the internationalized message associated with the specified
   * key and locale.
   *
   * @param d
   *          The managed object definition.
   * @param key
   *          The resource key.
   * @param locale
   *          The locale.
   * @return Returns the internationalized message associated with the
   *         specified key and locale.
   * @throws MissingResourceException
   *           If the key was not found.
   */
  public String getMessage(AbstractManagedObjectDefinition d,
      String key, Locale locale) throws MissingResourceException {
    return getMessage(d, key, locale, (String[]) null);
  }
  /**
   * Get the parameterized internationalized message associated with
   * the specified key and locale.
   *
   * @param d
   *          The managed object definition.
   * @param key
   *          The resource key.
   * @param locale
   *          The locale.
   * @param args
   *          Arguments that should be inserted into the retrieved
   *          message.
   * @return Returns the internationalized message associated with the
   *         specified key and locale.
   * @throws MissingResourceException
   *           If the key was not found.
   */
  public String getMessage(AbstractManagedObjectDefinition d,
      String key, Locale locale, String... args)
      throws MissingResourceException {
    ResourceBundle resource = getResourceBundle(d, locale);
    if (args == null) {
      return resource.getString(key);
    } else {
      MessageFormat mf = new MessageFormat(resource.getString(key));
      return mf.format(args);
    }
  }
  // Retrieve the resource bundle associated with a managed object and
  // locale,
  // lazily loading it if necessary.
  private synchronized ResourceBundle getResourceBundle(
      AbstractManagedObjectDefinition d, Locale locale)
      throws MissingResourceException {
    ResourceBundle r = resources.get(d);
    if (r == null) {
      // Load the resource file.
      String baseName = prefix + "." + d.getClass().getName();
      r = ResourceBundle.getBundle(baseName, locale,
          ClassLoaderProvider.getInstance().getClassLoader());
      // Cache the resource.
      resources.put(d, r);
    }
    return r;
  }
}
opends/src/server/org/opends/server/admin/ManagedObjectDefinitionResource.java
New file
@@ -0,0 +1,145 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Properties;
/**
 * A class for retrieving non-internationalized resource properties
 * associated with a managed object definition.
 */
public final class ManagedObjectDefinitionResource {
  // Mapping from definition to property tables.
  private final Map<AbstractManagedObjectDefinition, Properties> properties;
  // The resource name prefix.
  private final String prefix;
  /**
   * Creates a new resource instance for the named profile.
   *
   * @param profile
   *          The name of the profile.
   * @return Returns the resource instance for the named profile.
   */
  public static ManagedObjectDefinitionResource createForProfile(
      String profile) {
    return new ManagedObjectDefinitionResource("admin.profiles."
        + profile);
  }
  // Private constructor.
  private ManagedObjectDefinitionResource(String prefix) {
    this.properties =
      new HashMap<AbstractManagedObjectDefinition, Properties>();
    this.prefix = prefix;
  }
  /**
   * Get the resource value associated with the specified key.
   *
   * @param d
   *          The managed object definition.
   * @param key
   *          The resource key.
   * @return Returns the resource value associated with the specified
   *         key.
   * @throws MissingResourceException
   *           If the key was not found.
   */
  public String getString(AbstractManagedObjectDefinition d,
      String key) throws MissingResourceException {
    Properties p = getProperties(d);
    String result = p.getProperty(key);
    if (result == null) {
      String baseName = prefix + "." + d.getClass().getName();
      String path = baseName.replace('.', '/') + ".properties";
      throw new MissingResourceException("Can't find resource "
          + path + ", key " + key, baseName, key);
    }
    return result;
  }
  // Retrieve the properties table associated with a managed object,
  // lazily
  // loading it if necessary.
  private synchronized Properties getProperties(
      AbstractManagedObjectDefinition d)
      throws MissingResourceException {
    Properties p = properties.get(d);
    if (p == null) {
      // Load the resource file.
      String baseName = prefix + "." + d.getClass().getName();
      String path = baseName.replace('.', '/') + ".properties";
      InputStream stream = ClassLoaderProvider.getInstance()
          .getClassLoader().getResourceAsStream(path);
      if (stream == null) {
        throw new MissingResourceException("Can't find resource "
            + path, baseName, "");
      }
      p = new Properties();
      try {
        p.load(new BufferedInputStream(stream));
      } catch (IOException e) {
        throw new MissingResourceException("Can't load resource "
            + path + " due to IO exception: " + e.getMessage(),
            baseName, "");
      }
      // Cache the resource.
      properties.put(d, p);
    }
    return p;
  }
}
opends/src/server/org/opends/server/admin/ManagedObjectNotFoundException.java
New file
@@ -0,0 +1,66 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * The requested managed object could not be located.
 */
public class ManagedObjectNotFoundException extends OperationsException {
  /**
   * Version ID required by serializable classes.
   */
  private static final long serialVersionUID = -477551786551892978L;
  // Simple description of this exception for debugging.
  private static final String MSG =
    "The requested managed object could not be found";
  /**
   * Create a managed object not found exception.
   */
  public ManagedObjectNotFoundException() {
    super(MSG);
  }
  /**
   * Create a managed object not found exception with the specified cause.
   *
   * @param cause
   *          The cause of this exception.
   */
  public ManagedObjectNotFoundException(Throwable cause) {
    super(MSG, cause);
  }
}
opends/src/server/org/opends/server/admin/ManagedObjectPath.java
New file
@@ -0,0 +1,484 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.opends.server.admin.std.meta.RootCfgDefn;
/**
 * A path which can be used to determine the location of a managed
 * object instance.
 */
public final class ManagedObjectPath {
  /**
   * Abstract path element.
   */
  private static abstract class Element {
    /**
     * Protected constructor.
     */
    protected Element() {
      // No implementation required.
    }
    /**
     * Get the relation definition associated with this element.
     *
     * @return Returns the relation definition associated with this
     *         element.
     */
    public abstract RelationDefinition<?, ?> getRelation();
    /**
     * Serialize this path element using the provided serialization
     * strategy.
     *
     * @param serializer
     *          The managed object path serialization strategy.
     */
    public abstract void serialize(
        ManagedObjectPathSerializer serializer);
  }
  /**
   * A path element representing an instantiable managed object.
   */
  private static final class InstantiableElement extends Element {
    // The instantiable relation.
    private final InstantiableRelationDefinition<?, ?> r;
    // The name of the managed object.
    private final String name;
    // Private constructor.
    private InstantiableElement(
        InstantiableRelationDefinition<?, ?> r, String name) {
      this.r = r;
      this.name = name;
    }
    /**
     * {@inheritDoc}
     */
    @Override
    public RelationDefinition<?, ?> getRelation() {
      return r;
    }
    /**
     * {@inheritDoc}
     */
    @Override
    public void serialize(ManagedObjectPathSerializer serializer) {
      serializer.appendManagedObjectPathElement(r, name);
    }
  }
  /**
   * A path element representing an optional managed object.
   */
  private static final class OptionalElement extends Element {
    // The optional relation.
    private final OptionalRelationDefinition<?, ?> r;
    // Private constructor.
    private OptionalElement(OptionalRelationDefinition<?, ?> r) {
      this.r = r;
    }
    /**
     * {@inheritDoc}
     */
    @Override
    public RelationDefinition<?, ?> getRelation() {
      return r;
    }
    /**
     * {@inheritDoc}
     */
    @Override
    public void serialize(ManagedObjectPathSerializer serializer) {
      serializer.appendManagedObjectPathElement(r);
    }
  }
  /**
   * A path element representing a singleton managed object.
   */
  private static final class SingletonElement extends Element {
    // The singleton relation.
    private final SingletonRelationDefinition<?, ?> r;
    // Private constructor.
    private SingletonElement(SingletonRelationDefinition<?, ?> r) {
      this.r = r;
    }
    /**
     * {@inheritDoc}
     */
    @Override
    public RelationDefinition<?, ?> getRelation() {
      return r;
    }
    /**
     * {@inheritDoc}
     */
    @Override
    public void serialize(ManagedObjectPathSerializer serializer) {
      serializer.appendManagedObjectPathElement(r);
    }
  }
  // Single instance of a root path.
  private static final ManagedObjectPath EMPTY_PATH = new ManagedObjectPath(
      new LinkedList<Element>());
  /**
   * Creates a new managed object path representing the configuration
   * root.
   *
   * @return Returns a new managed object path representing the
   *         configuration root.
   */
  public static ManagedObjectPath emptyPath() {
    return EMPTY_PATH;
  }
  /**
   * Returns a managed object path holding the value of the specified
   * string.
   *
   * @param s
   *          The string to be parsed.
   * @return Returns a managed object path holding the value of the
   *         specified string.
   * @throws IllegalArgumentException
   *           If the string could not be parsed.
   */
  public static ManagedObjectPath valueOf(String s)
      throws IllegalArgumentException {
    return null;
  }
  // The list of path elements in this path.
  private final List<Element> elements;
  // Private constructor.
  private ManagedObjectPath(LinkedList<Element> elements) {
    this.elements = Collections.unmodifiableList(elements);
  }
  /**
   * Creates a new child managed object path beneath the provided
   * parent path.
   *
   * @param r
   *          The instantiable relation referencing the child.
   * @param name
   *          The relative name of the child managed object.
   * @return Returns a new child managed object path beneath the
   *         provided parent path.
   */
  public ManagedObjectPath child(
      InstantiableRelationDefinition<?, ?> r, String name) {
    LinkedList<Element> celements = new LinkedList<Element>(elements);
    celements.add(new InstantiableElement(r, name));
    return new ManagedObjectPath(celements);
  }
  /**
   * Creates a new child managed object path beneath the provided
   * parent path.
   *
   * @param r
   *          The optional relation referencing the child.
   * @return Returns a new child managed object path beneath the
   *         provided parent path.
   */
  public ManagedObjectPath child(OptionalRelationDefinition<?, ?> r) {
    LinkedList<Element> celements = new LinkedList<Element>(elements);
    celements.add(new OptionalElement(r));
    return new ManagedObjectPath(celements);
  }
  /**
   * Creates a new child managed object path beneath the provided
   * parent path.
   *
   * @param r
   *          The singleton relation referencing the child.
   * @return Returns a new child managed object path beneath the
   *         provided parent path.
   */
  public ManagedObjectPath child(SingletonRelationDefinition<?, ?> r) {
    LinkedList<Element> celements = new LinkedList<Element>(elements);
    celements.add(new SingletonElement(r));
    return new ManagedObjectPath(celements);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean equals(Object obj) {
    if (obj == this) {
      return true;
    } else if (obj instanceof ManagedObjectPath) {
      ManagedObjectPath other = (ManagedObjectPath) obj;
      return toString().equals(other.toString());
    } else {
      return false;
    }
  }
  /**
   * Get the definition of the managed object referred to by this
   * path.
   * <p>
   * When the path is empty, the {@link RootCfgDefn}
   * is returned.
   *
   * @return Returns the definition of the managed object referred to
   *         by this path, or the {@link RootCfgDefn}
   *         if the path is empty.
   */
  public AbstractManagedObjectDefinition<?, ?> getManagedObjectDefinition() {
    if (elements.isEmpty()) {
      return RootCfgDefn.getInstance();
    } else {
      Element e = elements.get(elements.size() - 1);
      return e.getRelation().getChildDefinition();
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public int hashCode() {
    return toString().hashCode();
  }
  /**
   * Determine whether or not this path contains any path elements.
   *
   * @return Returns <code>true</code> if this path does not contain
   *         any path elements.
   */
  public boolean isEmpty() {
    return elements.isEmpty();
  }
  /**
   * Creates a new parent managed object path the specified number of
   * path elements above this path.
   *
   * @param offset
   *          The number of path elements (0 - means no offset, 1
   *          means the parent, and 2 means the grand-parent).
   * @return Returns a new parent managed object path the specified
   *         number of path elements above this path.
   * @throws IllegalArgumentException
   *           If the offset is less than 0, or greater than the
   *           number of path elements in this path.
   */
  public ManagedObjectPath parent(int offset)
      throws IllegalArgumentException {
    if (offset < 0) {
      throw new IllegalArgumentException("Negative offset");
    }
    if (offset > elements.size()) {
      throw new IllegalArgumentException(
          "Offset is greater than the number of path elements");
    }
    // An offset of 0 leaves the path unchanged.
    if (offset == 0) {
      return this;
    }
    LinkedList<Element> celements = new LinkedList<Element>(elements
        .subList(0, elements.size() - offset));
    return new ManagedObjectPath(celements);
  }
  /**
   * Serialize this managed object path using the provided
   * serialization strategy.
   * <p>
   * The path elements will be passed to the serializer in big-endian
   * order: starting from the root element and proceeding down to the
   * leaf.
   *
   * @param serializer
   *          The managed object path serialization strategy.
   */
  public void serialize(ManagedObjectPathSerializer serializer) {
    for (Element element : elements) {
      element.serialize(serializer);
    }
  }
  /**
   * Get the number of path elements in this managed object path.
   *
   * @return Returns the number of path elements (0 - means no offset,
   *         1 means the parent, and 2 means the grand-parent).
   */
  public int size() {
    return elements.size();
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String toString() {
    StringBuilder builder = new StringBuilder();
    toString(builder);
    return builder.toString();
  }
  /**
   * Appends a string representation of this managed object path to
   * the provided string builder.
   *
   * @param builder
   *          Append the string representation to this builder.
   * @see #toString()
   */
  public void toString(final StringBuilder builder) {
    // Use a simple serializer to create the contents.
    ManagedObjectPathSerializer serializer = new ManagedObjectPathSerializer() {
      public void appendManagedObjectPathElement(
          InstantiableRelationDefinition<?, ?> r, String name) {
        builder.append('/');
        builder.append(r.getName());
        builder.append('/');
        builder.append(name);
      }
      public void appendManagedObjectPathElement(
          OptionalRelationDefinition<?, ?> r) {
        builder.append('/');
        builder.append(r.getName());
      }
      public void appendManagedObjectPathElement(
          SingletonRelationDefinition<?, ?> r) {
        builder.append('/');
        builder.append(r.getName());
      }
    };
    serialize(serializer);
  }
}
opends/src/server/org/opends/server/admin/ManagedObjectPathSerializer.java
New file
@@ -0,0 +1,78 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A strategy for serializing managed object paths.
 * <p>
 * This interface provides a generic means for serializing managed object paths
 * into application specific forms. For example, a JNDI client would use this
 * interface to construct <code>LdapName</code> objects from a path.
 * Similarly, on the server side, a serialization strategy is used to construct
 * <code>DN</code> instances from a path.
 * <p>
 * During serialization the serializer is invoked for each element in the
 * managed object path in big-endian order, starting from the root and
 * proceeding down to the leaf element.
 */
public interface ManagedObjectPathSerializer {
  /**
   * Append a managed object path element identified by an instantiable relation
   * and an instance name.
   *
   * @param r
   *          The instantiable relation.
   * @param name
   *          The instance name.
   */
  void appendManagedObjectPathElement(InstantiableRelationDefinition<?, ?> r,
      String name);
  /**
   * Append a managed object path element identified by a optional relation.
   *
   * @param r
   *          The optional relation.
   */
  void appendManagedObjectPathElement(OptionalRelationDefinition<?, ?> r);
  /**
   * Append a managed object path element identified by a singleton relation.
   *
   * @param r
   *          The singleton relation.
   */
  void appendManagedObjectPathElement(SingletonRelationDefinition<?, ?> r);
}
opends/src/server/org/opends/server/admin/OperationsException.java
New file
@@ -0,0 +1,89 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Exceptions thrown as a result of errors that occurred when reading, listing,
 * and modifying managed objects.
 */
public class OperationsException extends AdminException {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = 6329910102360262187L;
  /**
   * Create an operations exception.
   */
  public OperationsException() {
    // No implementation required.
  }
  /**
   * Create an operations exception with a cause.
   *
   * @param cause
   *          The cause.
   */
  public OperationsException(Throwable cause) {
    super(cause);
  }
  /**
   * Create an operations exception with a message and cause.
   *
   * @param message
   *          The message.
   * @param cause
   *          The cause.
   */
  public OperationsException(String message, Throwable cause) {
    super(message, cause);
  }
  /**
   * Create an operations exception with a message.
   *
   * @param message
   *          The message.
   */
  public OperationsException(String message) {
    super(message);
  }
}
opends/src/server/org/opends/server/admin/OptionalRelationDefinition.java
New file
@@ -0,0 +1,90 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A managed object composite relationship definition which represents
 * a composition of an optional single managed object (i.e. the
 * referenced managed object may or may not be present).
 *
 * @param <C>
 *          The type of client managed object configuration that this
 *          relation definition refers to.
 * @param <S>
 *          The type of server managed object configuration that this
 *          relation definition refers to.
 */
public final class OptionalRelationDefinition
    <C extends ConfigurationClient, S extends Configuration>
    extends RelationDefinition<C, S> {
  /**
   * Create a new optional managed object relation definition.
   *
   * @param pd
   *          The parent managed object definition.
   * @param name
   *          The name of the relation.
   * @param cd
   *          The child managed object definition.
   */
  public OptionalRelationDefinition(
      AbstractManagedObjectDefinition<?, ?> pd, String name,
      AbstractManagedObjectDefinition<C, S> cd) {
    super(pd, name, cd);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public final void toString(StringBuilder builder) {
    builder.append("name=");
    builder.append(getName());
    builder.append(" type=composition parent=");
    builder.append(getParentDefinition().getName());
    builder.append(" child=");
    builder.append(getChildDefinition().getName());
    builder.append(" minOccurs=0 maxOccurs=1");
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p) {
    return v.visitOptional(this, p);
  }
}
opends/src/server/org/opends/server/admin/PropertyDefinition.java
New file
@@ -0,0 +1,252 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import java.io.Serializable;
import java.util.Comparator;
/**
 * An interface for querying generic property definition features.
 * <p>
 * Property definitions are analogous to ConfigAttributes in the current model
 * and will play a similar role. Eventually these will replace them.
 * <p>
 * Implementations <b>must</b> take care to implement the various comparison
 * methods.
 * <p>
 * Implementations of this interface must be serializable. This is required so
 * that management applications can query property meta-information remotely.
 * <p>
 * TODO: define other call-backs (e.g. initial values).
 *
 * @param <T>
 *          The data-type of values of the property.
 */
public interface PropertyDefinition<T> extends Comparator<T>,
    Comparable<PropertyDefinition<?>>, Serializable {
  /**
   * Apply a visitor to this property definition.
   *
   * @param <R>
   *          The return type of the visitor's methods.
   * @param <P>
   *          The type of the additional parameters to the visitor's methods.
   * @param v
   *          The property definition visitor.
   * @param p
   *          Optional additional visitor parameter.
   * @return Returns a result as specified by the visitor.
   */
  <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p);
  /**
   * Cast the provided value to the type associated with this property
   * definition.
   * <p>
   * This method only casts the object to the required type; it does not
   * validate the value once it has been cast. Subsequent validation should be
   * performed using the method {@link #validateValue(Object)}.
   * <p>
   * This method guarantees the following expression is always
   * <code>true</code>:
   *
   * <pre>
   *  PropertyDefinition d;
   *  x == d.cast(x);
   * </pre>
   *
   * @param object
   *          The property value to be cast (can be <code>null</code>).
   * @return Returns the property value cast to the correct type.
   * @throws ClassCastException
   *           If the provided property value did not have the correct type.
   */
  T castValue(Object object) throws ClassCastException;
  /**
   * Compares this property definition with the specified property definition
   * for order. Returns a negative integer, zero, or a positive integer if this
   * property definition is less than, equal to, or greater than the specified
   * property definition.
   * <p>
   * The ordering must be determined first from the property name and then base
   * on the underlying value type.
   *
   * @param o
   *          The reference property definition with which to compare.
   * @return Returns a negative integer, zero, or a positive integer if this
   *         property definition is less than, equal to, or greater than the
   *         specified property definition.
   */
  int compareTo(PropertyDefinition<?> o);
  /**
   * Parse and validate a string representation of a property value.
   *
   * @param value
   *          The property string value (must not be <code>null</code>).
   * @return Returns the decoded property value.
   * @throws IllegalPropertyValueStringException
   *           If the property value string is invalid.
   */
  T decodeValue(String value) throws IllegalPropertyValueStringException;
  /**
   * Encode the provided property value into its string representation.
   * <p>
   * TODO: change name to avoid confusion with toString()?
   *
   * @param value
   *          The property value (must not be <code>null</code>).
   * @return Returns the encoded property string value.
   * @throws IllegalPropertyValueException
   *           If the property value is invalid.
   */
  String encodeValue(T value) throws IllegalPropertyValueException;
  /**
   * Indicates whether some other object is &quot;equal to&quot; this property
   * definition. This method must obey the general contract of
   * <tt>Object.equals(Object)</tt>. Additionally, this method can return
   * <tt>true</tt> <i>only</i> if the specified Object is also a property
   * definition and it has the same name, as returned by {@link #getName()},
   * and also is deemed to be &quot;compatible&quot; with this property
   * definition. Compatibility means that the two property definitions share the
   * same underlying value type and provide similar comparator implementations.
   *
   * @param o
   *          The reference object with which to compare.
   * @return Returns <code>true</code> only if the specified object is also a
   *         property definition and it has the same name and is compatible with
   *         this property definition.
   * @see java.lang.Object#equals(java.lang.Object)
   * @see java.lang.Object#hashCode()
   */
  boolean equals(Object o);
  /**
   * Get the default behavior provider associated with this property
   * definition.
   *
   * @return Returns the default behavior provider associated with this
   *         property definition.
   */
  DefaultBehaviorProvider<T> getDefaultBehaviorProvider();
  /**
   * Get the name of the property.
   *
   * @return Returns the name of the property.
   */
  String getName();
  /**
   * Returns a hash code value for this property definition. The hash code
   * should be derived from the property name.
   *
   * @return Returns the hash code value for this property definition.
   */
  int hashCode();
  /**
   * Check if the specified option is set for this property definition.
   *
   * @param option
   *          The option to test.
   * @return Returns <code>true</code> if the option is set, or
   *         <code>false</code> otherwise.
   */
  boolean hasOption(PropertyOption option);
  /**
   * Get a normalized string representation of a property value. This can then
   * be used for comparisons and for generating hash-codes.
   * <p>
   * This method may throw an exception if the provided value is invalid.
   * However, applications should not assume that implementations of this method
   * will always validate a value. This task is the responsibility of
   * {@link #validateValue(Object)}.
   *
   * @param value
   *          The property value to be normalized.
   * @return Returns the normalized property value.
   * @throws IllegalPropertyValueException
   *           If the property value is invalid.
   */
  String normalizeValue(T value) throws IllegalPropertyValueException;
  /**
   * Append a string representation of the property definition to the provided
   * string builder.
   *
   * @param builder
   *          The string builder where the string representation should be
   *          appended.
   */
  void toString(StringBuilder builder);
  /**
   * Determine if the provided property value is valid according to this
   * property definition.
   *
   * @param value
   *          The property value (must not be <code>null</code>).
   * @throws IllegalPropertyValueException
   *           If the property value is invalid.
   */
  void validateValue(T value) throws IllegalPropertyValueException;
}
opends/src/server/org/opends/server/admin/PropertyDefinitionVisitor.java
New file
@@ -0,0 +1,212 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A visitor of property definitions, in the style of the visitor
 * design pattern. Classes implementing this interface can query
 * property definitions in a type-safe manner when the kind of
 * property definition is unknown at compile time. When a visitor is
 * passed to a property definition's accept method, the corresponding
 * visit method most applicable to that property definition is
 * invoked.
 *
 * @param <R>
 *          The return type of this visitor's methods. Use
 *          {@link java.lang.Void} for visitors that do not need to
 *          return results.
 * @param <P>
 *          The type of the additional parameter to this visitor's
 *          methods. Use {@link java.lang.Void} for visitors that do
 *          not need an additional parameter.
 */
public interface PropertyDefinitionVisitor<R, P> {
  /**
   * Visit an attribute type property definition.
   *
   * @param d
   *          The attribute type property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitAttributeType(AttributeTypePropertyDefinition d, P p);
  /**
   * Visit a boolean property definition.
   *
   * @param d
   *          The boolean property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitBoolean(BooleanPropertyDefinition d, P p);
  /**
   * Visit a class property definition.
   *
   * @param d
   *          The class property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitClass(ClassPropertyDefinition d, P p);
  /**
   * Visit a DN property definition.
   *
   * @param d
   *          The DN property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitDN(DNPropertyDefinition d, P p);
  /**
   * Visit a duration property definition.
   *
   * @param d
   *          The duration property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitDuration(DurationPropertyDefinition d, P p);
  /**
   * Visit an integer property definition.
   *
   * @param d
   *          The integer property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitInteger(IntegerPropertyDefinition d, P p);
  /**
   * Visit a IP address property definition.
   *
   * @param d
   *          The IP address property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitIPAddress(IPAddressPropertyDefinition d, P p);
  /**
   * Visit a IP address mask property definition.
   *
   * @param d
   *          The IP address mask property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitIPAddressMask(IPAddressMaskPropertyDefinition d, P p);
  /**
   * Visit a size property definition.
   *
   * @param d
   *          The size property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitSize(SizePropertyDefinition d, P p);
  /**
   * Visit a string property definition.
   *
   * @param d
   *          The string property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitString(StringPropertyDefinition d, P p);
  /**
   * Visit an unknown type of property definition. Implementations of
   * this method can provide default behavior for unknown property
   * definition types.
   *
   * @param d
   *          The property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   * @throws UnknownPropertyDefinitionException
   *           Visitor implementations may optionally throw this
   *           exception.
   */
  R visitUnknown(PropertyDefinition d, P p)
      throws UnknownPropertyDefinitionException;
  /**
   * Visit an enumeration property definition.
   *
   * @param d
   *          The enumeration property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitEnum(EnumPropertyDefinition<?> d, P p);
}
opends/src/server/org/opends/server/admin/PropertyException.java
New file
@@ -0,0 +1,81 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Exceptions thrown as a result of errors that occurred when decoding and
 * modifying property values.
 */
public abstract class PropertyException extends AdminRuntimeException {
  /**
   * Version ID required by serializable classes.
   */
  private static final long serialVersionUID = -8465109598081914482L;
  // The property definition associated with the property that caused the
  // exception.
  private final PropertyDefinition<?> definition;
  /**
   * Create an operations exception with a cause.
   *
   * @param definition
   *          The property definition associated with the property that caused
   *          the exception.
   */
  protected PropertyException(PropertyDefinition<?> definition) {
    this.definition = definition;
  }
  /**
   * Get the property definition associated with the property that caused the
   * exception.
   *
   * @return Returns the property definition associated with the property that
   *         caused the exception.
   */
  public final PropertyDefinition<?> getPropertyDefinition() {
    return definition;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public abstract String getMessage();
}
opends/src/server/org/opends/server/admin/PropertyIsMandatoryException.java
New file
@@ -0,0 +1,65 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Thrown when an attempt is made to remove a mandatory property.
 */
public class PropertyIsMandatoryException extends PropertyException {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = 5328211711156565625L;
  /**
   * Create a new property is mandatory exception.
   *
   * @param d
   *          The property definition.
   */
  public PropertyIsMandatoryException(PropertyDefinition d) {
    super(d);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String getMessage() {
    return "The property \"" + getPropertyDefinition().getName()
        + "\" must not be removed as it is mandatory";
  }
}
opends/src/server/org/opends/server/admin/PropertyIsReadOnlyException.java
New file
@@ -0,0 +1,65 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Thrown when an attempt is made to modify a read-only property.
 */
public class PropertyIsReadOnlyException extends PropertyException {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = 5315348044141024459L;
  /**
   * Create a new property is read-only exception.
   *
   * @param d
   *          The property definition.
   */
  public PropertyIsReadOnlyException(PropertyDefinition d) {
    super(d);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String getMessage() {
    return "The property \"" + getPropertyDefinition().getName()
        + "\" must not be modified as it is read-only";
  }
}
opends/src/server/org/opends/server/admin/PropertyIsSingleValuedException.java
New file
@@ -0,0 +1,66 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Thrown when an attempt is made to add more than value to a single-valued
 * property.
 */
public class PropertyIsSingleValuedException extends PropertyException {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = -8056602690887917027L;
  /**
   * Create a new property is single valued exception.
   *
   * @param d
   *          The property definition.
   */
  public PropertyIsSingleValuedException(PropertyDefinition d) {
    super(d);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public String getMessage() {
    return "The property \"" + getPropertyDefinition().getName()
        + "\" must not contain more than one value";
  }
}
opends/src/server/org/opends/server/admin/PropertyNotFoundException.java
New file
@@ -0,0 +1,73 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Thrown when an attempt is made to retrieve a property using its name but the
 * name was not recognized.
 * <p>
 * This exception can occur when attempt is made to retrieve inherited default
 * values from a managed object.
 */
public class PropertyNotFoundException extends OperationsException {
  /**
   * Serialization ID.
   */
  private static final long serialVersionUID = -895548482881819610L;
  // The name of the property that could not be found.
  private final String propertyName;
  /**
   * Create a new property not found exception.
   *
   * @param propertyName
   *          The name of the property that could not be found.
   */
  public PropertyNotFoundException(String propertyName) {
    super("The property \"" + propertyName + "\" was not recognized");
    this.propertyName = propertyName;
  }
  /**
   * Get the name of the property that could not be found.
   *
   * @return Returns the name of the property that could not be found.
   */
  public String getPropertyName() {
    return propertyName;
  }
}
opends/src/server/org/opends/server/admin/PropertyOption.java
New file
@@ -0,0 +1,64 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * This enumeration contains various options that can be associated with
 * property definitions.
 */
public enum PropertyOption {
  /**
   * Use this option to identify properties which must not be directly exposed
   * in client applications.
   */
  HIDDEN,
  /**
   * Use this option to identify properties which must have a value.
   */
  MANDATORY,
  /**
   * Use this option to identify properties which are multi-valued.
   */
  MULTI_VALUED,
  /**
   * Use this option to identify properties which cannot be modified.
   */
  READ_ONLY,
  /**
   * Use this option to identify properties which, when modified, will require
   * some additiona administrator action in order for the changes to take
   * effect.
   */
  REQUIRES_ADMIN_ACTION
}
opends/src/server/org/opends/server/admin/PropertyProvider.java
New file
@@ -0,0 +1,89 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import java.util.Collection;
import java.util.Collections;
/**
 * An interface which can be used to initialize the contents of a managed
 * object.
 */
public interface PropertyProvider {
  /**
   * A property provider which always returns empty property values, indicating
   * default behavior.
   */
  public static final PropertyProvider DEFAULT_PROVIDER =
    new PropertyProvider() {
    /**
     * {@inheritDoc}
     */
    public <T> Collection<T> getPropertyValues(PropertyDefinition<T> d)
        throws IllegalArgumentException {
      return Collections.<T> emptySet();
    }
  };
  /**
   * Get the property values associated with the specified property definition.
   * <p>
   * Implementations are not required to validate the values that they provide.
   * Specifically:
   * <ul>
   * <li>they do not need to guarantee that the provided values are valid
   * according to the property's syntax
   * <li>they do not need to provide values for mandatory properties
   * <li>they do not need to ensure that single-valued properties do contain at
   * most one value.
   * </ul>
   * The returned set of values is allowed to contain duplicates.
   *
   * @param <T>
   *          The underlying type of the property.
   * @param d
   *          The Property definition.
   * @return Returns a newly allocated set containing a copy of the property's
   *         values. An empty set indicates that the property has no values
   *         defined and any default behavior is applicable.
   * @throws IllegalArgumentException
   *           If this property provider does not recognise the requested
   *           property definition.
   */
  <T> Collection<T> getPropertyValues(PropertyDefinition<T> d)
      throws IllegalArgumentException;
}
opends/src/server/org/opends/server/admin/RelationDefinition.java
New file
@@ -0,0 +1,181 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * Relation definitions define relationships between types of managed
 * objects. In addition they define the ownership model:
 * <ul>
 * <li>composition - referenced managed objects are owned by the
 * parent managed object and are deleted when the parent is deleted
 * <li>aggregation - referenced managed objects are not owned by the
 * parent managed object. Instead they are shared by other managed
 * objects.
 * </ul>
 * 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.
 * <p>
 * Within the server, listeners can choose to request notification of
 * managed objects being added or removed from relations.
 * <p>
 * In LDAP, compositions are represented as follows:
 * <ul>
 * <li>singleton relations (one to one): a referenced managed object
 * is represented using a child entry directly beneath the parent
 * <li>optional relations (one to zero or one): a referenced managed
 * object is represented using a child entry directly beneath the
 * parent
 * <li>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".
 * </ul>
 * Whereas, aggregations are represented by storing the DNs of the
 * referenced managed objects in an attribute of the aggregating
 * managed object.
 *
 * @param <C>
 *          The type of client managed object configuration that this
 *          relation definition refers to.
 * @param <S>
 *          The type of server managed object configuration that this
 *          relation definition refers to.
 */
public abstract class RelationDefinition
    <C extends ConfigurationClient, S extends Configuration> {
  // The name of the relation.
  private final String name;
  // The definition of the parent managed object.
  private final AbstractManagedObjectDefinition<?, ?> pd;
  // The definition of the child managed object.
  private final AbstractManagedObjectDefinition<C, S> cd;
  /**
   * Create a new managed object relation definition with the specified name and
   * referenced managed object definition.
   *
   * @param pd
   *          The parent managed object definition.
   * @param name
   *          The name of the relation.
   * @param cd
   *          The child managed object definition.
   */
  protected RelationDefinition(AbstractManagedObjectDefinition<?, ?> pd,
      String name, AbstractManagedObjectDefinition<C, S> cd) {
    this.name = name;
    this.pd = pd;
    this.cd = cd;
  }
  /**
   * Get the name of the relation.
   *
   * @return Returns the name of the relation.
   */
  public final String getName() {
    return name;
  }
  /**
   * Get the definition of the parent managed object.
   *
   * @return Returns the definition of the parent managed object.
   */
  public final AbstractManagedObjectDefinition<?, ?> getParentDefinition() {
    return pd;
  }
  /**
   * Get the definition of the child managed object.
   *
   * @return Returns the definition of the child managed object.
   */
  public final AbstractManagedObjectDefinition<C, S> getChildDefinition() {
    return cd;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public final String toString() {
    StringBuilder builder = new StringBuilder();
    toString(builder);
    return builder.toString();
  }
  /**
   * Append a string representation of the managed object relation to the
   * provided string builder.
   *
   * @param builder
   *          The string builder where the string representation should be
   *          appended.
   */
  public abstract void toString(StringBuilder builder);
  /**
   * Apply a visitor to this relation definition.
   *
   * @param <R>
   *          The return type of the visitor's methods.
   * @param <P>
   *          The type of the additional parameters to the visitor's
   *          methods.
   * @param v
   *          The relation definition visitor.
   * @param p
   *          Optional additional visitor parameter.
   * @return Returns a result as specified by the visitor.
   */
  public abstract <R, P> R accept(RelationDefinitionVisitor<R, P> v,
      P p);
}
opends/src/server/org/opends/server/admin/RelationDefinitionVisitor.java
New file
@@ -0,0 +1,102 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A visitor of relation definitions, in the style of the visitor
 * design pattern. Classes implementing this interface can query
 * relation definitions in a type-safe manner when the kind of
 * relation definition is unknown at compile time. When a visitor is
 * passed to a relation definition's accept method, the corresponding
 * visit method most applicable to that relation definition is
 * invoked.
 *
 * @param <R>
 *          The return type of this visitor's methods. Use
 *          {@link java.lang.Void} for visitors that do not need to
 *          return results.
 * @param <P>
 *          The type of the additional parameter to this visitor's
 *          methods. Use {@link java.lang.Void} for visitors that do
 *          not need an additional parameter.
 */
public interface RelationDefinitionVisitor<R, P> {
  /**
   * Visit an aggregation relation definition.
   *
   * @param d
   *          The aggregation relation definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitAggregation(AggregationRelationDefinition<?, ?> d, P p);
  /**
   * Visit an instantiable relation definition.
   *
   * @param d
   *          The instantiable relation definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitInstantiable(InstantiableRelationDefinition<?, ?> d, P p);
  /**
   * Visit an optional relation definition.
   *
   * @param d
   *          The optional relation definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitOptional(OptionalRelationDefinition<?, ?> d, P p);
  /**
   * Visit a singleton relation definition.
   *
   * @param d
   *          The singleton relation definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  R visitSingleton(SingletonRelationDefinition<?, ?> d, P p);
}
opends/src/server/org/opends/server/admin/RelativeInheritedDefaultBehaviorProvider.java
New file
@@ -0,0 +1,123 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A default behavior provider which retrieves default values from a parent
 * managed object. It should be used by properties which inherit their default
 * value(s) from properties held in an other managed object.
 *
 * @param <T>
 *          The type of values represented by this provider.
 */
public final class RelativeInheritedDefaultBehaviorProvider<T> implements
    DefaultBehaviorProvider<T> {
  // The relative offset (where 1 = parent, 2 = grandparent) of the managed
  // object containing the property.
  private final int offset;
  // The name of the property containing the inherited default values.
  private final String propertyName;
  /**
   * Create a relative inherited default behavior provider associated with a
   * parent managed object.
   *
   * @param offset
   *          The relative location of the parent managed object (where 0 is the
   *          managed object itself, 1 is the parent, and 2 is the
   *          grand-parent).
   * @param propertyName
   *          The name of the property containing the inherited default values.
   * @throws IllegalArgumentException
   *           If the offset is less than 0.
   */
  public RelativeInheritedDefaultBehaviorProvider(int offset,
      String propertyName) throws IllegalArgumentException {
    if (offset < 0) {
      throw new IllegalArgumentException("Negative offset");
    }
    this.propertyName = propertyName;
    this.offset = offset;
  }
  /**
   * {@inheritDoc}
   */
  public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
    return v.visitRelativeInherited(this, p);
  }
  /**
   * Get the absolute path of the managed object containing the property which
   * has the default values.
   *
   * @param path
   *          The path of the current managed object from which the relative
   *          path should be determined.
   * @return Returns the absolute path of the managed object containing the
   *         property which has the default values.
   */
  public ManagedObjectPath getManagedObjectPath(ManagedObjectPath path) {
    return path.parent(offset);
  }
  /**
   * Get the name of the property containing the inherited default values.
   *
   * @return Returns the name of the property containing the inherited default
   *         values.
   */
  public String getPropertyName() {
    return propertyName;
  }
  /**
   * Get the relative location of the parent managed object.
   *
   * @return Returns the relative location of the parent managed object (where 0
   *         is the managed object itself, 1 is the parent, and 2 is the
   *         grand-parent).
   */
  public int getRelativeOffset() {
    return offset;
  }
}
opends/src/server/org/opends/server/admin/SingletonRelationDefinition.java
New file
@@ -0,0 +1,89 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
/**
 * A managed object composite relationship definition which represents
 * a compososition of a single managed object (i.e. the managed object
 * must be present).
 *
 * @param <C>
 *          The type of client managed object configuration that this
 *          relation definition refers to.
 * @param <S>
 *          The type of server managed object configuration that this
 *          relation definition refers to.
 */
public final class SingletonRelationDefinition
    <C extends ConfigurationClient, S extends Configuration>
    extends RelationDefinition<C, S> {
  /**
   * Create a new singleton managed object relation definition.
   *
   * @param pd
   *          The parent managed object definition.
   * @param name
   *          The name of the relation.
   * @param cd
   *          The child managed object definition.
   */
  public SingletonRelationDefinition(AbstractManagedObjectDefinition<?, ?> pd,
      String name, AbstractManagedObjectDefinition<C, S> cd) {
    super(pd, name, cd);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public final void toString(StringBuilder builder) {
    builder.append("name=");
    builder.append(getName());
    builder.append(" type=composition parent=");
    builder.append(getParentDefinition().getName());
    builder.append(" child=");
    builder.append(getChildDefinition().getName());
    builder.append(" minOccurs=1 maxOccurs=1");
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p) {
    return v.visitSingleton(this, p);
  }
}
Diff truncated after the above file
opends/src/server/org/opends/server/admin/SizePropertyDefinition.java opends/src/server/org/opends/server/admin/SizeUnit.java opends/src/server/org/opends/server/admin/StringPropertyDefinition.java opends/src/server/org/opends/server/admin/StringPropertyProvider.java opends/src/server/org/opends/server/admin/UndefinedDefaultBehaviorProvider.java opends/src/server/org/opends/server/admin/UnknownPropertyDefinitionException.java opends/src/server/org/opends/server/admin/client/ExampleClient.java opends/src/server/org/opends/server/admin/client/ExampleIntrospection.java opends/src/server/org/opends/server/admin/client/InitialManagedObject.java opends/src/server/org/opends/server/admin/client/ManagedObject.java opends/src/server/org/opends/server/admin/client/ManagedObjectDecodingException.java opends/src/server/org/opends/server/admin/client/ManagementContext.java opends/src/server/org/opends/server/admin/client/Property.java opends/src/server/org/opends/server/admin/client/PropertySet.java opends/src/server/org/opends/server/admin/client/ldap/LDAPChangeBuilder.java opends/src/server/org/opends/server/admin/client/ldap/LDAPManagedObject.java opends/src/server/org/opends/server/admin/client/ldap/LDAPManagementContext.java opends/src/server/org/opends/server/admin/client/ldap/LDAPNameBuilder.java opends/src/server/org/opends/server/admin/client/ldap/OperationsExceptionFactory.java opends/src/server/org/opends/server/admin/client/ldap/package-info.java opends/src/server/org/opends/server/admin/client/package-info.java opends/src/server/org/opends/server/admin/package-info.java opends/src/server/org/opends/server/admin/server/AbstractConfigListenerAdaptor.java opends/src/server/org/opends/server/admin/server/AbstractOptionalConfigurationManager.java opends/src/server/org/opends/server/admin/server/ConfigAddListenerAdaptor.java opends/src/server/org/opends/server/admin/server/ConfigChangeListenerAdaptor.java opends/src/server/org/opends/server/admin/server/ConfigDeleteListenerAdaptor.java opends/src/server/org/opends/server/admin/server/ConfigExceptionFactory.java opends/src/server/org/opends/server/admin/server/ConfigurationAddListener.java opends/src/server/org/opends/server/admin/server/ConfigurationChangeListener.java opends/src/server/org/opends/server/admin/server/ConfigurationDeleteListener.java opends/src/server/org/opends/server/admin/server/DNBuilder.java opends/src/server/org/opends/server/admin/server/ServerManagedObject.java opends/src/server/org/opends/server/admin/server/ServerManagedObjectDecodingException.java opends/src/server/org/opends/server/admin/server/ServerManagementContext.java opends/src/server/org/opends/server/admin/server/package-info.java opends/src/server/org/opends/server/api/CertificateMapper.java opends/src/server/org/opends/server/api/ConnectionHandler.java opends/src/server/org/opends/server/api/IdentityMapper.java opends/src/server/org/opends/server/api/KeyManagerProvider.java opends/src/server/org/opends/server/api/PasswordValidator.java opends/src/server/org/opends/server/api/SASLMechanismHandler.java opends/src/server/org/opends/server/api/plugin/DirectoryServerPlugin.java opends/src/server/org/opends/server/backends/task/RecurringTask.java opends/src/server/org/opends/server/backends/task/TaskScheduler.java opends/src/server/org/opends/server/core/AccessControlConfigManager.java opends/src/server/org/opends/server/core/AccountStatusNotificationHandlerConfigManager.java opends/src/server/org/opends/server/core/AddOperation.java opends/src/server/org/opends/server/core/BackendConfigManager.java opends/src/server/org/opends/server/core/CertificateMapperConfigManager.java opends/src/server/org/opends/server/core/ConnectionHandlerConfigManager.java opends/src/server/org/opends/server/core/DirectoryServer.java opends/src/server/org/opends/server/core/EntryCacheConfigManager.java opends/src/server/org/opends/server/core/ExtendedOperationConfigManager.java opends/src/server/org/opends/server/core/GroupManager.java opends/src/server/org/opends/server/core/IdentityMapperConfigManager.java opends/src/server/org/opends/server/core/KeyManagerProviderConfigManager.java opends/src/server/org/opends/server/core/LoggerConfigManager.java opends/src/server/org/opends/server/core/MonitorConfigManager.java opends/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java opends/src/server/org/opends/server/core/PasswordPolicy.java opends/src/server/org/opends/server/core/PasswordPolicyState.java opends/src/server/org/opends/server/core/PasswordStorageSchemeConfigManager.java opends/src/server/org/opends/server/core/PasswordValidatorConfigManager.java opends/src/server/org/opends/server/core/PluginConfigManager.java opends/src/server/org/opends/server/core/SASLConfigManager.java opends/src/server/org/opends/server/core/SchemaConfigManager.java opends/src/server/org/opends/server/core/SynchronizationProviderConfigManager.java opends/src/server/org/opends/server/core/TrustManagerProviderConfigManager.java opends/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandler.java opends/src/server/org/opends/server/extensions/CRAMMD5SASLMechanismHandler.java opends/src/server/org/opends/server/extensions/DigestMD5SASLMechanismHandler.java opends/src/server/org/opends/server/extensions/ExactMatchIdentityMapper.java opends/src/server/org/opends/server/extensions/ExternalSASLMechanismHandler.java opends/src/server/org/opends/server/extensions/FileBasedKeyManagerProvider.java opends/src/server/org/opends/server/extensions/FingerprintCertificateMapper.java opends/src/server/org/opends/server/extensions/GSSAPISASLMechanismHandler.java opends/src/server/org/opends/server/extensions/LengthBasedPasswordValidator.java opends/src/server/org/opends/server/extensions/NullKeyManagerProvider.java opends/src/server/org/opends/server/extensions/PKCS11KeyManagerProvider.java opends/src/server/org/opends/server/extensions/PlainSASLMechanismHandler.java opends/src/server/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java opends/src/server/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapper.java opends/src/server/org/opends/server/extensions/SubjectEqualsDNCertificateMapper.java opends/src/server/org/opends/server/messages/AdminMessages.java opends/src/server/org/opends/server/messages/MessageHandler.java opends/src/server/org/opends/server/messages/ProtocolMessages.java opends/src/server/org/opends/server/monitors/ConnectionHandlerMonitor.java opends/src/server/org/opends/server/plugins/EntryUUIDPlugin.java opends/src/server/org/opends/server/plugins/LDAPADListPlugin.java opends/src/server/org/opends/server/plugins/LastModPlugin.java opends/src/server/org/opends/server/plugins/PasswordPolicyImportPlugin.java opends/src/server/org/opends/server/plugins/profiler/ProfilerPlugin.java opends/src/server/org/opends/server/protocols/internal/InternalConnectionHandler.java opends/src/server/org/opends/server/protocols/jmx/JmxClientConnection.java opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/AdminTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/AttributeTypePropertyDefinitionTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ClassPropertyDefinitionTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DNPropertyDefinitionTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DurationPropertyDefinitionTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DurationUnitTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/IntegerPropertyDefinitionTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/LDAPProfileTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ManagedObjectDefinitionI18NResourceTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/RelativeInheritedDefaultBehaviorProviderTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/SizePropertyDefinitionTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/SizeUnitTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/PropertySetTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/admin/server/AdminTestCaseUtils.java opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CRAMMD5SASLMechanismHandlerTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/DigestMD5SASLMechanismHandlerTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/NullKeyManagerProviderTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/TestPasswordValidator.java opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/DelayPreOpPlugin.java opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/DisconnectClientPlugin.java opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/EntryUUIDPluginTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/InvocationCounterPlugin.java opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LDAPADListPluginTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LastModPluginTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/NullPlugin.java opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/PasswordPolicyImportPluginTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/ShortCircuitPlugin.java opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/UpdatePreOpPlugin.java opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/internal/InternalConnectionHandlerTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/JmxConnectTest.java opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LdapTestCase.java opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java