From e3acbc5e70b15dc5ca1134cd0ae4501b424d160f Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 15 Jun 2007 08:18:40 +0000
Subject: [PATCH] Partial fix for issue 1426: improve support for required admin actions.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ClassPropertyDefinitionTest.java | 29 -
opends/src/server/org/opends/server/admin/BooleanPropertyDefinition.java | 7
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/SizePropertyDefinitionTest.java | 10
opends/resource/admin/admin.xsd | 78 ++++-
opends/src/server/org/opends/server/admin/PropertyDefinition.java | 48 +++
opends/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java | 7
opends/src/server/org/opends/server/admin/SizePropertyDefinition.java | 7
opends/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java | 6
opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java | 6
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java | 10
opends/src/admin/defn/org/opends/server/admin/std/LDAPConnectionHandlerConfiguration.xml | 28 +
opends/src/server/org/opends/server/admin/EnumPropertyDefinition.java | 11
opends/src/admin/defn/org/opends/server/admin/std/Package.xml | 156 +++++++----
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java | 35 --
opends/src/server/org/opends/server/admin/AdministratorAction.java | 190 ++++++++++++++
opends/src/server/org/opends/server/admin/DurationPropertyDefinition.java | 8
opends/src/server/org/opends/server/admin/DNPropertyDefinition.java | 6
opends/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java | 7
opends/resource/admin/messagesMO.xsl | 13
opends/resource/admin/metaMO.xsl | 42 ++-
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/IntegerPropertyDefinitionTest.java | 10
opends/src/server/org/opends/server/admin/StringPropertyDefinition.java | 8
opends/src/server/org/opends/server/admin/PropertyOption.java | 9
opends/src/server/org/opends/server/admin/IntegerPropertyDefinition.java | 7
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DurationPropertyDefinitionTest.java | 10
25 files changed, 527 insertions(+), 221 deletions(-)
diff --git a/opends/resource/admin/admin.xsd b/opends/resource/admin/admin.xsd
index d7c2d96..a97b475 100644
--- a/opends/resource/admin/admin.xsd
+++ b/opends/resource/admin/admin.xsd
@@ -676,11 +676,29 @@
<xsd:element name="none">
<xsd:annotation>
<xsd:documentation>
- Used when no administrator action is required after
- modifications to a property.
+ Used when modifications to a property take effect
+ immediately, and no additional administrator action is
+ required.
</xsd:documentation>
</xsd:annotation>
- <xsd:complexType />
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="synopsis"
+ type="tns:rich-description-type" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ An optional description which can be used to describe
+ how changes to the modified property will take effect.
+ If present, the synopsis should be suitable for use in
+ applications such as tool-tips, CLI help, and the
+ summary description in Javadoc. It is possible to
+ embed rich content including XHTML markup (this will
+ only be used where supported).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
</xsd:element>
<xsd:element name="server-restart">
<xsd:annotation>
@@ -689,7 +707,26 @@
restart in order to take effect.
</xsd:documentation>
</xsd:annotation>
- <xsd:complexType />
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="synopsis"
+ type="tns:rich-description-type" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ An optional description of this required
+ administrative action. The description should
+ describe, preferably in one sentence, what additional
+ administrator action is required when the server is
+ restarted. If present, the synopsis should be suitable
+ for use in applications such as tool-tips, CLI help,
+ and the summary description in Javadoc. It is possible
+ to embed rich content including XHTML markup (this
+ will only be used where supported).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
</xsd:element>
<xsd:element name="component-restart">
<xsd:annotation>
@@ -699,7 +736,26 @@
re-enabling the component).
</xsd:documentation>
</xsd:annotation>
- <xsd:complexType />
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="synopsis"
+ type="tns:rich-description-type" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ An optional description of this required
+ administrative action. The description should
+ describe, preferably in one sentence, what additional
+ administrator action is required when the component is
+ restarted. If present, the synopsis should be suitable
+ for use in applications such as tool-tips, CLI help,
+ and the summary description in Javadoc. It is possible
+ to embed rich content including XHTML markup (this
+ will only be used where supported).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
</xsd:element>
<xsd:element name="other">
<xsd:annotation>
@@ -728,18 +784,6 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
- <xsd:element name="profile" type="tns:profile-type"
- minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>
- An annotation relating to this administrative action.
- Annotations can define additional information which
- cannot be directly represented using this XML schema.
- The additional information can relate to specific
- applications.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
diff --git a/opends/resource/admin/messagesMO.xsl b/opends/resource/admin/messagesMO.xsl
index 4bbdc1a..3b08e7b 100644
--- a/opends/resource/admin/messagesMO.xsl
+++ b/opends/resource/admin/messagesMO.xsl
@@ -109,18 +109,11 @@
select="concat('property.', normalize-space(@name), '.default-behavior.alias.synopsis=', normalize-space(adm:default-behavior/adm:alias/adm:synopsis), '
')" />
</xsl:if>
<!--
- Process requires admin action (other) synopsis.
+ Process requires admin action synopsis if present.
-->
- <xsl:if test="adm:requires-admin-action/adm:other">
- <xsl:if
- test="not(adm:requires-admin-action/adm:other/adm:synopsis)">
- <xsl:message terminate="yes">
- <xsl:value-of
- select="concat('No requires admin action (other) synopsis found for property ', @name, ' in managed object definition ', $this-name)" />
- </xsl:message>
- </xsl:if>
+ <xsl:if test="adm:requires-admin-action/*/adm:synopsis">
<xsl:value-of
- select="concat('property.', normalize-space(@name), '.requires-admin-action.other.synopsis=', normalize-space(adm:requires-admin-action/adm:other/adm:synopsis), '
')" />
+ select="concat('property.', normalize-space(@name), '.requires-admin-action.synopsis=', normalize-space(adm:requires-admin-action/*/adm:synopsis), '
')" />
</xsl:if>
<!--
Process syntax related descriptions.
diff --git a/opends/resource/admin/metaMO.xsl b/opends/resource/admin/metaMO.xsl
index 286c1e8..c609d89 100644
--- a/opends/resource/admin/metaMO.xsl
+++ b/opends/resource/admin/metaMO.xsl
@@ -98,13 +98,14 @@
<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: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:value-of
+ select="concat(' Tag.define("', @name, '");
')" />
</xsl:for-each>
- <xsl:value-of select="' }
'"/>
+ <xsl:value-of select="' }
'" />
</xsl:if>
<!--
Generate declarations for properties defined or
@@ -155,13 +156,15 @@
<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: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:value-of
+ select="concat(' INSTANCE.registerTag(Tag.valueOf("', @name, '"));
')" />
</xsl:for-each>
- <xsl:value-of select="' }
'"/>
+ <xsl:value-of select="' }
'" />
</xsl:if>
<!--
Configuration definition singleton getter.
@@ -611,11 +614,6 @@
<xsl:value-of
select="' builder.setOption(PropertyOption.MONITORING);
'" />
</xsl:if>
- <xsl:if
- test="adm:requires-admin-action/adm:server-restart|adm:requires-admin-action/adm:component-restart|adm:requires-admin-action/adm:other">
- <xsl:value-of
- select="' builder.setOption(PropertyOption.REQUIRES_ADMIN_ACTION);
'" />
- </xsl:if>
<xsl:if test="@mandatory='true'">
<xsl:value-of
select="' builder.setOption(PropertyOption.MANDATORY);
'" />
@@ -624,6 +622,21 @@
<xsl:value-of
select="' builder.setOption(PropertyOption.HIDDEN);
'" />
</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:if
test="not(@mandatory='true') and not(adm:default-behavior)">
<xsl:message terminate="yes">
@@ -1622,6 +1635,9 @@
@mandatory='true']">
<import>org.opends.server.admin.PropertyOption</import>
</xsl:if>
+ <xsl:if test="$this-local-properties">
+ <import>org.opends.server.admin.AdministratorAction</import>
+ </xsl:if>
<xsl:if test="$this/adm:tag-definition or $this/adm:tag">
<import>org.opends.server.admin.Tag</import>
</xsl:if>
diff --git a/opends/src/admin/defn/org/opends/server/admin/std/LDAPConnectionHandlerConfiguration.xml b/opends/src/admin/defn/org/opends/server/admin/std/LDAPConnectionHandlerConfiguration.xml
index cfd93ba..43dc8bb 100644
--- a/opends/src/admin/defn/org/opends/server/admin/std/LDAPConnectionHandlerConfiguration.xml
+++ b/opends/src/admin/defn/org/opends/server/admin/std/LDAPConnectionHandlerConfiguration.xml
@@ -440,11 +440,15 @@
Specifies the names of the SSL protocols that will be allowed for
use in SSL or StartTLS communication.
</adm:synopsis>
- <adm:description>
- Changes to this configuration attribute will take immediately but
- will only impact new SSL/TLS-based sessions created after the
- change.
- </adm:description>
+ <adm:requires-admin-action>
+ <adm:none>
+ <adm:synopsis>
+ Changes to this property will take effect immediately but will
+ only impact new SSL/TLS-based sessions created after the
+ change.
+ </adm:synopsis>
+ </adm:none>
+ </adm:requires-admin-action>
<adm:default-behavior>
<adm:alias>
<adm:synopsis>
@@ -469,11 +473,15 @@
Specifies the names of the SSL cipher suites that will be allowed
for use in SSL or StartTLS communication.
</adm:synopsis>
- <adm:description>
- Changes to this configuration attribute will take immediately but
- will only impact new SSL/TLS-based sessions created after the
- change.
- </adm:description>
+ <adm:requires-admin-action>
+ <adm:none>
+ <adm:synopsis>
+ Changes to this property will take effect immediately but will
+ only impact new SSL/TLS-based sessions created after the
+ change.
+ </adm:synopsis>
+ </adm:none>
+ </adm:requires-admin-action>
<adm:default-behavior>
<adm:alias>
<adm:synopsis>
diff --git a/opends/src/admin/defn/org/opends/server/admin/std/Package.xml b/opends/src/admin/defn/org/opends/server/admin/std/Package.xml
index c84c67c..d92243c 100644
--- a/opends/src/admin/defn/org/opends/server/admin/std/Package.xml
+++ b/opends/src/admin/defn/org/opends/server/admin/std/Package.xml
@@ -1,31 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ! 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
- ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
- ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- ! 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
- ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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
- !
- !
- ! Portions Copyright 2007 Sun Microsystems, Inc.
- ! -->
-
+ ! 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
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! 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
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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
+ !
+ !
+ ! Portions Copyright 2007 Sun Microsystems, Inc.
+ ! -->
<adm:package name="org.opends.server.admin.std"
xmlns:adm="http://www.opends.org/admin"
xmlns:ldap="http://www.opends.org/admin-ldap">
@@ -101,9 +100,7 @@
</adm:requires-admin-action>
<adm:default-behavior>
<adm:alias>
- <adm:synopsis>
- Let the server decide.
- </adm:synopsis>
+ <adm:synopsis>Let the server decide.</adm:synopsis>
</adm:alias>
</adm:default-behavior>
<adm:syntax>
@@ -122,10 +119,16 @@
<adm:user-friendly-name />
.
</adm:synopsis>
- <adm:description>
- Changes to this configuration attribute will take effect the next
- time that the key manager is accessed.
- </adm:description>
+ <adm:requires-admin-action>
+ <adm:none>
+ <adm:synopsis>
+ Changes to this property will take effect the next time that
+ the
+ <adm:user-friendly-name />
+ is accessed.
+ </adm:synopsis>
+ </adm:none>
+ </adm:requires-admin-action>
<adm:default-behavior>
<adm:defined>
<adm:value>jks</adm:value>
@@ -149,10 +152,16 @@
<adm:user-friendly-name />
.
</adm:synopsis>
- <adm:description>
- Changes to this configuration attribute will take effect the next
- time that the key manager is accessed.
- </adm:description>
+ <adm:requires-admin-action>
+ <adm:none>
+ <adm:synopsis>
+ Changes to this property will take effect the next time that
+ the
+ <adm:user-friendly-name />
+ is accessed.
+ </adm:synopsis>
+ </adm:none>
+ </adm:requires-admin-action>
<adm:default-behavior>
<adm:undefined />
</adm:default-behavior>
@@ -173,10 +182,16 @@
<adm:user-friendly-name />
.
</adm:synopsis>
- <adm:description>
- Changes to this configuration attribute will take effect the next
- time that the key manager is accessed.
- </adm:description>
+ <adm:requires-admin-action>
+ <adm:none>
+ <adm:synopsis>
+ Changes to this property will take effect the next time that
+ the
+ <adm:user-friendly-name />
+ is accessed.
+ </adm:synopsis>
+ </adm:none>
+ </adm:requires-admin-action>
<adm:default-behavior>
<adm:undefined />
</adm:default-behavior>
@@ -198,10 +213,16 @@
<adm:user-friendly-name />
.
</adm:synopsis>
- <adm:description>
- Changes to this configuration attribute will take effect the next
- time that the key manager is accessed.
- </adm:description>
+ <adm:requires-admin-action>
+ <adm:none>
+ <adm:synopsis>
+ Changes to this property will take effect the next time that
+ the
+ <adm:user-friendly-name />
+ is accessed.
+ </adm:synopsis>
+ </adm:none>
+ </adm:requires-admin-action>
<adm:default-behavior>
<adm:undefined />
</adm:default-behavior>
@@ -222,11 +243,15 @@
<adm:user-friendly-name />
.
</adm:synopsis>
- <adm:description>
- Changes to this attribute will take effect immediately, but only
- for subsequent attempts to access the key manager provider for
- associated client connections.
- </adm:description>
+ <adm:requires-admin-action>
+ <adm:none>
+ <adm:synopsis>
+ Changes to this property will take effect immediately, but
+ only for subsequent attempts to access the key manager
+ provider for associated client connections.
+ </adm:synopsis>
+ </adm:none>
+ </adm:requires-admin-action>
<adm:default-behavior>
<adm:undefined />
</adm:default-behavior>
@@ -249,11 +274,15 @@
<adm:user-friendly-name />
.
</adm:synopsis>
- <adm:description>
- Changes to this attribute will take effect immediately, but only
- for subsequent attempts to access the trust manager provider for
- associated client connections.
- </adm:description>
+ <adm:requires-admin-action>
+ <adm:none>
+ <adm:synopsis>
+ Changes to this property will take effect immediately, but
+ only for subsequent attempts to access the trust manager
+ provider for associated client connections.
+ </adm:synopsis>
+ </adm:none>
+ </adm:requires-admin-action>
<adm:default-behavior>
<adm:undefined />
</adm:default-behavior>
@@ -269,11 +298,11 @@
</ldap:attribute>
</adm:profile>
</adm:property>
-
- <adm:property name="include-filter" mandatory="false" multi-valued="true">
+ <adm:property name="include-filter" mandatory="false"
+ multi-valued="true">
<adm:synopsis>
- The set of filters that define the entries that should be
- included in the cache.
+ The set of filters that define the entries that should be included
+ in the cache.
</adm:synopsis>
<adm:default-behavior>
<adm:undefined />
@@ -288,11 +317,11 @@
</ldap:attribute>
</adm:profile>
</adm:property>
-
- <adm:property name="exclude-filter" mandatory="false" multi-valued="true">
+ <adm:property name="exclude-filter" mandatory="false"
+ multi-valued="true">
<adm:synopsis>
- The set of filters that define the entries that should be
- excluded from the cache.
+ The set of filters that define the entries that should be excluded
+ from the cache.
</adm:synopsis>
<adm:default-behavior>
<adm:undefined />
@@ -307,5 +336,4 @@
</ldap:attribute>
</adm:profile>
</adm:property>
-
</adm:package>
diff --git a/opends/src/server/org/opends/server/admin/AdministratorAction.java b/opends/src/server/org/opends/server/admin/AdministratorAction.java
new file mode 100644
index 0000000..891b38d
--- /dev/null
+++ b/opends/src/server/org/opends/server/admin/AdministratorAction.java
@@ -0,0 +1,190 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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
+ *
+ *
+ * Portions Copyright 2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.admin;
+
+
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+
+
+
+/**
+ * Defines an optional action which administators must perform after
+ * they have modified a property. By default modifications to
+ * properties are assumed to take effect immediately and require no
+ * additional administrative action. Developers should be aware that,
+ * where feasible, they should implement components such that property
+ * modifications require no additional administrative action. This is
+ * required in order to minimize server downtime during administration
+ * and provide a more user-friendly experience.
+ */
+public final class AdministratorAction {
+
+ /**
+ * Specifies the type of administrator action which must be
+ * performed in order for pending changes to take effect.
+ */
+ public static enum Type {
+ /**
+ * Used when modifications to a property require a component
+ * restart in order to take effect (usually by disabling and
+ * re-enabling the component). May have a description describing
+ * any additional administrator action that is required when the
+ * component is restarted.
+ */
+ COMPONENT_RESTART("component-restart"),
+
+ /**
+ * Used when modifications to a property take effect immediately,
+ * and no additional administrator action is required. May have a
+ * description describing how changes to the modified property
+ * will take effect.
+ */
+ NONE("none"),
+
+ /**
+ * Used when modifications to a property require an additional
+ * administrative action in order to take effect. This should be
+ * used when neither a server restart nor a component restart are
+ * applicable. Always has a description which describes the
+ * additional administrator action which is required when the
+ * property is modified.
+ */
+ OTHER("other"),
+
+ /**
+ * Used when modifications to a property require a server restart
+ * in order to take effect. May have a description describing any
+ * additional administrator action that is required when the
+ * component is restarted.
+ */
+ SERVER_RESTART("server-restart");
+
+ // The user-friendly name of the type.
+ private final String name;
+
+
+
+ // Private constructor.
+ private Type(String name) {
+ this.name = name;
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ }
+
+ // The managed object definition associated with this administrator
+ // action.
+ private final AbstractManagedObjectDefinition<?, ?> definition;
+
+ // The name of the property definition associated with this
+ // administrator action.
+ private final String propertyName;
+
+ // The type of administration action.
+ private final Type type;
+
+
+
+ /**
+ * Create a new administrator action.
+ *
+ * @param type
+ * The type of this administration action.
+ * @param d
+ * The managed object definition associated with this
+ * administrator action.
+ * @param propertyName
+ * The name of the property definition associated with this
+ * administrator action.
+ */
+ public AdministratorAction(Type type,
+ AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
+ this.type = type;
+ this.definition = d;
+ this.propertyName = propertyName;
+ }
+
+
+
+ /**
+ * Gets the synopsis of this administrator action in the default
+ * locale.
+ *
+ * @return Returns the synopsis of this administrator action in the
+ * default locale, or <code>null</code> if there is no
+ * synopsis defined.
+ */
+ public final String getSynopsis() {
+ return getSynopsis(Locale.getDefault());
+ }
+
+
+
+ /**
+ * Gets the synopsis of this administrator action in the specified
+ * locale.
+ *
+ * @param locale
+ * The locale.
+ * @return Returns the synopsis of this administrator action in the
+ * specified locale, or <code>null</code> if there is no
+ * synopsis defined.
+ */
+ public final String getSynopsis(Locale locale) {
+ ManagedObjectDefinitionI18NResource resource =
+ ManagedObjectDefinitionI18NResource.getInstance();
+ String property = "property." + propertyName
+ + ".requires-admin-action.synopsis";
+ try {
+ return resource.getMessage(definition, property, locale);
+ } catch (MissingResourceException e) {
+ return null;
+ }
+ }
+
+
+
+ /**
+ * Gets the type of this administrator action.
+ *
+ * @return Returns the type of this administrator action.
+ */
+ public final Type getType() {
+ return type;
+ }
+}
diff --git a/opends/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java b/opends/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java
index b10a687..9448251 100644
--- a/opends/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java
@@ -66,9 +66,10 @@
protected AttributeTypePropertyDefinition buildInstance(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<AttributeType> defaultBehavior) {
return new AttributeTypePropertyDefinition(d, propertyName,
- options, defaultBehavior);
+ options, adminAction, defaultBehavior);
}
}
@@ -129,9 +130,10 @@
private AttributeTypePropertyDefinition(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<AttributeType> defaultBehavior) {
super(d, AttributeType.class, propertyName, options,
- defaultBehavior);
+ adminAction, defaultBehavior);
}
diff --git a/opends/src/server/org/opends/server/admin/BooleanPropertyDefinition.java b/opends/src/server/org/opends/server/admin/BooleanPropertyDefinition.java
index d40d559..d0c657b 100644
--- a/opends/src/server/org/opends/server/admin/BooleanPropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/BooleanPropertyDefinition.java
@@ -90,9 +90,10 @@
protected BooleanPropertyDefinition buildInstance(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<Boolean> defaultBehavior) {
return new BooleanPropertyDefinition(d, propertyName, options,
- defaultBehavior);
+ adminAction, defaultBehavior);
}
}
@@ -120,8 +121,10 @@
private BooleanPropertyDefinition(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<Boolean> defaultBehavior) {
- super(d, Boolean.class, propertyName, options, defaultBehavior);
+ super(d, Boolean.class, propertyName, options, adminAction,
+ defaultBehavior);
}
diff --git a/opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java b/opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java
index fa17520..8b6e162 100644
--- a/opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java
@@ -121,9 +121,10 @@
protected ClassPropertyDefinition buildInstance(
AbstractManagedObjectDefinition<?, ?> d,
String propertyName, EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<String> defaultBehavior) {
return new ClassPropertyDefinition(d, propertyName, options,
- defaultBehavior, instanceOfInterfaces);
+ adminAction, defaultBehavior, instanceOfInterfaces);
}
}
@@ -204,9 +205,10 @@
private ClassPropertyDefinition(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<String> defaultBehavior,
List<String> instanceOfInterfaces) {
- super(d, String.class, propertyName, options, defaultBehavior);
+ super(d, String.class, propertyName, options, adminAction, defaultBehavior);
this.instanceOfInterfaces = Collections
.unmodifiableList(new LinkedList<String>(instanceOfInterfaces));
diff --git a/opends/src/server/org/opends/server/admin/DNPropertyDefinition.java b/opends/src/server/org/opends/server/admin/DNPropertyDefinition.java
index d2d170c..ee9f5b9 100644
--- a/opends/src/server/org/opends/server/admin/DNPropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/DNPropertyDefinition.java
@@ -115,9 +115,10 @@
protected DNPropertyDefinition buildInstance(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<DN> defaultBehavior) {
return new DNPropertyDefinition(d, propertyName, options,
- defaultBehavior, baseDN);
+ adminAction, defaultBehavior, baseDN);
}
}
@@ -144,8 +145,9 @@
private DNPropertyDefinition(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<DN> defaultBehavior, DN baseDN) {
- super(d, DN.class, propertyName, options, defaultBehavior);
+ super(d, DN.class, propertyName, options, adminAction, defaultBehavior);
this.baseDN = baseDN;
}
diff --git a/opends/src/server/org/opends/server/admin/DurationPropertyDefinition.java b/opends/src/server/org/opends/server/admin/DurationPropertyDefinition.java
index 816a9eb..eb269a5 100644
--- a/opends/src/server/org/opends/server/admin/DurationPropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/DurationPropertyDefinition.java
@@ -354,10 +354,11 @@
protected DurationPropertyDefinition buildInstance(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<Long> defaultBehavior) {
return new DurationPropertyDefinition(d, propertyName, options,
- defaultBehavior, baseUnit, maximumUnit, lowerLimit, upperLimit,
- allowUnlimited);
+ adminAction, defaultBehavior, baseUnit, maximumUnit, lowerLimit,
+ upperLimit, allowUnlimited);
}
}
@@ -383,10 +384,11 @@
// Private constructor.
private DurationPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d,
String propertyName, EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<Long> defaultBehavior, DurationUnit baseUnit,
DurationUnit maximumUnit, Long lowerLimit, Long upperLimit,
boolean allowUnlimited) {
- super(d, Long.class, propertyName, options, defaultBehavior);
+ super(d, Long.class, propertyName, options, adminAction, defaultBehavior);
this.baseUnit = baseUnit;
this.maximumUnit = maximumUnit;
this.lowerLimit = lowerLimit;
diff --git a/opends/src/server/org/opends/server/admin/EnumPropertyDefinition.java b/opends/src/server/org/opends/server/admin/EnumPropertyDefinition.java
index e5cda28..5a22bcf 100644
--- a/opends/src/server/org/opends/server/admin/EnumPropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/EnumPropertyDefinition.java
@@ -95,6 +95,7 @@
protected EnumPropertyDefinition<E> buildInstance(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<E> defaultBehavior) {
// Make sure that the enumeration class has been defined.
if (enumClass == null) {
@@ -102,7 +103,7 @@
}
return new EnumPropertyDefinition<E>(d, propertyName, options,
- defaultBehavior, enumClass);
+ adminAction, defaultBehavior, enumClass);
}
}
@@ -135,11 +136,11 @@
// Private constructor.
- private EnumPropertyDefinition(
- AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options,
+ private EnumPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d,
+ String propertyName, EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<E> defaultBehavior, Class<E> enumClass) {
- super(d, enumClass, propertyName, options, defaultBehavior);
+ super(d, enumClass, propertyName, options, adminAction, defaultBehavior);
this.enumClass = enumClass;
// Initialize the decoding map.
diff --git a/opends/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java b/opends/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java
index 18a025f..b08a313 100644
--- a/opends/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java
@@ -66,9 +66,10 @@
protected IPAddressMaskPropertyDefinition buildInstance(
AbstractManagedObjectDefinition<?, ?> d,
String propertyName, EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<AddressMask> defaultBehavior) {
return new IPAddressMaskPropertyDefinition(d, propertyName, options,
- defaultBehavior);
+ adminAction, defaultBehavior);
}
}
@@ -96,8 +97,10 @@
private IPAddressMaskPropertyDefinition(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<AddressMask> defaultBehavior) {
- super(d, AddressMask.class, propertyName, options, defaultBehavior);
+ super(d, AddressMask.class, propertyName, options, adminAction,
+ defaultBehavior);
}
diff --git a/opends/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java b/opends/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java
index abd9880..9744a03 100644
--- a/opends/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java
@@ -65,9 +65,10 @@
protected IPAddressPropertyDefinition buildInstance(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<InetAddress> defaultBehavior) {
return new IPAddressPropertyDefinition(d, propertyName, options,
- defaultBehavior);
+ adminAction, defaultBehavior);
}
}
@@ -95,8 +96,10 @@
private IPAddressPropertyDefinition(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<InetAddress> defaultBehavior) {
- super(d, InetAddress.class, propertyName, options, defaultBehavior);
+ super(d, InetAddress.class, propertyName, options, adminAction,
+ defaultBehavior);
}
diff --git a/opends/src/server/org/opends/server/admin/IntegerPropertyDefinition.java b/opends/src/server/org/opends/server/admin/IntegerPropertyDefinition.java
index cedb8e9..4904066 100644
--- a/opends/src/server/org/opends/server/admin/IntegerPropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/IntegerPropertyDefinition.java
@@ -154,9 +154,10 @@
protected IntegerPropertyDefinition buildInstance(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<Integer> defaultBehavior) {
return new IntegerPropertyDefinition(d, propertyName, options,
- defaultBehavior, lowerLimit, upperLimit, allowUnlimited);
+ adminAction, defaultBehavior, lowerLimit, upperLimit, allowUnlimited);
}
}
@@ -184,9 +185,11 @@
private IntegerPropertyDefinition(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<Integer> defaultBehavior, int lowerLimit,
Integer upperLimit, boolean allowUnlimited) {
- super(d, Integer.class, propertyName, options, defaultBehavior);
+ super(d, Integer.class, propertyName, options, adminAction,
+ defaultBehavior);
this.lowerLimit = lowerLimit;
this.upperLimit = upperLimit;
this.allowUnlimited = allowUnlimited;
diff --git a/opends/src/server/org/opends/server/admin/PropertyDefinition.java b/opends/src/server/org/opends/server/admin/PropertyDefinition.java
index 5f388e4..ad8ba9c 100644
--- a/opends/src/server/org/opends/server/admin/PropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/PropertyDefinition.java
@@ -67,6 +67,9 @@
protected abstract static class AbstractBuilder
<T, D extends PropertyDefinition<T>> {
+ // The administrator action.
+ private AdministratorAction adminAction;
+
// The default behavior provider.
private DefaultBehaviorProvider<T> defaultBehavior;
@@ -95,6 +98,8 @@
this.definition = d;
this.propertyName = propertyName;
this.options = EnumSet.noneOf(PropertyOption.class);
+ this.adminAction = new AdministratorAction(AdministratorAction.Type.NONE,
+ d, propertyName);
this.defaultBehavior = new UndefinedDefaultBehaviorProvider<T>();
}
@@ -107,7 +112,21 @@
* @return The new property definition.
*/
public final D getInstance() {
- return buildInstance(definition, propertyName, options, defaultBehavior);
+ return buildInstance(definition, propertyName, options, adminAction,
+ defaultBehavior);
+ }
+
+
+
+ /**
+ * Set the administrator action.
+ *
+ * @param adminAction
+ * The administrator action.
+ */
+ public final void setAdministratorAction(AdministratorAction adminAction) {
+ ensureNotNull(adminAction);
+ this.adminAction = adminAction;
}
@@ -150,15 +169,21 @@
* The property name.
* @param options
* Options applicable to this definition.
+ * @param adminAction
+ * The administrator action.
* @param defaultBehavior
* The default behavior provider.
* @return The new property definition.
*/
protected abstract D buildInstance(AbstractManagedObjectDefinition<?, ?> d,
String propertyName, EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<T> defaultBehavior);
}
+ // The administrator action.
+ private final AdministratorAction adminAction;
+
// The default behavior provider.
private final DefaultBehaviorProvider<T> defaultBehavior;
@@ -188,19 +213,23 @@
* The property name.
* @param options
* Options applicable to this definition.
+ * @param adminAction
+ * The administrator action.
* @param defaultBehavior
* The default behavior provider.
*/
protected PropertyDefinition(AbstractManagedObjectDefinition<?, ?> d,
Class<T> theClass, String propertyName, EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<T> defaultBehavior) {
ensureNotNull(d, theClass, propertyName);
- ensureNotNull(options, defaultBehavior);
+ ensureNotNull(options, adminAction, defaultBehavior);
this.definition = d;
this.theClass = theClass;
this.propertyName = propertyName;
this.options = EnumSet.copyOf(options);
+ this.adminAction = adminAction;
this.defaultBehavior = defaultBehavior;
}
@@ -403,6 +432,21 @@
/**
+ * Get the administrator action associated with this property
+ * definition. The administrator action describes any action which
+ * the administrator must perform in order for changes to this
+ * property to take effect.
+ *
+ * @return Returns the administrator action associated with this
+ * property definition.
+ */
+ public final AdministratorAction getAdministratorAction() {
+ return adminAction;
+ }
+
+
+
+ /**
* Get the default behavior provider associated with this property
* definition.
*
diff --git a/opends/src/server/org/opends/server/admin/PropertyOption.java b/opends/src/server/org/opends/server/admin/PropertyOption.java
index 9f97611..5fe79d4 100644
--- a/opends/src/server/org/opends/server/admin/PropertyOption.java
+++ b/opends/src/server/org/opends/server/admin/PropertyOption.java
@@ -60,12 +60,5 @@
* Use this option to identify properties which are for monitoring
* purposes only and are generated automatically by the server..
*/
- MONITORING,
-
- /**
- * Use this option to identify properties which, when modified, will
- * require some additiona administrator action in order for the
- * changes to take effect.
- */
- REQUIRES_ADMIN_ACTION
+ MONITORING;
}
diff --git a/opends/src/server/org/opends/server/admin/SizePropertyDefinition.java b/opends/src/server/org/opends/server/admin/SizePropertyDefinition.java
index 0c5a99c..55ddbda 100644
--- a/opends/src/server/org/opends/server/admin/SizePropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/SizePropertyDefinition.java
@@ -196,8 +196,9 @@
protected SizePropertyDefinition buildInstance(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<Long> defaultBehavior) {
- return new SizePropertyDefinition(d, propertyName, options,
+ return new SizePropertyDefinition(d, propertyName, options, adminAction,
defaultBehavior, lowerLimit, upperLimit, allowUnlimited);
}
@@ -226,9 +227,11 @@
private SizePropertyDefinition(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<Long> defaultBehavior, Long lowerLimit,
Long upperLimit, boolean allowUnlimited) {
- super(d, Long.class, propertyName, options, defaultBehavior);
+ super(d, Long.class, propertyName, options, adminAction,
+ defaultBehavior);
this.lowerLimit = lowerLimit;
this.upperLimit = upperLimit;
this.allowUnlimited = allowUnlimited;
diff --git a/opends/src/server/org/opends/server/admin/StringPropertyDefinition.java b/opends/src/server/org/opends/server/admin/StringPropertyDefinition.java
index c1ebeb7..62ef6fd 100644
--- a/opends/src/server/org/opends/server/admin/StringPropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/StringPropertyDefinition.java
@@ -123,9 +123,11 @@
protected StringPropertyDefinition buildInstance(
AbstractManagedObjectDefinition<?, ?> d, String propertyName,
EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<String> defaultBehavior) {
return new StringPropertyDefinition(d, propertyName, options,
- defaultBehavior, isCaseInsensitive, pattern, patternUsage);
+ adminAction, defaultBehavior, isCaseInsensitive, pattern,
+ patternUsage);
}
}
@@ -163,9 +165,11 @@
// Private constructor.
private StringPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d,
String propertyName, EnumSet<PropertyOption> options,
+ AdministratorAction adminAction,
DefaultBehaviorProvider<String> defaultBehavior,
boolean isCaseInsensitive, Pattern pattern, String patternUsage) {
- super(d, String.class, propertyName, options, defaultBehavior);
+ super(d, String.class, propertyName, options, adminAction,
+ defaultBehavior);
this.isCaseInsensitive = isCaseInsensitive;
this.pattern = pattern;
this.patternUsage = patternUsage;
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java
index 1c03811..f2fe1ce 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java
@@ -30,9 +30,9 @@
import static org.testng.Assert.*;
import org.opends.server.admin.std.meta.RootCfgDefn;
-import org.testng.annotations.*;
-
-import java.util.EnumSet;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
/**
* BooleanPropertyDefinition Tester.
@@ -122,9 +122,7 @@
}
private BooleanPropertyDefinition createPropertyDefinition() {
- return builder.buildInstance(RootCfgDefn.getInstance(), "test-property",
- EnumSet.noneOf(PropertyOption.class),
- new UndefinedDefaultBehaviorProvider<Boolean>());
+ return builder.getInstance();
}
}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ClassPropertyDefinitionTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ClassPropertyDefinitionTest.java
index 4a3c15d..2585c8f 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ClassPropertyDefinitionTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ClassPropertyDefinitionTest.java
@@ -29,12 +29,13 @@
import static org.testng.Assert.*;
-import org.opends.server.admin.std.meta.RootCfgDefn;
-import org.testng.annotations.*;
-
-import java.util.EnumSet;
import java.util.List;
+import org.opends.server.admin.std.meta.RootCfgDefn;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
/**
* ClassPropertyDefinition Tester.
*/
@@ -79,10 +80,7 @@
ClassPropertyDefinition.createBuilder(RootCfgDefn.getInstance(),
"test-property");
localBuilder.addInstanceOf(className);
- ClassPropertyDefinition cpd = localBuilder.buildInstance(
- RootCfgDefn.getInstance(), "test-property",
- EnumSet.noneOf(PropertyOption.class),
- new UndefinedDefaultBehaviorProvider<String>());
+ ClassPropertyDefinition cpd = localBuilder.getInstance();
List<String> instances = cpd.getInstanceOfInterface();
assertTrue(instances.contains(className));
}
@@ -111,10 +109,7 @@
ClassPropertyDefinition.createBuilder(
RootCfgDefn.getInstance(), "test-property");
localBuilder.addInstanceOf(className);
- ClassPropertyDefinition cpd = localBuilder.buildInstance(
- RootCfgDefn.getInstance(), "test-property",
- EnumSet.noneOf(PropertyOption.class),
- new UndefinedDefaultBehaviorProvider<String>());
+ ClassPropertyDefinition cpd = localBuilder.getInstance();
List<String> instances = cpd.getInstanceOfInterface();
assertTrue(instances.contains(className));
}
@@ -147,10 +142,7 @@
ClassPropertyDefinition.createBuilder(
RootCfgDefn.getInstance(), "test-property");
localBuilder.addInstanceOf(interfaceName);
- ClassPropertyDefinition cpd = localBuilder.buildInstance(
- RootCfgDefn.getInstance(), "test-property",
- EnumSet.noneOf(PropertyOption.class),
- new UndefinedDefaultBehaviorProvider<String>());
+ ClassPropertyDefinition cpd = localBuilder.getInstance();
Class clazz = cpd.loadClass(loadClassName, instanceOfClass);
assertEquals(clazz, expectedClass);
}
@@ -184,10 +176,7 @@
ClassPropertyDefinition.createBuilder(
RootCfgDefn.getInstance(), "test-property");
localBuilder.addInstanceOf(interfaceName);
- ClassPropertyDefinition cpd = localBuilder.buildInstance(
- RootCfgDefn.getInstance(), "test-property",
- EnumSet.noneOf(PropertyOption.class),
- new UndefinedDefaultBehaviorProvider<String>());
+ ClassPropertyDefinition cpd = localBuilder.getInstance();
Class clazz = cpd.loadClass(loadClassName, instanceOfClass);
assertEquals(clazz, String.class);
}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DurationPropertyDefinitionTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DurationPropertyDefinitionTest.java
index a848b24..2d9d38d 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DurationPropertyDefinitionTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DurationPropertyDefinitionTest.java
@@ -30,9 +30,8 @@
import static org.testng.Assert.*;
import org.opends.server.admin.std.meta.RootCfgDefn;
-import org.testng.annotations.*;
-
-import java.util.EnumSet;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
/**
* DurationPropertyDefinition Tester.
@@ -487,9 +486,8 @@
}
private DurationPropertyDefinition buildTestDefinition(DurationPropertyDefinition.Builder builder) {
- return builder.buildInstance(RootCfgDefn.getInstance(), "test-prop",
- EnumSet.noneOf(PropertyOption.class),
- new DefinedDefaultBehaviorProvider<Long>("0"));
+ builder.setDefaultBehaviorProvider(new DefinedDefaultBehaviorProvider<Long>("0"));
+ return builder.getInstance();
}
}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java
index a350eba..fc547d7 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java
@@ -30,9 +30,9 @@
import static org.testng.Assert.*;
import org.opends.server.admin.std.meta.RootCfgDefn;
-import org.testng.annotations.*;
-
-import java.util.EnumSet;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
/**
* EnumPropertyDefinition Tester.
@@ -61,10 +61,7 @@
*/
@Test
public void testBuildInstance() {
- EnumPropertyDefinition epd = builder.buildInstance(
- RootCfgDefn.getInstance(), "test-property",
- EnumSet.noneOf(PropertyOption.class),
- new UndefinedDefaultBehaviorProvider<TestEnum>());
+ EnumPropertyDefinition epd = builder.getInstance();
assertEquals(epd.getEnumClass(), TestEnum.class);
}
@@ -77,9 +74,7 @@
EnumPropertyDefinition.Builder<TestEnum> localBuilder =
EnumPropertyDefinition.createBuilder(
RootCfgDefn.getInstance(), "test-property");
- localBuilder.buildInstance(RootCfgDefn.getInstance(), "test-property",
- EnumSet.noneOf(PropertyOption.class),
- new UndefinedDefaultBehaviorProvider<TestEnum>());
+ localBuilder.getInstance();
}
/**
@@ -100,10 +95,7 @@
*/
@Test(dataProvider = "decodeValueData")
public void testDecodeValue(String value, TestEnum expectedValue) {
- EnumPropertyDefinition epd = builder.buildInstance(
- RootCfgDefn.getInstance(), "test-property",
- EnumSet.noneOf(PropertyOption.class),
- new UndefinedDefaultBehaviorProvider<TestEnum>());
+ EnumPropertyDefinition epd = builder.getInstance();
assertEquals(epd.decodeValue(value), expectedValue);
}
@@ -127,10 +119,7 @@
expectedExceptions = {AssertionError.class,
IllegalPropertyValueStringException.class} )
public void testDecodeValue2(String value) {
- EnumPropertyDefinition epd = builder.buildInstance(
- RootCfgDefn.getInstance(), "test-property",
- EnumSet.noneOf(PropertyOption.class),
- new UndefinedDefaultBehaviorProvider<TestEnum>());
+ EnumPropertyDefinition epd = builder.getInstance();
epd.decodeValue(value);
}
@@ -139,10 +128,7 @@
*/
@Test
public void testNormalizeValue() {
- EnumPropertyDefinition<TestEnum> epd = builder.buildInstance(
- RootCfgDefn.getInstance(), "test-property",
- EnumSet.noneOf(PropertyOption.class),
- new UndefinedDefaultBehaviorProvider<TestEnum>());
+ EnumPropertyDefinition<TestEnum> epd = builder.getInstance();
assertEquals(epd.normalizeValue(TestEnum.ONE), "one");
}
@@ -151,10 +137,7 @@
*/
@Test
public void testValidateValue() {
- EnumPropertyDefinition<TestEnum> epd = builder.buildInstance(
- RootCfgDefn.getInstance(), "test-property",
- EnumSet.noneOf(PropertyOption.class),
- new UndefinedDefaultBehaviorProvider<TestEnum>());
+ EnumPropertyDefinition<TestEnum> epd = builder.getInstance();
epd.validateValue(TestEnum.ONE);
}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/IntegerPropertyDefinitionTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/IntegerPropertyDefinitionTest.java
index 16ad9ec..bf45e92 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/IntegerPropertyDefinitionTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/IntegerPropertyDefinitionTest.java
@@ -30,9 +30,8 @@
import static org.testng.Assert.*;
import org.opends.server.admin.std.meta.RootCfgDefn;
-import org.testng.annotations.*;
-
-import java.util.EnumSet;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
/**
* IntegerPropertyDefinition Tester.
@@ -329,9 +328,8 @@
}
private IntegerPropertyDefinition buildTestDefinition(IntegerPropertyDefinition.Builder builder) {
- return builder.buildInstance(RootCfgDefn.getInstance(), "test-prop",
- EnumSet.noneOf(PropertyOption.class),
- new DefinedDefaultBehaviorProvider<Integer>("0"));
+ builder.setDefaultBehaviorProvider(new DefinedDefaultBehaviorProvider<Integer>("0"));
+ return builder.getInstance();
}
}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/SizePropertyDefinitionTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/SizePropertyDefinitionTest.java
index 796f151..125bc28 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/SizePropertyDefinitionTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/SizePropertyDefinitionTest.java
@@ -27,15 +27,12 @@
package org.opends.server.admin;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.*;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import java.util.EnumSet;
-
/**
* SizePropertyDefinition Tester.
*/
@@ -353,9 +350,8 @@
}
private SizePropertyDefinition buildTestDefinition(SizePropertyDefinition.Builder builder) {
- return builder.buildInstance(RootCfgDefn.getInstance(), "test-prop",
- EnumSet.noneOf(PropertyOption.class),
- new DefinedDefaultBehaviorProvider<Long>("0"));
+ builder.setDefaultBehaviorProvider(new DefinedDefaultBehaviorProvider<Long>("0"));
+ return builder.getInstance();
}
}
--
Gitblit v1.10.0