<!--
|
! CDDL HEADER START
|
!
|
! The contents of this file are subject to the terms of the
|
! Common Development and Distribution License, Version 1.0 only
|
! (the "License"). You may not use this file except in compliance
|
! with the License.
|
!
|
! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
|
! or http://forgerock.org/license/CDDLv1.0.html.
|
! See the License for the specific language governing permissions
|
! and limitations under the License.
|
!
|
! When distributing Covered Code, include this CDDL HEADER in each
|
! file and include the License file at legal-notices/CDDLv1_0.txt.
|
! If applicable, add the following below this CDDL HEADER, with the
|
! fields enclosed by brackets "[]" replaced with your own identifying
|
! information:
|
! Portions Copyright [yyyy] [name of copyright owner]
|
!
|
! CDDL HEADER END
|
!
|
!
|
! Copyright 2007-2010 Sun Microsystems, Inc.
|
! Portions copyright 2011 ForgeRock AS.
|
! -->
|
<xsl:stylesheet version="1.0" xmlns:adm="http://opendj.forgerock.org/admin"
|
xmlns:admpp="http://opendj.forgerock.org/admin-preprocessor"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:exsl="http://exslt.org/common">
|
<xsl:import href="java-utilities.xsl" />
|
<xsl:import href="preprocessor.xsl" />
|
<xsl:import href="property-types.xsl" />
|
<xsl:output method="text" encoding="us-ascii" />
|
<!--
|
Template for generating the class declaration.
|
-->
|
<xsl:template name="generate-meta-class-declaration">
|
<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('An interface for querying the ', $this-ufn,
|
' managed object definition meta information.')" />
|
</xsl:call-template>
|
<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:call-template>
|
<xsl:value-of select="' */
'" />
|
<xsl:value-of
|
select="concat('public final class ',
|
$this-java-class,
|
'CfgDefn extends ')" />
|
<xsl:choose>
|
<xsl:when test="$this-is-abstract">
|
<xsl:value-of
|
select="concat('AbstractManagedObjectDefinition<',
|
$this-java-class, 'CfgClient, ',
|
$this-java-class, 'Cfg> {
')" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of
|
select="concat('ManagedObjectDefinition<',
|
$this-java-class, 'CfgClient, ',
|
$this-java-class, 'Cfg> {
')" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:template>
|
<!--
|
Template for generating the meta class body.
|
-->
|
<xsl:template name="generate-meta-class-body">
|
<!--
|
Singleton configuration definition instance.
|
-->
|
<xsl:value-of
|
select="concat(' // The singleton configuration definition instance.
',
|
' private static final ',
|
$this-java-class ,
|
'CfgDefn INSTANCE = new ', $this-java-class, 'CfgDefn();
')" />
|
<!--
|
Generate enumerations defined by this managed object..
|
-->
|
<xsl:for-each
|
select="$this-local-properties[adm:syntax/adm:enumeration and not(adm:profile[@name='preprocessor']/adm:first-defined-in)]">
|
<xsl:sort select="@name" />
|
<xsl:if
|
test="not(adm:profile[@name='preprocessor']/admpp:first-defined-in)">
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:call-template name="generate-enumeration" />
|
</xsl:if>
|
</xsl:for-each>
|
<!--
|
Define application tags if this is the root configuration.
|
-->
|
<xsl:if test="$this-is-root">
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of select="' // Define managed object tags.
'" />
|
<xsl:value-of select="' static {
'" />
|
<xsl:for-each select="$this/adm:tag-definition">
|
<xsl:sort select="@name" />
|
<xsl:value-of
|
select="concat(' Tag.define("', @name, '");
')" />
|
</xsl:for-each>
|
<xsl:value-of select="' }
'" />
|
</xsl:if>
|
<!--
|
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" />
|
</xsl:for-each>
|
<!--
|
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" />
|
</xsl:for-each>
|
<!--
|
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" />
|
</xsl:for-each>
|
<!--
|
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" />
|
</xsl:for-each>
|
<!--
|
Register any optins associated with this managed object definition.
|
-->
|
<xsl:if test="$this-is-advanced or $this-is-hidden">
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="' // Register the options associated with this managed object definition.
'" />
|
<xsl:value-of select="' static {
'" />
|
<xsl:if test="$this-is-advanced">
|
<xsl:value-of
|
select="' INSTANCE.registerOption(ManagedObjectOption.ADVANCED);
'" />
|
</xsl:if>
|
<xsl:if test="$this-is-hidden">
|
<xsl:value-of
|
select="' INSTANCE.registerOption(ManagedObjectOption.HIDDEN);
'" />
|
</xsl:if>
|
<xsl:value-of select="' }
'" />
|
</xsl:if>
|
<!--
|
Register any tags associated with this managed object definition.
|
-->
|
<xsl:if test="$this/adm:tag">
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="' // Register the tags associated with this managed object definition.
'" />
|
<xsl:value-of select="' static {
'" />
|
<xsl:for-each select="$this/adm:tag">
|
<xsl:sort select="@name" />
|
<xsl:value-of
|
select="concat(' INSTANCE.registerTag(Tag.valueOf("', @name, '"));
')" />
|
</xsl:for-each>
|
<xsl:value-of select="' }
'" />
|
</xsl:if>
|
<!--
|
Register any constraints associated with this managed object definition.
|
-->
|
<xsl:if test="$this/adm:constraint">
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="' // Register the constraints associated with this managed object definition.
'" />
|
<xsl:value-of select="' static {
'" />
|
<xsl:for-each select="$this/adm:constraint">
|
<xsl:value-of
|
select="concat(' INSTANCE.registerConstraint(new GenericConstraint(INSTANCE, ', position(), ', ')" />
|
<xsl:apply-templates select="adm:condition/*"
|
mode="compile-condition" />
|
<xsl:value-of select="'));
'" />
|
</xsl:for-each>
|
<xsl:value-of select="' }
'" />
|
</xsl:if>
|
<!--
|
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:call-template>
|
<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:call-template>
|
<xsl:value-of select="' */
'" />
|
<xsl:value-of
|
select="concat(' public static ',
|
$this-java-class ,
|
'CfgDefn getInstance() {
',
|
' return INSTANCE;
',
|
' }
')" />
|
<!--
|
Private constructor.
|
-->
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * Private constructor.
',
|
' */
',
|
' private ',
|
$this-java-class ,
|
'CfgDefn() {
')" />
|
<xsl:choose>
|
<xsl:when test="boolean($this/@extends)">
|
<xsl:value-of
|
select="concat(' super("',
|
$this/@name,
|
'", ',
|
$parent-java-class,
|
'CfgDefn.getInstance());
')" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of
|
select="concat(' super("',
|
$this/@name,
|
'", TopCfgDefn.getInstance());
')" />
|
</xsl:otherwise>
|
</xsl:choose>
|
<xsl:value-of select="' }
'" />
|
<!--
|
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.
|
-->
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public ',
|
$this-java-class,
|
'CfgClient createClientConfiguration(
',
|
' ManagedObject<? extends ',
|
$this-java-class,
|
'CfgClient> impl) {
',
|
' return new ',
|
$this-java-class ,
|
'CfgClientImpl(impl);
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<!--
|
Generate configuration server factory method.
|
-->
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public ',
|
$this-java-class,
|
'Cfg createServerConfiguration(
',
|
' ServerManagedObject<? extends ',$this-java-class,'Cfg> impl) {
',
|
' return new ',
|
$this-java-class ,
|
'CfgServerImpl(impl);
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<!--
|
Generate configuration server class getter..
|
-->
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public Class<',
|
$this-java-class,
|
'Cfg> getServerConfigurationClass() {
',
|
' return ',
|
$this-java-class ,
|
'Cfg.class;
',
|
' }
')" />
|
</xsl:if>
|
<!--
|
Generate property definition getters for all 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" />
|
</xsl:for-each>
|
<!--
|
Generate relation definition getters for all 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" />
|
</xsl:for-each>
|
<!--
|
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" />
|
</xsl:if>
|
</xsl:template>
|
<!--
|
Generate managed object client class implementation.
|
-->
|
<xsl:template name="generate-client-impl-class">
|
<!--
|
Declaration.
|
-->
|
<xsl:value-of
|
select="concat(' /**
',
|
' * Managed object client implementation.
',
|
' */
',
|
' private static class ',
|
$this-java-class ,
|
'CfgClientImpl implements
 ',
|
$this-java-class ,
|
'CfgClient {
')" />
|
<xsl:text>
</xsl:text>
|
<!--
|
Private instance.
|
-->
|
<xsl:value-of
|
select="concat(' // Private implementation.
',
|
' private ManagedObject<? extends ',
|
$this-java-class,
|
'CfgClient> impl;
')" />
|
<!--
|
Private constructor.
|
-->
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' // Private constructor.
',
|
' private ',
|
$this-java-class,
|
'CfgClientImpl(
',
|
' ManagedObject<? extends ',
|
$this-java-class,
|
'CfgClient> impl) {
',
|
' this.impl = impl;
',
|
' }
')" />
|
<!--
|
Getters/Setters for all 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-getter-implementation">
|
<xsl:with-param name="interface" select="'client'" />
|
</xsl:call-template>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:call-template name="generate-property-setter-implementation" />
|
</xsl:for-each>
|
<!--
|
Relation methods.
|
-->
|
<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" />
|
</xsl:for-each>
|
<!--
|
Managed object definition getter.
|
-->
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public ManagedObjectDefinition<? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg> definition() {
',
|
' return INSTANCE;
',
|
' }
')" />
|
<!--
|
Property provider view.
|
-->
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public PropertyProvider properties() {
',
|
' return impl;
',
|
' }
')" />
|
<!--
|
Commit method.
|
-->
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public void commit() throws ManagedObjectAlreadyExistsException,
',
|
' MissingMandatoryPropertiesException, ConcurrentModificationException,
',
|
' OperationRejectedException, ErrorResultException {
',
|
' impl.commit();
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:value-of select="' }
'" />
|
</xsl:template>
|
<!--
|
Generate managed object server class implementation.
|
-->
|
<xsl:template name="generate-server-impl-class">
|
<!--
|
Declaration.
|
-->
|
<xsl:value-of
|
select="concat(' /**
',
|
' * Managed object server implementation.
',
|
' */
',
|
' private static class ',
|
$this-java-class ,
|
'CfgServerImpl implements
 ',
|
$this-java-class ,
|
'Cfg {
')" />
|
<xsl:text>
</xsl:text>
|
<!--
|
Private instance.
|
-->
|
<xsl:value-of
|
select="concat(' // Private implementation.
',
|
' private ServerManagedObject<? extends ', $this-java-class, 'Cfg> impl;
')" />
|
<!--
|
Private members for each property.
|
-->
|
<xsl:for-each select="$this-all-properties">
|
<xsl:sort select="@name" />
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' // The value of the "', @name, '" property.
')" />
|
<xsl:value-of select="' private final '" />
|
<xsl:choose>
|
<xsl:when test="string(@multi-valued) != 'true'">
|
<xsl:choose>
|
<xsl:when test="adm:default-behavior/adm:defined">
|
<!--
|
The property is guaranteed to contain a value since there is a
|
well-defined default value.
|
-->
|
<xsl:call-template
|
name="get-property-java-primitive-type" />
|
</xsl:when>
|
<xsl:when test="@mandatory = 'true'">
|
<!--
|
The property is guaranteed to contain a value in the server interface.
|
-->
|
<xsl:call-template
|
name="get-property-java-primitive-type" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:call-template name="get-property-java-type" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of select="'SortedSet<'" />
|
<xsl:call-template name="get-property-java-type" />
|
<xsl:value-of select="'>'" />
|
</xsl:otherwise>
|
</xsl:choose>
|
<xsl:value-of select="' p'" />
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value" select="@name" />
|
</xsl:call-template>
|
<xsl:value-of select="';
'" />
|
</xsl:for-each>
|
<!--
|
Private constructor.
|
-->
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' // Private constructor.
',
|
' private ',
|
$this-java-class,
|
'CfgServerImpl(ServerManagedObject<? extends ', $this-java-class, 'Cfg> impl) {
',
|
' this.impl = impl;
')" />
|
<xsl:for-each select="$this-all-properties">
|
<xsl:sort select="@name" />
|
<xsl:variable name="java-prop-name">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value" select="@name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:value-of
|
select="concat(' this.p', $java-prop-name, ' = ')" />
|
<xsl:choose>
|
<xsl:when test="string(@multi-valued) != 'true'">
|
<xsl:value-of
|
select="concat('impl.getPropertyValue(INSTANCE.get', $java-prop-name , 'PropertyDefinition());
')" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of
|
select="concat('impl.getPropertyValues(INSTANCE.get', $java-prop-name , 'PropertyDefinition());
')" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:for-each>
|
<xsl:value-of select="' }
'" />
|
<!--
|
Generate all the change listener methods - one for each managed
|
object in the hierarchy.
|
-->
|
<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:if>
|
<!--
|
Getters for all 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-getter-implementation">
|
<xsl:with-param name="interface" select="'server'" />
|
</xsl:call-template>
|
</xsl:for-each>
|
<!--
|
Relation methods.
|
-->
|
<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" />
|
</xsl:for-each>
|
<!--
|
Configuration class getter.
|
-->
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public Class<? extends ', $this-java-class,'Cfg> configurationClass() {
',
|
' return ', $this-java-class, 'Cfg.class;
',
|
' }
')" />
|
<!--
|
Configuration entry DN getter.
|
-->
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public DN dn() {
',
|
' return impl.getDN();
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:value-of select="' }
'" />
|
</xsl:template>
|
<!--
|
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:call-template>
|
</xsl:variable>
|
<xsl:variable name="type">
|
<xsl:call-template name="get-property-definition-type" />
|
</xsl:variable>
|
<xsl:variable name="generic-type">
|
<xsl:call-template name="get-property-definition-generic-type" />
|
</xsl:variable>
|
<xsl:variable name="pdtype">
|
<xsl:choose>
|
<xsl:when test="string-length($generic-type) != 0">
|
<xsl:value-of
|
select="concat($type, '<', $generic-type, '>')" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of select="$type" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:variable>
|
<xsl:value-of
|
select="concat(' // The "',
|
@name,
|
'" property definition.
',
|
' private static final ', $pdtype, ' PD_', $java-prop-name, ';
')" />
|
</xsl:template>
|
<!--
|
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:call-template>
|
</xsl:variable>
|
<xsl:variable name="type">
|
<xsl:call-template name="get-property-definition-type" />
|
</xsl:variable>
|
<xsl:variable name="generic-type">
|
<xsl:call-template name="get-property-definition-generic-type" />
|
</xsl:variable>
|
<xsl:variable name="value-type">
|
<xsl:call-template name="get-property-java-type" />
|
</xsl:variable>
|
<xsl:value-of
|
select="concat(' // Build the "', @name, '" property definition.
',
|
' static {
')" />
|
<xsl:choose>
|
<xsl:when test="string-length($generic-type) != 0">
|
<xsl:value-of
|
select="concat(' ', $type, '.Builder<', $generic-type, '> builder = ', $type, '.createBuilder(INSTANCE, "',@name, '");
')" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of
|
select="concat(' ', $type, '.Builder builder = ', $type, '.createBuilder(INSTANCE, "',@name, '");
')" />
|
</xsl:otherwise>
|
</xsl:choose>
|
<xsl:if test="@multi-valued='true'">
|
<xsl:value-of
|
select="' builder.setOption(PropertyOption.MULTI_VALUED);
'" />
|
</xsl:if>
|
<xsl:if test="@read-only='true'">
|
<xsl:value-of
|
select="' builder.setOption(PropertyOption.READ_ONLY);
'" />
|
</xsl:if>
|
<xsl:if test="@monitoring='true'">
|
<xsl:value-of
|
select="' builder.setOption(PropertyOption.MONITORING);
'" />
|
</xsl:if>
|
<xsl:if test="@mandatory='true'">
|
<xsl:value-of
|
select="' builder.setOption(PropertyOption.MANDATORY);
'" />
|
</xsl:if>
|
<xsl:if test="@hidden='true'">
|
<xsl:value-of
|
select="' builder.setOption(PropertyOption.HIDDEN);
'" />
|
</xsl:if>
|
<xsl:if test="@advanced='true'">
|
<xsl:value-of
|
select="' builder.setOption(PropertyOption.ADVANCED);
'" />
|
</xsl:if>
|
<xsl:variable name="action-type">
|
<xsl:choose>
|
<xsl:when test="adm:requires-admin-action">
|
<xsl:call-template name="name-to-java-constant">
|
<xsl:with-param name="value"
|
select="local-name(adm:requires-admin-action/*)" />
|
</xsl:call-template>
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of select="'NONE'" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:variable>
|
<xsl:value-of
|
select="concat(' builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.', $action-type, ', INSTANCE, "', @name, '"));
')" />
|
<xsl:choose>
|
<xsl:when
|
test="not(adm:default-behavior) or adm:default-behavior/adm:undefined">
|
<xsl:value-of
|
select="concat(' builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<', $value-type,'>());
')" />
|
</xsl:when>
|
<xsl:when test="adm:default-behavior/adm:alias">
|
<xsl:value-of
|
select="concat(' builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<', $value-type,'>(INSTANCE, "', @name, '"));
')" />
|
</xsl:when>
|
<xsl:when test="adm:default-behavior/adm:defined">
|
<xsl:value-of
|
select="concat(' DefaultBehaviorProvider<', $value-type,'> provider = ',
|
'new DefinedDefaultBehaviorProvider<', $value-type,'>(')" />
|
<xsl:for-each
|
select="adm:default-behavior/adm:defined/adm:value">
|
<xsl:value-of
|
select="concat('"', normalize-space(), '"')" />
|
<xsl:if test="position() != last()">
|
<xsl:value-of select="', '" />
|
</xsl:if>
|
</xsl:for-each>
|
<xsl:value-of select="');
'" />
|
<xsl:value-of
|
select="' builder.setDefaultBehaviorProvider(provider);
'" />
|
</xsl:when>
|
<xsl:when
|
test="adm:default-behavior/adm:inherited/adm:relative">
|
<xsl:value-of
|
select="concat(' DefaultBehaviorProvider<', $value-type,'> provider = ',
|
'new RelativeInheritedDefaultBehaviorProvider<', $value-type,'>(')" />
|
<xsl:variable name="managed-object-name">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value"
|
select="adm:default-behavior/adm:inherited/adm:relative/@managed-object-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:variable name="property-name"
|
select="adm:default-behavior/adm:inherited/adm:relative/@property-name" />
|
<xsl:variable name="offset"
|
select="adm:default-behavior/adm:inherited/adm:relative/@offset" />
|
<xsl:value-of
|
select="concat($managed-object-name, 'CfgDefn.getInstance(), "', $property-name, '", ', $offset, ');
')" />
|
<xsl:value-of
|
select="' builder.setDefaultBehaviorProvider(provider);
'" />
|
</xsl:when>
|
<xsl:when
|
test="adm:default-behavior/adm:inherited/adm:absolute">
|
<xsl:value-of
|
select="concat(' DefaultBehaviorProvider<', $value-type,'> provider = ',
|
'new AbsoluteInheritedDefaultBehaviorProvider<', $value-type,'>(')" />
|
<xsl:variable name="property-name"
|
select="adm:default-behavior/adm:inherited/adm:absolute/@property-name" />
|
<xsl:variable name="path"
|
select="adm:default-behavior/adm:inherited/adm:absolute/@path" />
|
<xsl:value-of
|
select="concat('"', $path, '", "', $property-name, '");
')" />
|
<xsl:value-of
|
select="' builder.setDefaultBehaviorProvider(provider);
'" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:message terminate="yes">
|
<xsl:value-of
|
select="concat('Unrecognized default behavior type for property "', @name,
|
'".')" />
|
</xsl:message>
|
</xsl:otherwise>
|
</xsl:choose>
|
<xsl:call-template name="get-property-definition-ctor" />
|
<xsl:value-of
|
select="concat(' PD_', $java-prop-name, ' = builder.getInstance();
')" />
|
<xsl:value-of
|
select="concat(' INSTANCE.registerPropertyDefinition(PD_', $java-prop-name, ');
')" />
|
<xsl:call-template name="get-property-definition-post-ctor" />
|
<xsl:value-of select="' }
'" />
|
</xsl:template>
|
<!--
|
Generate a relation definition declaration.
|
-->
|
<xsl:template name="generate-relation-declaration">
|
<xsl:variable name="relation-name">
|
<xsl:choose>
|
<xsl:when test="adm:one-to-many">
|
<xsl:value-of select="adm:one-to-many/@plural-name" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of select="@name" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:variable>
|
<xsl:variable name="java-relation-name">
|
<xsl:call-template name="name-to-java-constant">
|
<xsl:with-param name="value" select="$relation-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:variable name="java-managed-object-name">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value" select="@managed-object-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:value-of
|
select="concat(' // The "',
|
$relation-name,
|
'" relation definition.
',
|
' private static final ')" />
|
<xsl:choose>
|
<xsl:when test="adm:one-to-one">
|
<xsl:text>SingletonRelationDefinition<</xsl:text>
|
</xsl:when>
|
<xsl:when test="adm:one-to-zero-or-one">
|
<xsl:text>OptionalRelationDefinition<</xsl:text>
|
</xsl:when>
|
<xsl:when test="string(adm:one-to-many/@unique) != 'true'">
|
<xsl:text>InstantiableRelationDefinition<</xsl:text>
|
</xsl:when>
|
<xsl:when test="string(adm:one-to-many/@unique) = 'true'">
|
<xsl:text>SetRelationDefinition<</xsl:text>
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:message terminate="yes">
|
<xsl:value-of
|
select="concat('Unknown relation type "', local-name(*), '" in relation "', @name, '".')" />
|
</xsl:message>
|
</xsl:otherwise>
|
</xsl:choose>
|
<xsl:value-of
|
select="concat($java-managed-object-name, 'CfgClient, ', $java-managed-object-name, 'Cfg> RD_', $java-relation-name, ';
')" />
|
</xsl:template>
|
<!--
|
Generate a relation definition constructor.
|
-->
|
<xsl:template name="generate-relation-constructor">
|
<xsl:variable name="relation-name">
|
<xsl:choose>
|
<xsl:when test="adm:one-to-many">
|
<xsl:value-of select="adm:one-to-many/@plural-name" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of select="@name" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:variable>
|
<xsl:variable name="java-relation-name">
|
<xsl:call-template name="name-to-java-constant">
|
<xsl:with-param name="value" select="$relation-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:variable name="java-managed-object-name">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value" select="@managed-object-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:variable name="java-relation-builder-type">
|
<xsl:choose>
|
<xsl:when test="adm:one-to-one">
|
<xsl:text>SingletonRelationDefinition</xsl:text>
|
</xsl:when>
|
<xsl:when test="adm:one-to-zero-or-one">
|
<xsl:text>OptionalRelationDefinition</xsl:text>
|
</xsl:when>
|
<xsl:when test="string(adm:one-to-many/@unique) != 'true'">
|
<xsl:text>InstantiableRelationDefinition</xsl:text>
|
</xsl:when>
|
<xsl:when test="string(adm:one-to-many/@unique) = 'true'">
|
<xsl:text>SetRelationDefinition</xsl:text>
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:message terminate="yes">
|
<xsl:value-of
|
select="concat('Unknown relation type "', local-name(*), '" in relation "', @name, '".')" />
|
</xsl:message>
|
</xsl:otherwise>
|
</xsl:choose>
|
<xsl:value-of
|
select="concat('.Builder<', $java-managed-object-name, 'CfgClient, ', $java-managed-object-name, 'Cfg>')" />
|
</xsl:variable>
|
<xsl:value-of
|
select="concat(' // Build the "', $relation-name, '" relation definition.
',
|
' static {
',
|
' ', $java-relation-builder-type, ' builder =
',
|
' new ', $java-relation-builder-type, '(INSTANCE, "', @name, '", ')" />
|
<xsl:if test="adm:one-to-many">
|
<xsl:value-of
|
select="concat('"', adm:one-to-many/@plural-name, '", ')" />
|
</xsl:if>
|
<xsl:value-of
|
select="concat($java-managed-object-name, 'CfgDefn.getInstance());
')" />
|
<xsl:if test="adm:one-to-many/@naming-property">
|
<xsl:if test="string(adm:one-to-many/@unique) = 'true'">
|
<xsl:message terminate="yes">
|
<xsl:value-of
|
select="concat('Naming properties found in unique one-to-many relation "', @name, '".')" />
|
</xsl:message>
|
</xsl:if>
|
<xsl:variable name="java-property-name">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value"
|
select="adm:one-to-many/@naming-property" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:value-of
|
select="concat(' builder.setNamingProperty(',
|
$java-managed-object-name,
|
'CfgDefn.getInstance().get',
|
$java-property-name, 'PropertyDefinition());
')" />
|
</xsl:if>
|
<xsl:for-each select="*/adm:default-managed-object">
|
<xsl:variable name="dmo-java-name">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value" select="@managed-object-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:value-of select="' {
'" />
|
<xsl:value-of
|
select="concat(' DefaultManagedObject.Builder<',
|
$dmo-java-name, 'CfgClient, ',
|
$dmo-java-name, 'Cfg> dmoBuilder = new DefaultManagedObject.Builder<',
|
$dmo-java-name, 'CfgClient, ',
|
$dmo-java-name, 'Cfg>(',
|
$dmo-java-name, 'CfgDefn.getInstance());
')" />
|
<xsl:for-each select="adm:property">
|
<xsl:value-of
|
select="concat(' dmoBuilder.setPropertyValues("', @name, '"')" />
|
<xsl:for-each select="adm:value">
|
<xsl:value-of
|
select="concat(', "', normalize-space(), '"')" />
|
</xsl:for-each>
|
<xsl:value-of select="');
'" />
|
</xsl:for-each>
|
<xsl:choose>
|
<xsl:when test="@name">
|
<xsl:value-of
|
select="concat(' builder.setDefaultManagedObject("', @name, '", dmoBuilder.getInstance());
')" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of
|
select="' builder.setDefaultManagedObject(dmoBuilder.getInstance());
'" />
|
</xsl:otherwise>
|
</xsl:choose>
|
<xsl:value-of select="' }
'" />
|
</xsl:for-each>
|
<xsl:if test="@advanced='true'">
|
<xsl:value-of
|
select="' builder.setOption(RelationOption.ADVANCED);
'" />
|
</xsl:if>
|
<xsl:if test="@hidden='true'">
|
<xsl:value-of
|
select="' builder.setOption(RelationOption.HIDDEN);
'" />
|
</xsl:if>
|
<xsl:value-of
|
select="concat(' RD_', $java-relation-name, ' = builder.getInstance();
')" />
|
<xsl:value-of
|
select="concat(' INSTANCE.registerRelationDefinition(RD_', $java-relation-name,');
')" />
|
<xsl:value-of select="' }
'" />
|
</xsl:template>
|
<!--
|
Generate a property definition getter for a locally defined
|
or overriden property.
|
-->
|
<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:call-template>
|
</xsl:variable>
|
<xsl:variable name="java-prop-name-constant">
|
<xsl:call-template name="name-to-java-constant">
|
<xsl:with-param name="value" select="@name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:variable name="type">
|
<xsl:call-template name="get-property-definition-type" />
|
</xsl:variable>
|
<xsl:variable name="generic-type">
|
<xsl:call-template name="get-property-definition-generic-type" />
|
</xsl:variable>
|
<xsl:variable name="pdtype">
|
<xsl:choose>
|
<xsl:when test="string-length($generic-type) != 0">
|
<xsl:value-of
|
select="concat($type, '<', $generic-type, '>')" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of select="$type" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:variable>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * Get the "',
|
@name,
|
'" 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:call-template>
|
</xsl:if>
|
<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" />
|
</xsl:call-template>
|
</xsl:if>
|
<xsl:choose>
|
<xsl:when
|
test="adm:profile[@name='preprocessor']/admpp:last-defined-in[@name=$this-name and @package=$this-package]">
|
<xsl:value-of
|
select="concat(' *
',
|
' * @return Returns the "',
|
@name,
|
'" property definition.
',
|
' */
',
|
' public ',
|
$pdtype,
|
' get',
|
$java-prop-name,
|
'PropertyDefinition() {
' ,
|
' return PD_',
|
$java-prop-name-constant ,
|
';
' ,
|
' }
')" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of
|
select="concat(' *
',
|
' * @return Returns the "',
|
@name,
|
'" property definition.
',
|
' */
',
|
' public ',
|
$pdtype,
|
' get',
|
$java-prop-name,
|
'PropertyDefinition() {
' ,
|
' return ',
|
$parent-java-class, 'CfgDefn.getInstance().get',
|
$java-prop-name,
|
'PropertyDefinition();
',
|
' }
')" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:template>
|
<!--
|
Generate a relation definition getter.
|
-->
|
<xsl:template name="generate-relation-definition-getter">
|
<xsl:variable name="relation-name">
|
<xsl:choose>
|
<xsl:when test="adm:one-to-many">
|
<xsl:value-of select="adm:one-to-many/@plural-name" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of select="@name" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:variable>
|
<xsl:variable name="java-relation-name">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value" select="$relation-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:variable name="java-relation-name-constant">
|
<xsl:call-template name="name-to-java-constant">
|
<xsl:with-param name="value" select="$relation-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * Get the "',
|
$relation-name,
|
'" relation definition.
',
|
' *
',
|
' * @return Returns the "',
|
$relation-name,
|
'" relation definition.
',
|
' */
',
|
' public ')" />
|
<xsl:choose>
|
<xsl:when test="adm:one-to-one">
|
<xsl:text>SingletonRelationDefinition<</xsl:text>
|
</xsl:when>
|
<xsl:when test="adm:one-to-zero-or-one">
|
<xsl:text>OptionalRelationDefinition<</xsl:text>
|
</xsl:when>
|
<xsl:when test="string(adm:one-to-many/@unique) != 'true'">
|
<xsl:text>InstantiableRelationDefinition<</xsl:text>
|
</xsl:when>
|
<xsl:when test="string(adm:one-to-many/@unique) = 'true'">
|
<xsl:text>SetRelationDefinition<</xsl:text>
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:message terminate="yes">
|
<xsl:value-of
|
select="concat('Unknown relation type "', local-name(*), '" in relation "', @name, '".')" />
|
</xsl:message>
|
</xsl:otherwise>
|
</xsl:choose>
|
<xsl:variable name="java-managed-object-name">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value" select="@managed-object-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:choose>
|
<xsl:when
|
test="adm:profile[@name='preprocessor']/admpp:last-defined-in[@name=$this-name and @package=$this-package]">
|
<xsl:value-of
|
select="concat($java-managed-object-name, 'CfgClient,',
|
$java-managed-object-name, 'Cfg> get',
|
$java-relation-name,
|
'RelationDefinition() {
' ,
|
' return RD_',
|
$java-relation-name-constant,
|
';
' ,
|
' }
')" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of
|
select="concat($java-managed-object-name, 'CfgClient,',
|
$java-managed-object-name, 'Cfg> get',
|
$java-relation-name,
|
'RelationDefinition() {
' ,
|
' return ',
|
$parent-java-class, 'CfgDefn.getInstance().get',
|
$java-relation-name,
|
'RelationDefinition();
',
|
' }
')" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:template>
|
<!--
|
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:call-template>
|
</xsl:variable>
|
<xsl:variable name="java-class-name">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value" select="@managed-object-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:choose>
|
<xsl:when test="adm:one-to-one">
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public ', $java-class-name, 'CfgClient get', $java-relation-name, '()
',
|
' throws DefinitionDecodingException, ManagedObjectDecodingException,
',
|
' ManagedObjectNotFoundException, ConcurrentModificationException,
',
|
' ErrorResultException {
',
|
' return impl.getChild(INSTANCE.get', $java-relation-name,'RelationDefinition()).getConfiguration();
',
|
' }
')" />
|
</xsl:when>
|
<xsl:when test="adm:one-to-zero-or-one">
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public boolean has', $java-relation-name, '() throws ConcurrentModificationException,
',
|
' ErrorResultException {
',
|
' return impl.hasChild(INSTANCE.get', $java-relation-name,'RelationDefinition());
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public ', $java-class-name, 'CfgClient get', $java-relation-name, '()
',
|
' throws DefinitionDecodingException, ManagedObjectDecodingException,
',
|
' ManagedObjectNotFoundException, ConcurrentModificationException,
',
|
' ErrorResultException {
',
|
' return impl.getChild(INSTANCE.get', $java-relation-name,'RelationDefinition()).getConfiguration();
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public <M extends ', $java-class-name, 'CfgClient> M create', $java-relation-name, '(
',
|
' ManagedObjectDefinition<M, ? extends ', $java-class-name,'Cfg> d, Collection<DefaultBehaviorException> exceptions) {
',
|
' return impl.createChild(INSTANCE.get', $java-relation-name,'RelationDefinition(), d, exceptions).getConfiguration();
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public void remove', $java-relation-name, '()
',
|
' throws ManagedObjectNotFoundException, ConcurrentModificationException,
',
|
' OperationRejectedException, ErrorResultException {
',
|
' impl.removeChild(INSTANCE.get', $java-relation-name,'RelationDefinition());
',
|
' }
')" />
|
</xsl:when>
|
<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" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public String[] list', $java-relation-plural-name, '() throws ConcurrentModificationException,
',
|
' ErrorResultException {
',
|
' return impl.listChildren(INSTANCE.get', $java-relation-plural-name,'RelationDefinition());
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public ', $java-class-name, 'CfgClient get', $java-relation-name, '(String name)
',
|
' throws DefinitionDecodingException, ManagedObjectDecodingException,
',
|
' ManagedObjectNotFoundException, ConcurrentModificationException,
',
|
' ErrorResultException {
',
|
' return impl.getChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), name).getConfiguration();
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:choose>
|
<xsl:when test="string(adm:one-to-many/@unique) != 'true'">
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public <M extends ', $java-class-name, 'CfgClient> M create', $java-relation-name, '(
',
|
' ManagedObjectDefinition<M, ? extends ', $java-class-name,'Cfg> d, String name, Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException {
',
|
' return impl.createChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), d, name, exceptions).getConfiguration();
',
|
' }
')" />
|
</xsl:when>
|
<xsl:when test="string(adm:one-to-many/@unique) = 'true'">
|
<!-- Unique one-to-many children are named implicitly by their definition -->
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public <M extends ', $java-class-name, 'CfgClient> M create', $java-relation-name, '(
',
|
' ManagedObjectDefinition<M, ? extends ', $java-class-name,'Cfg> d, Collection<DefaultBehaviorException> exceptions) {
',
|
' return impl.createChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), d, exceptions).getConfiguration();
',
|
' }
')" />
|
</xsl:when>
|
</xsl:choose>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public void remove', $java-relation-name, '(String name)
',
|
' throws ManagedObjectNotFoundException, ConcurrentModificationException,
',
|
' OperationRejectedException, ErrorResultException {
',
|
' impl.removeChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), name);
',
|
' }
')" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:message terminate="yes">
|
<xsl:value-of
|
select="concat('Unknown relation type "', local-name(*), '" in relation "', $name, '".')" />
|
</xsl:message>
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:template>
|
<!--
|
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:call-template>
|
</xsl:variable>
|
<xsl:variable name="java-class-name">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value" select="@managed-object-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:choose>
|
<xsl:when test="adm:one-to-one">
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public ', $java-class-name, 'Cfg get',
|
$java-relation-name, '() throws ConfigException {
',
|
' return impl.getChild(INSTANCE.get', $java-relation-name, 'RelationDefinition()).getConfiguration();
',
|
' }
')" />
|
</xsl:when>
|
<xsl:when test="adm:one-to-zero-or-one">
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public boolean has',
|
$java-relation-name, '() {
',
|
' return impl.hasChild(INSTANCE.get', $java-relation-name, 'RelationDefinition());
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public ', $java-class-name, 'Cfg get',
|
$java-relation-name, '() throws ConfigException {
',
|
' return impl.getChild(INSTANCE.get', $java-relation-name, 'RelationDefinition()).getConfiguration();
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public void add', $java-relation-name, 'AddListener(
',
|
' ConfigurationAddListener<', $java-class-name,'Cfg> listener) throws ConfigException {
',
|
' impl.registerAddListener(INSTANCE.get', $java-relation-name, 'RelationDefinition(), listener);
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public void remove', $java-relation-name, 'AddListener(
',
|
' ConfigurationAddListener<', $java-class-name,'Cfg> listener) {
',
|
' impl.deregisterAddListener(INSTANCE.get', $java-relation-name, 'RelationDefinition(), listener);
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public void add', $java-relation-name, 'DeleteListener(
',
|
' ConfigurationDeleteListener<', $java-class-name,'Cfg> listener) throws ConfigException {
',
|
' impl.registerDeleteListener(INSTANCE.get', $java-relation-name, 'RelationDefinition(), listener);
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public void remove', $java-relation-name, 'DeleteListener(
',
|
' ConfigurationDeleteListener<', $java-class-name,'Cfg> listener) {
',
|
' impl.deregisterDeleteListener(INSTANCE.get', $java-relation-name, 'RelationDefinition(), listener);
',
|
' }
')" />
|
</xsl:when>
|
<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" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public String[] list',
|
$java-relation-plural-name, '() {
',
|
' return impl.listChildren(INSTANCE.get', $java-relation-plural-name,'RelationDefinition());
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public ', $java-class-name, 'Cfg get',
|
$java-relation-name, '(String name) throws ConfigException {
',
|
' return impl.getChild(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), name).getConfiguration();
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public void add', $java-relation-name, 'AddListener(
',
|
' ConfigurationAddListener<', $java-class-name,'Cfg> listener) throws ConfigException {
',
|
' impl.registerAddListener(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), listener);
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public void remove', $java-relation-name, 'AddListener(
',
|
' ConfigurationAddListener<', $java-class-name,'Cfg> listener) {
',
|
' impl.deregisterAddListener(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), listener);
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public void add', $java-relation-name, 'DeleteListener(
',
|
' ConfigurationDeleteListener<', $java-class-name,'Cfg> listener) throws ConfigException {
',
|
' impl.registerDeleteListener(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), listener);
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public void remove', $java-relation-name, 'DeleteListener(
',
|
' ConfigurationDeleteListener<', $java-class-name,'Cfg> listener) {
',
|
' impl.deregisterDeleteListener(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), listener);
',
|
' }
')" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:message terminate="yes">
|
<xsl:value-of
|
select="concat('Unknown relation type "', local-name(*), '" in relation "', $name, '".')" />
|
</xsl:message>
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:template>
|
<!--
|
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" />
|
</xsl:call-template>
|
<!--
|
Process parent hierarchy.
|
-->
|
<xsl:for-each
|
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" />
|
</xsl:call-template>
|
</xsl:for-each>
|
</xsl:template>
|
<!--
|
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="_top-length" select="string-length($top-name)" />
|
<xsl:variable name="_length" select="string-length($name)" />
|
<xsl:variable name="_diff" select="$_length - $_top-length" />
|
<xsl:variable name="_start" select="substring($name, 1, $_diff - 1)" />
|
<xsl:variable name="_middle" select="substring($name, $_diff, 1)" />
|
<xsl:variable name="_end"
|
select="substring($name, $_diff + 1, $_top-length)" />
|
|
<xsl:variable name="short-name">
|
<xsl:choose>
|
<xsl:when test="not($top-name) or $top-name = $name">
|
<xsl:value-of select="''" />
|
</xsl:when>
|
<xsl:when test="$_middle != '-' or $_end != $_top-name">
|
<xsl:value-of select="$name" />
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of select="$_start" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:variable>
|
|
<xsl:variable name="java-class">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value" select="$name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:variable name="short-java-class">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value" select="$short-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
')" />
|
<xsl:value-of
|
select="concat(' public void add', $short-java-class, 'ChangeListener(
',
|
' ConfigurationChangeListener<',$java-class,'Cfg> listener) {
',
|
' impl.registerChangeListener(listener);
',
|
' }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
select="concat(' /**
',
|
' * {@inheritDoc}
',
|
' */
')" />
|
<xsl:value-of
|
select="concat(' public void remove', $short-java-class, 'ChangeListener(
',
|
' ConfigurationChangeListener<',$java-class,'Cfg> listener) {
',
|
' impl.deregisterChangeListener(listener);
',
|
' }
')" />
|
</xsl:template>
|
<!--
|
Generate import statements for change-listener
|
-->
|
<xsl:template name="generate-change-listener-import-statements">
|
<!--
|
Process this managed object.
|
-->
|
<xsl:element name="import">
|
<xsl:value-of
|
select="concat($this-package, '.server.', $this-java-class, 'Cfg')" />
|
</xsl:element>
|
<!--
|
Process parent hierarchy.
|
-->
|
<xsl:for-each
|
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:call-template>
|
</xsl:variable>
|
<xsl:element name="import">
|
<xsl:value-of
|
select="concat(@package, '.server.', $java-class, 'Cfg')" />
|
</xsl:element>
|
</xsl:for-each>
|
</xsl:template>
|
<!--
|
Generate an enumeration for a locally defined enumerated property.
|
-->
|
<xsl:template name="generate-enumeration">
|
<xsl:value-of
|
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:call-template>
|
</xsl:if>
|
<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" />
|
</xsl:call-template>
|
</xsl:if>
|
<xsl:value-of
|
select="concat(' */
',
|
' public static enum ')" />
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value" select="@name" />
|
</xsl:call-template>
|
<xsl:value-of select="' {
'" />
|
<xsl:text>
</xsl:text>
|
<xsl:for-each select="adm:syntax/adm:enumeration/adm:value">
|
<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:synopsis" />
|
</xsl:call-template>
|
<xsl:value-of select="' */
'" />
|
<xsl:value-of select="' '" />
|
<xsl:call-template name="name-to-java-constant">
|
<xsl:with-param name="value" select="@name" />
|
</xsl:call-template>
|
<xsl:value-of select="concat('("', @name, '")')" />
|
<xsl:choose>
|
<xsl:when test="position() != last()">
|
<xsl:value-of select="',
'" />
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:value-of select="';
'" />
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:for-each>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
<xsl:value-of
|
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" />
|
</xsl:call-template>
|
<xsl:value-of
|
select="concat('(String name) { this.name = name; }
',
|
'
',
|
'
',
|
'
',
|
' /**
',
|
' * {@inheritDoc}
',
|
' */
',
|
' public String toString() { return name; }
')" />
|
<xsl:text>
</xsl:text>
|
<xsl:value-of select="' }
'" />
|
</xsl:template>
|
<!--
|
Main document parsing template.
|
-->
|
<xsl:template match="/">
|
<!-- Perform some initial validation.
|
-->
|
<xsl:for-each select="$this-all-properties">
|
<!--
|
Check that all non-mandatory properties have a default behavior.
|
-->
|
<xsl:if
|
test="not(@mandatory='true') and not(adm:default-behavior)">
|
<xsl:message terminate="yes">
|
<xsl:value-of
|
select="concat('No default behavior defined for non-mandatory property "', @name,
|
'".')" />
|
</xsl:message>
|
</xsl:if>
|
<!--
|
Check that all advanced properties conform to one of
|
the following rules:
|
|
* is mandatory and has a defined default value(s)
|
* is mandatory and is part of an advanced managed object
|
* is mandatory and is part of an abstract managed object
|
* is not mandatory
|
-->
|
<xsl:choose>
|
<xsl:when test="$this-is-advanced">
|
<!-- OK -->
|
</xsl:when>
|
<xsl:when test="$this-is-abstract">
|
<!-- OK -->
|
</xsl:when>
|
<xsl:when test="@advanced='true' and @mandatory='true'">
|
<xsl:choose>
|
<xsl:when test="adm:default-behavior/adm:defined">
|
<!-- OK -->
|
</xsl:when>
|
<xsl:when test="adm:default-behavior/adm:inherited">
|
<!-- OK -->
|
</xsl:when>
|
<xsl:otherwise>
|
<xsl:message terminate="yes">
|
<xsl:value-of
|
select="concat('Advanced property "', @name,
|
'" must have defined or inherited default values.')" />
|
</xsl:message>
|
</xsl:otherwise>
|
</xsl:choose>
|
</xsl:when>
|
</xsl:choose>
|
</xsl:for-each>
|
<!--
|
Now generate the definition.
|
-->
|
<xsl:call-template name="copyright-notice" />
|
<xsl:value-of
|
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">
|
<xsl:if test="not(boolean($this/@extends))">
|
<import>org.forgerock.opendj.config.TopCfgDefn</import>
|
</xsl:if>
|
<xsl:if test="$this/adm:constraint">
|
<import>org.forgerock.opendj.config.GenericConstraint</import>
|
<import>org.forgerock.opendj.config.conditions.Conditions</import>
|
</xsl:if>
|
<xsl:if
|
test="$this-local-properties[@multi-valued='true' or
|
@read-only='true' or
|
@monitoring='true' or
|
@hidden='true' or
|
@advanced='true' or
|
@mandatory='true']">
|
<import>org.forgerock.opendj.config.PropertyOption</import>
|
</xsl:if>
|
<xsl:if test="$this-local-properties">
|
<import>org.forgerock.opendj.config.AdministratorAction</import>
|
</xsl:if>
|
<xsl:if test="$this/adm:tag-definition or $this/adm:tag">
|
<import>org.forgerock.opendj.config.Tag</import>
|
</xsl:if>
|
<xsl:if
|
test="$this-local-properties[adm:default-behavior/adm:undefined or not(adm:default-behavior)]">
|
<import>
|
org.forgerock.opendj.config.UndefinedDefaultBehaviorProvider
|
</import>
|
</xsl:if>
|
<xsl:if
|
test="$this-local-properties/adm:default-behavior/adm:alias">
|
<import>
|
org.forgerock.opendj.config.AliasDefaultBehaviorProvider
|
</import>
|
</xsl:if>
|
<xsl:if
|
test="$this-local-properties/adm:default-behavior/adm:inherited/adm:absolute">
|
<import>
|
org.forgerock.opendj.config.AbsoluteInheritedDefaultBehaviorProvider
|
</import>
|
<import>
|
org.forgerock.opendj.config.DefaultBehaviorProvider
|
</import>
|
</xsl:if>
|
<xsl:if
|
test="$this-local-properties/adm:default-behavior/adm:inherited/adm:relative">
|
<import>
|
org.forgerock.opendj.config.RelativeInheritedDefaultBehaviorProvider
|
</import>
|
<import>
|
org.forgerock.opendj.config.DefaultBehaviorProvider
|
</import>
|
<xsl:for-each
|
select="$this-local-properties/adm:default-behavior/adm:inherited/adm:relative">
|
<xsl:if test="@managed-object-package != $this-package">
|
<xsl:variable name="java-class-name">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value"
|
select="@managed-object-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:element name="import">
|
<xsl:value-of
|
select="concat(@managed-object-package, '.meta.', $java-class-name, 'CfgDefn')" />
|
</xsl:element>
|
</xsl:if>
|
</xsl:for-each>
|
</xsl:if>
|
<xsl:if
|
test="$this-local-properties/adm:default-behavior/adm:defined">
|
<import>
|
org.forgerock.opendj.config.DefinedDefaultBehaviorProvider
|
</import>
|
<import>
|
org.forgerock.opendj.config.DefaultBehaviorProvider
|
</import>
|
</xsl:if>
|
<xsl:element name="import">
|
<xsl:value-of
|
select="concat($this-package, '.client.', $this-java-class, 'CfgClient')" />
|
</xsl:element>
|
<xsl:element name="import">
|
<xsl:value-of
|
select="concat($this-package, '.server.', $this-java-class, 'Cfg')" />
|
</xsl:element>
|
<xsl:for-each select="$this-inherited-properties">
|
<xsl:call-template name="get-property-java-imports">
|
<xsl:with-param name="interface" select="'server'" />
|
</xsl:call-template>
|
</xsl:for-each>
|
<xsl:for-each select="$this-all-properties">
|
<xsl:call-template
|
name="get-property-definition-java-imports" />
|
</xsl:for-each>
|
<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:call-template>
|
</xsl:variable>
|
<xsl:element name="import">
|
<xsl:value-of
|
select="concat(@managed-object-package, '.client.', $java-class-name, 'CfgClient')" />
|
</xsl:element>
|
<xsl:element name="import">
|
<xsl:value-of
|
select="concat(@managed-object-package, '.server.', $java-class-name, 'Cfg')" />
|
</xsl:element>
|
</xsl:for-each>
|
<xsl:if
|
test="$this-local-relations/*/adm:default-managed-object">
|
<import>org.forgerock.opendj.config.DefaultManagedObject</import>
|
</xsl:if>
|
<xsl:for-each
|
select="$this-local-relations/*/adm:default-managed-object">
|
<xsl:variable name="java-class-name">
|
<xsl:call-template name="name-to-java">
|
<xsl:with-param name="value"
|
select="@managed-object-name" />
|
</xsl:call-template>
|
</xsl:variable>
|
<xsl:element name="import">
|
<xsl:value-of
|
select="concat(@managed-object-package, '.client.', $java-class-name, 'CfgClient')" />
|
</xsl:element>
|
<xsl:element name="import">
|
<xsl:value-of
|
select="concat(@managed-object-package, '.server.', $java-class-name, 'Cfg')" />
|
</xsl:element>
|
<xsl:element name="import">
|
<xsl:value-of
|
select="concat(@managed-object-package, '.meta.', $java-class-name, 'CfgDefn')" />
|
</xsl:element>
|
</xsl:for-each>
|
<xsl:if
|
test="$this-local-relations[@advanced='true' or @hidden='true']">
|
<import>org.forgerock.opendj.config.RelationOption</import>
|
</xsl:if>
|
<xsl:if test="$this-is-hidden or $this-is-advanced">
|
<import>org.forgerock.opendj.config.ManagedObjectOption</import>
|
</xsl:if>
|
<xsl:if test="$this-all-relations/adm:one-to-many[not(@unique = 'true')]">
|
<import>
|
org.forgerock.opendj.config.InstantiableRelationDefinition
|
</import>
|
</xsl:if>
|
<xsl:if test="$this-all-relations/adm:one-to-many[@unique = 'true']">
|
<import>
|
org.forgerock.opendj.config.SetRelationDefinition
|
</import>
|
</xsl:if>
|
<xsl:if test="$this-all-relations/adm:one-to-zero-or-one">
|
<import>
|
org.forgerock.opendj.config.OptionalRelationDefinition
|
</import>
|
</xsl:if>
|
<xsl:if test="$this-all-relations/adm:one-to-one">
|
<import>
|
org.forgerock.opendj.config.SingletonRelationDefinition
|
</import>
|
</xsl:if>
|
<xsl:choose>
|
<xsl:when test="$this-is-abstract">
|
<import>
|
org.forgerock.opendj.config.AbstractManagedObjectDefinition
|
</import>
|
</xsl:when>
|
<xsl:otherwise>
|
<import>
|
org.forgerock.opendj.config.ManagedObjectDefinition
|
</import>
|
<import>org.forgerock.opendj.config.PropertyProvider</import>
|
<import>
|
org.forgerock.opendj.config.client.MissingMandatoryPropertiesException
|
</import>
|
<import>
|
org.forgerock.opendj.config.ManagedObjectAlreadyExistsException
|
</import>
|
<import>
|
org.forgerock.opendj.ldap.ErrorResultException
|
</import>
|
<import>
|
org.forgerock.opendj.config.client.ConcurrentModificationException
|
</import>
|
<import>
|
org.forgerock.opendj.config.client.OperationRejectedException
|
</import>
|
<import>
|
org.forgerock.opendj.config.client.ManagedObject
|
</import>
|
<import>
|
org.forgerock.opendj.config.server.ServerManagedObject
|
</import>
|
<xsl:if test="not($this-is-root)">
|
<import>
|
org.forgerock.opendj.config.server.ConfigurationChangeListener
|
</import>
|
<xsl:call-template
|
name="generate-change-listener-import-statements" />
|
</xsl:if>
|
<import>org.forgerock.opendj.ldap.DN</import>
|
<xsl:if test="$this-all-relations">
|
<import>
|
org.forgerock.opendj.config.DefinitionDecodingException
|
</import>
|
<import>
|
org.forgerock.opendj.config.ManagedObjectNotFoundException
|
</import>
|
<import>
|
org.forgerock.opendj.config.client.ManagedObjectDecodingException
|
</import>
|
</xsl:if>
|
<xsl:if test="$this-all-relations/adm:one-to-many">
|
<import>java.util.Collection</import>
|
<xsl:if test="$this-all-relations/adm:one-to-many[not(@unique = 'true')]">
|
<import>
|
org.forgerock.opendj.config.client.IllegalManagedObjectNameException
|
</import>
|
</xsl:if>
|
<import>
|
org.forgerock.opendj.config.DefaultBehaviorException
|
</import>
|
<import>
|
org.forgerock.opendj.config.server.ConfigurationAddListener
|
</import>
|
<import>
|
org.forgerock.opendj.config.server.ConfigurationDeleteListener
|
</import>
|
<import>org.forgerock.opendj.config.server.ConfigException</import>
|
</xsl:if>
|
<xsl:if test="$this-all-relations/adm:one-to-zero-or-one">
|
<import>java.util.Collection</import>
|
<import>
|
org.forgerock.opendj.config.DefaultBehaviorException
|
</import>
|
<import>
|
org.forgerock.opendj.config.server.ConfigurationAddListener
|
</import>
|
<import>
|
org.forgerock.opendj.config.server.ConfigurationDeleteListener
|
</import>
|
<import>org.forgerock.opendj.config.server.ConfigException</import>
|
</xsl:if>
|
<xsl:if test="$this-all-relations/adm:one-to-one">
|
<import>org.forgerock.opendj.config.server.ConfigException</import>
|
</xsl:if>
|
<xsl:if test="$this-all-properties[@multi-valued='true']">
|
<import>java.util.SortedSet</import>
|
<import>java.util.Collection</import>
|
</xsl:if>
|
<xsl:if test="$this-all-properties[@read-only='true']">
|
<import>
|
org.forgerock.opendj.config.PropertyIsReadOnlyException
|
</import>
|
</xsl:if>
|
</xsl:otherwise>
|
</xsl:choose>
|
<xsl:if test="$this/@extends">
|
<xsl:if test="$parent-package != $this-package">
|
<xsl:element name="import">
|
<xsl:value-of
|
select="concat($parent-package, '.meta.', $parent-java-class, 'CfgDefn')" />
|
</xsl:element>
|
</xsl:if>
|
</xsl:if>
|
</xsl:with-param>
|
</xsl:call-template>
|
<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>
|
</xsl:template>
|
</xsl:stylesheet>
|