clientMO.xsl revision e32b0f1464ea290b749a43d5ee7a6085b14532c9
286N/A ! The contents of this file are subject to the terms of the 286N/A ! Common Development and Distribution License, Version 1.0 only 286N/A ! (the "License"). You may not use this file except in compliance 286N/A ! You can obtain a copy of the license at 286N/A ! See the License for the specific language governing permissions 286N/A ! and limitations under the License. 286N/A ! When distributing Covered Code, include this CDDL HEADER in each 286N/A ! file and include the License file at 286N/A ! add the following below this CDDL HEADER, with the fields enclosed 286N/A ! by brackets "[]" replaced with your own identifying information: 286N/A ! Portions Copyright [yyyy] [name of copyright owner] 286N/A ! Portions Copyright 2007 Sun Microsystems, Inc. 286N/A <
xsl:
output method="text" encoding="us-ascii" />
286N/A Template for generating the interface declaration. 286N/A <
xsl:
template name="generate-interface-declaration">
286N/A <
xsl:
value-
of select="'/**
'" />
286N/A <
xsl:
call-
template name="add-java-comment">
286N/A <
xsl:
with-
param name="indent-text" select="' *'" />
286N/A <
xsl:
with-
param name="content" 286N/A select="concat('A client-side interface for reading and modifying ', 286N/A $this-ufn, ' settings.')" />
286N/A <
xsl:
value-
of select="' * <p>
'" />
286N/A <
xsl:
call-
template name="add-java-comment">
286N/A <
xsl:
with-
param name="indent-text" select="' *'" />
286N/A <
xsl:
with-
param name="content" select="$this/adm:synopsis" />
286N/A <
xsl:
value-
of select="' */
'" />
286N/A select="concat('public interface ', 286N/A 'CfgClient extends ')" />
286N/A <
xsl:
when test="boolean($this/@extends)">
286N/A <
xsl:
value-
of select="concat($parent-java-class,'CfgClient ')" />
286N/A <
xsl:
value-
of select="'ConfigurationClient '" />
286N/A <
xsl:
text>{
</
xsl:
text>
286N/A Template for generating the configuration definition getter. 286N/A <
xsl:
template name="generate-configuration-definition-getter">
286N/A select="concat(' /**
', 286N/A ' * Get the configuration definition associated with this ', $this-ufn, '.
', 286N/A ' * @return Returns the configuration definition associated with this ', $this-ufn, '.
', 286N/A select="concat(' ManagedObjectDefinition<? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg> definition();
')" />
286N/A Template for generating the relation getter declarations. 286N/A <
xsl:
template name="generate-relation-declarations">
286N/A <
xsl:
variable name="name" select="@name" />
286N/A <
xsl:
variable name="ufn">
286N/A <
xsl:
call-
template name="name-to-ufn">
286N/A <
xsl:
with-
param name="value" select="$name" />
286N/A <
xsl:
variable name="java-relation-name">
286N/A <
xsl:
call-
template name="name-to-java">
286N/A <
xsl:
with-
param name="value" select="$name" />
286N/A <
xsl:
variable name="java-class-name">
286N/A <
xsl:
call-
template name="name-to-java">
286N/A <
xsl:
with-
param name="value" select="@managed-object-name" />
286N/A <
xsl:
when test="adm:one-to-one">
286N/A <
xsl:
call-
template name="add-java-comment2">
286N/A <
xsl:
with-
param name="indent" select="2" />
286N/A <
xsl:
with-
param name="content" 286N/A 'Gets the ', $ufn,'.
', 286N/A '@return Returns the ', $ufn,'.
', 286N/A '@throws DefinitionDecodingException
', 286N/A ' If the ', $ufn, ' was found but its type could not be determined.
', 286N/A '@throws ManagedObjectDecodingException
', 286N/A ' If the ', $ufn, ' was found but one or more of its properties could not be decoded.
', 286N/A '@throws ManagedObjectNotFoundException
', 286N/A ' If the ', $ufn, ' could not be found on the server.
', 286N/A '@throws ConcurrentModificationException
', 286N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 286N/A '@throws AuthorizationException
', 286N/A ' If the server refuses to retrieve the ', $ufn, ' because the client does not have the correct privileges.
', 286N/A '@throws CommunicationException
', 286N/A ' If the client cannot contact the server due to an underlying communication problem.')" />
286N/A select="concat(' ', $java-class-name, 'CfgClient get', $java-relation-name, '()
', 286N/A ' throws DefinitionDecodingException, ManagedObjectDecodingException,
', 286N/A ' ManagedObjectNotFoundException, ConcurrentModificationException,
', 286N/A ' AuthorizationException, CommunicationException;
')" />
286N/A <
xsl:
when test="adm:one-to-zero-or-one">
286N/A <
xsl:
call-
template name="add-java-comment2">
<
xsl:
with-
param name="indent" select="2" />
<
xsl:
with-
param name="content" select="concat('Determines whether or not the ', $ufn,' exists.
', '@return Returns <true> if the ', $ufn,' exists.
', '@throws ConcurrentModificationException
', ' If this ', $this-ufn, ' has been removed from the server by another client.
', '@throws AuthorizationException
', ' If the server refuses to make the determination because the client does not have the correct privileges.
', '@throws CommunicationException
', ' If the client cannot contact the server due to an underlying communication problem.')" />
select="concat(' boolean has', $java-relation-name, '() throws ConcurrentModificationException,
', ' AuthorizationException, CommunicationException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="add-java-comment2">
<
xsl:
with-
param name="indent" select="2" />
<
xsl:
with-
param name="content" 'Gets the ', $ufn,' if it is present.
', '@return Returns the ', $ufn, ' if it is present.
', '@throws DefinitionDecodingException
', ' If the ', $ufn, ' was found but its type could not be determined.
', '@throws ManagedObjectDecodingException
', ' If the ', $ufn, ' was found but one or more of its properties could not be decoded.
', '@throws ManagedObjectNotFoundException
', ' If the ', $ufn, ' is not present.
', '@throws ConcurrentModificationException
', ' If this ', $this-ufn, ' has been removed from the server by another client.
', '@throws AuthorizationException
', ' If the server refuses to retrieve the ', $ufn, ' because the client does not have the correct privileges.
', '@throws CommunicationException
', ' If the client cannot contact the server due to an underlying communication problem.')" />
select="concat(' ', $java-class-name, 'CfgClient get', $java-relation-name, '()
', ' throws DefinitionDecodingException, ManagedObjectDecodingException,
', ' ManagedObjectNotFoundException, ConcurrentModificationException,
', ' AuthorizationException, CommunicationException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="add-java-comment2">
<
xsl:
with-
param name="indent" select="2" />
<
xsl:
with-
param name="content" 'Creates a new ', $ufn,'. The new ', $ufn,' will initially ', 'not contain any property values (including mandatory ', 'properties). Once the ', $ufn,' has been configured it ', 'can be added to the server using the {@link #commit()} ', ' The type of the ', $ufn,' being created.
', ' The definition of the ', $ufn,' to be created.
', '@param exceptions
', ' An optional collection in which to place any ', '{@link DefaultBehaviorException}s that occurred whilst ', 'attempting to determine the default values of the ', $ufn, '. This argument can be <code>null<code>.
', '@return Returns a new ', $ufn,' configuration instance.
')" />
select="concat(' <C extends ', $java-class-name,'CfgClient> C create', $java-relation-name, '(
', ' ManagedObjectDefinition<C, ?> d, Collection<DefaultBehaviorException> exceptions);
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="add-java-comment2">
<
xsl:
with-
param name="indent" select="2" />
<
xsl:
with-
param name="content" 'Removes the ', $ufn,' if it exists.
', '@throws ManagedObjectNotFoundException
', ' If the ', $ufn, ' does not exist.
', '@throws OperationRejectedException
', ' If the server refuses to remove the ', $ufn, ' due to some server-side constraint which cannot be satisfied (for example, if it is referenced by another managed object).
', '@throws ConcurrentModificationException
', ' If this ', $this-ufn, ' has been removed from the server by another client.
', '@throws AuthorizationException
', ' If the server refuses to remove the ', $ufn, ' because the client does not have the correct privileges.
', '@throws CommunicationException
', ' If the client cannot contact the server due to an underlying communication problem.')" />
select="concat(' void remove', $java-relation-name, '()
', ' throws ManagedObjectNotFoundException, OperationRejectedException,
', ' ConcurrentModificationException, AuthorizationException,
', ' CommunicationException;
')" />
<
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" />
<
xsl:
call-
template name="add-java-comment2">
<
xsl:
with-
param name="indent" select="2" />
<
xsl:
with-
param name="content" select="concat('Lists the ', $ufpn,'.
', '@return Returns an array containing the names of the ', $ufpn,'.
', '@throws ConcurrentModificationException
', ' If this ', $this-ufn, ' has been removed from the server by another client.
', '@throws AuthorizationException
', ' If the server refuses to list the ', $ufpn, ' because the client does not have the correct privileges.
', '@throws CommunicationException
', ' If the client cannot contact the server due to an underlying communication problem.')" />
select="concat(' String[] list', $java-relation-plural-name, '() throws ConcurrentModificationException,
', ' AuthorizationException, CommunicationException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="add-java-comment2">
<
xsl:
with-
param name="indent" select="2" />
<
xsl:
with-
param name="content" 'Gets the named ', $ufn, '.
', ' The name of the ', $ufn,' to retrieve.
', '@return Returns the named ', $ufn, '.
', '@throws DefinitionDecodingException
', ' If the named ', $ufn, ' was found but its type could not be determined.
', '@throws ManagedObjectDecodingException
', ' If the named ', $ufn, ' was found but one or more of its properties could not be decoded.
', '@throws ManagedObjectNotFoundException
', ' If the named ', $ufn, ' was not found on the server.
', '@throws ConcurrentModificationException
', ' If this ', $this-ufn, ' has been removed from the server by another client.
', '@throws AuthorizationException
', ' If the server refuses to retrieve the named ', $ufn, ' because the client does not have the correct privileges.
', '@throws CommunicationException
', ' If the client cannot contact the server due to an underlying communication problem.')" />
select="concat(' ', $java-class-name, 'CfgClient get', $java-relation-name, '(String name)
', ' throws DefinitionDecodingException, ManagedObjectDecodingException,
', ' ManagedObjectNotFoundException, ConcurrentModificationException,
', ' AuthorizationException, CommunicationException;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="add-java-comment2">
<
xsl:
with-
param name="indent" select="2" />
<
xsl:
with-
param name="content" 'Creates a new ', $ufn,'. The new ', $ufn,' will initially ', 'not contain any property values (including mandatory ', 'properties). Once the ', $ufn,' has been configured it ', 'can be added to the server using the {@link #commit()} ', ' The type of the ', $ufn,' being created.
', ' The definition of the ', $ufn,' to be created.
', ' The name of the new ', $ufn,'.
', '@param exceptions
', ' An optional collection in which to place any ', '{@link DefaultBehaviorException}s that occurred whilst ', 'attempting to determine the default values of the ', $ufn, '. This argument can be <code>null<code>.
', '@return Returns a new ', $ufn,' configuration instance.
')" />
select="concat(' <C extends ', $java-class-name,'CfgClient> C create', $java-relation-name, '(
', ' ManagedObjectDefinition<C, ?> d, String name, Collection<DefaultBehaviorException> exceptions);
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="add-java-comment2">
<
xsl:
with-
param name="indent" select="2" />
<
xsl:
with-
param name="content" 'Removes the named ', $ufn,'.
', ' The name of the ', $ufn,' to remove.
', '@throws ManagedObjectNotFoundException
', ' If the ', $ufn, ' does not exist.
', '@throws OperationRejectedException
', ' If the server refuses to remove the ', $ufn, ' due to some server-side constraint which cannot be satisfied (for example, if it is referenced by another managed object).
', '@throws ConcurrentModificationException
', ' If this ', $this-ufn, ' has been removed from the server by another client.
', '@throws AuthorizationException
', ' If the server refuses to remove the ', $ufn, ' because the client does not have the correct privileges.
', '@throws CommunicationException
', ' If the client cannot contact the server due to an underlying communication problem.')" />
select="concat(' void remove', $java-relation-name, '(String name)
', ' throws ManagedObjectNotFoundException, OperationRejectedException,
', ' ConcurrentModificationException, AuthorizationException,
', ' CommunicationException;
')" />
<
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(@monitoring='true')]">
<
xsl:
if test="$this-local-properties[@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>