serverMO.xsl revision a3d3ab94806056d2355afea6fe8daac41059b9fb
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 ! You can obtain a copy of the license at 0N/A ! See the License for the specific language governing permissions 0N/A ! and limitations under the License. 0N/A ! When distributing Covered Code, include this CDDL HEADER in each 0N/A ! file and include the License file at 0N/A ! add the following below this CDDL HEADER, with the fields enclosed 2362N/A ! by brackets "[]" replaced with your own identifying information: 2362N/A ! Portions Copyright [yyyy] [name of copyright owner] 0N/A ! Copyright 2007-2008 Sun Microsystems, Inc. 0N/A <
xsl:
output method="text" encoding="us-ascii" />
0N/A Template for generating the interface declaration. 0N/A <
xsl:
template name="generate-interface-declaration">
0N/A <
xsl:
value-
of select="'/**
'" />
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" 0N/A select="concat('A server-side interface for querying ', $this-ufn, 0N/A </
xsl:
call-
template>
0N/A <
xsl:
value-
of select="' * <p>
'" />
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="' */
'" />
0N/A select="concat('public interface ', 0N/A <
xsl:
when test="boolean($this/@extends)">
0N/A <
xsl:
value-
of select="concat($parent-java-class,'Cfg ')" />
0N/A <
xsl:
value-
of select="'Configuration '" />
0N/A <
xsl:
text>{
</
xsl:
text>
0N/A Template for generating the configuration class getter. 0N/A <
xsl:
template name="generate-configuration-definition-getter">
0N/A select="concat(' /**
', 0N/A ' * Gets the configuration class associated with this ', $this-ufn, '.
', 0N/A ' * @return Returns the configuration class associated with this ', $this-ufn, '.
', 0N/A select="concat(' Class<? extends ', $this-java-class,'Cfg> configurationClass();
')" />
0N/A Template for generating the change listener declaration. 0N/A <
xsl:
template name="generate-change-listener-declaration">
0N/A select="concat(' /**
', 0N/A ' * Register to be notified when this ', $this-ufn,' is changed.
', 0N/A ' * @param listener
', 0N/A ' * The ', $this-ufn,' configuration change listener.
', 0N/A select="concat(' void add', $this-short-java-class, 0N/A 'ChangeListener(ConfigurationChangeListener<', 0N/A $this-java-class,'Cfg> listener);
')" />
0N/A <
xsl:
text>
</
xsl:
text>
0N/A <
xsl:
text>
</
xsl:
text>
0N/A <
xsl:
text>
</
xsl:
text>
0N/A select="concat(' /**
', 0N/A ' * Deregister an existing ', $this-ufn,' configuration change listener.
', 0N/A ' * @param listener
', 0N/A ' * The ', $this-ufn,' configuration change listener.
', 0N/A select="concat(' void remove', $this-short-java-class, 0N/A 'ChangeListener(ConfigurationChangeListener<', 0N/A $this-java-class,'Cfg> listener);
')" />
0N/A Template for generating the relation getter declarations. 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 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 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:
when test="adm:one-to-one">
0N/A select="concat(' /**
', 0N/A ' * Gets the ', $ufn,'.
', 0N/A ' * @return Returns the ', $ufn,'.
', 0N/A ' * @throws ConfigException
', 0N/A ' * If the ', $ufn,' could not be found or it could not
', 0N/A ' * be successfully decoded.
', select="concat(' ', $java-class-name, 'Cfg get', $java-relation-name, '() throws ConfigException;
')" />
<
xsl:
when test="adm:one-to-zero-or-one">
select="concat(' /**
', ' * Determines whether or not the ', $ufn,' exists.
', ' * @return Returns <true> if the ', $ufn,' exists.
', select="concat(' boolean has', $java-relation-name, '();
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Gets the ', $ufn,' if it is present.
', ' * @return Returns the ', $ufn,' if it is present.
', ' * @throws ConfigException
', ' * If the ', $ufn,' does not exist or it could not
', ' * be successfully decoded.
', select="concat(' ', $java-class-name, 'Cfg get', $java-relation-name, '() throws ConfigException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Registers to be notified when the ', $ufn,' is added.
', ' * @param listener
', ' * The ', $ufn,' configuration add listener.
', ' * @throws ConfigException
', ' * If the add listener could not be registered.
', select="concat(' void add', $java-relation-name, 'AddListener(ConfigurationAddListener<', $java-class-name,'Cfg> listener) throws ConfigException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Deregisters an existing ', $ufn,' configuration add listener.
', ' * @param listener
', ' * The ', $ufn,' configuration add listener.
', select="concat(' void remove', $java-relation-name, 'AddListener(ConfigurationAddListener<', $java-class-name,'Cfg> listener);
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Registers to be notified the ', $ufn,' is deleted.
', ' * @param listener
', ' * The ', $ufn,' configuration delete listener.
', ' * @throws ConfigException
', ' * If the delete listener could not be registered.
', select="concat(' void add', $java-relation-name, 'DeleteListener(ConfigurationDeleteListener<', $java-class-name,'Cfg> listener) throws ConfigException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Deregisters an existing ', $ufn,' configuration delete listener.
', ' * @param listener
', ' * The ', $ufn,' configuration delete listener.
', select="concat(' void remove', $java-relation-name, 'DeleteListener(ConfigurationDeleteListener<', $java-class-name,'Cfg> listener);
')" />
<
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:
variable name="java-relation-plural-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="$plural-name" />
select="concat(' /**
', ' * Lists the ', $ufpn, '.
', ' * @return Returns an array containing the names of the
', select="concat(' String[] list', $java-relation-plural-name, '();
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Gets the named ', $ufn,'.
', ' * The name of the ',$ufn,' to retrieve.
', ' * @return Returns the named ', $ufn,'.
', ' * @throws ConfigException
', ' * If the ', $ufn,' could not be found or it
', ' * could not be successfully decoded.
', select="concat(' ', $java-class-name, 'Cfg get', $java-relation-name, '(String name) throws ConfigException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Registers to be notified when new ', $ufpn,' are added.
', ' * @param listener
', ' * The ', $ufn,' configuration add listener.
', ' * @throws ConfigException
', ' * If the add listener could not be registered.
', select="concat(' void add', $java-relation-name, 'AddListener(ConfigurationAddListener<', $java-class-name,'Cfg> listener) throws ConfigException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Deregisters an existing ', $ufn,' configuration add listener.
', ' * @param listener
', ' * The ', $ufn,' configuration add listener.
', select="concat(' void remove', $java-relation-name, 'AddListener(ConfigurationAddListener<', $java-class-name,'Cfg> listener);
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Registers to be notified when existing ', $ufpn,' are deleted.
', ' * @param listener
', ' * The ', $ufn,' configuration delete listener.
', ' * @throws ConfigException
', ' * If the delete listener could not be registered.
', select="concat(' void add', $java-relation-name, 'DeleteListener(ConfigurationDeleteListener<', $java-class-name,'Cfg> listener) throws ConfigException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Deregisters an existing ', $ufn,' configuration delete listener.
', ' * @param listener
', ' * The ', $ufn,' configuration delete listener.
', select="concat(' void remove', $java-relation-name, 'DeleteListener(ConfigurationDeleteListener<', $java-class-name,'Cfg> listener);
')" />
<
xsl:
message terminate="yes">
select="concat('Unknown relation type "', local-name(*), '" in relation "', $name, '".')" />
Main document parsing template. <
xsl:
call-
template name="copyright-notice" />
select="concat('package ', $this-package, '.server;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
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:
with-
param name="interface" select="'server'" />
<
xsl:
if test="$this-local-properties[@multi-valued='true']">
<
xsl:
when test="$this/@extends">
<
xsl:
if test="$parent-package != $this-package">
<
xsl:
element name="import">
select="concat($parent-package, '.server.', $parent-java-class, 'Cfg')" />
<
xsl:
if test="not($this-is-root)">
<
xsl:
if test="$this-local-relations">
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-interface-declaration" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-configuration-definition-getter" />
<
xsl:
if test="not($this-is-root)">
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-change-listener-declaration" />
<
xsl:
for-
each select="$this-local-properties">
<
xsl:
sort select="@name" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-property-getter-declaration">
<
xsl:
with-
param name="interface" select="'server'" />
<
xsl:
for-
each select="$this-local-relations">
<
xsl:
sort select="@name" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-relation-declarations" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>}
</
xsl:
text>