serverMO.xsl revision 23ab7b85e3631cb4c75a6f9277c1d1aa7a7bfbd6
0N/A<!--
2273N/A ! CDDL HEADER START
0N/A !
0N/A ! The contents of this file are subject to the terms of the
0N/A ! Common Development and Distribution License, Version 1.0 only
0N/A ! (the "License"). You may not use this file except in compliance
0N/A ! with the License.
0N/A !
0N/A ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
0N/A ! or http://forgerock.org/license/CDDLv1.0.html.
0N/A ! See the License for the specific language governing permissions
0N/A ! and limitations under the License.
0N/A !
0N/A ! When distributing Covered Code, include this CDDL HEADER in each
0N/A ! file and include the License file at legal-notices/CDDLv1_0.txt.
0N/A ! If applicable, add the following below this CDDL HEADER, with the
0N/A ! fields enclosed by brackets "[]" replaced with your own identifying
0N/A ! information:
1472N/A ! Portions Copyright [yyyy] [name of copyright owner]
1472N/A !
1472N/A ! CDDL HEADER END
0N/A !
0N/A !
0N/A ! Copyright 2007-2008 Sun Microsystems, Inc.
1879N/A ! -->
1879N/A<xsl:stylesheet version="1.0" xmlns:adm="http://opendj.forgerock.org/admin"
1879N/A xmlns:admpp="http://opendj.forgerock.org/admin-preprocessor"
1879N/A xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
1879N/A <xsl:import href="java-utilities.xsl" />
1879N/A <xsl:import href="preprocessor.xsl" />
1879N/A <xsl:import href="property-types.xsl" />
1879N/A <xsl:output method="text" encoding="us-ascii" />
1879N/A <!--
1879N/A Template for generating the interface declaration.
1879N/A -->
1879N/A <xsl:template name="generate-interface-declaration">
0N/A <xsl:value-of select="'/**&#xa;'" />
2062N/A <xsl:call-template name="add-java-comment">
2062N/A <xsl:with-param name="indent-text" select="' *'" />
2062N/A <xsl:with-param name="content"
2062N/A select="concat('A server-side interface for querying ', $this-ufn,
0N/A ' settings.')" />
0N/A </xsl:call-template>
0N/A <xsl:value-of select="' * &lt;p&gt;&#xa;'" />
0N/A <xsl:call-template name="add-java-comment">
0N/A <xsl:with-param name="indent-text" select="' *'" />
0N/A <xsl:with-param name="content" select="$this/adm:synopsis" />
0N/A </xsl:call-template>
0N/A <xsl:value-of select="' */&#xa;'" />
0N/A <xsl:value-of
0N/A select="concat('public interface ',
0N/A $this-java-class ,
0N/A 'Cfg extends ')" />
0N/A <xsl:choose>
0N/A <xsl:when test="boolean($this/@extends)">
0N/A <xsl:value-of select="concat($parent-java-class,'Cfg ')" />
0N/A </xsl:when>
0N/A <xsl:otherwise>
0N/A <xsl:value-of select="'Configuration '" />
0N/A </xsl:otherwise>
0N/A </xsl:choose>
0N/A <xsl:text>{&#xa;</xsl:text>
0N/A </xsl:template>
0N/A <!--
0N/A Template for generating the configuration class getter.
0N/A -->
0N/A <xsl:template name="generate-configuration-definition-getter">
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Gets the configuration class associated with this ', $this-ufn, '.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @return Returns the configuration class associated with this ', $this-ufn, '.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' Class&lt;? extends ', $this-java-class,'Cfg&gt; configurationClass();&#xa;')" />
0N/A </xsl:template>
0N/A <!--
0N/A Template for generating the change listener declaration.
0N/A -->
0N/A <xsl:template name="generate-change-listener-declaration">
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Register to be notified when this ', $this-ufn,' is changed.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @param listener&#xa;',
0N/A ' * The ', $this-ufn,' configuration change listener.&#xa;',
0N/A ' */&#xa;')" />
605N/A <xsl:value-of
0N/A select="concat(' void add', $this-short-java-class,
0N/A 'ChangeListener(ConfigurationChangeListener&lt;',
0N/A $this-java-class,'Cfg&gt; listener);&#xa;')" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Deregister an existing ', $this-ufn,' configuration change listener.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @param listener&#xa;',
0N/A ' * The ', $this-ufn,' configuration change listener.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' void remove', $this-short-java-class,
0N/A 'ChangeListener(ConfigurationChangeListener&lt;',
0N/A $this-java-class,'Cfg&gt; listener);&#xa;')" />
0N/A </xsl:template>
0N/A <!--
0N/A Template for generating the relation getter declarations.
0N/A -->
0N/A <xsl:template name="generate-relation-declarations">
0N/A <xsl:variable name="name" select="@name" />
0N/A <xsl:variable name="ufn">
0N/A <xsl:call-template name="name-to-ufn">
0N/A <xsl:with-param name="value" select="$name" />
0N/A </xsl:call-template>
0N/A </xsl:variable>
0N/A <xsl:variable name="java-relation-name">
0N/A <xsl:call-template name="name-to-java">
0N/A <xsl:with-param name="value" select="$name" />
0N/A </xsl:call-template>
0N/A </xsl:variable>
2062N/A <xsl:variable name="java-class-name">
0N/A <xsl:call-template name="name-to-java">
0N/A <xsl:with-param name="value" select="@managed-object-name" />
0N/A </xsl:call-template>
0N/A </xsl:variable>
0N/A <xsl:choose>
0N/A <xsl:when test="adm:one-to-one">
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Gets the ', $ufn,'.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @return Returns the ', $ufn,'.&#xa;',
0N/A ' * @throws ConfigException&#xa;',
0N/A ' * If the ', $ufn,' could not be found or it could not&#xa;',
0N/A ' * be successfully decoded.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' ', $java-class-name, 'Cfg get',
0N/A $java-relation-name, '() throws ConfigException;&#xa;')" />
0N/A </xsl:when>
0N/A <xsl:when test="adm:one-to-zero-or-one">
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Determines whether or not the ', $ufn,' exists.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @return Returns &lt;true&gt; if the ', $ufn,' exists.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' boolean has',
0N/A $java-relation-name, '();&#xa;')" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Gets the ', $ufn,' if it is present.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @return Returns the ', $ufn,' if it is present.&#xa;',
0N/A ' * @throws ConfigException&#xa;',
3081N/A ' * If the ', $ufn,' does not exist or it could not&#xa;',
3081N/A ' * be successfully decoded.&#xa;',
3081N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' ', $java-class-name, 'Cfg get',
0N/A $java-relation-name, '() throws ConfigException;&#xa;')" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Registers to be notified when the ', $ufn,' is added.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @param listener&#xa;',
0N/A ' * The ', $ufn,' configuration add listener.&#xa;',
0N/A ' * @throws ConfigException&#xa;',
0N/A ' * If the add listener could not be registered.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' void add', $java-relation-name,
0N/A 'AddListener(ConfigurationAddListener&lt;',
0N/A $java-class-name,'Cfg&gt; listener) throws ConfigException;&#xa;')" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Deregisters an existing ', $ufn,' configuration add listener.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @param listener&#xa;',
0N/A ' * The ', $ufn,' configuration add listener.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' void remove', $java-relation-name,
0N/A 'AddListener(ConfigurationAddListener&lt;',
0N/A $java-class-name,'Cfg&gt; listener);&#xa;')" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
29N/A ' * Registers to be notified the ', $ufn,' is deleted.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @param listener&#xa;',
0N/A ' * The ', $ufn,' configuration delete listener.&#xa;',
0N/A ' * @throws ConfigException&#xa;',
0N/A ' * If the delete listener could not be registered.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' void add', $java-relation-name,
0N/A 'DeleteListener(ConfigurationDeleteListener&lt;',
0N/A $java-class-name,'Cfg&gt; listener) throws ConfigException;&#xa;')" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Deregisters an existing ', $ufn,' configuration delete listener.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @param listener&#xa;',
0N/A ' * The ', $ufn,' configuration delete listener.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' void remove', $java-relation-name,
0N/A 'DeleteListener(ConfigurationDeleteListener&lt;',
0N/A $java-class-name,'Cfg&gt; listener);&#xa;')" />
0N/A </xsl:when>
0N/A <xsl:when test="adm:one-to-many">
0N/A <xsl:variable name="plural-name"
0N/A select="adm:one-to-many/@plural-name" />
0N/A <xsl:variable name="ufpn">
0N/A <xsl:call-template name="name-to-ufn">
0N/A <xsl:with-param name="value" select="$plural-name" />
0N/A </xsl:call-template>
0N/A </xsl:variable>
0N/A <xsl:variable name="java-relation-plural-name">
1142N/A <xsl:call-template name="name-to-java">
1142N/A <xsl:with-param name="value" select="$plural-name" />
0N/A </xsl:call-template>
0N/A </xsl:variable>
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Lists the ', $ufpn, '.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @return Returns an array containing the names of the&#xa;',
0N/A ' * ', $ufpn,'.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' String[] list', $java-relation-plural-name, '();&#xa;')" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Gets the named ', $ufn,'.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @param name&#xa;',
0N/A ' * The name of the ',$ufn,' to retrieve.&#xa;',
0N/A ' * @return Returns the named ', $ufn,'.&#xa;',
0N/A ' * @throws ConfigException&#xa;',
0N/A ' * If the ', $ufn,' could not be found or it&#xa;',
0N/A ' * could not be successfully decoded.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' ', $java-class-name, 'Cfg get',
0N/A $java-relation-name, '(String name) throws ConfigException;&#xa;')" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Registers to be notified when new ', $ufpn,' are added.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @param listener&#xa;',
0N/A ' * The ', $ufn,' configuration add listener.&#xa;',
0N/A ' * @throws ConfigException&#xa;',
0N/A ' * If the add listener could not be registered.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' void add', $java-relation-name,
0N/A 'AddListener(ConfigurationAddListener&lt;',
0N/A $java-class-name,'Cfg&gt; listener) throws ConfigException;&#xa;')" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Deregisters an existing ', $ufn,' configuration add listener.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @param listener&#xa;',
0N/A ' * The ', $ufn,' configuration add listener.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' void remove', $java-relation-name,
0N/A 'AddListener(ConfigurationAddListener&lt;',
0N/A $java-class-name,'Cfg&gt; listener);&#xa;')" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Registers to be notified when existing ', $ufpn,' are deleted.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @param listener&#xa;',
0N/A ' * The ', $ufn,' configuration delete listener.&#xa;',
0N/A ' * @throws ConfigException&#xa;',
0N/A ' * If the delete listener could not be registered.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' void add', $java-relation-name,
0N/A 'DeleteListener(ConfigurationDeleteListener&lt;',
0N/A $java-class-name,'Cfg&gt; listener) throws ConfigException;&#xa;')" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:value-of
0N/A select="concat(' /**&#xa;',
0N/A ' * Deregisters an existing ', $ufn,' configuration delete listener.&#xa;',
0N/A ' *&#xa;',
0N/A ' * @param listener&#xa;',
0N/A ' * The ', $ufn,' configuration delete listener.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' void remove', $java-relation-name,
0N/A 'DeleteListener(ConfigurationDeleteListener&lt;',
0N/A $java-class-name,'Cfg&gt; listener);&#xa;')" />
0N/A </xsl:when>
0N/A <xsl:otherwise>
0N/A <xsl:message terminate="yes">
0N/A <xsl:value-of
0N/A select="concat('Unknown relation type &quot;', local-name(*), '&quot; in relation &quot;', $name, '&quot;.')" />
0N/A </xsl:message>
0N/A </xsl:otherwise>
0N/A </xsl:choose>
0N/A </xsl:template>
0N/A <!--
0N/A Main document parsing template.
0N/A -->
0N/A <xsl:template match="/">
0N/A <xsl:call-template name="copyright-notice" />
0N/A <xsl:value-of
0N/A select="concat('package ', $this-package, '.server;&#xa;')" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:call-template name="generate-import-statements">
0N/A <xsl:with-param name="imports">
0N/A <xsl:for-each select="$this-local-properties">
0N/A <xsl:call-template name="get-property-java-imports" >
0N/A <xsl:with-param name="interface" select="'server'" />
0N/A </xsl:call-template>
0N/A </xsl:for-each>
0N/A <xsl:if test="$this-local-properties[@multi-valued='true']">
0N/A <import>java.util.SortedSet</import>
0N/A </xsl:if>
0N/A <xsl:choose>
0N/A <xsl:when test="$this/@extends">
0N/A <xsl:if test="$parent-package != $this-package">
0N/A <xsl:element name="import">
0N/A <xsl:value-of
0N/A select="concat($parent-package, '.server.', $parent-java-class, 'Cfg')" />
0N/A </xsl:element>
0N/A </xsl:if>
0N/A </xsl:when>
0N/A <xsl:otherwise>
0N/A <import>org.forgerock.opendj.config.Configuration</import>
0N/A </xsl:otherwise>
0N/A </xsl:choose>
0N/A <xsl:if test="not($this-is-root)">
0N/A <import>
0N/A org.forgerock.opendj.config.server.ConfigurationChangeListener
0N/A </import>
0N/A </xsl:if>
0N/A <xsl:if test="$this-local-relations">
0N/A <import>org.forgerock.opendj.config.server.ConfigException</import>
0N/A </xsl:if>
0N/A <xsl:if
0N/A test="$this-local-relations/adm:one-to-zero-or-one|$this-local-relations/adm:one-to-many">
0N/A <import>
0N/A org.forgerock.opendj.config.server.ConfigurationAddListener
0N/A </import>
0N/A <import>
0N/A org.forgerock.opendj.config.server.ConfigurationDeleteListener
0N/A </import>
0N/A </xsl:if>
0N/A </xsl:with-param>
0N/A </xsl:call-template>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
1142N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:call-template name="generate-interface-declaration" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:call-template name="generate-configuration-definition-getter" />
0N/A <xsl:if test="not($this-is-root)">
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:call-template name="generate-change-listener-declaration" />
0N/A </xsl:if>
0N/A <xsl:for-each select="$this-local-properties">
0N/A <xsl:sort select="@name" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:call-template name="generate-property-getter-declaration">
0N/A <xsl:with-param name="interface" select="'server'" />
0N/A </xsl:call-template>
0N/A </xsl:for-each>
0N/A <xsl:for-each select="$this-local-relations">
0N/A <xsl:sort select="@name" />
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:call-template name="generate-relation-declarations" />
0N/A </xsl:for-each>
0N/A <xsl:text>&#xa;</xsl:text>
0N/A <xsl:text>}&#xa;</xsl:text>
0N/A </xsl:template>
0N/A</xsl:stylesheet>
0N/A