| | |
| | | <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> |
| | |
| | | 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> |
| | |
| | | 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> |
| | |
| | | </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> |
| | |
| | | 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. |
| | |
| | | <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 |
| | |
| | | <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. |
| | |
| | | <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);
'" /> |
| | |
| | | <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"> |
| | |
| | | @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> |
| | |
| | | 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> |
| | |
| | | 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> |
| | |
| | | <?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"> |
| | |
| | | </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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | </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 /> |
| | |
| | | </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 /> |
| | |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | </adm:package> |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | private AttributeTypePropertyDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | AdministratorAction adminAction, |
| | | DefaultBehaviorProvider<AttributeType> defaultBehavior) { |
| | | super(d, AttributeType.class, propertyName, options, |
| | | defaultBehavior); |
| | | adminAction, defaultBehavior); |
| | | } |
| | | |
| | | |
| | |
| | | protected BooleanPropertyDefinition buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | AdministratorAction adminAction, |
| | | DefaultBehaviorProvider<Boolean> defaultBehavior) { |
| | | return new BooleanPropertyDefinition(d, propertyName, options, |
| | | defaultBehavior); |
| | | adminAction, defaultBehavior); |
| | | } |
| | | |
| | | } |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | 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)); |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | // 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; |
| | |
| | | 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) { |
| | |
| | | } |
| | | |
| | | return new EnumPropertyDefinition<E>(d, propertyName, options, |
| | | defaultBehavior, enumClass); |
| | | adminAction, defaultBehavior, enumClass); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | // 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. |
| | |
| | | protected IPAddressMaskPropertyDefinition buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, |
| | | String propertyName, EnumSet<PropertyOption> options, |
| | | AdministratorAction adminAction, |
| | | DefaultBehaviorProvider<AddressMask> defaultBehavior) { |
| | | return new IPAddressMaskPropertyDefinition(d, propertyName, options, |
| | | defaultBehavior); |
| | | adminAction, defaultBehavior); |
| | | } |
| | | |
| | | } |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | |
| | | protected IPAddressPropertyDefinition buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | AdministratorAction adminAction, |
| | | DefaultBehaviorProvider<InetAddress> defaultBehavior) { |
| | | return new IPAddressPropertyDefinition(d, propertyName, options, |
| | | defaultBehavior); |
| | | adminAction, defaultBehavior); |
| | | } |
| | | |
| | | } |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | protected abstract static class AbstractBuilder |
| | | <T, D extends PropertyDefinition<T>> { |
| | | |
| | | // The administrator action. |
| | | private AdministratorAction adminAction; |
| | | |
| | | // The default behavior provider. |
| | | private DefaultBehaviorProvider<T> defaultBehavior; |
| | | |
| | |
| | | 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>(); |
| | | } |
| | | |
| | |
| | | * @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; |
| | | } |
| | | |
| | | |
| | |
| | | * 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; |
| | | |
| | |
| | | * 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; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 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. |
| | | * |
| | |
| | | * 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; |
| | | } |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | // 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; |
| | |
| | | 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. |
| | |
| | | } |
| | | |
| | | private BooleanPropertyDefinition createPropertyDefinition() { |
| | | return builder.buildInstance(RootCfgDefn.getInstance(), "test-property", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new UndefinedDefaultBehaviorProvider<Boolean>()); |
| | | return builder.getInstance(); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | 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. |
| | | */ |
| | |
| | | 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)); |
| | | } |
| | |
| | | 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)); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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. |
| | |
| | | } |
| | | |
| | | 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(); |
| | | } |
| | | |
| | | } |
| | |
| | | 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. |
| | |
| | | */ |
| | | @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); |
| | | } |
| | | |
| | |
| | | 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(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @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); |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | */ |
| | | @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"); |
| | | } |
| | | |
| | |
| | | */ |
| | | @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); |
| | | } |
| | | |
| | |
| | | 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. |
| | |
| | | } |
| | | |
| | | 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(); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | 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. |
| | | */ |
| | |
| | | } |
| | | |
| | | 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(); |
| | | } |
| | | |
| | | } |