2407N/A<!--
2407N/A ! CDDL HEADER START
2407N/A !
2407N/A ! The contents of this file are subject to the terms of the
2407N/A ! Common Development and Distribution License, Version 1.0 only
2407N/A ! (the "License"). You may not use this file except in compliance
2407N/A ! with the License.
2407N/A !
2407N/A ! You can obtain a copy of the license at
2407N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
2407N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
2407N/A ! See the License for the specific language governing permissions
2407N/A ! and limitations under the License.
2407N/A !
2407N/A ! When distributing Covered Code, include this CDDL HEADER in each
2407N/A ! file and include the License file at
2407N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
2407N/A ! add the following below this CDDL HEADER, with the fields enclosed
2407N/A ! by brackets "[]" replaced with your own identifying information:
2407N/A ! Portions Copyright [yyyy] [name of copyright owner]
2407N/A !
2407N/A ! CDDL HEADER END
2407N/A !
2407N/A !
5018N/A ! Copyright 2008-2010 Sun Microsystems, Inc.
2407N/A ! -->
2407N/A<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
2407N/A xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5018N/A <xsl:import href="/java-utilities.xsl" />
2644N/A <xsl:include href="/conditions.xsl" />
2407N/A <!--
2407N/A Templates for processing aggregation properties.
2407N/A -->
2412N/A <xsl:template match="adm:aggregation"
2412N/A mode="java-definition-imports">
2407N/A <xsl:element name="import">
2407N/A <xsl:call-template name="get-definition-package" />
2407N/A <xsl:value-of select="'.client.'" />
2407N/A <xsl:call-template name="get-client-type" />
2407N/A </xsl:element>
2407N/A <xsl:element name="import">
2407N/A <xsl:call-template name="get-definition-package" />
2407N/A <xsl:value-of select="'.server.'" />
2407N/A <xsl:call-template name="get-server-type" />
2407N/A </xsl:element>
2500N/A <xsl:if test="../../@multi-valued = 'true'">
2500N/A <import>java.util.TreeSet</import>
2500N/A </xsl:if>
4017N/A <xsl:if test="adm:constraint/adm:target-needs-enabling-condition">
2644N/A <import>org.opends.server.admin.condition.Conditions</import>
2644N/A </xsl:if>
4017N/A <xsl:if test="adm:constraint/adm:target-is-enabled-condition">
2644N/A <import>org.opends.server.admin.condition.Conditions</import>
2644N/A </xsl:if>
2535N/A <import>
2535N/A org.opends.server.admin.AggregationPropertyDefinition
2535N/A </import>
2407N/A </xsl:template>
2407N/A <xsl:template match="adm:aggregation" mode="java-value-type">
2407N/A <xsl:value-of select="'String'" />
2407N/A </xsl:template>
2500N/A <xsl:template match="adm:aggregation" mode="java-value-imports">
2500N/A <xsl:param name="interface" select="/.." />
2500N/A <xsl:if test="$interface = 'server'">
2500N/A <import>org.opends.server.types.DN</import>
2500N/A </xsl:if>
2500N/A </xsl:template>
2407N/A <xsl:template match="adm:aggregation" mode="java-definition-type">
2407N/A <xsl:value-of select="'AggregationPropertyDefinition'" />
2407N/A </xsl:template>
2407N/A <xsl:template match="adm:aggregation"
2407N/A mode="java-definition-generic-type">
2407N/A <xsl:call-template name="get-client-type" />
2407N/A <xsl:value-of select="', '" />
2407N/A <xsl:call-template name="get-server-type" />
2407N/A </xsl:template>
2407N/A <xsl:template match="adm:aggregation" mode="java-definition-ctor">
2407N/A <xsl:if test="not(@parent-path)">
2407N/A <xsl:message terminate="yes">
2407N/A <xsl:value-of
2407N/A select="concat('No parent-path defined for aggregation property ', ../../@name)" />
2407N/A </xsl:message>
2407N/A </xsl:if>
2407N/A <xsl:if test="not(@relation-name)">
2407N/A <xsl:message terminate="yes">
2407N/A <xsl:value-of
2407N/A select="concat('No relation-name defined for aggregation property ', ../../@name)" />
2407N/A </xsl:message>
2407N/A </xsl:if>
2407N/A <xsl:value-of
2501N/A select="concat(' builder.setParentPath(&quot;',
2501N/A normalize-space(@parent-path), '&quot;);&#xa;')" />
2407N/A <xsl:value-of
2407N/A select="concat(' builder.setRelationDefinition(&quot;',
2407N/A normalize-space(@relation-name), '&quot;);&#xa;')" />
4017N/A <xsl:if test="adm:constraint/adm:target-needs-enabling-condition">
2407N/A <xsl:value-of
2644N/A select="' builder.setTargetNeedsEnablingCondition('" />
2644N/A <xsl:apply-templates
4017N/A select="adm:constraint/adm:target-needs-enabling-condition/*"
2644N/A mode="compile-condition" />
2644N/A <xsl:value-of select="');&#xa;'" />
2644N/A </xsl:if>
4017N/A <xsl:if test="adm:constraint/adm:target-is-enabled-condition">
2407N/A <xsl:value-of
2644N/A select="' builder.setTargetIsEnabledCondition('" />
4017N/A <xsl:apply-templates select="adm:constraint/adm:target-is-enabled-condition/*"
2644N/A mode="compile-condition" />
2644N/A <xsl:value-of select="');&#xa;'" />
2407N/A </xsl:if>
2407N/A </xsl:template>
2412N/A <xsl:template match="adm:aggregation"
2412N/A mode="java-definition-post-ctor">
2412N/A <xsl:value-of select="' INSTANCE.registerConstraint(PD_'" />
2412N/A <xsl:call-template name="name-to-java-constant">
2412N/A <xsl:with-param name="value" select="../../@name" />
2412N/A </xsl:call-template>
2648N/A <xsl:value-of select="'.getSourceConstraint());&#xa;'" />
2412N/A </xsl:template>
2407N/A <!--
2500N/A Generate property getter declaration(s).
2500N/A -->
2500N/A <xsl:template match="adm:aggregation"
2500N/A mode="java-property-getter-declaration">
2500N/A <xsl:param name="interface" select="/.." />
2500N/A <xsl:call-template
2500N/A name="generate-default-property-getter-declaration">
2500N/A <xsl:with-param name="interface" select="$interface" />
2500N/A </xsl:call-template>
2500N/A <xsl:if test="$interface='server'">
2500N/A <xsl:variable name="name" select="../../@name" />
2500N/A <xsl:variable name="java-property-name">
2500N/A <xsl:call-template name="name-to-java">
2500N/A <xsl:with-param name="value" select="$name" />
2500N/A </xsl:call-template>
2500N/A </xsl:variable>
2500N/A <xsl:variable name="comment">
2500N/A <xsl:if test="/adm:synopsis">
2500N/A <xsl:value-of select="'&lt;p&gt;&#xa;'" />
2500N/A <xsl:value-of select="normalize-space(/adm:synopsis)" />
2500N/A <xsl:value-of select="'&#xa;'" />
2500N/A </xsl:if>
2500N/A <xsl:if test="/adm:description">
2500N/A <xsl:value-of select="'&lt;p&gt;&#xa;'" />
2500N/A <xsl:value-of select="normalize-space(/adm:description)" />
2500N/A <xsl:value-of select="'&#xa;'" />
2500N/A </xsl:if>
2500N/A </xsl:variable>
2500N/A <xsl:text>&#xa;</xsl:text>
2500N/A <xsl:text>&#xa;</xsl:text>
2500N/A <xsl:text>&#xa;</xsl:text>
2500N/A <xsl:choose>
2500N/A <xsl:when test="string(../../@multi-valued) != 'true'">
2500N/A <xsl:call-template name="add-java-comment2">
2500N/A <xsl:with-param name="indent" select="2" />
2500N/A <xsl:with-param name="content"
2500N/A select="concat(
2500N/A 'Gets the &quot;', $name,'&quot; property as a DN.&#xa;',
2500N/A $comment,
2500N/A '&#xa;',
2500N/A '@return Returns the DN value of the &quot;', $name, '&quot; property.&#xa;')" />
2500N/A </xsl:call-template>
2500N/A <xsl:value-of
2500N/A select="concat(' DN get', $java-property-name, 'DN();&#xa;')" />
2500N/A </xsl:when>
2500N/A <xsl:otherwise>
2500N/A <xsl:call-template name="add-java-comment2">
2500N/A <xsl:with-param name="indent" select="2" />
2500N/A <xsl:with-param name="content"
2500N/A select="concat(
2500N/A 'Gets the &quot;', $name,'&quot; property as a set of DNs.&#xa;',
2500N/A $comment,
2500N/A '&#xa;',
2500N/A '@return Returns the DN values of the &quot;', $name, '&quot; property.&#xa;')" />
2500N/A </xsl:call-template>
2500N/A <xsl:value-of
2500N/A select="concat(' SortedSet&lt;DN&gt; get', $java-property-name, 'DNs();&#xa;')" />
2500N/A </xsl:otherwise>
2500N/A </xsl:choose>
2500N/A </xsl:if>
2500N/A </xsl:template>
2500N/A <!--
2500N/A Generate property getter implementation(s).
2500N/A -->
2500N/A <xsl:template match="adm:aggregation"
2500N/A mode="java-property-getter-implementation">
2500N/A <xsl:param name="interface" select="/.." />
2500N/A <xsl:call-template
2500N/A name="generate-default-property-getter-implementation">
2500N/A <xsl:with-param name="interface" select="$interface" />
2500N/A </xsl:call-template>
2500N/A <xsl:if test="$interface='server'">
2500N/A <xsl:variable name="name" select="../../@name" />
2500N/A <xsl:variable name="java-property-name">
2500N/A <xsl:call-template name="name-to-java">
2500N/A <xsl:with-param name="value" select="$name" />
2500N/A </xsl:call-template>
2500N/A </xsl:variable>
2500N/A <xsl:text>&#xa;</xsl:text>
2500N/A <xsl:text>&#xa;</xsl:text>
2500N/A <xsl:text>&#xa;</xsl:text>
2500N/A <xsl:call-template name="add-java-comment2">
2500N/A <xsl:with-param name="indent" select="4" />
2500N/A <xsl:with-param name="content" select="'{@inheritDoc}&#xa;'" />
2500N/A </xsl:call-template>
2500N/A <xsl:choose>
2500N/A <xsl:when test="string(../../@multi-valued) != 'true'">
2500N/A <xsl:value-of
2500N/A select="concat(' public DN get', $java-property-name, 'DN() {&#xa;')" />
2500N/A <xsl:value-of
2500N/A select="concat(' String value = get', $java-property-name, '();&#xa;')" />
2500N/A <xsl:value-of
5018N/A select="' if (value == null) return null;&#xa;'" />
2564N/A <xsl:value-of
2500N/A select="concat(' return INSTANCE.get', $java-property-name, 'PropertyDefinition().getChildDN(value);&#xa;')" />
2500N/A <xsl:value-of select="' }&#xa;'" />
2500N/A </xsl:when>
2500N/A <xsl:otherwise>
2500N/A <xsl:value-of
2500N/A select="concat(' public SortedSet&lt;DN&gt; get', $java-property-name, 'DNs() {&#xa;')" />
2500N/A <xsl:value-of
2500N/A select="concat(' SortedSet&lt;String&gt; values = get', $java-property-name, '();&#xa;')" />
2500N/A <xsl:value-of
2500N/A select="' SortedSet&lt;DN&gt; dnValues = new TreeSet&lt;DN&gt;();&#xa;'" />
2500N/A <xsl:value-of
2500N/A select="' for (String value : values) {&#xa;'" />
2500N/A <xsl:value-of
2500N/A select="concat(' DN dn = INSTANCE.get', $java-property-name, 'PropertyDefinition().getChildDN(value);&#xa;')" />
2500N/A <xsl:value-of select="' dnValues.add(dn);&#xa;'" />
2500N/A <xsl:value-of select="' }&#xa;'" />
2500N/A <xsl:value-of select="' return dnValues;&#xa;'" />
2500N/A <xsl:value-of select="' }&#xa;'" />
2500N/A </xsl:otherwise>
2500N/A </xsl:choose>
2500N/A </xsl:if>
2500N/A </xsl:template>
2500N/A <!--
2407N/A Gets the Java client configuration interface for the referenced type.
2407N/A -->
2407N/A <xsl:template name="get-client-type">
2407N/A <xsl:call-template name="get-reference-type" />
2407N/A <xsl:value-of select="'CfgClient'" />
2407N/A </xsl:template>
2407N/A <!--
2407N/A Gets the Java server configuration interface for the referenced type.
2407N/A -->
2407N/A <xsl:template name="get-server-type">
2407N/A <xsl:call-template name="get-reference-type" />
2407N/A <xsl:value-of select="'Cfg'" />
2407N/A </xsl:template>
2407N/A <!--
2407N/A Gets the Java definition configuration interface for the referenced type.
2407N/A -->
2407N/A <xsl:template name="get-definition-type">
2407N/A <xsl:call-template name="get-reference-type" />
2407N/A <xsl:value-of select="'CfgDefn'" />
2407N/A </xsl:template>
2407N/A <!--
2407N/A Gets the Java definition configuration package.
2407N/A -->
2407N/A <xsl:template name="get-definition-package">
2407N/A <xsl:choose>
2407N/A <xsl:when test="@managed-object-package">
2407N/A <xsl:value-of select="@managed-object-package" />
2407N/A </xsl:when>
2407N/A <xsl:otherwise>
2407N/A <xsl:value-of select="$this-package" />
2407N/A </xsl:otherwise>
2407N/A </xsl:choose>
2407N/A </xsl:template>
2407N/A <!--
2407N/A Gets the Java name for the referenced type.
2407N/A -->
2407N/A <xsl:template name="get-reference-type">
2407N/A <xsl:choose>
2407N/A <xsl:when test="@managed-object-name">
2407N/A <xsl:call-template name="name-to-java">
2407N/A <xsl:with-param name="value" select="@managed-object-name" />
2407N/A </xsl:call-template>
2407N/A </xsl:when>
2407N/A <xsl:otherwise>
2407N/A <xsl:call-template name="name-to-java">
2407N/A <xsl:with-param name="value" select="@relation-name" />
2407N/A </xsl:call-template>
2407N/A </xsl:otherwise>
2407N/A </xsl:choose>
2407N/A </xsl:template>
2407N/A</xsl:stylesheet>