metaMO.xsl revision 1008
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! CDDL HEADER START
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! The contents of this file are subject to the terms of the
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! Common Development and Distribution License, Version 1.0 only
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! (the "License"). You may not use this file except in compliance
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! with the License.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! You can obtain a copy of the license at
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! See the License for the specific language governing permissions
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! and limitations under the License.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! When distributing Covered Code, include this CDDL HEADER in each
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! file and include the License file at
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! add the following below this CDDL HEADER, with the fields enclosed
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! by brackets "[]" replaced with your own identifying information:
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! Portions Copyright [yyyy] [name of copyright owner]
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! CDDL HEADER END
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ! Portions Copyright 2007 Sun Microsystems, Inc.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott xmlns:admpp="http://www.opends.org/admin-preprocessor"
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:output method="text" encoding="us-ascii" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott Template for generating the class declaration.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:template name="generate-meta-class-declaration">
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:with-param name="indent-text" select="' *'" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott select="concat('An interface for querying the ', $this-ufn,
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ' managed object definition meta information.')" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:value-of select="' * <p>
'" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:with-param name="indent-text" select="' *'" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:with-param name="content" select="$this/adm:synopsis" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott select="concat('public final class ',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott $this-java-class,
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott 'CfgDefn extends ')" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott select="concat('AbstractManagedObjectDefinition<',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott $this-java-class, 'CfgClient, ',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott $this-java-class, 'Cfg> {
')" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott select="concat('ManagedObjectDefinition<',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott $this-java-class, 'CfgClient, ',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott $this-java-class, 'Cfg> {
')" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott Template for generating the meta class body.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:template name="generate-meta-class-body">
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott Singleton configuration definition instance.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott select="concat(' // The singleton configuration definition instance.
',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ' private static final ',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott $this-java-class ,
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott 'CfgDefn INSTANCE = new ', $this-java-class, 'CfgDefn();
')" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott Generate enumerations defined by this managed object..
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott select="$this-local-properties[adm:syntax/adm:enumeration]">
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:call-template name="generate-enumeration" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott Generate declarations for properties defined or
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott overridden by this managed object.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:for-each select="$this-local-properties">
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:call-template name="generate-property-declaration" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott Generate declarations for relations.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:for-each select="$this-local-relations">
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:call-template name="generate-relation-declaration" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott Generate constructors for properties defined or
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott overridden by this managed object.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:for-each select="$this-local-properties">
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:call-template name="generate-property-constructor" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott Generate constructors for relations.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:for-each select="$this-local-relations">
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:call-template name="generate-relation-constructor" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott Configuration definition singleton getter.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:with-param name="indent-text" select="' *'" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott select="concat('Get the ', $this-ufn,' configuration definition singleton.')" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:with-param name="indent-text" select="' *'" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott <xsl:with-param name="indent-text2" select="' * '" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott select="concat('@return Returns the ', $this-ufn,
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ' configuration definition singleton.')" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott select="concat(' public static ',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott $this-java-class ,
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott 'CfgDefn getInstance() {
',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ' return INSTANCE;
',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ' }
')" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott Private constructor.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott select="concat(' /**
',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott ' * Private constructor.
',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott $this-java-class ,
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott 'CfgDefn() {
')" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott select="concat(' super("',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott $parent-java-class,
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott select="concat(' super("',
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott '", null);
')" />
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott Create configuration view factory methods for non-abstract definitions
'Cfg.class;
',
' this.impl = impl;
',
' public ManagedObjectDefinition<? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg> definition() {
',
' impl.commit();
',
' this.impl = impl;
',
' public ManagedObjectDefinition<? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg> definition() {
',
' return impl.getDN();
',
select="concat(' ', $type, '.Builder<', $generic-type, '> builder = ', $type, '.createBuilder("',@name, '");
')" />
select="concat(' ', $type, '.Builder builder = ', $type, '.createBuilder("',@name, '");
')" />
select="' builder.setOption(PropertyOption.MULTI_VALUED);
'" />
select="' builder.setOption(PropertyOption.READ_ONLY);
'" />
test="adm:requires-admin-action/adm:server-restart|adm:requires-admin-action/adm:component-restart|adm:requires-admin-action/adm:other">
select="' builder.setOption(PropertyOption.REQUIRES_ADMIN_ACTION);
'" />
select="' builder.setOption(PropertyOption.MANDATORY);
'" />
select="' builder.setOption(PropertyOption.HIDDEN);
'" />
select="concat(' builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<', $value-type,'>());
')" />
select="concat(' builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<', $value-type,'>());
')" />
select="concat(' builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<', $value-type,'>());
')" />
select="adm:default-behavior/adm:defined/adm:value">
select="' builder.setDefaultBehaviorProvider(provider);
'" />
test="adm:default-behavior/adm:inherited/adm:relative">
test="adm:default-behavior/adm:inherited/adm:absolute">
select="concat(' PD_', $java-prop-name, ' = builder.getInstance();
')" />
select="concat(' INSTANCE.registerPropertyDefinition(PD_', $java-prop-name, ');
')" />
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, ';
')" />
select="concat('Unknown relation type "', local-name(*), '" in relation "', @name, '".')" />
select="concat($java-managed-object-name, 'CfgClient, ', $java-managed-object-name, 'Cfg>(
',
select="concat($java-managed-object-name, 'CfgDefn.getInstance());
')" />
select="concat(' INSTANCE.registerRelationDefinition(RD_', $java-relation-name,');
')" />
test="adm:profile[@name='preprocessor']/admpp:managed-object[@name=$this-name and @package=$this-package]">
$parent-java-class, 'CfgDefn.getInstance().get',
select="concat('Unknown relation type "', local-name(*), '" in relation "', @name, '".')" />
test="adm:profile[@name='preprocessor']/admpp:managed-object[@name=$this-name and @package=$this-package]">
$parent-java-class, 'CfgDefn.getInstance().get',
' return impl.getPropertyValue',
'(INSTANCE.get', $java-prop-name ,
' return impl.getPropertyValues',
'(INSTANCE.get', $java-prop-name ,
' return impl.getChild(INSTANCE.get', $java-relation-name,'RelationDefinition()).getConfiguration();
',
' return impl.hasChild(INSTANCE.get', $java-relation-name,'RelationDefinition());
',
' return impl.getChild(INSTANCE.get', $java-relation-name,'RelationDefinition()).getConfiguration();
',
$java-relation-name, '(ManagedObjectDefinition<M, ?> d, PropertyProvider p) throws OperationsException {
',
' return impl.createChild(INSTANCE.get', $java-relation-name,'RelationDefinition(), d, p).getConfiguration();
',
' impl.removeChild(INSTANCE.get', $java-relation-name,'RelationDefinition());
',
' return impl.listChildren(INSTANCE.get', $java-relation-plural-name,'RelationDefinition());
',
' return impl.getChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), name).getConfiguration();
',
$java-relation-name, '(ManagedObjectDefinition<M, ?> d, String name, PropertyProvider p) throws OperationsException {
',
' return impl.createChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), d, name, p).getConfiguration();
',
' impl.removeChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), name);
',
select="concat('Unknown relation type "', local-name(*), '" in relation "', $name, '".')" />
' return impl.getChild(INSTANCE.get', $java-relation-name, 'RelationDefinition()).getConfiguration();
',
' return impl.hasChild(INSTANCE.get', $java-relation-name, 'RelationDefinition());
',
' return impl.getChild(INSTANCE.get', $java-relation-name, 'RelationDefinition()).getConfiguration();
',
' ConfigurationAddListener<', $java-class-name,'Cfg> listener) throws ConfigException {
',
' impl.registerAddListener(INSTANCE.get', $java-relation-name, 'RelationDefinition(), listener);
',
' impl.deregisterAddListener(INSTANCE.get', $java-relation-name, 'RelationDefinition(), listener);
',
' ConfigurationDeleteListener<', $java-class-name,'Cfg> listener) throws ConfigException {
',
' impl.registerDeleteListener(INSTANCE.get', $java-relation-name, 'RelationDefinition(), listener);
',
' impl.deregisterDeleteListener(INSTANCE.get', $java-relation-name, 'RelationDefinition(), listener);
',
' return impl.listChildren(INSTANCE.get', $java-relation-plural-name,'RelationDefinition());
',
' return impl.getChild(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), name).getConfiguration();
',
' ConfigurationAddListener<', $java-class-name,'Cfg> listener) throws ConfigException {
',
' impl.registerAddListener(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), listener);
',
' impl.deregisterAddListener(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), listener);
',
' ConfigurationDeleteListener<', $java-class-name,'Cfg> listener) throws ConfigException {
',
' impl.registerDeleteListener(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), listener);
',
' impl.deregisterDeleteListener(INSTANCE.get', $java-relation-plural-name, 'RelationDefinition(), listener);
',
select="concat('Unknown relation type "', local-name(*), '" in relation "', $name, '".')" />
' impl.registerChangeListener(listener);
',
' impl.deregisterChangeListener(listener);
',
select="concat('(String name) { this.name = name; }
',
test="$this-local-properties/adm:default-behavior/adm:undefined
test="$this-local-properties/adm:default-behavior/adm:alias">
test="$this-local-properties/adm:default-behavior/adm:defined">