serverMO.xsl revision 3233
0N/A<!--
0N/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
0N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
0N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
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
0N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
0N/A ! add the following below this CDDL HEADER, with the fields enclosed
0N/A ! by brackets "[]" replaced with your own identifying information:
0N/A ! Portions Copyright [yyyy] [name of copyright owner]
0N/A !
0N/A ! CDDL HEADER END
0N/A !
0N/A !
0N/A ! Copyright 2007-2008 Sun Microsystems, Inc.
0N/A ! -->
0N/A<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
0N/A xmlns:admpp="http://www.opends.org/admin-preprocessor"
0N/A xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
0N/A <xsl:import href="java-utilities.xsl" />
0N/A <xsl:import href="preprocessor.xsl" />
0N/A <xsl:import href="property-types.xsl" />
0N/A <xsl:output method="text" encoding="us-ascii" />
0N/A <!--
0N/A Template for generating the interface declaration.
0N/A -->
0N/A <xsl:template name="generate-interface-declaration">
0N/A <xsl:value-of select="'/**&#xa;'" />
0N/A <xsl:call-template name="add-java-comment">
0N/A <xsl:with-param name="indent-text" select="' *'" />
48N/A <xsl:with-param name="content"
96N/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>
65N/A <xsl:otherwise>
65N/A <xsl:value-of select="'Configuration '" />
65N/A </xsl:otherwise>
65N/A </xsl:choose>
65N/A <xsl:text>{&#xa;</xsl:text>
65N/A </xsl:template>
65N/A <!--
65N/A Template for generating the configuration class getter.
65N/A -->
65N/A <xsl:template name="generate-configuration-definition-getter">
65N/A <xsl:value-of
65N/A select="concat(' /**&#xa;',
65N/A ' * Gets the configuration class associated with this ', $this-ufn, '.&#xa;',
65N/A ' *&#xa;',
65N/A ' * @return Returns the configuration class associated with this ', $this-ufn, '.&#xa;',
65N/A ' */&#xa;')" />
65N/A <xsl:value-of
65N/A select="concat(' Class&lt;? extends ', $this-java-class,'Cfg&gt; configurationClass();&#xa;')" />
65N/A </xsl:template>
65N/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;')" />
0N/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>
48N/A <!--
0N/A Template for generating the relation getter declarations.
48N/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>
0N/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;',
0N/A ' * If the ', $ufn,' does not exist 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: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;')" />
48N/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;')" />
71N/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
48N/A select="concat(' /**&#xa;',
0N/A ' * Registers to be notified the ', $ufn,' is deleted.&#xa;',
0N/A ' *&#xa;',
48N/A ' * @param listener&#xa;',
48N/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">
0N/A <xsl:call-template name="name-to-java">
0N/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;',
9N/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
48N/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;',
46N/A ' * The ', $ufn,' configuration delete listener.&#xa;',
0N/A ' */&#xa;')" />
0N/A <xsl:value-of
0N/A select="concat(' void remove', $java-relation-name,
46N/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.opends.server.admin.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.opends.server.admin.server.ConfigurationChangeListener
0N/A </import>
0N/A </xsl:if>
0N/A <xsl:if test="$this-local-relations">
0N/A <import>org.opends.server.config.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.opends.server.admin.server.ConfigurationAddListener
0N/A </import>
0N/A <import>
0N/A org.opends.server.admin.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>
0N/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