clientMO.xsl revision 44d9730b69143d1fd7cd8b382b557e2c9d65225e
10139N/A ! The contents of this file are subject to the terms of the 10139N/A ! Common Development and Distribution License, Version 1.0 only 10139N/A ! (the "License"). You may not use this file except in compliance 10139N/A ! See the License for the specific language governing permissions 10139N/A ! and limitations under the License. 10981N/A ! When distributing Covered Code, include this CDDL HEADER in each 10139N/A ! If applicable, add the following below this CDDL HEADER, with the 10139N/A ! fields enclosed by brackets "[]" replaced with your own identifying 10139N/A ! Portions Copyright [yyyy] [name of copyright owner] 10139N/A ! Copyright 2008-2009 Sun Microsystems, Inc. 10139N/A <
xsl:
output method="text" encoding="us-ascii" />
10139N/A Template for generating the interface declaration. 10139N/A <
xsl:
template name="generate-interface-declaration">
10981N/A <
xsl:
value-
of select="'/**
'" />
10981N/A <
xsl:
call-
template name="add-java-comment">
10139N/A <
xsl:
with-
param name="indent-text" select="' *'" />
10139N/A select="concat('A client-side interface for reading and modifying ', 10986N/A <
xsl:
value-
of select="' * <p>
'" />
10139N/A <
xsl:
call-
template name="add-java-comment">
10139N/A <
xsl:
with-
param name="indent-text" select="' *'" />
10139N/A <
xsl:
value-
of select="' */
'" />
10139N/A select="concat('public interface ', 10139N/A <
xsl:
when test="boolean($this/@extends)">
10139N/A <
xsl:
value-
of select="concat($parent-java-class,'CfgClient ')" />
10139N/A <
xsl:
value-
of select="'ConfigurationClient '" />
10139N/A Template for generating the configuration definition getter. 10139N/A <
xsl:
template name="generate-configuration-definition-getter">
10139N/A ' * Get the configuration definition associated with this ', $this-ufn, '.
', 10139N/A ' * @return Returns the configuration definition associated with this ', $this-ufn, '.
', 10139N/A select="concat(' ManagedObjectDefinition<? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg> definition();
')" />
10139N/A Template for generating the relation getter declarations. 10139N/A <
xsl:
template name="generate-relation-declarations">
10139N/A <
xsl:
variable name="name" select="@name" />
10139N/A <
xsl:
call-
template name="name-to-ufn">
10139N/A <
xsl:
with-
param name="value" select="$name" />
10139N/A <
xsl:
variable name="java-relation-name">
10139N/A <
xsl:
call-
template name="name-to-java">
10139N/A <
xsl:
with-
param name="value" select="$name" />
10139N/A <
xsl:
variable name="java-class-name">
10139N/A <
xsl:
call-
template name="name-to-java">
10139N/A <
xsl:
with-
param name="value" select="@managed-object-name" />
10139N/A <
xsl:
when test="adm:one-to-one">
10139N/A <
xsl:
call-
template name="add-java-comment2">
10139N/A <
xsl:
with-
param name="indent" select="2" />
10139N/A '@return Returns the ', $ufn,'.
', 10139N/A '@throws DefinitionDecodingException
', 10139N/A ' If the ', $ufn, ' was found but its type could not be determined.
', 10139N/A '@throws ManagedObjectDecodingException
', 10139N/A ' If the ', $ufn, ' was found but one or more of its properties could not be decoded.
', 10139N/A '@throws ManagedObjectNotFoundException
', 10139N/A ' If the ', $ufn, ' could not be found on the server.
', 10139N/A '@throws ConcurrentModificationException
', 10139N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 10139N/A '@throws ErrorResultException
', 10139N/A ' If any other error occurs.')" />
10139N/A select="concat(' ', $java-class-name, 'CfgClient get', $java-relation-name, '()
', 10139N/A ' throws DefinitionDecodingException, ManagedObjectDecodingException,
', 10139N/A ' ManagedObjectNotFoundException, ConcurrentModificationException,
', 10139N/A ' ErrorResultException;
')" />
10139N/A <
xsl:
when test="adm:one-to-zero-or-one">
10139N/A <
xsl:
call-
template name="add-java-comment2">
10139N/A <
xsl:
with-
param name="indent" select="2" />
10139N/A select="concat('Determines whether or not the ', $ufn,' exists.
', 10139N/A '@return Returns <true> if the ', $ufn,' exists.
', 10139N/A '@throws ConcurrentModificationException
', 10986N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 10139N/A '@throws ErrorResultException
', 10139N/A ' If any other error occurs.')" />
10142N/A $java-relation-name, '() throws ConcurrentModificationException,
', 10139N/A ' ErrorResultException;
')" />
10139N/A <
xsl:
call-
template name="add-java-comment2">
10139N/A <
xsl:
with-
param name="indent" select="2" />
10139N/A 'Gets the ', $ufn,' if it is present.
', 10139N/A '@return Returns the ', $ufn, ' if it is present.
', 10139N/A '@throws DefinitionDecodingException
', 10139N/A ' If the ', $ufn, ' was found but its type could not be determined.
', 10139N/A '@throws ManagedObjectDecodingException
', 10139N/A ' If the ', $ufn, ' was found but one or more of its properties could not be decoded.
', 10139N/A '@throws ManagedObjectNotFoundException
', 10139N/A ' If the ', $ufn, ' is not present.
', 10139N/A '@throws ConcurrentModificationException
', 10139N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 10139N/A '@throws ErrorResultException
', 10139N/A ' If any other error occurs.')" />
10139N/A select="concat(' ', $java-class-name, 'CfgClient get', $java-relation-name, '()
', 10139N/A ' throws DefinitionDecodingException, ManagedObjectDecodingException,
', 10139N/A ' ManagedObjectNotFoundException, ConcurrentModificationException,
', 10139N/A ' ErrorResultException;
')" />
10139N/A <
xsl:
call-
template name="add-java-comment2">
10139N/A <
xsl:
with-
param name="indent" select="2" />
10139N/A 'Creates a new ', $ufn,'. The new ', $ufn,' will initially ', 10139N/A 'not contain any property values (including mandatory ', 10139N/A 'properties). Once the ', $ufn,' has been configured it ', 10139N/A 'can be added to the server using the {@link #commit()} ', 10139N/A ' The type of the ', $ufn,' being created.
', 10139N/A ' The definition of the ', $ufn,' to be created.
', 10139N/A ' An optional collection in which to place any ', 10139N/A '{@link DefaultBehaviorException}s that occurred whilst ', 10139N/A 'attempting to determine the default values of the ', $ufn, 10139N/A '. This argument can be <code>null<code>.
', 10139N/A '@return Returns a new ', $ufn,' configuration instance.
')" />
10139N/A select="concat(' <C extends ', $java-class-name,'CfgClient> C create', $java-relation-name, '(
', 10139N/A ' ManagedObjectDefinition<C, ? extends ', $java-class-name,'Cfg> d, Collection<DefaultBehaviorException> exceptions);
')" />
10139N/A <
xsl:
call-
template name="add-java-comment2">
10139N/A <
xsl:
with-
param name="indent" select="2" />
10139N/A 'Removes the ', $ufn,' if it exists.
', 10139N/A '@throws ManagedObjectNotFoundException
', 10139N/A ' If the ', $ufn, ' does not exist.
', 10139N/A '@throws OperationRejectedException
', 10139N/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).
', 10139N/A '@throws ConcurrentModificationException
', 10139N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 10139N/A '@throws ErrorResultException
', 10139N/A ' If any other error occurs.')" />
10139N/A select="concat(' void remove', $java-relation-name, '()
', 10139N/A ' throws ManagedObjectNotFoundException, OperationRejectedException,
', 10139N/A ' ConcurrentModificationException, ErrorResultException;
')" />
10139N/A <
xsl:
when test="adm:one-to-many">
10139N/A <
xsl:
variable name="plural-name" 10139N/A select="adm:one-to-many/@plural-name" />
10139N/A <
xsl:
call-
template name="name-to-ufn">
10139N/A <
xsl:
with-
param name="value" select="$plural-name" />
10981N/A <
xsl:
variable name="java-relation-plural-name">
10981N/A <
xsl:
call-
template name="name-to-java">
10921N/A <
xsl:
with-
param name="value" select="$plural-name" />
10821N/A <
xsl:
call-
template name="add-java-comment2">
10746N/A <
xsl:
with-
param name="indent" select="2" />
10637N/A select="concat('Lists the ', $ufpn,'.
', 10454N/A '@return Returns an array containing the names of the ', $ufpn,'.
', 10454N/A '@throws ConcurrentModificationException
', 10264N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 10264N/A '@throws ErrorResultException
', 10176N/A ' If any other error occurs.')" />
10139N/A select="concat(' String[] list', 10139N/A $java-relation-plural-name, '() throws ConcurrentModificationException,
', 10139N/A ' ErrorResultException;
')" />
10139N/A <
xsl:
call-
template name="add-java-comment2">
10139N/A <
xsl:
with-
param name="indent" select="2" />
10139N/A 'Gets the named ', $ufn, '.
', 10139N/A ' The name of the ', $ufn,' to retrieve.
', 10139N/A '@return Returns the named ', $ufn, '.
', 10139N/A '@throws DefinitionDecodingException
', 10139N/A ' If the named ', $ufn, ' was found but its type could not be determined.
', 10139N/A '@throws ManagedObjectDecodingException
', 10139N/A ' If the named ', $ufn, ' was found but one or more of its properties could not be decoded.
', 10139N/A '@throws ManagedObjectNotFoundException
', 10139N/A ' If the named ', $ufn, ' was not found on the server.
', 10139N/A '@throws ConcurrentModificationException
', 10139N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 10139N/A '@throws ErrorResultException
', 10139N/A ' If any other error occurs.')" />
10139N/A select="concat(' ', $java-class-name, 'CfgClient get', $java-relation-name, '(String name)
', 10139N/A ' throws DefinitionDecodingException, ManagedObjectDecodingException,
', 10139N/A ' ManagedObjectNotFoundException, ConcurrentModificationException,
', 10139N/A ' ErrorResultException;
')" />
10139N/A <
xsl:
when test="string(adm:one-to-many/@unique) != 'true'">
10139N/A <
xsl:
call-
template name="add-java-comment2">
10139N/A <
xsl:
with-
param name="indent" select="2" />
10139N/A 'Creates a new ', $ufn,'. The new ', $ufn,' will initially ', 10139N/A 'not contain any property values (including mandatory ', 10139N/A 'properties). Once the ', $ufn,' has been configured it ', 10139N/A 'can be added to the server using the {@link #commit()} ', 10139N/A ' The type of the ', $ufn,' being created.
', 10139N/A ' The definition of the ', $ufn,' to be created.
', 10139N/A ' The name of the new ', $ufn,'.
', 10139N/A ' An optional collection in which to place any ', 10139N/A '{@link DefaultBehaviorException}s that occurred whilst ', 10139N/A 'attempting to determine the default values of the ', $ufn, 10139N/A '. This argument can be <code>null<code>.
', 10139N/A '@return Returns a new ', $ufn,' configuration instance.
', 10139N/A '@throws IllegalManagedObjectNameException
', 10139N/A ' If the name of the new ', $ufn,' is invalid.
')" />
10139N/A select="concat(' <C extends ', $java-class-name,'CfgClient> C create', $java-relation-name, '(
', 10139N/A ' ManagedObjectDefinition<C, ? extends ', $java-class-name,'Cfg> d, String name, Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException;
')" />
10139N/A <
xsl:
when test="string(adm:one-to-many/@unique) = 'true'">
10139N/A <
xsl:
call-
template name="add-java-comment2">
10139N/A <
xsl:
with-
param name="indent" select="2" />
10139N/A 'Creates a new ', $ufn,'. The new ', $ufn,' will initially ', 10139N/A 'not contain any property values (including mandatory ', 10139N/A 'properties). Once the ', $ufn,' has been configured it ', 10139N/A 'can be added to the server using the {@link #commit()} ', 10139N/A ' The type of the ', $ufn,' being created.
', 10139N/A ' The definition of the ', $ufn,' to be created.
', 10139N/A ' An optional collection in which to place any ', 10139N/A '{@link DefaultBehaviorException}s that occurred whilst ', 10139N/A 'attempting to determine the default values of the ', $ufn, 10139N/A '. This argument can be <code>null<code>.
', 10139N/A '@return Returns a new ', $ufn,' configuration instance.
')" />
10139N/A select="concat(' <C extends ', $java-class-name,'CfgClient> C create', $java-relation-name, '(
', 10139N/A ' ManagedObjectDefinition<C, ? extends ', $java-class-name,'Cfg> d, Collection<DefaultBehaviorException> exceptions);
')" />
10139N/A <
xsl:
call-
template name="add-java-comment2">
10139N/A <
xsl:
with-
param name="indent" select="2" />
10139N/A 'Removes the named ', $ufn,'.
', 10139N/A ' The name of the ', $ufn,' to remove.
', 10139N/A '@throws ManagedObjectNotFoundException
', 10139N/A ' If the ', $ufn, ' does not exist.
', 10139N/A '@throws OperationRejectedException
', 10139N/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).
', 10139N/A '@throws ConcurrentModificationException
', 10139N/A ' If this ', $this-ufn, ' has been removed from the server by another client.
', 10139N/A '@throws ErrorResultException
', 10139N/A ' If any other error occurs.')" />
10139N/A select="concat(' void remove', $java-relation-name, '(String name)
', 10139N/A ' throws ManagedObjectNotFoundException, OperationRejectedException,
', 10139N/A ' ConcurrentModificationException, ErrorResultException;
')" />
10139N/A select="concat('Unknown relation type "', local-name(*), '" in relation "', $name, '".')" />
10139N/A Main document parsing template. 10139N/A <
xsl:
call-
template name="copyright-notice" />
10139N/A select="concat('package ', $this-package, '.client;
')" />
10139N/A <
xsl:
call-
template name="generate-import-statements">
10139N/A <
xsl:
with-
param name="imports">
10139N/A <
xsl:
for-
each select="$this-local-properties">
10139N/A <
xsl:
call-
template name="get-property-java-imports">
10139N/A <
xsl:
with-
param name="interface" select="'client'" />
10139N/A <
xsl:
if test="$this-local-properties[@multi-valued='true']">
10139N/A test="$this-local-properties[not(@monitoring='true')]">
10139N/A <
xsl:
if test="$this-local-properties[@read-only='true']">
10139N/A <
xsl:
if test="$this-local-relations">
10139N/A select="$this-local-relations[adm:one-to-zero-or-one]|$this-local-relations[adm:one-to-many]">
10139N/A <
xsl:
variable name="java-class-name">
10139N/A <
xsl:
call-
template name="name-to-java">
10139N/A select="@managed-object-name" />
10139N/A select="concat(@managed-object-package, '.server.', $java-class-name, 'Cfg')" />
10139N/A <
xsl:
when test="$this/@extends">
10139N/A <
xsl:
if test="$parent-package != $this-package">
10139N/A select="concat($parent-package, '.client.', $parent-java-class, 'CfgClient')" />
10139N/A select="concat($this-package, '.server.', $this-java-class, 'Cfg')" />
10139N/A <
xsl:
call-
template name="generate-interface-declaration" />
10139N/A <
xsl:
call-
template name="generate-configuration-definition-getter" />
10139N/A <
xsl:
for-
each select="$this-local-properties">
10139N/A <
xsl:
call-
template name="generate-property-getter-declaration">
10139N/A <
xsl:
with-
param name="interface" select="'client'" />
10139N/A <
xsl:
call-
template name="generate-property-setter-declaration" />
10139N/A <
xsl:
for-
each select="$this-local-relations">
10139N/A <
xsl:
call-
template name="generate-relation-declarations" />