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 553N/A ! by brackets "[]" replaced with your own identifying information: 553N/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 class declaration. 0N/A <
xsl:
template name="generate-meta-class-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('An interface for querying the ', $this-ufn, 0N/A ' managed object definition meta information.')" />
<
xsl:
value-
of select="' * <p>
'" />
<
xsl:
call-
template name="add-java-comment">
<
xsl:
with-
param name="indent-text" select="' *'" />
<
xsl:
with-
param name="content" select="$this/adm:synopsis" />
<
xsl:
value-
of select="' */
'" />
select="concat('public final class ', <
xsl:
when test="$this-is-abstract">
select="concat('AbstractManagedObjectDefinition<', $this-java-class, 'CfgClient, ', $this-java-class, 'Cfg> {
')" />
select="concat('ManagedObjectDefinition<', $this-java-class, 'CfgClient, ', $this-java-class, 'Cfg> {
')" />
Template for generating the meta class body. <
xsl:
template name="generate-meta-class-body">
Singleton configuration definition instance. select="concat(' // The singleton configuration definition instance.
', ' private static final ', 'CfgDefn INSTANCE = new ', $this-java-class, 'CfgDefn();
')" />
Generate enumerations defined by this managed object.. select="$this-local-properties[adm:syntax/adm:enumeration]">
<
xsl:
sort select="@name" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-enumeration" />
Generate declarations for properties defined or overridden by this managed object. <
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-declaration" />
Generate declarations for relations. <
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-declaration" />
Generate constructors for properties defined or overridden by this managed object. <
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-constructor" />
Generate constructors for relations. <
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-constructor" />
Configuration definition singleton getter. <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
value-
of select="' /**
'" />
<
xsl:
call-
template name="add-java-comment">
<
xsl:
with-
param name="indent-text" select="' *'" />
<
xsl:
with-
param name="content" select="concat('Get the ', $this-ufn,' configuration definition singleton.')" />
<
xsl:
value-
of select="' *
'" />
<
xsl:
call-
template name="add-java-comment">
<
xsl:
with-
param name="indent-text" select="' *'" />
<
xsl:
with-
param name="indent-text2" select="' * '" />
<
xsl:
with-
param name="content" select="concat('@return Returns the ', $this-ufn, ' configuration definition singleton.')" />
<
xsl:
value-
of select="' */
'" />
select="concat(' public static ', 'CfgDefn getInstance() {
', ' return INSTANCE;
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' * Private constructor.
', <
xsl:
when test="boolean($this/@extends)">
select="concat(' super("', select="concat(' super("', '", null);
')" />
<
xsl:
value-
of select="concat(' }
')" />
Create configuration view factory methods for non-abstract definitions <
xsl:
if test="not($this-is-abstract)">
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
Generate configuration client factory method. select="concat(' /**
', 'CfgClient createClientConfiguration(
', ' ManagedObject<? extends ', 'CfgClient> impl) {
', 'CfgClientImpl(impl);
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
Generate configuration server factory method. select="concat(' /**
', 'Cfg createServerConfiguration(
', ' ServerManagedObject<? extends ',$this-java-class,'Cfg> impl) {
', 'CfgServerImpl(impl);
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
Generate configuration server class getter.. select="concat(' /**
', 'Cfg> getServerConfigurationClass() {
', Generate property definition getters for local properties. <
xsl:
for-
each select="$this-all-properties">
<
xsl:
sort select="@name" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-property-definition-getter" />
Generate relation definition getters for local relations. <
xsl:
for-
each select="$this-all-relations">
<
xsl:
sort select="@name" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-relation-definition-getter" />
Managed object class implementations. <
xsl:
if test="not($this-is-abstract)">
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-client-impl-class" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-server-impl-class" />
Generate managed object client class implementation. <
xsl:
template name="generate-client-impl-class">
select="concat(' /**
', ' * Managed object client implementation.
', ' private static class ', 'CfgClientImpl implements
 ', <
xsl:
text>
</
xsl:
text>
select="concat(' // Private implementation.
', ' private ManagedObject<? extends ', 'CfgClient> impl;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' // Private constructor.
', ' ManagedObject<? extends ', 'CfgClient> impl) {
', <
xsl:
for-
each select="$this-all-properties">
<
xsl:
sort select="@name" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-property-getter">
<
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" />
<
xsl:
for-
each select="$this-all-relations">
<
xsl:
sort select="@name" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-client-relation-methods" />
Managed object definition getter. <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public ManagedObjectDefinition<? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg> definition() {
', ' return INSTANCE;
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public PropertyProvider properties() {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public void commit() throws OperationsException {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
value-
of select="' }
'" />
Generate managed object server class implementation. <
xsl:
template name="generate-server-impl-class">
select="concat(' /**
', ' * Managed object server implementation.
', ' private static class ', 'CfgServerImpl implements
 ', <
xsl:
text>
</
xsl:
text>
select="concat(' // Private implementation.
', ' private ServerManagedObject<? extends ', $this-java-class, 'Cfg> impl;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' // Private constructor.
', 'CfgServerImpl(ServerManagedObject<? extends ', $this-java-class, 'Cfg> impl) {
', Generate all the change listener methods - one for each managed <
xsl:
if test="not($this-is-root)">
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-change-listener" />
<
xsl:
for-
each select="$this-all-properties">
<
xsl:
sort select="@name" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-property-getter">
<
xsl:
with-
param name="interface" select="'server'" />
<
xsl:
for-
each select="$this-all-relations">
<
xsl:
sort select="@name" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-server-relation-methods" />
Configuration definition getter. <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public ManagedObjectDefinition<? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg> definition() {
', ' return INSTANCE;
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public PropertyProvider properties() {
', Configuration entry DN getter. <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public DN dn() {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
value-
of select="' }
'" />
Generate a property definition constructor. <
xsl:
template name="generate-property-declaration">
<
xsl:
variable name="java-prop-name">
<
xsl:
call-
template name="name-to-java-constant">
<
xsl:
with-
param name="value" select="@name" />
<
xsl:
variable name="type">
<
xsl:
call-
template name="get-property-definition-type" />
<
xsl:
variable name="generic-type">
<
xsl:
call-
template name="get-property-definition-generic-type" />
<
xsl:
variable name="pdtype">
<
xsl:
when test="string-length($generic-type) != 0">
select="concat($type, '<', $generic-type, '>')" />
<
xsl:
value-
of select="$type" />
select="concat(' // The "', '" property definition.
', ' private static final ', $pdtype, ' PD_', $java-prop-name, ';
')" />
Generate a property definition constructor. <
xsl:
template name="generate-property-constructor">
<
xsl:
variable name="java-prop-name">
<
xsl:
call-
template name="name-to-java-constant">
<
xsl:
with-
param name="value" select="@name" />
<
xsl:
variable name="type">
<
xsl:
call-
template name="get-property-definition-type" />
<
xsl:
variable name="generic-type">
<
xsl:
call-
template name="get-property-definition-generic-type" />
<
xsl:
variable name="value-type">
<
xsl:
call-
template name="get-property-java-type" />
select="concat(' // Build the "', @name, '" property definition.
', <
xsl:
when test="string-length($generic-type) != 0">
select="concat(' ', $type, '.Builder<', $generic-type, '> builder = ', $type, '.createBuilder("',@name, '");
')" />
select="concat(' ', $type, '.Builder builder = ', $type, '.createBuilder("',@name, '");
')" />
<
xsl:
if test="string(@multi-valued) = 'true'">
<
xsl:
if test="string(@read-only) = 'true'">
<
xsl:
if test="string(@mandatory) = 'true'">
<
xsl:
if test="string(@hidden) = 'true'">
<
xsl:
when test="string(@mandatory) = 'true'">
<
xsl:
if test="not(adm:default-behavior)">
<
xsl:
message terminate="yes">
select="concat('No default behavior defined for non-mandatory property "', @name, select="concat(' DefaultBehaviorProvider<', $value-type,'> provider = ', 'new DefinedDefaultBehaviorProvider<', $value-type,'>(')" />
select="concat('"', normalize-space(), '"')" />
<
xsl:
if test="position() != last()">
<
xsl:
value-
of select="', '" />
<
xsl:
value-
of select="');
'" />
<
xsl:
message terminate="yes">
select="concat('Relative inherited property defaults not yet implemented (property "', @name, <
xsl:
message terminate="yes">
select="concat('Absolute inherited property defaults not yet implemented (property "', @name, <
xsl:
message terminate="yes">
select="concat('Unrecognized default behavior type for property "', @name, <
xsl:
call-
template name="get-property-definition-ctor" />
<
xsl:
value-
of select="' }
'" />
Generate a relation definition declaration. <
xsl:
template name="generate-relation-declaration">
<
xsl:
variable name="relation-name">
<
xsl:
when test="adm:one-to-many">
<
xsl:
value-
of select="adm:one-to-many/@plural-name" />
<
xsl:
value-
of select="@name" />
<
xsl:
variable name="java-relation-name">
<
xsl:
call-
template name="name-to-java-constant">
<
xsl:
with-
param name="value" select="$relation-name" />
<
xsl:
variable name="java-managed-object-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="@managed-object-name" />
select="concat(' // The "', '" relation definition.
', ' private static final ')" />
<
xsl:
when test="adm:one-to-one">
<
xsl:
text>SingletonRelationDefinition<</
xsl:
text>
<
xsl:
when test="adm:one-to-zero-or-one">
<
xsl:
text>OptionalRelationDefinition<</
xsl:
text>
<
xsl:
when test="adm:one-to-many">
<
xsl:
text>InstantiableRelationDefinition<</
xsl:
text>
<
xsl:
message terminate="yes">
select="concat('Unknown relation type "', local-name(*), '" in relation "', @name, '".')" />
select="concat($java-managed-object-name, 'CfgClient, ', $java-managed-object-name, 'Cfg> RD_', $java-relation-name, ';
')" />
Generate a relation definition constructor. <
xsl:
template name="generate-relation-constructor">
<
xsl:
variable name="relation-name">
<
xsl:
when test="adm:one-to-many">
<
xsl:
value-
of select="adm:one-to-many/@plural-name" />
<
xsl:
value-
of select="@name" />
<
xsl:
variable name="java-relation-name">
<
xsl:
call-
template name="name-to-java-constant">
<
xsl:
with-
param name="value" select="$relation-name" />
<
xsl:
variable name="java-managed-object-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="@managed-object-name" />
select="concat(' // Build the "', $relation-name, '" relation definition.
', ' RD_', $java-relation-name, ' = new ')" />
<
xsl:
when test="adm:one-to-one">
<
xsl:
text>SingletonRelationDefinition<</
xsl:
text>
<
xsl:
when test="adm:one-to-zero-or-one">
<
xsl:
text>OptionalRelationDefinition<</
xsl:
text>
<
xsl:
when test="adm:one-to-many">
<
xsl:
text>InstantiableRelationDefinition<</
xsl:
text>
<
xsl:
message terminate="yes">
select="concat('Unknown relation type "', local-name(*), '" in relation "', @name, '".')" />
select="concat($java-managed-object-name, 'CfgClient, ', $java-managed-object-name, 'Cfg>(
', ' INSTANCE, "', @name, '", ')" />
<
xsl:
if test="adm:one-to-many">
select="concat('"', adm:one-to-many/@plural-name, '", ')" />
<
xsl:
value-
of select="' }
'" />
Generate a property definition getter for a locally defined <
xsl:
template name="generate-property-definition-getter">
<
xsl:
variable name="java-prop-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="@name" />
<
xsl:
variable name="java-prop-name-constant">
<
xsl:
call-
template name="name-to-java-constant">
<
xsl:
with-
param name="value" select="@name" />
<
xsl:
variable name="type">
<
xsl:
call-
template name="get-property-definition-type" />
<
xsl:
variable name="generic-type">
<
xsl:
call-
template name="get-property-definition-generic-type" />
<
xsl:
variable name="pdtype">
<
xsl:
when test="string-length($generic-type) != 0">
select="concat($type, '<', $generic-type, '>')" />
<
xsl:
value-
of select="$type" />
select="concat(' /**
', '" property definition.
')" />
<
xsl:
if test="adm:synopsis">
<
xsl:
value-
of select="' * <p>
'" />
<
xsl:
call-
template name="add-java-comment">
<
xsl:
with-
param name="indent-text" select="' *'" />
<
xsl:
with-
param name="content" select="adm:synopsis" />
<
xsl:
if test="adm:description">
<
xsl:
value-
of select="' * <p>
'" />
<
xsl:
call-
template name="add-java-comment">
<
xsl:
with-
param name="indent-text" select="' *'" />
<
xsl:
with-
param name="content" select="adm:description" />
test="adm:profile[@name='preprocessor']/admpp:managed-object[@name=$this-name and @package=$this-package]">
select="concat(' *
', ' * @return Returns the "', '" property definition.
', 'PropertyDefinition() {
' , $java-prop-name-constant , select="concat(' *
', ' * @return Returns the "', '" property definition.
', 'PropertyDefinition() {
' , 'PropertyDefinition();
', Generate a relation definition getter. <
xsl:
template name="generate-relation-definition-getter">
<
xsl:
variable name="relation-name">
<
xsl:
when test="adm:one-to-many">
<
xsl:
value-
of select="adm:one-to-many/@plural-name" />
<
xsl:
value-
of select="@name" />
<
xsl:
variable name="java-relation-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="$relation-name" />
<
xsl:
variable name="java-relation-name-constant">
<
xsl:
call-
template name="name-to-java-constant">
<
xsl:
with-
param name="value" select="$relation-name" />
select="concat(' /**
', '" relation definition.
', ' * @return Returns the "', '" relation definition.
', <
xsl:
when test="adm:one-to-one">
<
xsl:
text>SingletonRelationDefinition<</
xsl:
text>
<
xsl:
when test="adm:one-to-zero-or-one">
<
xsl:
text>OptionalRelationDefinition<</
xsl:
text>
<
xsl:
when test="adm:one-to-many">
<
xsl:
text>InstantiableRelationDefinition<</
xsl:
text>
<
xsl:
message terminate="yes">
select="concat('Unknown relation type "', local-name(*), '" in relation "', @name, '".')" />
<
xsl:
variable name="java-managed-object-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="@managed-object-name" />
test="adm:profile[@name='preprocessor']/admpp:managed-object[@name=$this-name and @package=$this-package]">
select="concat($java-managed-object-name, 'CfgClient,', $java-managed-object-name, 'Cfg> get', 'RelationDefinition() {
' , $java-relation-name-constant, select="concat($java-managed-object-name, 'CfgClient,', $java-managed-object-name, 'Cfg> get', 'RelationDefinition() {
' , 'RelationDefinition();
', Generate a property value getter. <
xsl:
template name="generate-property-getter">
<
xsl:
param name="interface" select="/.." />
<
xsl:
variable name="java-prop-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="@name" />
select="concat(' /**
', <
xsl:
when test="string(@multi-valued) != 'true'">
The method is guaranteed to return a value since there is a well-defined default value. <
xsl:
call-
template name="get-property-java-primitive-type" />
test="$interface = 'server' and @mandatory = 'true'">
The method is guaranteed to return a value in the server interface, but not necessarily in the client, since the mandatory property might not <
xsl:
call-
template name="get-property-java-primitive-type" />
<
xsl:
call-
template name="get-property-java-type" />
<
xsl:
value-
of select="'SortedSet<'" />
<
xsl:
call-
template name="get-property-java-type" />
<
xsl:
value-
of select="'>'" />
<
xsl:
value-
of select="' is'" />
<
xsl:
value-
of select="' get'" />
<
xsl:
when test="string(@multi-valued) != 'true'">
select="concat($java-prop-name, '() {
', 'PropertyDefinition());
' , select="concat($java-prop-name, '() {
', 'PropertyDefinition());
' , Generate a property value setter. <
xsl:
template name="generate-property-setter">
<
xsl:
if test="string(@read-only) != 'true'">
<
xsl:
variable name="java-prop-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="@name" />
select="concat(' /**
', <
xsl:
when test="string(@multi-valued) != 'true'">
<
xsl:
when test="@mandatory = 'true'">
name="get-property-java-primitive-type" />
<
xsl:
call-
template name="get-property-java-type" />
select="concat(' value) {
' , 'PropertyDefinition(), value);
', <
xsl:
value-
of select="'Collection<'" />
<
xsl:
call-
template name="get-property-java-type" />
select="concat('> values) {
' , 'PropertyDefinition(), values);
', Generate client relation methods. <
xsl:
template name="generate-client-relation-methods">
<
xsl:
variable name="name" select="@name" />
<
xsl:
variable name="java-relation-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="$name" />
<
xsl:
variable name="java-class-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="@managed-object-name" />
<
xsl:
when test="adm:one-to-one">
select="concat(' /**
', ' public ', $java-class-name, 'CfgClient get', $java-relation-name, '() throws OperationsException {
', <
xsl:
when test="adm:one-to-zero-or-one">
select="concat(' /**
', $java-relation-name, '() throws OperationsException {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public ', $java-class-name, 'CfgClient get', $java-relation-name, '() throws OperationsException {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public <M extends ', $java-class-name, 'CfgClient> M create', $java-relation-name, '(ManagedObjectDefinition<M, ?> d, PropertyProvider p) throws OperationsException {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', $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="java-relation-plural-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="$plural-name" />
select="concat(' /**
', $java-relation-plural-name, '() throws OperationsException {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public ', $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(' /**
', ' public <M extends ', $java-class-name, 'CfgClient> M create', $java-relation-name, '(ManagedObjectDefinition<M, ?> d, String name, PropertyProvider p) throws OperationsException {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', $java-relation-name, '(String name) throws OperationsException {
', <
xsl:
message terminate="yes">
select="concat('Unknown relation type "', local-name(*), '" in relation "', $name, '".')" />
Generate server relation methods. <
xsl:
template name="generate-server-relation-methods">
<
xsl:
variable name="name" select="@name" />
<
xsl:
variable name="java-relation-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="$name" />
<
xsl:
variable name="java-class-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="@managed-object-name" />
<
xsl:
when test="adm:one-to-one">
select="concat(' /**
', ' public ', $java-class-name, 'Cfg get', $java-relation-name, '() throws ConfigException {
', <
xsl:
when test="adm:one-to-zero-or-one">
select="concat(' /**
', $java-relation-name, '() {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public ', $java-class-name, 'Cfg get', $java-relation-name, '() throws ConfigException {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public void add', $java-relation-name, 'AddListener(
', ' ConfigurationAddListener<', $java-class-name,'Cfg> listener) throws ConfigException {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public void remove', $java-relation-name, 'AddListener(
', ' ConfigurationAddListener<', $java-class-name,'Cfg> listener) {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public void add', $java-relation-name, 'DeleteListener(
', ' ConfigurationDeleteListener<', $java-class-name,'Cfg> listener) throws ConfigException {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public void remove', $java-relation-name, 'DeleteListener(
', ' ConfigurationDeleteListener<', $java-class-name,'Cfg> listener) {
', <
xsl:
when test="adm:one-to-many">
<
xsl:
variable name="plural-name" select="adm:one-to-many/@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(' /**
', $java-relation-plural-name, '() {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public ', $java-class-name, 'Cfg get', $java-relation-name, '(String name) throws ConfigException {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public void add', $java-relation-name, 'AddListener(
', ' ConfigurationAddListener<', $java-class-name,'Cfg> listener) throws ConfigException {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public void remove', $java-relation-name, 'AddListener(
', ' ConfigurationAddListener<', $java-class-name,'Cfg> listener) {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public void add', $java-relation-name, 'DeleteListener(
', ' ConfigurationDeleteListener<', $java-class-name,'Cfg> listener) throws ConfigException {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', ' public void remove', $java-relation-name, 'DeleteListener(
', ' ConfigurationDeleteListener<', $java-class-name,'Cfg> listener) {
', <
xsl:
message terminate="yes">
select="concat('Unknown relation type "', local-name(*), '" in relation "', $name, '".')" />
Generate change listener registration methods. <
xsl:
template name="generate-change-listener">
Process this managed object. <
xsl:
variable name="top-name" select="$this/adm:profile[@name='preprocessor']/admpp:parent-managed-object[last()]/@name" />
<
xsl:
call-
template name="generate-change-listener-help">
<
xsl:
with-
param name="top-name" select="$top-name" />
<
xsl:
with-
param name="name" select="$this-name" />
Process parent hierarchy. select="$this/adm:profile[@name='preprocessor']/admpp:parent-managed-object">
<
xsl:
call-
template name="generate-change-listener-help">
<
xsl:
with-
param name="top-name" select="$top-name" />
<
xsl:
with-
param name="name" select="@name" />
Generate a single set of change listener registration methods. <
xsl:
template name="generate-change-listener-help">
<
xsl:
param name="top-name" select="/.." />
<
xsl:
param name="name" select="/.." />
<
xsl:
variable name="short-name">
<
xsl:
when test="not($top-name) or $top-name = $name">
<
xsl:
value-
of select="''" />
<
xsl:
variable name="top-length" select="string-length($top-name)" />
<
xsl:
variable name="length" select="string-length($name)" />
<
xsl:
variable name="diff" select="$length - $top-length" />
<
xsl:
value-
of select="substring($name, 1, $diff - 1)" />
<
xsl:
variable name="java-class">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="$name" />
<
xsl:
variable name="short-java-class">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="$short-name" />
select="concat(' /**
', select="concat(' public void add', $short-java-class, 'ChangeListener(
', ' ConfigurationChangeListener<',$java-class,'Cfg> listener) {
', <
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="concat(' /**
', select="concat(' public void remove', $short-java-class, 'ChangeListener(
', ' ConfigurationChangeListener<',$java-class,'Cfg> listener) {
', Generate import statements for change-listener <
xsl:
template name="generate-change-listener-import-statements">
Process this managed object. <
xsl:
element name="import">
select="concat($this-package, '.server.', $this-java-class, 'Cfg')" />
Process parent hierarchy. select="$this/adm:profile[@name='preprocessor']/admpp:parent-managed-object">
<
xsl:
variable name="java-class">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="@name" />
<
xsl:
element name="import">
select="concat(@package, '.server.', $java-class, 'Cfg')" />
Generate an enumeration for a locally defined enumerated property. <
xsl:
template name="generate-enumeration">
select="concat(' /**
', ' * Defines the set of permissable values for the "', @name, '" property.
')" />
<
xsl:
if test="adm:synopsis">
<
xsl:
value-
of select="' * <p>
'" />
<
xsl:
call-
template name="add-java-comment">
<
xsl:
with-
param name="indent-text" select="' *'" />
<
xsl:
with-
param name="content" select="adm:synopsis" />
<
xsl:
if test="adm:description">
<
xsl:
value-
of select="' * <p>
'" />
<
xsl:
call-
template name="add-java-comment">
<
xsl:
with-
param name="indent-text" select="' *'" />
<
xsl:
with-
param name="content" select="adm:description" />
select="concat(' */
', ' public static enum ')" />
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="@name" />
<
xsl:
value-
of select="' {
'" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
sort select="@name" />
<
xsl:
value-
of select="' /**
'" />
<
xsl:
call-
template name="add-java-comment">
<
xsl:
with-
param name="indent-text" select="' *'" />
<
xsl:
with-
param name="content" select="adm:description" />
<
xsl:
value-
of select="' */
'" />
<
xsl:
value-
of select="' '" />
<
xsl:
call-
template name="name-to-java-constant">
<
xsl:
with-
param name="value" select="@name" />
<
xsl:
value-
of select="concat('("', @name, '")')" />
<
xsl:
when test="position() != last()">
<
xsl:
value-
of select="',
'" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
value-
of select="';
'" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
select="' // String representation of the value.
'" />
<
xsl:
value-
of select="' private final String name;
'" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
value-
of select="' // Private constructor.
'" />
<
xsl:
value-
of select="' private '" />
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="@name" />
select="concat('(String name) { this.name = name; }
', ' public String toString() { return name; }
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
value-
of select="' }
'" />
Main document parsing template. <
xsl:
call-
template name="copyright-notice" />
select="concat('package ', $this-package, '.meta;
')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-import-statements">
<
xsl:
with-
param name="imports">
test="$this-local-properties[@multi-valued='true' or | $this-local-properties[@mandatory='true']">
<
xsl:
element name="import">
select="concat($this-package, '.client.', $this-java-class, 'CfgClient')" />
<
xsl:
element name="import">
select="concat($this-package, '.server.', $this-java-class, 'Cfg')" />
<
xsl:
for-
each select="$this-inherited-properties">
<
xsl:
call-
template name="get-property-java-imports" />
<
xsl:
for-
each select="$this-all-properties">
name="get-property-definition-java-imports" />
<
xsl:
for-
each select="$this-all-relations">
<
xsl:
variable name="java-class-name">
<
xsl:
call-
template name="name-to-java">
<
xsl:
with-
param name="value" select="@managed-object-name" />
<
xsl:
element name="import">
select="concat(@managed-object-package, '.client.', $java-class-name, 'CfgClient')" />
<
xsl:
element name="import">
select="concat(@managed-object-package, '.server.', $java-class-name, 'Cfg')" />
<
xsl:
when test="$this-is-abstract">
<
xsl:
if test="not($this-is-root)">
name="generate-change-listener-import-statements" />
<
xsl:
if test="$this-all-properties[@multi-valued='true']">
<
xsl:
if test="$this/@extends">
<
xsl:
if test="$parent-package != $this-package">
<
xsl:
element name="import">
select="concat($parent-package, '.meta.', $parent-java-class, 'CfgDefn')" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-meta-class-declaration" />
<
xsl:
text>
</
xsl:
text>
<
xsl:
call-
template name="generate-meta-class-body" />
<
xsl:
text>}
</
xsl:
text>