1008N/A ! The contents of this file are subject to the terms of the 1008N/A ! Common Development and Distribution License, Version 1.0 only 1008N/A ! (the "License"). You may not use this file except in compliance 1008N/A ! You can obtain a copy of the license at 1008N/A ! See the License for the specific language governing permissions 1008N/A ! and limitations under the License. 1008N/A ! When distributing Covered Code, include this CDDL HEADER in each 1008N/A ! file and include the License file at 1008N/A ! add the following below this CDDL HEADER, with the fields enclosed 1008N/A ! by brackets "[]" replaced with your own identifying information: 1008N/A ! Portions Copyright [yyyy] [name of copyright owner] 5018N/A ! Copyright 2008-2010 Sun Microsystems, Inc. 1008N/A WARNING: when new property types are defined, they must be 1008N/A These stylesheets are included and NOT imported so that they 1008N/A have the same import precedence as the default rules. 1008N/A Default rules applicable to each property type. 1008N/A Property type stylesheets should override these where necessary. 1008N/A Get the Java object-based type associated with a property syntax. 1008N/A By default property values are represented using strings. 1008N/A <
xsl:
template match="*" mode="java-value-type">
1008N/A <
xsl:
value-
of select="'String'" />
1008N/A Get the Java primitive type, if applicable, associated with a 1008N/A By default property values are represented using the type defined by 1008N/A <
xsl:
template match="*" mode="java-value-primitive-type">
1008N/A <
xsl:
apply-
templates select="." mode="java-value-type" />
1008N/A Generate import elements represesenting the import statements 1008N/A required by values of the property. 1008N/A By default property values are represented using strings which 1008N/A don't require an import statement - so do nothing. 2499N/A <
xsl:
template match="*" mode="java-value-imports">
2499N/A <
xsl:
param name="interface" select="/.." />
1008N/A Generate the Java definition type used to define the property. 1008N/A By default properties are defined using string property 1008N/A <
xsl:
template match="*" mode="java-definition-type">
1008N/A <
xsl:
value-
of select="'StringPropertyDefinition'" />
1008N/A Generate import elements represesenting the import statements 1008N/A required by the property's definition and its values. 1008N/A By default assume that the definition type is in 1008N/A java-definition-type (might not be the case for parameterized 1008N/A types. In addition pull in the value imports. 1008N/A <
xsl:
template match="*" mode="java-definition-imports">
1008N/A <
xsl:
element name="import">
1008N/A <
xsl:
apply-
templates select="." mode="java-definition-type" />
2499N/A <
xsl:
apply-
templates select="." mode="java-value-imports">
2499N/A <
xsl:
with-
param name="interface" select="'server'" />
1008N/A If the property definition is generic, get the generic type. Otherwise, 1008N/A <
xsl:
template match="*" mode="java-definition-generic-type" />
1008N/A Generate property definition specific constructor setters. 1008N/A <
xsl:
template match="*" mode="java-definition-ctor" />
2411N/A Generate property definition specific post-construction code. 2411N/A <
xsl:
template match="*" mode="java-definition-post-ctor" />
2499N/A Generate property getter declaration(s). 2499N/A By default, generate a single getter with minimal documentation. 2499N/A <
xsl:
template match="*" mode="java-property-getter-declaration">
2499N/A <
xsl:
param name="interface" select="/.." />
2499N/A name="generate-default-property-getter-declaration">
2499N/A <
xsl:
with-
param name="interface" select="$interface" />
2499N/A Generate property getter implementation(s). 2499N/A By default, generate a single getter. 2499N/A <
xsl:
template match="*" mode="java-property-getter-implementation">
2499N/A <
xsl:
param name="interface" select="/.." />
2499N/A name="generate-default-property-getter-implementation">
2499N/A <
xsl:
with-
param name="interface" select="$interface" />
2499N/A Generate property setter declaration(s). 2499N/A By default, generate a single setter with minimal documentation. 2499N/A <
xsl:
template match="*" mode="java-property-setter-declaration">
2499N/A name="generate-default-property-setter-declaration" />
2499N/A Generate property setter implementation(s). 2499N/A By default, generate a single setter. 2499N/A <
xsl:
template match="*" mode="java-property-setter-implementation">
2499N/A name="generate-default-property-setter-implementation" />
1008N/A Wrapper templates which can be called directly instead of 1008N/A requiring the more indirect and less readable apply-templates 1008N/A Get the Java imports required for a property's values. 1008N/A <
xsl:
template name="get-property-java-imports">
2499N/A <
xsl:
param name="interface" select="/.." />
1008N/A <
xsl:
apply-
templates select="adm:syntax/*" 2499N/A <
xsl:
with-
param name="interface" select="$interface" />
1008N/A Get the Java imports required for a property's definition. 1008N/A <
xsl:
template name="get-property-definition-java-imports">
1008N/A <
xsl:
apply-
templates select="adm:syntax/*" 1008N/A mode="java-definition-imports" />
1008N/A Get the Java object-based type associated with a property syntax. 1008N/A <
xsl:
template name="get-property-java-type">
1008N/A <
xsl:
apply-
templates select="adm:syntax/*" mode="java-value-type" />
1008N/A Get the Java primitive type, if applicable, associated with a 1008N/A <
xsl:
template name="get-property-java-primitive-type">
1008N/A <
xsl:
apply-
templates select="adm:syntax/*" 1008N/A mode="java-value-primitive-type" />
1008N/A Get the property definition type associated with a 1008N/A <
xsl:
template name="get-property-definition-type">
1008N/A <
xsl:
apply-
templates select="adm:syntax/*" 1008N/A mode="java-definition-type" />
1008N/A If the property definition is generic, get the generic type. Otherwise, 1008N/A <
xsl:
template name="get-property-definition-generic-type">
1008N/A <
xsl:
apply-
templates select="adm:syntax/*" 1008N/A mode="java-definition-generic-type" />
1008N/A Generate property definition specific constructor setters. 1008N/A <
xsl:
template name="get-property-definition-ctor">
1008N/A <
xsl:
apply-
templates select="adm:syntax/*" 1008N/A mode="java-definition-ctor" />
2411N/A Generate property definition specific post-construction code. 2411N/A <
xsl:
template name="get-property-definition-post-ctor">
2411N/A <
xsl:
apply-
templates select="adm:syntax/*" 2411N/A mode="java-definition-post-ctor" />
1008N/A Generate the property getter declarations. 1008N/A <
xsl:
template name="generate-property-getter-declaration">
1008N/A <
xsl:
param name="interface" select="/.." />
2499N/A <
xsl:
apply-
templates select="adm:syntax/*" 2499N/A mode="java-property-getter-declaration">
2499N/A <
xsl:
with-
param name="interface" select="$interface" />
2499N/A Generate the property getter implementations. 2499N/A <
xsl:
template name="generate-property-getter-implementation">
2499N/A <
xsl:
param name="interface" select="/.." />
2499N/A <
xsl:
apply-
templates select="adm:syntax/*" 2499N/A mode="java-property-getter-implementation">
2499N/A <
xsl:
with-
param name="interface" select="$interface" />
2499N/A Generate the property setter declarations. 2499N/A <
xsl:
template name="generate-property-setter-declaration">
2499N/A <
xsl:
apply-
templates select="adm:syntax/*" 2499N/A mode="java-property-setter-declaration" />
2499N/A Generate the property setter implementations. 2499N/A <
xsl:
template name="generate-property-setter-implementation">
2499N/A <
xsl:
apply-
templates select="adm:syntax/*" 2499N/A mode="java-property-setter-implementation" />
2499N/A Generate the default property getter declarations. 2499N/A <
xsl:
template name="generate-default-property-getter-declaration">
2499N/A <
xsl:
param name="interface" select="/.." />
2499N/A <
xsl:
apply-
templates select="../.." 2499N/A mode="generate-default-property-getter-declaration-aux">
2499N/A <
xsl:
with-
param name="interface" select="$interface" />
2499N/A <
xsl:
template match="adm:property" 2499N/A mode="generate-default-property-getter-declaration-aux">
2499N/A <
xsl:
param name="interface" select="/.." />
1008N/A <
xsl:
variable name="name" select="@name" />
1008N/A <
xsl:
variable name="java-property-name">
1008N/A <
xsl:
call-
template name="name-to-java">
1008N/A <
xsl:
with-
param name="value" select="$name" />
1008N/A select="concat(' /**
', 2499N/A ' * Gets the "', $name,'" property.
')" />
1008N/A <
xsl:
if test="adm:synopsis">
1008N/A <
xsl:
value-
of select="' * <p>
'" />
1008N/A <
xsl:
call-
template name="add-java-comment">
1008N/A <
xsl:
with-
param name="indent-text" select="' *'" />
1008N/A <
xsl:
with-
param name="content" select="adm:synopsis" />
1008N/A <
xsl:
if test="adm:description">
1008N/A <
xsl:
value-
of select="' * <p>
'" />
1008N/A <
xsl:
call-
template name="add-java-comment">
1008N/A <
xsl:
with-
param name="indent-text" select="' *'" />
1008N/A <
xsl:
with-
param name="content" select="adm:description" />
1008N/A <
xsl:
when test="string(@multi-valued) != 'true'">
1008N/A ' * @return Returns the value of the "', $name,'" property.
', 1008N/A <
xsl:
value-
of select="' '" />
1008N/A The method is guaranteed to return a value since there is a 1008N/A well-defined default value. 1008N/A <
xsl:
call-
template name="get-property-java-primitive-type" />
1008N/A test="$interface = 'server' and @mandatory = 'true'">
1008N/A The method is guaranteed to return a value in the server interface, but 1008N/A not necessarily in the client, since the mandatory property might not 1008N/A <
xsl:
call-
template name="get-property-java-primitive-type" />
1008N/A <
xsl:
call-
template name="get-property-java-type" />
2517N/A <
xsl:
when test="$interface='server'">
2517N/A ' * @return Returns an unmodifiable set containing the values of the "', $name,'" property.
', 1008N/A ' * @return Returns the values of the "', $name,'" property.
', 1008N/A <
xsl:
value-
of select="' SortedSet<'" />
1008N/A <
xsl:
call-
template name="get-property-java-type" />
1008N/A <
xsl:
value-
of select="'>'" />
1008N/A <
xsl:
value-
of select="' is'" />
1008N/A <
xsl:
value-
of select="' get'" />
1008N/A select="concat($java-property-name, 2499N/A Generate the default property getter implementation. 2499N/A name="generate-default-property-getter-implementation">
2499N/A <
xsl:
param name="interface" select="/.." />
2499N/A <
xsl:
apply-
templates select="../.." 2499N/A mode="generate-default-property-getter-implementation-aux">
2499N/A <
xsl:
with-
param name="interface" select="$interface" />
2499N/A <
xsl:
template match="adm:property" 2499N/A mode="generate-default-property-getter-implementation-aux">
2499N/A <
xsl:
param name="interface" select="/.." />
2499N/A <
xsl:
variable name="java-prop-name">
2499N/A <
xsl:
call-
template name="name-to-java">
2499N/A <
xsl:
with-
param name="value" select="@name" />
2499N/A select="concat(' /**
', 2499N/A <
xsl:
when test="string(@multi-valued) != 'true'">
2499N/A The method is guaranteed to return a value since there is a 2499N/A well-defined default value. 2499N/A <
xsl:
call-
template name="get-property-java-primitive-type" />
2499N/A test="$interface = 'server' and @mandatory = 'true'">
2499N/A The method is guaranteed to return a value in the server interface, but 2499N/A not necessarily in the client, since the mandatory property might not 2499N/A <
xsl:
call-
template name="get-property-java-primitive-type" />
2499N/A <
xsl:
call-
template name="get-property-java-type" />
2499N/A <
xsl:
value-
of select="'SortedSet<'" />
2499N/A <
xsl:
call-
template name="get-property-java-type" />
2499N/A <
xsl:
value-
of select="'>'" />
2499N/A <
xsl:
value-
of select="' is'" />
2499N/A <
xsl:
value-
of select="' get'" />
2517N/A <
xsl:
when test="$interface='server'">
2499N/A select="concat($java-prop-name, '() {
', 2517N/A ' return p', $java-prop-name , ';
' , 2517N/A <
xsl:
when test="string(@multi-valued) != 'true'">
2517N/A select="concat($java-prop-name, '() {
', 2499N/A 'PropertyDefinition());
' , 2517N/A select="concat($java-prop-name, '() {
', 2499N/A 'PropertyDefinition());
' , 2499N/A Generate the default property setter declarations. 2499N/A <
xsl:
template name="generate-default-property-setter-declaration">
2499N/A <
xsl:
apply-
templates select="../.." 2499N/A mode="generate-default-property-setter-declaration-aux" />
2499N/A <
xsl:
template match="adm:property" 2499N/A mode="generate-default-property-setter-declaration-aux">
1418N/A <
xsl:
if test="not(@monitoring='true')">
1008N/A <
xsl:
variable name="name" select="@name" />
1008N/A <
xsl:
variable name="java-property-name">
1008N/A <
xsl:
call-
template name="name-to-java">
1008N/A <
xsl:
with-
param name="value" select="$name" />
1008N/A select="concat(' /**
', 2499N/A ' * Sets the "', $name, '" property.
')" />
1008N/A <
xsl:
if test="adm:synopsis">
1008N/A <
xsl:
value-
of select="' * <p>
'" />
1008N/A <
xsl:
call-
template name="add-java-comment">
1008N/A <
xsl:
with-
param name="indent-text" select="' *'" />
1008N/A <
xsl:
with-
param name="content" select="adm:synopsis" />
1008N/A <
xsl:
if test="adm:description">
1008N/A <
xsl:
value-
of select="' * <p>
'" />
1008N/A <
xsl:
call-
template name="add-java-comment">
1008N/A <
xsl:
with-
param name="indent-text" select="' *'" />
1008N/A <
xsl:
with-
param name="content" select="adm:description" />
1418N/A <
xsl:
if test="@read-only='true'">
1418N/A <
xsl:
value-
of select="' * <p>
'" />
1418N/A ' * This property is read-only and can only be modified during
', 1418N/A ' * creation of a ', $this-ufn, '.
')" />
1418N/A <
xsl:
when test="not(@multi-valued='true')">
1008N/A ' * @param value The value of the "', $name, '" property.
', 1008N/A ' * @throws IllegalPropertyValueException
', 1418N/A ' * If the new value is invalid.
')" />
1418N/A <
xsl:
if test="@read-only='true'">
1418N/A ' * @throws PropertyIsReadOnlyException
', 1418N/A ' * If this ', $this-ufn, ' is not being initialized.
')" />
1008N/A ' void set', $java-property-name, '(')" />
1008N/A <
xsl:
when test="@mandatory = 'true'">
1008N/A name="get-property-java-primitive-type" />
1008N/A <
xsl:
call-
template name="get-property-java-type" />
1418N/A <
xsl:
value-
of select="' value'" />
1008N/A ' * @param values The values of the "', $name, '" property.
', 1008N/A ' * @throws IllegalPropertyValueException
', 1418N/A ' * If one or more of the new values are invalid.
')" />
1418N/A <
xsl:
if test="@read-only='true'">
1418N/A ' * @throws PropertyIsReadOnlyException
', 1418N/A ' * If this ', $this-ufn, ' is not being initialized.
')" />
1008N/A ' void set', $java-property-name, '(Collection<')" />
1008N/A <
xsl:
call-
template name="get-property-java-type" />
1418N/A <
xsl:
value-
of select="'> values'" />
1418N/A <
xsl:
value-
of select="') throws IllegalPropertyValueException'" />
1418N/A <
xsl:
if test="@read-only='true'">
1418N/A <
xsl:
value-
of select="', PropertyIsReadOnlyException'" />
1418N/A <
xsl:
value-
of select="';
'" />
2499N/A Generate the default property setter implementation. 2499N/A name="generate-default-property-setter-implementation">
2499N/A <
xsl:
apply-
templates select="../.." 2499N/A mode="generate-default-property-setter-implementation-aux" />
2499N/A <
xsl:
template match="adm:property" 2499N/A mode="generate-default-property-setter-implementation-aux">
2499N/A <
xsl:
if test="not(@monitoring='true')">
2499N/A <
xsl:
variable name="java-prop-name">
2499N/A <
xsl:
call-
template name="name-to-java">
2499N/A <
xsl:
with-
param name="value" select="@name" />
2499N/A select="concat(' /**
', 2499N/A <
xsl:
when test="not(@multi-valued='true')">
2499N/A <
xsl:
when test="@mandatory='true'">
2499N/A name="get-property-java-primitive-type" />
2499N/A <
xsl:
call-
template name="get-property-java-type" />
2499N/A <
xsl:
value-
of select="' value)'" />
2499N/A <
xsl:
if test="@read-only='true'">
2499N/A select="' throws PropertyIsReadOnlyException'" />
2499N/A 'PropertyDefinition(), value);
', 2499N/A <
xsl:
value-
of select="'Collection<'" />
2499N/A <
xsl:
call-
template name="get-property-java-type" />
5018N/A <
xsl:
value-
of select="'> values)'" />
5018N/A <
xsl:
if test="@read-only='true'">
5018N/A select="' throws PropertyIsReadOnlyException'" />
2499N/A 'PropertyDefinition(), values);
',