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

matthew_swift
02.13.2007 63b5dd63368748ca4c5a7e551e3a9ab005134393
Fix bug in code generation which was preventing overriding the default behavior for enumerated properties.
4 files modified
100 ■■■■ changed files
opends/resource/admin/admin-preprocessor.xsd 26 ●●●●● patch | view | raw | blame | history
opends/resource/admin/metaMO.xsl 10 ●●●●● patch | view | raw | blame | history
opends/resource/admin/preprocessor.xsl 33 ●●●●● patch | view | raw | blame | history
opends/resource/admin/property-types/enumeration.xsl 31 ●●●● patch | view | raw | blame | history
opends/resource/admin/admin-preprocessor.xsd
@@ -34,11 +34,11 @@
      "package" element is appended identifying the referenced package.
    </xsd:documentation>
  </xsd:annotation>
  <xsd:element name="managed-object">
  <xsd:element name="last-defined-in">
    <xsd:annotation>
      <xsd:documentation>
        Specifies the name and package of the managed object definition
        which defines a property definition.
        Specifies the name and package of the last managed object
        definition which defined or overrides this property definition.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
@@ -60,16 +60,26 @@
      </xsd:attribute>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="package">
  <xsd:element name="first-defined-in">
    <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.
        This optional element specifies the location where the property
        was first defined. This may be in a referenced Package.xml
        definition, or in an overridden parent definition. This element
        is only present when the package/name attributes would differ
        from those specified in the last-defined-in element.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:attribute name="name" type="admin:package-type"
      <xsd:attribute name="name" type="admin:name-type"
        use="optional">
        <xsd:annotation>
          <xsd:documentation>
            The name of the managed object if applicable.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
      <xsd:attribute name="package" type="admin:package-type"
        use="required">
        <xsd:annotation>
          <xsd:documentation>
opends/resource/admin/metaMO.xsl
@@ -84,12 +84,14 @@
      Generate enumerations defined by this managed object..
    -->
    <xsl:for-each
      select="$this-local-properties[adm:syntax/adm:enumeration]">
      select="$this-local-properties[adm:syntax/adm:enumeration and not(adm:profile[@name='preprocessor']/adm:first-defined-in)]">
      <xsl:sort select="@name" />
      <xsl:if test="not(adm:profile[@name='preprocessor']/admpp:first-defined-in)">
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:text>&#xa;</xsl:text>
      <xsl:call-template name="generate-enumeration" />
      </xsl:if>
    </xsl:for-each>
    <!--
      Define application tags if this is the root configuration.
@@ -222,7 +224,7 @@
                         '&quot;, null);&#xa;')" />
      </xsl:otherwise>
    </xsl:choose>
    <xsl:value-of select="concat('  }&#xa;')" />
    <xsl:value-of select="'  }&#xa;'" />
    <!--
      Create configuration view factory methods for non-abstract definitions
    -->
@@ -897,7 +899,7 @@
    </xsl:if>
    <xsl:choose>
      <xsl:when
        test="adm:profile[@name='preprocessor']/admpp:managed-object[@name=$this-name and @package=$this-package]">
        test="adm:profile[@name='preprocessor']/admpp:last-defined-in[@name=$this-name and @package=$this-package]">
        <xsl:value-of
          select="concat('   *&#xa;',
                     '   * @return Returns the &quot;',
@@ -993,7 +995,7 @@
    </xsl:variable>
    <xsl:choose>
      <xsl:when
        test="adm:profile[@name='preprocessor']/admpp:managed-object[@name=$this-name and @package=$this-package]">
        test="adm:profile[@name='preprocessor']/admpp:last-defined-in[@name=$this-name and @package=$this-package]">
        <xsl:value-of
          select="concat($java-managed-object-name, 'CfgClient,',
                     $java-managed-object-name, 'Cfg&gt; get',
opends/resource/admin/preprocessor.xsl
@@ -378,7 +378,7 @@
        <xsl:attribute name="name">
          <xsl:value-of select="'preprocessor'" />
        </xsl:attribute>
        <xsl:element name="admpp:managed-object">
        <xsl:element name="admpp:last-defined-in">
          <xsl:attribute name="name">
            <xsl:value-of select="$moname" />
          </xsl:attribute>
@@ -529,7 +529,7 @@
        <xsl:attribute name="name">
          <xsl:value-of select="'preprocessor'" />
        </xsl:attribute>
        <xsl:element name="admpp:managed-object">
        <xsl:element name="admpp:last-defined-in">
          <xsl:attribute name="name">
            <xsl:value-of select="$moname" />
          </xsl:attribute>
@@ -537,8 +537,8 @@
            <xsl:value-of select="$mopackage" />
          </xsl:attribute>
        </xsl:element>
        <xsl:element name="admpp:package">
          <xsl:attribute name="name">
        <xsl:element name="admpp:first-defined-in">
          <xsl:attribute name="package">
            <xsl:value-of select="$package" />
          </xsl:attribute>
        </xsl:element>
@@ -641,7 +641,7 @@
        <xsl:attribute name="name">
          <xsl:value-of select="'preprocessor'" />
        </xsl:attribute>
        <xsl:element name="admpp:managed-object">
        <xsl:element name="admpp:last-defined-in">
          <xsl:attribute name="name">
            <xsl:value-of select="$moname" />
          </xsl:attribute>
@@ -649,6 +649,19 @@
            <xsl:value-of select="$mopackage" />
          </xsl:attribute>
        </xsl:element>
        <xsl:choose>
          <xsl:when
            test="$property/adm:profile[@name='preprocessor']/admpp:first-defined-in">
            <xsl:copy-of
              select="$property/adm:profile[@name='preprocessor']/admpp:first-defined-in" />
          </xsl:when>
          <xsl:otherwise>
            <xsl:element name="admpp:first-defined-in">
              <xsl:copy-of
                select="$property/adm:profile[@name='preprocessor']/admpp:last-defined-in/@*" />
            </xsl:element>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:element>
    </xsl:element>
  </xsl:template>
@@ -799,7 +812,7 @@
        <xsl:attribute name="name">
          <xsl:value-of select="'preprocessor'" />
        </xsl:attribute>
        <xsl:element name="admpp:managed-object">
        <xsl:element name="admpp:last-defined-in">
          <xsl:attribute name="name">
            <xsl:value-of select="$moname" />
          </xsl:attribute>
@@ -1170,17 +1183,17 @@
    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]]" />
    select="$this/adm:relation[adm:profile[@name='preprocessor']/admpp:last-defined-in[@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)]]" />
    select="$this/adm:relation[adm:profile[@name='preprocessor']/admpp:last-defined-in[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]]" />
    select="$this/adm:property[adm:profile[@name='preprocessor']/admpp:last-defined-in[@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)]]" />
    select="$this/adm:property[adm:profile[@name='preprocessor']/admpp:last-defined-in[not(@name=$this-name and @package=$this-package)]]" />
  <xsl:variable name="this-all-properties" select="$this/adm:property" />
  <!--
    Default rule for testing.
opends/resource/admin/property-types/enumeration.xsl
@@ -35,15 +35,25 @@
      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 test="$pp/admpp:first-defined-in">
          <xsl:value-of
            select="concat($pp/admpp:first-defined-in/@package, '.')" />
          <xsl:if test="$pp/admpp:first-defined-in/@name">
            <xsl:value-of select="'meta.'" />
            <xsl:call-template name="name-to-java">
              <xsl:with-param name="value"
                select="$pp/admpp:first-defined-in/@name" />
            </xsl:call-template>
            <xsl:value-of select="'CfgDefn.'" />
          </xsl:if>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of
            select="concat($pp/admpp:managed-object/@package, '.meta.')" />
            select="concat($pp/admpp:last-defined-in/@package, '.')" />
          <xsl:value-of select="'meta.'" />
          <xsl:call-template name="name-to-java">
            <xsl:with-param name="value"
              select="$pp/admpp:managed-object/@name" />
              select="$pp/admpp:last-defined-in/@name" />
          </xsl:call-template>
          <xsl:value-of select="'CfgDefn.'" />
        </xsl:otherwise>
@@ -59,9 +69,18 @@
    </xsl:element>
    <xsl:variable name="pp"
      select="../../adm:profile[@name='preprocessor']" />
    <xsl:if test="$pp/admpp:package">
    <xsl:if test="$pp/admpp:first-defined-in">
      <xsl:element name="import">
        <xsl:value-of select="concat($pp/admpp:package/@name, '.')" />
        <xsl:value-of
          select="concat($pp/admpp:first-defined-in/@package, '.')" />
        <xsl:if test="$pp/admpp:first-defined-in/@name">
          <xsl:value-of select="'meta.'" />
          <xsl:call-template name="name-to-java">
            <xsl:with-param name="value"
              select="$pp/admpp:first-defined-in/@name" />
          </xsl:call-template>
          <xsl:value-of select="'CfgDefn.'" />
        </xsl:if>
        <xsl:apply-templates select="." mode="java-value-type" />
      </xsl:element>
    </xsl:if>