| | |
| | | <param name="base-dir" expression="${admin.defn.dir}" /> |
| | | </xslt> |
| | | |
| | | <!-- Generate I18N messages for core administration components. --> |
| | | <xslt basedir="${admin.defn.dir}" destdir="${classes.dir}/admin/messages" includes="**/*Configuration.xml" style="${admin.rules.dir}/messagesMO.xsl"> |
| | | <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" /> |
| | | <param name="base-dir" expression="${admin.defn.dir}" /> |
| | | </xslt> |
| | | |
| | | <!-- Generate manifest file for core administration components. --> |
| | | <tempfile property="admin.temp.dir" destDir="${build.dir}" prefix="tmp" /> |
| | | <mkdir dir="${admin.temp.dir}" /> |
| | |
| | | <param name="base-dir" expression="${src.dir}" /> |
| | | </xslt> |
| | | |
| | | <!-- Compile the Directory Server extension configuration I18N message files. --> |
| | | <xslt basedir="${src.dir}" destdir="${classes.dir}/admin/messages" style="${admin.dir}/messageMO.xsl"> |
| | | <include name="**/*Configuration.xml" /> |
| | | <exclude name="org/opends/server/admin/std/*.xml" /> |
| | | <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" /> |
| | | <param name="base-dir" expression="${src.dir}" /> |
| | | </xslt> |
| | | |
| | | <!-- Compile the Directory Server extension configuration manifest file. --> |
| | | <tempfile property="admin.temp.dir" destDir="${classes.dir}" /> |
| | | <mkdir dir="${admin.temp.dir}" /> |
| 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. |
| | | ! --> |
| | | <xsl:stylesheet version="1.0" |
| | | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| | | xmlns:adm="http://www.opends.org/admin" |
| | | xmlns:ldap="http://www.opends.org/admin-ldap"> |
| | | <xsl:import href="java-utilities.xsl" /> |
| | | <xsl:import href="preprocessor.xsl" /> |
| | | <xsl:import href="property-types.xsl" /> |
| | | <xsl:output method="text" encoding="us-ascii" /> |
| | | <!-- |
| | | Document parsing. |
| | | --> |
| | | <xsl:template match="/"> |
| | | <!-- |
| | | Generate user friendly names. |
| | | --> |
| | | <xsl:value-of |
| | | select="concat('user-friendly-name=', $this-ufn, '
')" /> |
| | | <xsl:value-of |
| | | select="concat('user-friendly-plural-name=', $this-ufpn, '
')" /> |
| | | <!-- |
| | | Pull out the managed object synopsis (mandatory). |
| | | --> |
| | | <xsl:if test="not($this/adm:synopsis)"> |
| | | <xsl:message terminate="yes"> |
| | | <xsl:value-of |
| | | select="concat('No synopsis found for managed object definition ', $this-name)" /> |
| | | </xsl:message> |
| | | </xsl:if> |
| | | <xsl:value-of |
| | | select="concat('synopsis=', normalize-space($this/adm:synopsis), '
')" /> |
| | | <!-- |
| | | Pull out the managed object description (optional). |
| | | --> |
| | | <xsl:if test="$this/adm:description"> |
| | | <xsl:value-of |
| | | select="concat('description=', normalize-space($this/adm:description), '
')" /> |
| | | </xsl:if> |
| | | <!-- |
| | | Process each property definition. |
| | | --> |
| | | <xsl:for-each select="$this-all-properties"> |
| | | <xsl:sort select="@name" /> |
| | | <!-- |
| | | Pull out the property definition synopsis (mandatory). |
| | | --> |
| | | <xsl:if test="not(adm:synopsis)"> |
| | | <xsl:message terminate="yes"> |
| | | <xsl:value-of |
| | | select="concat('No synopsis found for property ', @name, ' in managed object definition ', $this-name)" /> |
| | | </xsl:message> |
| | | </xsl:if> |
| | | <xsl:value-of |
| | | select="concat('property.', normalize-space(@name), '.synopsis=', normalize-space(adm:synopsis), '
')" /> |
| | | <!-- |
| | | Pull out the property definition description (optional). |
| | | --> |
| | | <xsl:if test="adm:description"> |
| | | <xsl:value-of |
| | | select="concat('property.', normalize-space(@name), '.description=', normalize-space(adm:description), '
')" /> |
| | | </xsl:if> |
| | | <!-- |
| | | Process alias default behavior synopsis. |
| | | --> |
| | | <xsl:if test="adm:default-behavior/adm:alias"> |
| | | <xsl:if |
| | | test="not(adm:default-behavior/adm:alias/adm:synopsis)"> |
| | | <xsl:message terminate="yes"> |
| | | <xsl:value-of |
| | | select="concat('No alias default behavior synopsis found for property ', @name, ' in managed object definition ', $this-name)" /> |
| | | </xsl:message> |
| | | </xsl:if> |
| | | <xsl:value-of |
| | | 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. |
| | | --> |
| | | <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:value-of |
| | | select="concat('property.', normalize-space(@name), '.requires-admin-action.other.synopsis=', normalize-space(adm:requires-admin-action/adm:other/adm:synopsis), '
')" /> |
| | | </xsl:if> |
| | | <!-- |
| | | Process syntax related descriptions. |
| | | --> |
| | | <xsl:choose> |
| | | <xsl:when test="adm:syntax/adm:integer"> |
| | | <!-- |
| | | Process integer syntax unit synopsis (optional). |
| | | --> |
| | | <xsl:if test="adm:syntax/adm:integer/adm:synopsis"> |
| | | <xsl:value-of |
| | | select="concat('property.', normalize-space(@name), '.syntax.integer.unit-synopsis=', normalize-space(adm:syntax/adm:integer/adm:synopsis), '
')" /> |
| | | </xsl:if> |
| | | </xsl:when> |
| | | <xsl:when test="adm:syntax/adm:string/adm:pattern"> |
| | | <!-- |
| | | Process string syntax pattern synopsis (mandatory if pattern defined). |
| | | --> |
| | | <xsl:if |
| | | test="not(adm:syntax/adm:string/adm:pattern/adm:synopsis)"> |
| | | <xsl:message terminate="yes"> |
| | | <xsl:value-of |
| | | select="concat('No string pattern synopsis found for property ', @name, ' in managed object definition ', $this-name)" /> |
| | | </xsl:message> |
| | | </xsl:if> |
| | | <xsl:value-of |
| | | select="concat('property.', normalize-space(@name), '.syntax.string.pattern.synopsis=', normalize-space(adm:syntax/adm:string/adm:pattern/adm:synopsis), '
')" /> |
| | | </xsl:when> |
| | | <xsl:when test="adm:syntax/adm:enumeration"> |
| | | <!-- |
| | | Process enumeration value synopsis (mandatory). |
| | | --> |
| | | <xsl:for-each select="adm:syntax/adm:enumeration/adm:value"> |
| | | <xsl:sort select="@name" /> |
| | | <xsl:if test="not(adm:synopsis)"> |
| | | <xsl:message terminate="yes"> |
| | | <xsl:value-of |
| | | select="concat('No synopsis found for enumeration value ', @name, ' for property ', ../../../@name, ' in managed object definition ', $this-name)" /> |
| | | </xsl:message> |
| | | </xsl:if> |
| | | <xsl:value-of |
| | | select="concat('property.', normalize-space(../../../@name), '.syntax.enumeration.value.', @name,'.synopsis=', normalize-space(adm:synopsis), '
')" /> |
| | | </xsl:for-each> |
| | | </xsl:when> |
| | | </xsl:choose> |
| | | </xsl:for-each> |
| | | <!-- |
| | | Process each relation definition. |
| | | --> |
| | | <xsl:for-each select="$this-all-relations"> |
| | | <xsl:sort select="@name" /> |
| | | <!-- |
| | | Generate user friendly names. |
| | | --> |
| | | <xsl:value-of |
| | | select="concat('relation.', normalize-space(@name), '.user-friendly-name=')" /> |
| | | <xsl:call-template name="name-to-ufn"> |
| | | <xsl:with-param name="value" select="@name" /> |
| | | </xsl:call-template> |
| | | <xsl:value-of select="'
'" /> |
| | | <xsl:if test="adm:one-to-many"> |
| | | <xsl:value-of |
| | | select="concat('relation.', normalize-space(@name), '.user-friendly-plural-name=')" /> |
| | | <xsl:call-template name="name-to-ufn"> |
| | | <xsl:with-param name="value" |
| | | select="adm:one-to-many/@plural-name" /> |
| | | </xsl:call-template> |
| | | <xsl:value-of select="'
'" /> |
| | | </xsl:if> |
| | | <!-- |
| | | Pull out the relation definition synopsis (mandatory). |
| | | --> |
| | | <xsl:if test="not(adm:synopsis)"> |
| | | <xsl:message terminate="yes"> |
| | | <xsl:value-of |
| | | select="concat('No synopsis found for relation ', @name, ' in managed object definition ', $this-name)" /> |
| | | </xsl:message> |
| | | </xsl:if> |
| | | <xsl:value-of |
| | | select="concat('relation.', normalize-space(@name), '.synopsis=', normalize-space(adm:synopsis), '
')" /> |
| | | <!-- |
| | | Pull out the relation definition description (optional). |
| | | --> |
| | | <xsl:if test="adm:description"> |
| | | <xsl:value-of |
| | | select="concat('relation.', normalize-space(@name), '.description=', normalize-space(adm:description), '
')" /> |
| | | </xsl:if> |
| | | </xsl:for-each> |
| | | </xsl:template> |
| | | </xsl:stylesheet> |
| | |
| | | <xsl:choose> |
| | | <xsl:when test="string-length($generic-type) != 0"> |
| | | <xsl:value-of |
| | | select="concat(' ', $type, '.Builder<', $generic-type, '> builder = ', $type, '.createBuilder("',@name, '");
')" /> |
| | | select="concat(' ', $type, '.Builder<', $generic-type, '> builder = ', $type, '.createBuilder(INSTANCE, "',@name, '");
')" /> |
| | | </xsl:when> |
| | | <xsl:otherwise> |
| | | <xsl:value-of |
| | | select="concat(' ', $type, '.Builder builder = ', $type, '.createBuilder("',@name, '");
')" /> |
| | | select="concat(' ', $type, '.Builder builder = ', $type, '.createBuilder(INSTANCE, "',@name, '");
')" /> |
| | | </xsl:otherwise> |
| | | </xsl:choose> |
| | | <xsl:if test="string(@multi-valued) = 'true'"> |
| | |
| | | </xsl:when> |
| | | <xsl:when test="adm:default-behavior/adm:alias"> |
| | | <xsl:value-of |
| | | select="concat(' builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<', $value-type,'>());
')" /> |
| | | select="concat(' builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<', $value-type,'>(INSTANCE, "', @name, '"));
')" /> |
| | | </xsl:when> |
| | | <xsl:when test="adm:default-behavior/adm:defined"> |
| | | <xsl:value-of |
| | |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.Locale; |
| | | import java.util.Map; |
| | | import java.util.MissingResourceException; |
| | | |
| | | import org.opends.server.admin.DefinitionDecodingException.Reason; |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Gets the optional description of this managed object definition |
| | | * in the default locale. |
| | | * |
| | | * @return Returns the description of this managed object definition |
| | | * in the default locale, or <code>null</code> if there is |
| | | * no description. |
| | | */ |
| | | public final String getDescription() { |
| | | return getDescription(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the optional description of this managed object definition |
| | | * in the specified locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the description of this managed object definition |
| | | * in the specified locale, or <code>null</code> if there |
| | | * is no description. |
| | | */ |
| | | public final String getDescription(Locale locale) { |
| | | try { |
| | | return ManagedObjectDefinitionI18NResource.getInstance() |
| | | .getMessage(this, "description", locale); |
| | | } catch (MissingResourceException e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the name of the definition. |
| | | * |
| | | * @return Returns the name of the definition. |
| | |
| | | * Get the parent managed object definition, if applicable. |
| | | * |
| | | * @return Returns the parent of this managed object definition, or |
| | | * <code>null</code> if this definition does not have a parent. |
| | | * <code>null</code> if this definition does not have a |
| | | * parent. |
| | | */ |
| | | public final AbstractManagedObjectDefinition<? super C, |
| | | ? super S> getParent() { |
| | |
| | | |
| | | |
| | | /** |
| | | * Gets the synopsis of this managed object definition in the |
| | | * default locale. |
| | | * |
| | | * @return Returns the synopsis of this managed object definition in |
| | | * the default locale. |
| | | */ |
| | | public final String getSynopsis() { |
| | | return getSynopsis(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the synopsis of this managed object definition in the |
| | | * specified locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the synopsis of this managed object definition in |
| | | * the specified locale. |
| | | */ |
| | | public final String getSynopsis(Locale locale) { |
| | | return ManagedObjectDefinitionI18NResource.getInstance() |
| | | .getMessage(this, "synopsis", locale); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the user friendly name of this managed object definition in |
| | | * the default locale. |
| | | * |
| | | * @return Returns the user friendly name of this managed object |
| | | * definition in the default locale. |
| | | */ |
| | | public final String getUserFriendlyName() { |
| | | return getUserFriendlyName(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the user friendly name of this managed object definition in |
| | | * the specified locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the user friendly name of this managed object |
| | | * definition in the specified locale. |
| | | */ |
| | | public final String getUserFriendlyName(Locale locale) { |
| | | return ManagedObjectDefinitionI18NResource.getInstance() |
| | | .getMessage(this, "user-friendly-name", locale); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the user friendly plural name of this managed object |
| | | * definition in the default locale. |
| | | * |
| | | * @return Returns the user friendly plural name of this managed |
| | | * object definition in the default locale. |
| | | */ |
| | | public final String getUserFriendlyPluralName() { |
| | | return getUserFriendlyPluralName(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the user friendly plural name of this managed object |
| | | * definition in the specified locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the user friendly plural name of this managed |
| | | * object definition in the specified locale. |
| | | */ |
| | | public final String getUserFriendlyPluralName(Locale locale) { |
| | | return ManagedObjectDefinitionI18NResource.getInstance() |
| | | .getMessage(this, "user-friendly-plural-name", locale); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Determine whether there are any child managed object definitions which |
| | | * inherit from this managed object definition. |
| | | * |
| | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | |
| | | import java.util.EnumSet; |
| | | import java.util.Locale; |
| | | import java.util.MissingResourceException; |
| | | import java.util.Set; |
| | | |
| | | |
| | |
| | | protected abstract static class AbstractBuilder<T, |
| | | D extends PropertyDefinition<T>> { |
| | | |
| | | // The abstract managed object |
| | | private final AbstractManagedObjectDefinition<?, ?> definition; |
| | | |
| | | // The name of this property definition. |
| | | private final String propertyName; |
| | | |
| | |
| | | /** |
| | | * Create a property definition builder. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | */ |
| | | protected AbstractBuilder(String propertyName) { |
| | | protected AbstractBuilder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | this.definition = d; |
| | | this.propertyName = propertyName; |
| | | this.options = EnumSet.noneOf(PropertyOption.class); |
| | | this.defaultBehavior = new UndefinedDefaultBehaviorProvider<T>(); |
| | |
| | | * @return The new property definition. |
| | | */ |
| | | public final D getInstance() { |
| | | return buildInstance(propertyName, options, defaultBehavior); |
| | | return buildInstance(definition, propertyName, options, defaultBehavior); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Build a property definition based on the properties of this builder. |
| | | * Build a property definition based on the properties of this |
| | | * builder. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | * @param options |
| | |
| | | * The default behavior provider. |
| | | * @return The new property definition. |
| | | */ |
| | | protected abstract D buildInstance(String propertyName, |
| | | protected abstract D buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<T> defaultBehavior); |
| | | } |
| | |
| | | // The default behavior provider. |
| | | private final DefaultBehaviorProvider<T> defaultBehavior; |
| | | |
| | | // The abstract managed object |
| | | private final AbstractManagedObjectDefinition<?, ?> definition; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Create a property definition. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param theClass |
| | | * The property value class. |
| | | * @param propertyName |
| | |
| | | * @param defaultBehavior |
| | | * The default behavior provider. |
| | | */ |
| | | protected AbstractPropertyDefinition(Class<T> theClass, String propertyName, |
| | | protected AbstractPropertyDefinition(AbstractManagedObjectDefinition<?,?> d, |
| | | Class<T> theClass, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<T> defaultBehavior) { |
| | | ensureNotNull(theClass, propertyName, options, defaultBehavior); |
| | | ensureNotNull(d, theClass, propertyName); |
| | | ensureNotNull(options, defaultBehavior); |
| | | |
| | | this.definition = d; |
| | | this.theClass = theClass; |
| | | this.propertyName = propertyName; |
| | | this.options = EnumSet.copyOf(options); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public final String getDescription() { |
| | | return getDescription(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public final String getDescription(Locale locale) { |
| | | ManagedObjectDefinitionI18NResource resource = |
| | | ManagedObjectDefinitionI18NResource.getInstance(); |
| | | String property = "property." + propertyName + ".description"; |
| | | try { |
| | | return resource.getMessage(definition, property, locale); |
| | | } catch (MissingResourceException e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the managed object definition associated with this property |
| | | * definition. |
| | | * |
| | | * @return Returns the managed object definition associated with |
| | | * this property definition. |
| | | */ |
| | | public final AbstractManagedObjectDefinition<?, ?> |
| | | getManagedObjectDefinition() { |
| | | return definition; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public final String getName() { |
| | | return propertyName; |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public final String getSynopsis() { |
| | | return getSynopsis(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public final String getSynopsis(Locale locale) { |
| | | ManagedObjectDefinitionI18NResource resource = |
| | | ManagedObjectDefinitionI18NResource.getInstance(); |
| | | String property = "property." + propertyName + ".synopsis"; |
| | | try { |
| | | return resource.getMessage(definition, property, locale); |
| | | } catch (MissingResourceException e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int hashCode() { |
| | | // TODO: see comment in equals(). |
| | |
| | | */ |
| | | package org.opends.server.admin; |
| | | |
| | | import java.util.Locale; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | public final class AliasDefaultBehaviorProvider<T> implements |
| | | DefaultBehaviorProvider<T> { |
| | | |
| | | // The managed object definition associated with this default |
| | | // behavior. |
| | | private final AbstractManagedObjectDefinition<?, ?> definition; |
| | | |
| | | // The name of the property definition associated with this default |
| | | // behavior. |
| | | private final String propertyName; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Create an alias default behavior provider. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * default behavior. |
| | | * @param propertyName |
| | | * The name of the property definition associated with this |
| | | * default behavior. |
| | | */ |
| | | public AliasDefaultBehaviorProvider() { |
| | | // No implementation required. |
| | | public AliasDefaultBehaviorProvider( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | this.definition = d; |
| | | this.propertyName = propertyName; |
| | | } |
| | | |
| | | |
| | |
| | | return v.visitAlias(this, p); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the synopsis of this alias default behavior in the |
| | | * default locale. |
| | | * |
| | | * @return Returns the synopsis of this alias default behavior in |
| | | * the default locale. |
| | | */ |
| | | public final String getSynopsis() { |
| | | return getSynopsis(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the synopsis of this alias default behavior in the specified |
| | | * locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the synopsis of this alias default behavior in |
| | | * the specified locale. |
| | | */ |
| | | public final String getSynopsis(Locale locale) { |
| | | ManagedObjectDefinitionI18NResource resource = |
| | | ManagedObjectDefinitionI18NResource.getInstance(); |
| | | String property = "property." + propertyName |
| | | + ".default-behavior.alias.synopsis"; |
| | | return resource.getMessage(definition, property, locale); |
| | | } |
| | | |
| | | } |
| | |
| | | AbstractBuilder<AttributeType, AttributeTypePropertyDefinition> { |
| | | |
| | | // Private constructor |
| | | private Builder(String propertyName) { |
| | | super(propertyName); |
| | | private Builder(AbstractManagedObjectDefinition<?, ?> d, |
| | | String propertyName) { |
| | | super(d, propertyName); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @Override |
| | | protected AttributeTypePropertyDefinition buildInstance( |
| | | String propertyName, EnumSet<PropertyOption> options, |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<AttributeType> defaultBehavior) { |
| | | return new AttributeTypePropertyDefinition(propertyName, |
| | | return new AttributeTypePropertyDefinition(d, propertyName, |
| | | options, defaultBehavior); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * Create a attribute type property definition builder. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | * @return Returns the new attribute type property definition |
| | | * builder. |
| | | */ |
| | | public static Builder createBuilder(String propertyName) { |
| | | return new Builder(propertyName); |
| | | public static Builder createBuilder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | return new Builder(d, propertyName); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | // Private constructor. |
| | | private AttributeTypePropertyDefinition(String propertyName, |
| | | private AttributeTypePropertyDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<AttributeType> defaultBehavior) { |
| | | super(AttributeType.class, propertyName, options, |
| | | super(d, AttributeType.class, propertyName, options, |
| | | defaultBehavior); |
| | | } |
| | | |
| | |
| | | AbstractBuilder<Boolean, BooleanPropertyDefinition> { |
| | | |
| | | // Private constructor |
| | | private Builder(String propertyName) { |
| | | super(propertyName); |
| | | private Builder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | super(d, propertyName); |
| | | } |
| | | |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected BooleanPropertyDefinition buildInstance(String propertyName, |
| | | protected BooleanPropertyDefinition buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<Boolean> defaultBehavior) { |
| | | return new BooleanPropertyDefinition(propertyName, options, |
| | | return new BooleanPropertyDefinition(d, propertyName, options, |
| | | defaultBehavior); |
| | | } |
| | | |
| | |
| | | /** |
| | | * Create a boolean property definition builder. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | * @return Returns the new boolean property definition builder. |
| | | */ |
| | | public static Builder createBuilder(String propertyName) { |
| | | return new Builder(propertyName); |
| | | public static Builder createBuilder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | return new Builder(d, propertyName); |
| | | } |
| | | |
| | | |
| | | |
| | | // Private constructor. |
| | | private BooleanPropertyDefinition(String propertyName, |
| | | private BooleanPropertyDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<Boolean> defaultBehavior) { |
| | | super(Boolean.class, propertyName, options, defaultBehavior); |
| | | super(d, Boolean.class, propertyName, options, defaultBehavior); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | // Private constructor |
| | | private Builder(String propertyName) { |
| | | super(propertyName); |
| | | private Builder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | super(d, propertyName); |
| | | |
| | | this.instanceOfInterfaces = new LinkedList<String>(); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | protected ClassPropertyDefinition buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, |
| | | String propertyName, EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<String> defaultBehavior) { |
| | | return new ClassPropertyDefinition(propertyName, options, |
| | | return new ClassPropertyDefinition(d, propertyName, options, |
| | | defaultBehavior, instanceOfInterfaces); |
| | | } |
| | | |
| | |
| | | /** |
| | | * Create a class property definition builder. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | * @return Returns the new class property definition builder. |
| | | */ |
| | | public static Builder createBuilder(String propertyName) { |
| | | return new Builder(propertyName); |
| | | public static Builder createBuilder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | return new Builder(d, propertyName); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | // Private constructor. |
| | | private ClassPropertyDefinition(String propertyName, |
| | | private ClassPropertyDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<String> defaultBehavior, |
| | | List<String> instanceOfInterfaces) { |
| | | super(String.class, propertyName, options, defaultBehavior); |
| | | super(d, String.class, propertyName, options, defaultBehavior); |
| | | |
| | | this.instanceOfInterfaces = Collections |
| | | .unmodifiableList(new LinkedList<String>(instanceOfInterfaces)); |
| | |
| | | |
| | | |
| | | // Private constructor |
| | | private Builder(String propertyName) { |
| | | super(propertyName); |
| | | private Builder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | super(d, propertyName); |
| | | } |
| | | |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected DNPropertyDefinition buildInstance(String propertyName, |
| | | protected DNPropertyDefinition buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<DN> defaultBehavior) { |
| | | return new DNPropertyDefinition(propertyName, options, |
| | | return new DNPropertyDefinition(d, propertyName, options, |
| | | defaultBehavior, baseDN); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * Create a DN property definition builder. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | * @return Returns the new boolean property definition builder. |
| | | */ |
| | | public static Builder createBuilder(String propertyName) { |
| | | return new Builder(propertyName); |
| | | public static Builder createBuilder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | return new Builder(d, propertyName); |
| | | } |
| | | |
| | | |
| | | |
| | | // Private constructor. |
| | | private DNPropertyDefinition(String propertyName, |
| | | private DNPropertyDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<DN> defaultBehavior, DN baseDN) { |
| | | super(DN.class, propertyName, options, defaultBehavior); |
| | | super(d, DN.class, propertyName, options, defaultBehavior); |
| | | this.baseDN = baseDN; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | // Private constructor |
| | | private Builder(String propertyName) { |
| | | super(propertyName); |
| | | private Builder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | super(d, propertyName); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @Override |
| | | protected DurationPropertyDefinition buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, |
| | | String propertyName, EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<Long> defaultBehavior) { |
| | | return new DurationPropertyDefinition(propertyName, options, |
| | | return new DurationPropertyDefinition(d, propertyName, options, |
| | | defaultBehavior, baseUnit, maximumUnit, lowerLimit, |
| | | upperLimit, allowUnlimited); |
| | | } |
| | |
| | | /** |
| | | * Create a duration property definition builder. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | * @return Returns the new integer property definition builder. |
| | | */ |
| | | public static Builder createBuilder(String propertyName) { |
| | | return new Builder(propertyName); |
| | | public static Builder createBuilder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | return new Builder(d, propertyName); |
| | | } |
| | | |
| | | |
| | | |
| | | // Private constructor. |
| | | private DurationPropertyDefinition(String propertyName, |
| | | private DurationPropertyDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<Long> defaultBehavior, |
| | | DurationUnit baseUnit, DurationUnit maximumUnit, |
| | | Long lowerLimit, Long upperLimit, boolean allowUnlimited) { |
| | | super(Long.class, propertyName, options, defaultBehavior); |
| | | super(d, Long.class, propertyName, options, defaultBehavior); |
| | | this.baseUnit = baseUnit; |
| | | this.maximumUnit = maximumUnit; |
| | | this.lowerLimit = lowerLimit; |
| | |
| | | |
| | | import java.util.EnumSet; |
| | | import java.util.HashMap; |
| | | import java.util.Locale; |
| | | import java.util.Map; |
| | | import java.util.MissingResourceException; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | // Private constructor |
| | | private Builder(String propertyName) { |
| | | super(propertyName); |
| | | private Builder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | super(d, propertyName); |
| | | this.enumClass = null; |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | protected EnumPropertyDefinition<E> buildInstance( |
| | | String propertyName, EnumSet<PropertyOption> options, |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<E> defaultBehavior) { |
| | | // Make sure that the enumeration class has been defined. |
| | | if (enumClass == null) { |
| | | throw new IllegalStateException("Enumeration class undefined"); |
| | | } |
| | | |
| | | return new EnumPropertyDefinition<E>(propertyName, options, |
| | | return new EnumPropertyDefinition<E>(d, propertyName, options, |
| | | defaultBehavior, enumClass); |
| | | } |
| | | } |
| | |
| | | * @param <E> |
| | | * The enumeration that should be used for values of this |
| | | * property definition. |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | * @return Returns the new enumeration property definition builder. |
| | | */ |
| | | public static <E extends Enum<E>> Builder<E> createBuilder( |
| | | String propertyName) { |
| | | return new Builder<E>(propertyName); |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | return new Builder<E>(d, propertyName); |
| | | } |
| | | |
| | | // The enumeration class. |
| | |
| | | |
| | | |
| | | // Private constructor. |
| | | private EnumPropertyDefinition(String propertyName, |
| | | private EnumPropertyDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<E> defaultBehavior, Class<E> enumClass) { |
| | | super(enumClass, propertyName, options, defaultBehavior); |
| | | super(d, enumClass, propertyName, options, defaultBehavior); |
| | | this.enumClass = enumClass; |
| | | |
| | | // Initialize the decoding map. |
| | |
| | | |
| | | |
| | | /** |
| | | * Gets the synopsis of the specified enumeration value of this |
| | | * enumeration property definition in the default locale. |
| | | * |
| | | * @param value |
| | | * The enumeration value. |
| | | * @return Returns the synopsis of the specified enumeration value |
| | | * of this enumeration property definition in the default |
| | | * locale. |
| | | */ |
| | | public final String getValueSynopsis(E value) { |
| | | return getValueSynopsis(Locale.getDefault(), value); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the synopsis of the specified enumeration value of this |
| | | * enumeration property definition in the specified locale. |
| | | * |
| | | * @param value |
| | | * The enumeration value. |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the synopsis of the specified enumeration value |
| | | * of this enumeration property definition in the specified |
| | | * locale. |
| | | */ |
| | | public final String getValueSynopsis(Locale locale, E value) { |
| | | ManagedObjectDefinitionI18NResource resource = |
| | | ManagedObjectDefinitionI18NResource.getInstance(); |
| | | String property = "property." + getName() |
| | | + ".syntax.enumeration.value." + value.toString() |
| | | + ".synopsis"; |
| | | try { |
| | | return resource.getMessage(getManagedObjectDefinition(), |
| | | property, locale); |
| | | } catch (MissingResourceException e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | |
| | | AbstractBuilder<AddressMask, IPAddressMaskPropertyDefinition> { |
| | | |
| | | // Private constructor |
| | | private Builder(String propertyName) { |
| | | super(propertyName); |
| | | private Builder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | super(d, propertyName); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @Override |
| | | protected IPAddressMaskPropertyDefinition buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, |
| | | String propertyName, EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<AddressMask> defaultBehavior) { |
| | | return new IPAddressMaskPropertyDefinition(propertyName, options, |
| | | return new IPAddressMaskPropertyDefinition(d, propertyName, options, |
| | | defaultBehavior); |
| | | } |
| | | |
| | |
| | | /** |
| | | * Create a IP address mask property definition builder. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | * @return Returns the new IP address mask property definition builder. |
| | | */ |
| | | public static Builder createBuilder(String propertyName) { |
| | | return new Builder(propertyName); |
| | | public static Builder createBuilder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | return new Builder(d, propertyName); |
| | | } |
| | | |
| | | |
| | | |
| | | // Private constructor. |
| | | private IPAddressMaskPropertyDefinition(String propertyName, |
| | | private IPAddressMaskPropertyDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<AddressMask> defaultBehavior) { |
| | | super(AddressMask.class, propertyName, options, defaultBehavior); |
| | | super(d, AddressMask.class, propertyName, options, defaultBehavior); |
| | | } |
| | | |
| | | |
| | |
| | | AbstractBuilder<InetAddress, IPAddressPropertyDefinition> { |
| | | |
| | | // Private constructor |
| | | private Builder(String propertyName) { |
| | | super(propertyName); |
| | | private Builder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | super(d, propertyName); |
| | | } |
| | | |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected IPAddressPropertyDefinition buildInstance(String propertyName, |
| | | protected IPAddressPropertyDefinition buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<InetAddress> defaultBehavior) { |
| | | return new IPAddressPropertyDefinition(propertyName, options, |
| | | return new IPAddressPropertyDefinition(d, propertyName, options, |
| | | defaultBehavior); |
| | | } |
| | | |
| | |
| | | /** |
| | | * Create a IP address property definition builder. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | * @return Returns the new IP address property definition builder. |
| | | */ |
| | | public static Builder createBuilder(String propertyName) { |
| | | return new Builder(propertyName); |
| | | public static Builder createBuilder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | return new Builder(d, propertyName); |
| | | } |
| | | |
| | | |
| | | |
| | | // Private constructor. |
| | | private IPAddressPropertyDefinition(String propertyName, |
| | | private IPAddressPropertyDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<InetAddress> defaultBehavior) { |
| | | super(InetAddress.class, propertyName, options, defaultBehavior); |
| | | super(d, InetAddress.class, propertyName, options, defaultBehavior); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | import java.util.Locale; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | /** |
| | | * Gets the user friendly plural name of this relation definition in |
| | | * the default locale. |
| | | * |
| | | * @return Returns the user friendly plural name of this relation |
| | | * definition in the default locale. |
| | | */ |
| | | public final String getUserFriendlyPluralName() { |
| | | return getUserFriendlyPluralName(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the user friendly plural name of this relation definition in |
| | | * the specified locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the user friendly plural name of this relation |
| | | * definition in the specified locale. |
| | | */ |
| | | public final String getUserFriendlyPluralName(Locale locale) { |
| | | String property = "relation." + getName() |
| | | + ".user-friendly-plural-name"; |
| | | return ManagedObjectDefinitionI18NResource.getInstance() |
| | | .getMessage(getParentDefinition(), property, locale); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | |
| | | import java.util.EnumSet; |
| | | import java.util.Locale; |
| | | import java.util.MissingResourceException; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | // Private constructor |
| | | private Builder(String propertyName) { |
| | | super(propertyName); |
| | | private Builder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | super(d, propertyName); |
| | | } |
| | | |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected IntegerPropertyDefinition buildInstance(String propertyName, |
| | | protected IntegerPropertyDefinition buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<Integer> defaultBehavior) { |
| | | return new IntegerPropertyDefinition(propertyName, options, |
| | | return new IntegerPropertyDefinition(d, propertyName, options, |
| | | defaultBehavior, lowerLimit, upperLimit, allowUnlimited); |
| | | } |
| | | |
| | |
| | | /** |
| | | * Create an integer property definition builder. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | * @return Returns the new integer property definition builder. |
| | | */ |
| | | public static Builder createBuilder(String propertyName) { |
| | | return new Builder(propertyName); |
| | | public static Builder createBuilder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | return new Builder(d, propertyName); |
| | | } |
| | | |
| | | |
| | | |
| | | // Private constructor. |
| | | private IntegerPropertyDefinition(String propertyName, |
| | | private IntegerPropertyDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<Integer> defaultBehavior, int lowerLimit, |
| | | Integer upperLimit, boolean allowUnlimited) { |
| | | super(Integer.class, propertyName, options, defaultBehavior); |
| | | super(d, Integer.class, propertyName, options, defaultBehavior); |
| | | this.lowerLimit = lowerLimit; |
| | | this.upperLimit = upperLimit; |
| | | this.allowUnlimited = allowUnlimited; |
| | |
| | | |
| | | |
| | | /** |
| | | * Gets the optional unit synopsis of this integer property |
| | | * definition in the default locale. |
| | | * |
| | | * @return Returns the unit synopsis of this integer property |
| | | * definition in the default locale, or <code>null</code> |
| | | * if there is no unit synopsis. |
| | | */ |
| | | public String getUnitSynopsis() { |
| | | return getUnitSynopsis(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the optional unit synopsis of this integer property |
| | | * definition in the specified locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the unit synopsis of this integer property |
| | | * definition in the specified locale, or <code>null</code> |
| | | * if there is no unit synopsis. |
| | | */ |
| | | public String getUnitSynopsis(Locale locale) { |
| | | ManagedObjectDefinitionI18NResource resource = |
| | | ManagedObjectDefinitionI18NResource.getInstance(); |
| | | String property = "property." + getName() + ".syntax.integer.unit-synopsis"; |
| | | try { |
| | | return resource.getMessage(getManagedObjectDefinition(), |
| | | property, locale); |
| | | } catch (MissingResourceException e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Determine whether this property allows unlimited values. |
| | | * |
| | | * @return Returns <code>true</code> if this this property allows unlimited |
| | |
| | | */ |
| | | public final class ManagedObjectDefinitionI18NResource { |
| | | |
| | | // Mapping from definition to resource bundle. |
| | | private final Map<AbstractManagedObjectDefinition, ResourceBundle> resources; |
| | | |
| | | // The resource name prefix. |
| | | private final String prefix; |
| | | // Application-wide set of instances. |
| | | private static final Map<String, ManagedObjectDefinitionI18NResource> |
| | | INSTANCES = new HashMap<String, ManagedObjectDefinitionI18NResource>(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new internationalized resource instance which can be |
| | | * used to retrieve the localized descriptions for the managed |
| | | * objects and their associated properties and relations. |
| | | * Gets the internationalized resource instance which can be used to |
| | | * retrieve the localized descriptions for the managed objects and |
| | | * their associated properties and relations. |
| | | * |
| | | * @return Returns the I18N resource instance. |
| | | */ |
| | | public static ManagedObjectDefinitionI18NResource create() { |
| | | return new ManagedObjectDefinitionI18NResource("admin.messages"); |
| | | public static ManagedObjectDefinitionI18NResource getInstance() { |
| | | return getInstance("admin.messages"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new internationalized resource instance for the named |
| | | * Gets the internationalized resource instance for the named |
| | | * profile. |
| | | * |
| | | * @param profile |
| | | * The name of the profile. |
| | | * @return Returns the I18N resource instance for the named profile. |
| | | */ |
| | | public static ManagedObjectDefinitionI18NResource createForProfile( |
| | | public static ManagedObjectDefinitionI18NResource getInstanceForProfile( |
| | | String profile) { |
| | | return new ManagedObjectDefinitionI18NResource("admin.profiles." |
| | | + profile); |
| | | return getInstance("admin.profiles." + profile); |
| | | } |
| | | |
| | | |
| | | |
| | | // Get a resource instance creating it if necessary. |
| | | private synchronized static ManagedObjectDefinitionI18NResource getInstance( |
| | | String prefix) { |
| | | ManagedObjectDefinitionI18NResource instance = INSTANCES |
| | | .get(prefix); |
| | | |
| | | if (instance == null) { |
| | | instance = new ManagedObjectDefinitionI18NResource(prefix); |
| | | INSTANCES.put(prefix, instance); |
| | | } |
| | | |
| | | return instance; |
| | | } |
| | | |
| | | |
| | | |
| | | // Mapping from definition to locale-based resource bundle. |
| | | private final Map<AbstractManagedObjectDefinition, |
| | | Map<Locale, ResourceBundle>> resources; |
| | | |
| | | |
| | | |
| | | // The resource name prefix. |
| | | private final String prefix; |
| | | |
| | | |
| | | |
| | | // Private constructor. |
| | | private ManagedObjectDefinitionI18NResource(String prefix) { |
| | | this.resources = |
| | | new HashMap<AbstractManagedObjectDefinition, ResourceBundle>(); |
| | | this.resources = new HashMap<AbstractManagedObjectDefinition, |
| | | Map<Locale, ResourceBundle>>(); |
| | | this.prefix = prefix; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Get the parameterized internationalized message associated with |
| | | * the specified key in the default locale. |
| | | * |
| | | * @param d |
| | | * The managed object definition. |
| | | * @param key |
| | | * The resource key. |
| | | * @param args |
| | | * Arguments that should be inserted into the retrieved |
| | | * message. |
| | | * @return Returns the internationalized message associated with the |
| | | * specified key in the default locale. |
| | | * @throws MissingResourceException |
| | | * If the key was not found. |
| | | */ |
| | | public String getMessage(AbstractManagedObjectDefinition d, |
| | | String key, String... args) throws MissingResourceException { |
| | | return getMessage(d, key, Locale.getDefault(), args); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the internationalized message associated with the specified |
| | | * key and locale. |
| | | * |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the parameterized internationalized message associated with |
| | | * the specified key in the default locale. |
| | | * |
| | | * @param d |
| | | * The managed object definition. |
| | | * @param key |
| | | * The resource key. |
| | | * @param args |
| | | * Arguments that should be inserted into the retrieved |
| | | * message. |
| | | * @return Returns the internationalized message associated with the |
| | | * specified key in the default locale. |
| | | * @throws MissingResourceException |
| | | * If the key was not found. |
| | | */ |
| | | public String getMessage(AbstractManagedObjectDefinition d, |
| | | String key, String... args) throws MissingResourceException { |
| | | return getMessage(d, key, Locale.getDefault(), args); |
| | | } |
| | | |
| | | |
| | | |
| | | // Retrieve the resource bundle associated with a managed object and |
| | | // locale, |
| | | // lazily loading it if necessary. |
| | | // locale, lazily loading it if necessary. |
| | | private synchronized ResourceBundle getResourceBundle( |
| | | AbstractManagedObjectDefinition d, Locale locale) |
| | | throws MissingResourceException { |
| | | ResourceBundle r = resources.get(d); |
| | | |
| | | if (r == null) { |
| | | // Load the resource file. |
| | | String baseName = prefix + "." + d.getClass().getName(); |
| | | r = ResourceBundle.getBundle(baseName, locale, |
| | | ClassLoaderProvider.getInstance().getClassLoader()); |
| | | |
| | | // Cache the resource. |
| | | resources.put(d, r); |
| | | // First get the locale-resource mapping, creating it if |
| | | // necessary. |
| | | Map<Locale, ResourceBundle> map = resources.get(d); |
| | | if (map == null) { |
| | | map = new HashMap<Locale, ResourceBundle>(); |
| | | resources.put(d, map); |
| | | } |
| | | |
| | | return r; |
| | | // Now get the resource based on the locale, loading it if |
| | | // necessary. |
| | | ResourceBundle resourceBundle = map.get(locale); |
| | | if (resourceBundle == null) { |
| | | String baseName = prefix + "." + d.getClass().getName(); |
| | | resourceBundle = ResourceBundle.getBundle(baseName, locale, |
| | | ClassLoaderProvider.getInstance().getClassLoader()); |
| | | map.put(locale, resourceBundle); |
| | | } |
| | | |
| | | return resourceBundle; |
| | | } |
| | | } |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Comparator; |
| | | import java.util.Locale; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Gets the optional description of this property definition in the |
| | | * default locale. |
| | | * |
| | | * @return Returns the description of this property definition in |
| | | * the default locale, or <code>null</code> if there is no |
| | | * description. |
| | | */ |
| | | String getDescription(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the optional description of this property definition in the |
| | | * specified locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the description of this property definition in |
| | | * the specified locale, or <code>null</code> if there is |
| | | * no description. |
| | | */ |
| | | String getDescription(Locale locale); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the name of the property. |
| | | * |
| | | * @return Returns the name of the property. |
| | |
| | | |
| | | |
| | | /** |
| | | * Gets the synopsis of this property definition in the default |
| | | * locale. |
| | | * |
| | | * @return Returns the synopsis of this property definition in the |
| | | * default locale. |
| | | */ |
| | | String getSynopsis(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the synopsis of this property definition in the specified |
| | | * locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the synopsis of this property definition in the |
| | | * specified locale. |
| | | */ |
| | | String getSynopsis(Locale locale); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns a hash code value for this property definition. The hash code |
| | | * should be derived from the property name. |
| | | * |
| | |
| | | |
| | | |
| | | |
| | | import java.util.Locale; |
| | | import java.util.MissingResourceException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Relation definitions define relationships between types of managed |
| | | * objects. In addition they define the ownership model: |
| | |
| | | |
| | | |
| | | /** |
| | | * Create a new managed object relation definition with the specified name and |
| | | * referenced managed object definition. |
| | | * Create a new managed object relation definition with the |
| | | * specified name and referenced managed object definition. |
| | | * |
| | | * @param pd |
| | | * The parent managed object definition. |
| | |
| | | * @param cd |
| | | * The child managed object definition. |
| | | */ |
| | | protected RelationDefinition(AbstractManagedObjectDefinition<?, ?> pd, |
| | | String name, AbstractManagedObjectDefinition<C, S> cd) { |
| | | protected RelationDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> pd, String name, |
| | | AbstractManagedObjectDefinition<C, S> cd) { |
| | | this.name = name; |
| | | this.pd = pd; |
| | | this.cd = cd; |
| | |
| | | |
| | | |
| | | /** |
| | | * Apply a visitor to this relation definition. |
| | | * |
| | | * @param <R> |
| | | * The return type of the visitor's methods. |
| | | * @param <P> |
| | | * The type of the additional parameters to the visitor's |
| | | * methods. |
| | | * @param v |
| | | * The relation definition visitor. |
| | | * @param p |
| | | * Optional additional visitor parameter. |
| | | * @return Returns a result as specified by the visitor. |
| | | */ |
| | | public abstract <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the definition of the child managed object. |
| | | * |
| | | * @return Returns the definition of the child managed object. |
| | | */ |
| | | public final AbstractManagedObjectDefinition<C, S> getChildDefinition() { |
| | | return cd; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the optional description of this relation definition in the |
| | | * default locale. |
| | | * |
| | | * @return Returns the description of this relation definition in |
| | | * the default locale, or <code>null</code> if there is no |
| | | * description. |
| | | */ |
| | | public final String getDescription() { |
| | | return getDescription(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the optional description of this relation definition in the |
| | | * specified locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the description of this relation definition in |
| | | * the specified locale, or <code>null</code> if there is |
| | | * no description. |
| | | */ |
| | | public final String getDescription(Locale locale) { |
| | | try { |
| | | String property = "relation." + name + ".description"; |
| | | return ManagedObjectDefinitionI18NResource.getInstance() |
| | | .getMessage(getParentDefinition(), property, locale); |
| | | } catch (MissingResourceException e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the name of the relation. |
| | | * |
| | | * @return Returns the name of the relation. |
| | |
| | | |
| | | |
| | | /** |
| | | * Get the definition of the child managed object. |
| | | * Gets the synopsis of this relation definition in the default |
| | | * locale. |
| | | * |
| | | * @return Returns the definition of the child managed object. |
| | | * @return Returns the synopsis of this relation definition in the |
| | | * default locale. |
| | | */ |
| | | public final AbstractManagedObjectDefinition<C, S> getChildDefinition() { |
| | | return cd; |
| | | public final String getSynopsis() { |
| | | return getSynopsis(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the synopsis of this relation definition in the specified |
| | | * locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the synopsis of this relation definition in the |
| | | * specified locale. |
| | | */ |
| | | public final String getSynopsis(Locale locale) { |
| | | String property = "relation." + name + ".synopsis"; |
| | | return ManagedObjectDefinitionI18NResource.getInstance() |
| | | .getMessage(getParentDefinition(), property, locale); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the user friendly name of this relation definition in the |
| | | * default locale. |
| | | * |
| | | * @return Returns the user friendly name of this relation |
| | | * definition in the default locale. |
| | | */ |
| | | public final String getUserFriendlyName() { |
| | | return getUserFriendlyName(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the user friendly name of this relation definition in the |
| | | * specified locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the user friendly name of this relation |
| | | * definition in the specified locale. |
| | | */ |
| | | public final String getUserFriendlyName(Locale locale) { |
| | | String property = "relation." + name + ".user-friendly-name"; |
| | | return ManagedObjectDefinitionI18NResource.getInstance() |
| | | .getMessage(getParentDefinition(), property, locale); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Append a string representation of the managed object relation to the |
| | | * provided string builder. |
| | | * Append a string representation of the managed object relation to |
| | | * the provided string builder. |
| | | * |
| | | * @param builder |
| | | * The string builder where the string representation should be |
| | | * appended. |
| | | * The string builder where the string representation |
| | | * should be appended. |
| | | */ |
| | | public abstract void toString(StringBuilder builder); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Apply a visitor to this relation definition. |
| | | * |
| | | * @param <R> |
| | | * The return type of the visitor's methods. |
| | | * @param <P> |
| | | * The type of the additional parameters to the visitor's |
| | | * methods. |
| | | * @param v |
| | | * The relation definition visitor. |
| | | * @param p |
| | | * Optional additional visitor parameter. |
| | | * @return Returns a result as specified by the visitor. |
| | | */ |
| | | public abstract <R, P> R accept(RelationDefinitionVisitor<R, P> v, |
| | | P p); |
| | | } |
| | |
| | | |
| | | |
| | | // Private constructor |
| | | private Builder(String propertyName) { |
| | | super(propertyName); |
| | | private Builder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | super(d, propertyName); |
| | | } |
| | | |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected SizePropertyDefinition buildInstance(String propertyName, |
| | | protected SizePropertyDefinition buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<Long> defaultBehavior) { |
| | | return new SizePropertyDefinition(propertyName, options, |
| | | return new SizePropertyDefinition(d, propertyName, options, |
| | | defaultBehavior, lowerLimit, upperLimit, allowUnlimited); |
| | | } |
| | | |
| | |
| | | /** |
| | | * Create an memory size property definition builder. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | * @return Returns the new integer property definition builder. |
| | | */ |
| | | public static Builder createBuilder(String propertyName) { |
| | | return new Builder(propertyName); |
| | | public static Builder createBuilder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | return new Builder(d, propertyName); |
| | | } |
| | | |
| | | |
| | | |
| | | // Private constructor. |
| | | private SizePropertyDefinition(String propertyName, |
| | | private SizePropertyDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<Long> defaultBehavior, Long lowerLimit, |
| | | Long upperLimit, boolean allowUnlimited) { |
| | | super(Long.class, propertyName, options, defaultBehavior); |
| | | super(d, Long.class, propertyName, options, defaultBehavior); |
| | | this.lowerLimit = lowerLimit; |
| | | this.upperLimit = upperLimit; |
| | | this.allowUnlimited = allowUnlimited; |
| | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | |
| | | import java.util.EnumSet; |
| | | import java.util.Locale; |
| | | import java.util.MissingResourceException; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | // Private constructor |
| | | private Builder(String propertyName) { |
| | | super(propertyName); |
| | | private Builder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | super(d, propertyName); |
| | | } |
| | | |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected StringPropertyDefinition buildInstance(String propertyName, |
| | | protected StringPropertyDefinition buildInstance( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<String> defaultBehavior) { |
| | | return new StringPropertyDefinition(propertyName, options, |
| | | return new StringPropertyDefinition(d, propertyName, options, |
| | | defaultBehavior, isCaseInsensitive); |
| | | } |
| | | |
| | |
| | | /** |
| | | * Create a string property definition builder. |
| | | * |
| | | * @param d |
| | | * The managed object definition associated with this |
| | | * property definition. |
| | | * @param propertyName |
| | | * The property name. |
| | | * @return Returns the new string property definition builder. |
| | | */ |
| | | public static Builder createBuilder(String propertyName) { |
| | | return new Builder(propertyName); |
| | | public static Builder createBuilder( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | return new Builder(d, propertyName); |
| | | } |
| | | |
| | | |
| | | |
| | | // Private constructor. |
| | | private StringPropertyDefinition(String propertyName, |
| | | private StringPropertyDefinition( |
| | | AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, |
| | | DefaultBehaviorProvider<String> defaultBehavior, |
| | | boolean isCaseInsensitive) { |
| | | super(String.class, propertyName, options, defaultBehavior); |
| | | super(d, String.class, propertyName, options, defaultBehavior); |
| | | this.isCaseInsensitive = isCaseInsensitive; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the pattern synopsis of this string property definition in |
| | | * the default locale. |
| | | * |
| | | * @return Returns the pattern synopsis of this string property |
| | | * definition in the default locale, or <code>null</code> |
| | | * if there is no pattern synopsis (which is the case when |
| | | * there is no pattern matching defined for this string |
| | | * property definition). |
| | | */ |
| | | public String getPatternSynopsis() { |
| | | return getPatternSynopsis(Locale.getDefault()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the optional pattern synopsis of this string property |
| | | * definition in the specified locale. |
| | | * |
| | | * @param locale |
| | | * The locale. |
| | | * @return Returns the pattern synopsis of this string property |
| | | * definition in the specified locale, or <code>null</code> |
| | | * if there is no pattern synopsis (which is the case when |
| | | * there is no pattern matching defined for this string |
| | | * property definition). |
| | | */ |
| | | public String getPatternSynopsis(Locale locale) { |
| | | ManagedObjectDefinitionI18NResource resource = |
| | | ManagedObjectDefinitionI18NResource.getInstance(); |
| | | String property = "property." + getName() |
| | | + ".syntax.string.pattern.synopsis"; |
| | | try { |
| | | return resource.getMessage(getManagedObjectDefinition(), |
| | | property, locale); |
| | | } catch (MissingResourceException e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Query whether values of this property are case-insensitive. |
| | | * |
| | | * @return Returns <code>true</code> if values are case-insensitive, or |
| | |
| | | import static org.testng.Assert.assertEquals; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.RootCfgDefn; |
| | | import org.opends.server.backends.jeb.RootContainer; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | // Create a new definition. |
| | | private AttributeTypePropertyDefinition createPropertyDefinition() { |
| | | AttributeTypePropertyDefinition.Builder builder = AttributeTypePropertyDefinition |
| | | .createBuilder("test-property"); |
| | | .createBuilder(RootCfgDefn.getInstance(), "test-property"); |
| | | return builder.getInstance(); |
| | | } |
| | | |
| | |
| | | package org.opends.server.admin; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | import org.opends.server.admin.std.meta.RootCfgDefn; |
| | | import org.testng.annotations.*; |
| | | |
| | | import java.util.EnumSet; |
| | |
| | | */ |
| | | @BeforeClass |
| | | public void setUp() { |
| | | builder = BooleanPropertyDefinition.createBuilder("test-property"); |
| | | builder = BooleanPropertyDefinition.createBuilder( |
| | | RootCfgDefn.getInstance(), "test-property"); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | private BooleanPropertyDefinition createPropertyDefinition() { |
| | | return builder.buildInstance("test-property", |
| | | return builder.buildInstance(RootCfgDefn.getInstance(), "test-property", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new UndefinedDefaultBehaviorProvider<Boolean>()); |
| | | } |
| | |
| | | package org.opends.server.admin; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | import org.opends.server.admin.std.meta.RootCfgDefn; |
| | | import org.testng.annotations.*; |
| | | |
| | | import java.util.EnumSet; |
| | |
| | | @Test(dataProvider = "testBuilderAddInstanceOf") |
| | | public void testBuilderAddInstanceOf(String className) { |
| | | ClassPropertyDefinition.Builder localBuilder = |
| | | ClassPropertyDefinition.createBuilder("test-property"); |
| | | ClassPropertyDefinition.createBuilder(RootCfgDefn.getInstance(), |
| | | "test-property"); |
| | | localBuilder.addInstanceOf(className); |
| | | ClassPropertyDefinition cpd = localBuilder.buildInstance("test-property", |
| | | ClassPropertyDefinition cpd = localBuilder.buildInstance( |
| | | RootCfgDefn.getInstance(), "test-property", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new UndefinedDefaultBehaviorProvider<String>()); |
| | | List<String> instances = cpd.getInstanceOfInterface(); |
| | |
| | | expectedExceptions = {IllegalArgumentException.class}) |
| | | public void testBuilderAddInstanceOf2(String className) { |
| | | ClassPropertyDefinition.Builder localBuilder = |
| | | ClassPropertyDefinition.createBuilder("test-property"); |
| | | ClassPropertyDefinition.createBuilder( |
| | | RootCfgDefn.getInstance(), "test-property"); |
| | | localBuilder.addInstanceOf(className); |
| | | ClassPropertyDefinition cpd = localBuilder.buildInstance("test-property", |
| | | ClassPropertyDefinition cpd = localBuilder.buildInstance( |
| | | RootCfgDefn.getInstance(), "test-property", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new UndefinedDefaultBehaviorProvider<String>()); |
| | | List<String> instances = cpd.getInstanceOfInterface(); |
| | |
| | | public <T> void testLoadClass(String interfaceName, String loadClassName, |
| | | Class<T> instanceOfClass, Class expectedClass) { |
| | | ClassPropertyDefinition.Builder localBuilder = |
| | | ClassPropertyDefinition.createBuilder("test-property"); |
| | | ClassPropertyDefinition.createBuilder( |
| | | RootCfgDefn.getInstance(), "test-property"); |
| | | localBuilder.addInstanceOf(interfaceName); |
| | | ClassPropertyDefinition cpd = localBuilder.buildInstance("test-property", |
| | | ClassPropertyDefinition cpd = localBuilder.buildInstance( |
| | | RootCfgDefn.getInstance(), "test-property", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new UndefinedDefaultBehaviorProvider<String>()); |
| | | Class clazz = cpd.loadClass(loadClassName, instanceOfClass); |
| | |
| | | public <T> void testLoadClass2(String interfaceName, String loadClassName, |
| | | Class<T> instanceOfClass, Class expectedClass) { |
| | | ClassPropertyDefinition.Builder localBuilder = |
| | | ClassPropertyDefinition.createBuilder("test-property"); |
| | | ClassPropertyDefinition.createBuilder( |
| | | RootCfgDefn.getInstance(), "test-property"); |
| | | localBuilder.addInstanceOf(interfaceName); |
| | | ClassPropertyDefinition cpd = localBuilder.buildInstance("test-property", |
| | | ClassPropertyDefinition cpd = localBuilder.buildInstance( |
| | | RootCfgDefn.getInstance(), "test-property", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new UndefinedDefaultBehaviorProvider<String>()); |
| | | Class clazz = cpd.loadClass(loadClassName, instanceOfClass); |
| | |
| | | import static org.testng.Assert.assertEquals; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.RootCfgDefn; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | public void testBuilderSetBaseDN(String baseDN) |
| | | throws DirectoryException { |
| | | DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition |
| | | .createBuilder("test-property"); |
| | | .createBuilder(RootCfgDefn.getInstance(), "test-property"); |
| | | localBuilder.setBaseDN(baseDN); |
| | | DNPropertyDefinition pd = localBuilder.getInstance(); |
| | | |
| | |
| | | public void testValidateLegalValues(String baseDN, String value) |
| | | throws DirectoryException { |
| | | DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition |
| | | .createBuilder("test-property"); |
| | | .createBuilder(RootCfgDefn.getInstance(), "test-property"); |
| | | localBuilder.setBaseDN(baseDN); |
| | | DNPropertyDefinition pd = localBuilder.getInstance(); |
| | | pd.validateValue(DN.decode(value)); |
| | |
| | | public void testValidateIllegalValues(String baseDN, String value) |
| | | throws DirectoryException { |
| | | DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition |
| | | .createBuilder("test-property"); |
| | | .createBuilder(RootCfgDefn.getInstance(), "test-property"); |
| | | localBuilder.setBaseDN(baseDN); |
| | | DNPropertyDefinition pd = localBuilder.getInstance(); |
| | | pd.validateValue(DN.decode(value)); |
| | |
| | | @Test(dataProvider = "testLegalValues") |
| | | public void testDecodeLegalValues(String baseDN, String value) { |
| | | DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition |
| | | .createBuilder("test-property"); |
| | | .createBuilder(RootCfgDefn.getInstance(), "test-property"); |
| | | localBuilder.setBaseDN(baseDN); |
| | | DNPropertyDefinition pd = localBuilder.getInstance(); |
| | | pd.decodeValue(value); |
| | |
| | | @Test(dataProvider = "testIllegalValues", expectedExceptions = IllegalPropertyValueStringException.class) |
| | | public void testDecodeIllegalValues(String baseDN, String value) { |
| | | DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition |
| | | .createBuilder("test-property"); |
| | | .createBuilder(RootCfgDefn.getInstance(), "test-property"); |
| | | localBuilder.setBaseDN(baseDN); |
| | | DNPropertyDefinition pd = localBuilder.getInstance(); |
| | | pd.decodeValue(value); |
| | |
| | | package org.opends.server.admin; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | import org.opends.server.admin.std.meta.RootCfgDefn; |
| | | import org.testng.annotations.*; |
| | | |
| | | import java.util.EnumSet; |
| | |
| | | } |
| | | |
| | | private DurationPropertyDefinition.Builder createTestBuilder() { |
| | | return DurationPropertyDefinition.createBuilder("test-property-name"); |
| | | return DurationPropertyDefinition.createBuilder( |
| | | RootCfgDefn.getInstance(), "test-property-name"); |
| | | } |
| | | |
| | | private DurationPropertyDefinition buildTestDefinition(DurationPropertyDefinition.Builder builder) { |
| | | return builder.buildInstance("test-prop", |
| | | return builder.buildInstance(RootCfgDefn.getInstance(), "test-prop", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new DefinedDefaultBehaviorProvider<Long>("0")); |
| | | } |
| | |
| | | package org.opends.server.admin; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | import org.opends.server.admin.std.meta.RootCfgDefn; |
| | | import org.testng.annotations.*; |
| | | |
| | | import java.util.EnumSet; |
| | |
| | | |
| | | @BeforeClass |
| | | public void setUp() { |
| | | builder = EnumPropertyDefinition.createBuilder("test-property"); |
| | | builder = EnumPropertyDefinition.createBuilder( |
| | | RootCfgDefn.getInstance(), "test-property"); |
| | | builder.setEnumClass(TestEnum.class); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Test |
| | | public void testBuildInstance() { |
| | | EnumPropertyDefinition epd = builder.buildInstance("test-property", |
| | | EnumPropertyDefinition epd = builder.buildInstance( |
| | | RootCfgDefn.getInstance(), "test-property", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new UndefinedDefaultBehaviorProvider<TestEnum>()); |
| | | assertEquals(epd.getEnumClass(), TestEnum.class); |
| | |
| | | @Test(expectedExceptions = {IllegalStateException.class}) |
| | | public void testBuildInstance2() { |
| | | EnumPropertyDefinition.Builder<TestEnum> localBuilder = |
| | | EnumPropertyDefinition.createBuilder("test-property"); |
| | | localBuilder.buildInstance("test-property", |
| | | EnumPropertyDefinition.createBuilder( |
| | | RootCfgDefn.getInstance(), "test-property"); |
| | | localBuilder.buildInstance(RootCfgDefn.getInstance(), "test-property", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new UndefinedDefaultBehaviorProvider<TestEnum>()); |
| | | } |
| | |
| | | */ |
| | | @Test(dataProvider = "decodeValueData") |
| | | public void testDecodeValue(String value, TestEnum expectedValue) { |
| | | EnumPropertyDefinition epd = builder.buildInstance("test-property", |
| | | EnumPropertyDefinition epd = builder.buildInstance( |
| | | RootCfgDefn.getInstance(), "test-property", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new UndefinedDefaultBehaviorProvider<TestEnum>()); |
| | | assertEquals(epd.decodeValue(value), expectedValue); |
| | |
| | | expectedExceptions = {AssertionError.class, |
| | | IllegalPropertyValueStringException.class} ) |
| | | public void testDecodeValue2(String value) { |
| | | EnumPropertyDefinition epd = builder.buildInstance("test-property", |
| | | EnumPropertyDefinition epd = builder.buildInstance( |
| | | RootCfgDefn.getInstance(), "test-property", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new UndefinedDefaultBehaviorProvider<TestEnum>()); |
| | | epd.decodeValue(value); |
| | |
| | | */ |
| | | @Test |
| | | public void testNormalizeValue() { |
| | | EnumPropertyDefinition<TestEnum> epd = builder.buildInstance("test-property", |
| | | EnumPropertyDefinition<TestEnum> epd = builder.buildInstance( |
| | | RootCfgDefn.getInstance(), "test-property", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new UndefinedDefaultBehaviorProvider<TestEnum>()); |
| | | assertEquals(epd.normalizeValue(TestEnum.ONE), "one"); |
| | |
| | | */ |
| | | @Test |
| | | public void testValidateValue() { |
| | | EnumPropertyDefinition<TestEnum> epd = builder.buildInstance("test-property", |
| | | EnumPropertyDefinition<TestEnum> epd = builder.buildInstance( |
| | | RootCfgDefn.getInstance(), "test-property", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new UndefinedDefaultBehaviorProvider<TestEnum>()); |
| | | 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; |
| | |
| | | } |
| | | |
| | | private IntegerPropertyDefinition.Builder createTestBuilder() { |
| | | return IntegerPropertyDefinition.createBuilder("test-property-name"); |
| | | return IntegerPropertyDefinition.createBuilder(RootCfgDefn.getInstance(), "test-property-name"); |
| | | } |
| | | |
| | | private IntegerPropertyDefinition buildTestDefinition(IntegerPropertyDefinition.Builder builder) { |
| | | return builder.buildInstance("test-prop", |
| | | return builder.buildInstance(RootCfgDefn.getInstance(), "test-prop", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new DefinedDefaultBehaviorProvider<Integer>("0")); |
| | | } |
| | |
| | | */ |
| | | @BeforeClass |
| | | public void setUp() { |
| | | modr = ManagedObjectDefinitionI18NResource.createForProfile("ldap"); |
| | | modr = ManagedObjectDefinitionI18NResource.getInstanceForProfile("ldap"); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import static org.testng.Assert.assertEquals; |
| | | import static org.testng.Assert.assertNotNull; |
| | | |
| | | import org.opends.server.admin.std.meta.RootCfgDefn; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | |
| | | } |
| | | |
| | | private SizePropertyDefinition.Builder createTestBuilder() { |
| | | return SizePropertyDefinition.createBuilder("test-property-name"); |
| | | return SizePropertyDefinition.createBuilder(RootCfgDefn.getInstance(), "test-property-name"); |
| | | } |
| | | |
| | | private SizePropertyDefinition buildTestDefinition(SizePropertyDefinition.Builder builder) { |
| | | return builder.buildInstance("test-prop", |
| | | return builder.buildInstance(RootCfgDefn.getInstance(), "test-prop", |
| | | EnumSet.noneOf(PropertyOption.class), |
| | | new DefinedDefaultBehaviorProvider<Long>("0")); |
| | | } |
| | |
| | | import org.opends.server.admin.*; |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.admin.server.ServerManagedObject; |
| | | import org.opends.server.admin.std.meta.RootCfgDefn; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | @BeforeClass |
| | | public void setUp() { |
| | | BooleanPropertyDefinition.Builder builder = |
| | | BooleanPropertyDefinition.createBuilder("test-bool-prop"); |
| | | BooleanPropertyDefinition.createBuilder(RootCfgDefn.getInstance(), "test-bool-prop"); |
| | | DefinedDefaultBehaviorProvider<Boolean> dbp = |
| | | new DefinedDefaultBehaviorProvider<Boolean>(BOOL_DEFAULT.toString()); |
| | | builder.setDefaultBehaviorProvider(dbp); |
| | | testBoolPropertyDefinition = builder.getInstance(); |
| | | |
| | | StringPropertyDefinition.Builder builder2 = |
| | | StringPropertyDefinition.createBuilder("test-sv-str-prop"); |
| | | StringPropertyDefinition.createBuilder(RootCfgDefn.getInstance(), "test-sv-str-prop"); |
| | | DefinedDefaultBehaviorProvider<String> dbp2 = |
| | | new DefinedDefaultBehaviorProvider<String>(STR_DEFAULT); |
| | | builder2.setDefaultBehaviorProvider(dbp2); |
| | | testSvStringPropertyDefinition = builder2.getInstance(); |
| | | |
| | | StringPropertyDefinition.Builder builder3 = |
| | | StringPropertyDefinition.createBuilder("test-mv-str-prop"); |
| | | StringPropertyDefinition.createBuilder(RootCfgDefn.getInstance(), "test-mv-str-prop"); |
| | | DefinedDefaultBehaviorProvider<String> dbp3 = |
| | | new DefinedDefaultBehaviorProvider<String>(STR_DEFAULT); |
| | | builder3.setDefaultBehaviorProvider(dbp3); |