clientMO.xsl revision 1418
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 873N/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" />
2636N/A Template for generating the interface declaration. 2636N/A <
xsl:
template name="generate-interface-declaration">
0N/A <
xsl:
value-
of select="'/**
'" />
2636N/A <
xsl:
call-
template name="add-java-comment">
2636N/A <
xsl:
with-
param name="indent-text" select="' *'" />
2636N/A <
xsl:
with-
param name="content" 2636N/A select="concat('A client-side interface for reading and modifying ', 2636N/A $this-ufn, ' settings.')" />
0N/A </
xsl:
call-
template>
2636N/A <
xsl:
value-
of select="' * <p>
'" />
2636N/A <
xsl:
call-
template name="add-java-comment">
2636N/A <
xsl:
with-
param name="indent-text" select="' *'" />
2636N/A <
xsl:
value-
of select="' */
'" />
2636N/A select="concat('public interface ', 2636N/A <
xsl:
when test="boolean($this/@extends)">
2636N/A <
xsl:
value-
of select="concat($parent-java-class,'CfgClient ')" />
2636N/A <
xsl:
value-
of select="'ConfigurationClient '" />
2636N/A <
xsl:
text>{
</
xsl:
text>
0N/A Template for generating the configuration definition getter. 2636N/A <
xsl:
template name="generate-configuration-definition-getter">
2636N/A select="concat(' /**
', 0N/A ' * Get the configuration definition associated with this ', $this-ufn, '.
', 2636N/A ' * @return Returns the configuration definition associated with this ', $this-ufn, '.
', 2636N/A select="concat(' ManagedObjectDefinition<? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg> definition();
')" />
2636N/A Template for generating the relation getter declarations. 2636N/A <
xsl:
template name="generate-relation-declarations">
2636N/A <
xsl:
variable name="name" select="@name" />
2636N/A <
xsl:
call-
template name="name-to-ufn">
2636N/A <
xsl:
with-
param name="value" select="$name" />
0N/A </
xsl:
call-
template>
2636N/A <
xsl:
variable name="java-relation-name">
2636N/A <
xsl:
call-
template name="name-to-java">
2636N/A <
xsl:
with-
param name="value" select="$name" />
2636N/A <
xsl:
variable name="java-class-name">
2636N/A <
xsl:
call-
template name="name-to-java">
2636N/A <
xsl:
with-
param name="value" select="@managed-object-name" />
0N/A <
xsl:
when test="adm:one-to-one">
0N/A <
xsl:
call-
template name="add-java-comment2">
2636N/A <
xsl:
with-
param name="indent" select="2" />
2636N/A <
xsl:
with-
param name="content" 0N/A 'Gets the ', $ufn,'.
', 2636N/A '@return Returns the ', $ufn,'.
', 2636N/A '@throws DefinitionDecodingException
', 2636N/A ' If the ', $ufn, ' was found but its type could not be determined.
', 2636N/A '@throws ManagedObjectDecodingException
', 2636N/A ' If the ', $ufn, ' was found but one or more of its properties could not be decoded.
', 2636N/A '@throws ManagedObjectNotFoundException
', 2636N/A ' If the ', $ufn, ' could not be found on the server.
', 2636N/A '@throws ConcurrentModificationException
', 2636N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 0N/A '@throws AuthorizationException
', 2636N/A ' If the server refuses to retrieve the ', $ufn, ' because the client does not have the correct privileges.
', 2636N/A '@throws CommunicationException
', 2636N/A ' If the client cannot contact the server due to an underlying communication problem.')" />
2636N/A select="concat(' ', $java-class-name, 'CfgClient get', $java-relation-name, '()
', 2636N/A ' throws DefinitionDecodingException, ManagedObjectDecodingException,
', 2636N/A ' ManagedObjectNotFoundException, ConcurrentModificationException,
', 2636N/A ' AuthorizationException, CommunicationException;
')" />
2636N/A <
xsl:
when test="adm:one-to-zero-or-one">
2636N/A <
xsl:
call-
template name="add-java-comment2">
2636N/A <
xsl:
with-
param name="indent" select="2" />
2636N/A <
xsl:
with-
param name="content" 2636N/A select="concat('Determines whether or not the ', $ufn,' exists.
', 2636N/A '@return Returns <true> if the ', $ufn,' exists.
', 2636N/A '@throws ConcurrentModificationException
', 0N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 0N/A '@throws AuthorizationException
', 2636N/A ' If the server refuses to make the determination because the client does not have the correct privileges.
', 2636N/A '@throws CommunicationException
', 2636N/A ' If the client cannot contact the server due to an underlying communication problem.')" />
2636N/A select="concat(' boolean has', 2636N/A $java-relation-name, '() throws ConcurrentModificationException,
', 2636N/A ' AuthorizationException, CommunicationException;
')" />
0N/A <
xsl:
call-
template name="add-java-comment2">
0N/A <
xsl:
with-
param name="indent" select="2" />
2636N/A <
xsl:
with-
param name="content" 2636N/A 'Gets the ', $ufn,' if it is present.
', 0N/A '@return Returns the ', $ufn, ' if it is present.
', 2636N/A '@throws DefinitionDecodingException
', 2636N/A ' If the ', $ufn, ' was found but its type could not be determined.
', 0N/A '@throws ManagedObjectDecodingException
', 0N/A ' If the ', $ufn, ' was found but one or more of its properties could not be decoded.
', 2636N/A '@throws ManagedObjectNotFoundException
', 2636N/A ' If the ', $ufn, ' is not present.
', 2636N/A '@throws ConcurrentModificationException
', 2636N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 0N/A '@throws AuthorizationException
', 2636N/A ' If the server refuses to retrieve the ', $ufn, ' because the client does not have the correct privileges.
', 2636N/A '@throws CommunicationException
', 2636N/A ' If the client cannot contact the server due to an underlying communication problem.')" />
2636N/A select="concat(' ', $java-class-name, 'CfgClient get', $java-relation-name, '()
', 2636N/A ' throws DefinitionDecodingException, ManagedObjectDecodingException,
', 2636N/A ' ManagedObjectNotFoundException, ConcurrentModificationException,
', 0N/A ' AuthorizationException, CommunicationException;
')" />
0N/A <
xsl:
call-
template name="add-java-comment2">
2636N/A <
xsl:
with-
param name="indent" select="2" />
2636N/A <
xsl:
with-
param name="content" 2636N/A 'Creates a new ', $ufn,'. The new ', $ufn,' will initially ', 2636N/A 'not contain any property values (including mandatory ', 2636N/A 'properties). Once the ', $ufn,' has been configured it ', 2636N/A 'can be added to the server using the {@link #commit()} ', 0N/A '@param <C>
', 2636N/A ' The type of the ', $ufn,' being created.
', 2636N/A ' The definition of the ', $ufn,' to be created.
', 2636N/A ' An optional collection in which to place any ', 2636N/A '{@link DefaultBehaviorException}s that occurred whilst ', 2636N/A 'attempting to determine the default values of the ', $ufn, 2636N/A '. This argument can be <code>null<code>.
', 2636N/A '@return Returns a new ', $ufn,' configuration instance.
')" />
2636N/A select="concat(' <C extends ', $java-class-name,'CfgClient> C create', $java-relation-name, '(
', 2636N/A ' ManagedObjectDefinition<C, ?> d, Collection<DefaultBehaviorException> exceptions);
')" />
2636N/A <
xsl:
call-
template name="add-java-comment2">
2636N/A <
xsl:
with-
param name="indent" select="2" />
2636N/A <
xsl:
with-
param name="content" 2636N/A 'Removes the ', $ufn,' if it exists.
', 2636N/A '@throws ManagedObjectNotFoundException
', 2636N/A ' If the ', $ufn, ' does not exist.
', 2636N/A '@throws OperationRejectedException
', 2636N/A ' 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).
', 2636N/A '@throws ConcurrentModificationException
', 2636N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 2636N/A '@throws AuthorizationException
', 0N/A ' If the server refuses to remove the ', $ufn, ' because the client does not have the correct privileges.
', 2636N/A '@throws CommunicationException
', 2636N/A ' If the client cannot contact the server due to an underlying communication problem.')" />
0N/A select="concat(' void remove', $java-relation-name, '()
', 2636N/A ' throws ManagedObjectNotFoundException, OperationRejectedException,
', 2636N/A ' ConcurrentModificationException, AuthorizationException,
', 2636N/A ' CommunicationException;
')" />
2636N/A <
xsl:
when test="adm:one-to-many">
2636N/A <
xsl:
variable name="plural-name" 2636N/A select="adm:one-to-many/@plural-name" />
2636N/A <
xsl:
call-
template name="name-to-ufn">
2636N/A <
xsl:
with-
param name="value" select="$plural-name" />
2636N/A <
xsl:
variable name="java-relation-plural-name">
2636N/A <
xsl:
call-
template name="name-to-java">
2636N/A <
xsl:
with-
param name="value" select="$plural-name" />
2636N/A <
xsl:
call-
template name="add-java-comment2">
0N/A <
xsl:
with-
param name="indent" select="2" />
2636N/A <
xsl:
with-
param name="content" 2636N/A select="concat('Lists the ', $ufpn,'.
', 2636N/A '@return Returns an array containing the names of the ', $ufpn,'.
', 2636N/A '@throws ConcurrentModificationException
', 2636N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 2636N/A '@throws AuthorizationException
', 2636N/A ' If the server refuses to list the ', $ufpn, ' because the client does not have the correct privileges.
', 2636N/A '@throws CommunicationException
', 2636N/A ' If the client cannot contact the server due to an underlying communication problem.')" />
2636N/A select="concat(' String[] list', 2636N/A $java-relation-plural-name, '() throws ConcurrentModificationException,
', 2636N/A ' AuthorizationException, CommunicationException;
')" />
2636N/A <
xsl:
call-
template name="add-java-comment2">
2636N/A <
xsl:
with-
param name="indent" select="2" />
2636N/A <
xsl:
with-
param name="content" 2636N/A 'Gets the named ', $ufn, '.
', 2636N/A ' The name of the ', $ufn,' to retrieve.
', 2636N/A '@return Returns the named ', $ufn, '.
', 2636N/A '@throws DefinitionDecodingException
', 2636N/A ' If the named ', $ufn, ' was found but its type could not be determined.
', 2636N/A '@throws ManagedObjectDecodingException
', 2636N/A ' If the named ', $ufn, ' was found but one or more of its properties could not be decoded.
', 2636N/A '@throws ManagedObjectNotFoundException
', 2636N/A ' If the named ', $ufn, ' was not found on the server.
', 2636N/A '@throws ConcurrentModificationException
', 2636N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 2636N/A '@throws AuthorizationException
', 2636N/A ' If the server refuses to retrieve the named ', $ufn, ' because the client does not have the correct privileges.
', 2636N/A '@throws CommunicationException
', 0N/A ' If the client cannot contact the server due to an underlying communication problem.')" />
0N/A </
xsl:
call-
template>
2636N/A select="concat(' ', $java-class-name, 'CfgClient get', $java-relation-name, '(String name)
', 2636N/A ' throws DefinitionDecodingException, ManagedObjectDecodingException,
', 0N/A ' ManagedObjectNotFoundException, ConcurrentModificationException,
', 0N/A ' AuthorizationException, CommunicationException;
')" />
0N/A <
xsl:
call-
template name="add-java-comment2">
2636N/A <
xsl:
with-
param name="indent" select="2" />
2636N/A <
xsl:
with-
param name="content" 2636N/A 'Creates a new ', $ufn,'. The new ', $ufn,' will initially ', 2636N/A 'not contain any property values (including mandatory ', 2636N/A 'properties). Once the ', $ufn,' has been configured it ', 2636N/A 'can be added to the server using the {@link #commit()} ', 2636N/A ' The type of the ', $ufn,' being created.
', 2636N/A ' The definition of the ', $ufn,' to be created.
', 2636N/A ' The name of the new ', $ufn,'.
', 2636N/A ' An optional collection in which to place any ', 2636N/A '{@link DefaultBehaviorException}s that occurred whilst ', 2636N/A 'attempting to determine the default values of the ', $ufn, 0N/A '. This argument can be <code>null<code>.
', 0N/A '@return Returns a new ', $ufn,' configuration instance.
')" />
2636N/A select="concat(' <C extends ', $java-class-name,'CfgClient> C create', $java-relation-name, '(
', 2636N/A ' ManagedObjectDefinition<C, ?> d, String name, Collection<DefaultBehaviorException> exceptions);
')" />
2636N/A <
xsl:
call-
template name="add-java-comment2">
2636N/A <
xsl:
with-
param name="indent" select="2" />
2636N/A <
xsl:
with-
param name="content" 2636N/A 'Removes the named ', $ufn,'.
', 2636N/A ' The name of the ', $ufn,' to remove.
', 2636N/A '@throws ManagedObjectNotFoundException
', 2636N/A ' If the ', $ufn, ' does not exist.
', 2636N/A '@throws OperationRejectedException
', 2636N/A ' 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).
', 2636N/A '@throws ConcurrentModificationException
', 2636N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 2636N/A '@throws AuthorizationException
', 2636N/A ' If the server refuses to remove the ', $ufn, ' because the client does not have the correct privileges.
', 2636N/A '@throws CommunicationException
', 2636N/A ' If the client cannot contact the server due to an underlying communication problem.')" />
0N/A select="concat(' void remove', $java-relation-name, '(String name)
', 0N/A ' throws ManagedObjectNotFoundException, OperationRejectedException,
', 2636N/A ' ConcurrentModificationException, AuthorizationException,
', 2636N/A ' CommunicationException;
')" />
2636N/A <
xsl:
message terminate="yes">
2636N/A select="concat('Unknown relation type "', local-name(*), '" in relation "', $name, '".')" />
2636N/A Main document parsing template. 0N/A <
xsl:
call-
template name="copyright-notice" />
2636N/A select="concat('package ', $this-package, '.client;
')" />
2636N/A <
xsl:
call-
template name="generate-import-statements">
2636N/A <
xsl:
with-
param name="imports">
2636N/A <
xsl:
for-
each select="$this-local-properties">
2636N/A <
xsl:
call-
template name="get-property-java-imports" />
2636N/A <
xsl:
if test="$this-local-properties[@multi-valued='true']">
0N/A <
xsl:
if test="$this-local-properties[not(@monitoring='true')]">
0N/A <
xsl:
if test="$this-local-properties[@read-only='true']">
2636N/A <
xsl:
if test="$this-local-relations">
2636N/A <
xsl:
when test="$this/@extends">
2636N/A <
xsl:
if test="$parent-package != $this-package">
2636N/A <
xsl:
element name="import">
2636N/A select="concat($parent-package, '.client.', $parent-java-class, 'CfgClient')" />
2636N/A <
xsl:
element name="import">
0N/A select="concat($this-package, '.server.', $this-java-class, 'Cfg')" />
0N/A <
xsl:
text>
</
xsl:
text>
723N/A <
xsl:
call-
template name="generate-interface-declaration" />
0N/A <
xsl:
text>
</
xsl:
text>
2636N/A <
xsl:
call-
template name="generate-configuration-definition-getter" />
2636N/A <
xsl:
for-
each select="$this-local-properties">
2636N/A <
xsl:
sort select="@name" />
2636N/A <
xsl:
call-
template name="generate-property-getter-declaration">
2636N/A <
xsl:
with-
param name="interface" select="'client'" />
0N/A </
xsl:
call-
template>
0N/A <
xsl:
text>
</
xsl:
text>
2636N/A <
xsl:
call-
template name="generate-property-setter-declaration" />
0N/A <
xsl:
for-
each select="$this-local-relations">
2636N/A <
xsl:
sort select="@name" />
0N/A <
xsl:
call-
template name="generate-relation-declarations" />
2636N/A <
xsl:
text>}
</
xsl:
text>