clientMO.xsl revision bb8874d71cdd8e5288297b9727703437c6dfcfed
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 0N/A ! by brackets "[]" replaced with your own identifying information: 0N/A ! Portions Copyright [yyyy] [name of copyright owner] 0N/A ! Portions Copyright 2007 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 client-side interface for reading and modifying ', 0N/A $this-ufn, ' settings.')" />
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 'CfgClient extends ')" />
0N/A <
xsl:
when test="boolean($this/@extends)">
0N/A <
xsl:
value-
of select="concat($parent-java-class,'CfgClient ')" />
0N/A <
xsl:
value-
of select="'ConfigurationClient '" />
0N/A <
xsl:
text>{
</
xsl:
text>
0N/A Template for generating the configuration definition getter. 0N/A <
xsl:
template name="generate-configuration-definition-getter">
0N/A select="concat(' /**
', 0N/A ' * Get the configuration definition associated with this ', $this-ufn, '.
', 0N/A ' * @return Returns the configuration definition associated with this ', $this-ufn, '.
', 0N/A select="concat(' ManagedObjectDefinition<? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg> definition();
')" />
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 OperationsException
', 0N/A ' * If the ', $ufn,' could not be read due to some
', 0N/A ' * underlying communication problem.
', 0N/A select="concat(' ', $java-class-name, 'CfgClient get', 0N/A $java-relation-name, '() throws OperationsException;
')" />
0N/A <
xsl:
when test="adm:one-to-zero-or-one">
0N/A select="concat(' /**
', 0N/A ' * Determines whether or not the ', $ufn,' exists.
', 0N/A ' * @return Returns <true> if the ', $ufn,' exists.
', 0N/A ' * @throws OperationsException
', 0N/A ' * If the determination could not be made
', 0N/A ' * due to some underlying communication problem.
', 0N/A select="concat(' boolean has', 0N/A $java-relation-name, '() throws OperationsException;
')" />
0N/A <
xsl:
text>
</
xsl:
text>
0N/A <
xsl:
text>
</
xsl:
text>
0N/A <
xsl:
text>
</
xsl:
text>
0N/A select="concat(' /**
', 0N/A ' * Gets the ', $ufn,' if it is present.
', 0N/A ' * @return Returns the ', $ufn,' if it is present.
', 0N/A ' * @throws OperationsException
', 0N/A ' * If the ', $ufn,' does not exist or could not be read
', 0N/A ' * due to some underlying communication problem.
', select="concat(' ', $java-class-name, 'CfgClient get', $java-relation-name, '() throws OperationsException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Creates the ', $ufn,' if it does not exist yet.
', ' * @param <C>
', ' * The type of the ', $ufn,' being added.
', ' * The definition of the ', $ufn,' to be created.
', ' * A property provider which can be used to initialize
', ' * the property values of the new ', $ufn,'.
', ' * @return Returns the ', $ufn,' instance representing the
', ' * ', $ufn,' that was created.
', ' * @throws OperationsException
', ' * If the ', $ufn,' already exists or could not be created
', ' * due to some underlying communication problem.
', select="concat(' <C extends ', $java-class-name,'CfgClient> C create', $java-relation-name, '(
', ' ManagedObjectDefinition<C, ?> d, PropertyProvider p) throws OperationsException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Removes the ', $ufn,' if it exists.
', ' * @throws OperationsException
', ' * If the ', $ufn,' does not exist or could not be removed
', ' * due to some underlying communication problem.
', select="concat(' void remove', $java-relation-name, '() throws OperationsException;
')" />
<
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
', ' * @throws OperationsException
', ' * If the ', $ufpn,' could not be listed due to some
', ' * underlying communication problem.
', select="concat(' String[] list', $java-relation-plural-name, '() throws OperationsException;
')" />
<
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 OperationsException
', ' * If the ', $ufn,' does not exist or could not be read
', ' * due to some underlying communication problem.
', select="concat(' ', $java-class-name, 'CfgClient get', $java-relation-name, '(String name) throws OperationsException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Creates a new ', $ufn,'.
', ' * @param <C>
', ' * The type of the ', $ufn,' being added.
', ' * The definition of the ', $ufn,' to be created.
', ' * The name of the new ', $ufn,'.
', ' * A property provider which can be used to initialize
', ' * the property values of the new ', $ufn,'.
', ' * @return Returns a new ', $ufn,' instance representing the
', ' * ', $ufn,' that was created.
', ' * @throws OperationsException
', ' * If the ', $ufn,' already exists or could not be created
', ' * due to some underlying communication problem.
', select="concat(' <C extends ', $java-class-name,'CfgClient> C create', $java-relation-name, '(
', ' ManagedObjectDefinition<C, ?> d, String name, PropertyProvider p) throws OperationsException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Removes the named ', $ufn,'.
', ' * The name of the ', $ufn,' to remove.
', ' * @throws OperationsException
', ' * If the ', $ufn,' does not exist or could not be removed
', ' * due to some underlying communication problem.
', select="concat(' void remove', $java-relation-name, '(String name) throws OperationsException;
')" />
<
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, '.client;
')" />
<
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:
if test="$this-local-properties[@multi-valued='true']">
<
xsl:
if test="$this-local-properties[not(@read-only='true')]">
<
xsl:
if test="$this-local-relations">
<
xsl:
when test="$this/@extends">
<
xsl:
if test="$parent-package != $this-package">
<
xsl:
element name="import">
select="concat($parent-package, '.client.', $parent-java-class, 'CfgClient')" />
<
xsl:
element name="import">
select="concat($this-package, '.server.', $this-java-class, 'Cfg')" />
<
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:
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="'client'" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-property-setter-declaration" />
<
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>