From efa949b25f472d7e4c39733678d8f0e5229f8201 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Thu, 26 Dec 2013 15:31:32 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1235 : Migrate configuration framework
---
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Reference.java | 13
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/TestCfg.java | 8
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/EnumPropertyDefinition.java | 21
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ConfigChangeListenerAdaptor.java | 2
opendj-sdk/opendj-admin/src/main/java/org/opends/server/util/package-info.java | 58
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListenerAdaptor.java | 6
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyProvider.java | 86
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IPAddressMaskPropertyDefinition.java | 14
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/StringPropertyDefinition.java | 24
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/DefaultBehaviorTest.java | 2
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/InstantiableRelationDefinition.java | 20
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DNPropertyDefinition.java | 16
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Tag.java | 33
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DurationPropertyDefinitionTest.java | 44
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/LDAPProfile.java | 15
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectOption.java | 28
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagementContext.java | 61
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java | 247
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectPathSerializer.java | 170
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DNPropertyDefinitionTest.java | 2
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/package-info.java | 2
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SingletonRelationDefinition.java | 238
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/AbstractManagedObjectDefinitionTest.java | 2
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ACIPropertyDefinition.java | 170
opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/Aci.java | 13
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IntegerPropertyDefinition.java | 22
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationOption.java | 27
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/AdminTestCaseUtils.java | 16
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ConfigurationClient.java | 2
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/IllegalManagedObjectNameException.java | 160
opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/package-info.java | 35
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/IntegerPropertyDefinitionTest.java | 2
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/BooleanPropertyDefinition.java | 213
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinitionDecodingException.java | 149
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinedDefaultBehaviorProvider.java | 81
opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/AddressMask.java | 10
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java | 24
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/ListenerTest.java | 10
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AdminClientException.java | 1
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelativeInheritedDefaultBehaviorProvider.java | 195
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinition.java | 16
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IllegalPropertyValueException.java | 1
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPDriver.java | 72
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/GenericConstraint.java | 12
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ConcurrentModificationException.java | 101
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinitionResolver.java | 61
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagementContext.java | 28
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ClassLoaderProvider.java | 75
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/Property.java | 160
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/client/ldap/MockLDAPConnection.java | 3
opendj-sdk/opendj-admin/src/main/java/org/opends/server/core/DirectoryServer.java | 16
opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/AciException.java | 44
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyNotFoundException.java | 1
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/MockLDAPProfile.java | 189
opendj-sdk/opendj-admin/src/main/java/org/opends/server/util/EmbeddedUtils.java | 6
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ClientConstraintHandler.java | 22
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AggregationPropertyDefinition.java | 142
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/AbstractManagedObject.java | 203
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectPath.java | 132
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagedObject.java | 105
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObject.java | 103
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AuthenticationException.java | 1
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/package-info.java | 2
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SizePropertyDefinition.java | 27
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/AggregationServerTest.java | 15
opendj-sdk/opendj-admin/src/main/java/org/opends/server/config/package-info.java | 45
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationDefinitionVisitor.java | 167
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyOption.java | 63
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectAddListenerAdaptor.java | 5
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/TestChildCfgDefn.java | 6
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IllegalPropertyValueStringException.java | 1
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/UnknownPropertyDefinitionException.java | 1
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/MissingMandatoryPropertiesException.java | 202
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectNotFoundException.java | 1
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ClassPropertyDefinition.java | 36
opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/package-info.java | 31
opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/OpenDsException.java | 150
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinitionVisitor.java | 454 +-
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPNameBuilder.java | 3
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectAlreadyExistsException.java | 1
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyValueVisitor.java | 514 +-
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/OperationRejectedException.java | 4
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AbstractManagedObjectDefinition.java | 52
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DurationPropertyDefinition.java | 38
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ConfigurationAddListener.java | 61
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinition.java | 112
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationDefinition.java | 12
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListener.java | 65
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPManagedObject.java | 14
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SizeUnit.java | 617 +--
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java | 16
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsMandatoryException.java | 1
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IPAddressPropertyDefinition.java | 16
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/OptionalRelationDefinition.java | 237
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/client/ldap/LDAPClientTest.java | 214
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DurationUnit.java | 583 +-
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagedObjectDecodingException.java | 153
opendj-sdk/opendj-admin/src/main/java/org/opends/server/core/package-info.java | 54
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/SizeUnitTest.java | 6
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultManagedObject.java | 245
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/condition/ContainsCondition.java | 5
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/DelayedConfigAddListener.java | 11
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsSingleValuedException.java | 1
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Configuration.java | 33
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/Driver.java | 78
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinitionResource.java | 175
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DurationUnitTest.java | 45
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinitionUsageBuilder.java | 7
opendj-sdk/opendj-admin/src/test/java/org/forgerock/opendj/config/ConfigurationMock.java | 4
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultBehaviorProvider.java | 113
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsReadOnlyException.java | 1
opendj-sdk/opendj-admin/src/main/java/org/opends/server/api/package-info.java | 44
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/UndefinedDefaultBehaviorProvider.java | 37
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SetRelationDefinition.java | 16
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/DNBuilderTest.java | 7
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AuthenticationNotSupportedException.java | 1
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/ValidateConfigDefinitionsTest.java | 85
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/PropertySet.java | 531 +-
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultBehaviorProviderVisitor.java | 129
119 files changed, 4,469 insertions(+), 4,813 deletions(-)
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ACIPropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ACIPropertyDefinition.java
index 0c938f8..afb40a5 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ACIPropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ACIPropertyDefinition.java
@@ -38,114 +38,96 @@
/**
* ACI property definition.
*/
-public class ACIPropertyDefinition extends PropertyDefinition<Aci> {
+public final class ACIPropertyDefinition extends PropertyDefinition<Aci> {
+ /**
+ * An interface for incrementally constructing ACI property definitions.
+ */
+ public static final class Builder extends AbstractBuilder<Aci, ACIPropertyDefinition> {
- /**
- * An interface for incrementally constructing ACI property
- * definitions.
- */
- public static class Builder extends
- AbstractBuilder<Aci, ACIPropertyDefinition> {
+ // Private constructor
+ private Builder(AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
+ super(d, propertyName);
+ }
- // Private constructor
- private Builder(
- AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
- super(d, propertyName);
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ACIPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<Aci> defaultBehavior) {
+ return new ACIPropertyDefinition(d, propertyName, options, adminAction, defaultBehavior);
+ }
+ }
+
+ /**
+ * Create a ACI property definition builder.
+ *
+ * @param d
+ * The managed object definition associated with this property
+ * definition.
+ * @param propertyName
+ * The property name.
+ * @return Returns the new ACI property definition builder.
+ */
+ public static Builder createBuilder(AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
+ return new Builder(d, propertyName);
+ }
+
+ // Private constructor.
+ private ACIPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<Aci> defaultBehavior) {
+ super(d, Aci.class, propertyName, options, adminAction, defaultBehavior);
}
/**
* {@inheritDoc}
*/
@Override
- protected ACIPropertyDefinition buildInstance(
- AbstractManagedObjectDefinition<?, ?> d,
- String propertyName, EnumSet<PropertyOption> options,
- AdministratorAction adminAction,
- DefaultBehaviorProvider<Aci> defaultBehavior) {
- return new ACIPropertyDefinition(d, propertyName, options,
- adminAction, defaultBehavior);
+ public void validateValue(Aci value) {
+ Reject.ifNull(value);
+
+ // No additional validation required.
}
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Aci decodeValue(String value) {
+ Reject.ifNull(value);
- /**
- * Create a ACI property definition builder.
- *
- * @param d
- * The managed object definition associated with this
- * property definition.
- * @param propertyName
- * The property name.
- * @return Returns the new ACI property definition builder.
- */
- public static Builder createBuilder(
- AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
- return new Builder(d, propertyName);
- }
-
-
- // Private constructor.
- private ACIPropertyDefinition(
- AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options,
- AdministratorAction adminAction,
- DefaultBehaviorProvider<Aci> defaultBehavior) {
- super(d, Aci.class, propertyName, options, adminAction,
- defaultBehavior);
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void validateValue(Aci value)
- throws IllegalPropertyValueException {
- Reject.ifNull(value);
-
- // No additional validation required.
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Aci decodeValue(String value)
- throws IllegalPropertyValueStringException {
- Reject.ifNull(value);
-
- try {
- return Aci.decode(ByteString.valueOf(value), DN.rootDN());
- } catch (AciException e) {
- // TODO: it would be nice to throw the cause.
- throw new IllegalPropertyValueStringException(this, value);
+ try {
+ return Aci.decode(ByteString.valueOf(value), DN.rootDN());
+ } catch (AciException e) {
+ // TODO: it would be nice to throw the cause.
+ throw new IllegalPropertyValueStringException(this, value);
+ }
}
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
+ return v.visitACI(this, p);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
- return v.visitACI(this, p);
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <R, P> R accept(PropertyValueVisitor<R, P> v, Aci value, P p) {
+ return v.visitACI(this, value, p);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public <R, P> R accept(PropertyValueVisitor<R, P> v, Aci value, P p) {
- return v.visitACI(this, value, p);
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int compare(Aci o1, Aci o2) {
- return o1.toString().compareTo(o2.toString());
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int compare(Aci o1, Aci o2) {
+ return o1.toString().compareTo(o2.toString());
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AbstractManagedObjectDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AbstractManagedObjectDefinition.java
index 77c772d..b83da60 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AbstractManagedObjectDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AbstractManagedObjectDefinition.java
@@ -23,7 +23,6 @@
*
* Copyright 2007-2010 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
import java.util.ArrayList;
@@ -121,7 +120,8 @@
* <code>null</code> parent, unless the definition is being used
* for testing).
*/
- protected AbstractManagedObjectDefinition(String name, AbstractManagedObjectDefinition<? super C, ? super S> parent) {
+ protected AbstractManagedObjectDefinition(String name,
+ AbstractManagedObjectDefinition<? super C, ? super S> parent) {
this.name = name;
this.parent = parent;
this.constraints = new LinkedList<Constraint>();
@@ -168,8 +168,8 @@
* definition.
*/
public final Collection<AbstractManagedObjectDefinition<? extends C, ? extends S>> getAllChildren() {
- List<AbstractManagedObjectDefinition<? extends C, ? extends S>> list = new ArrayList<AbstractManagedObjectDefinition<? extends C, ? extends S>>(
- children.values());
+ List<AbstractManagedObjectDefinition<? extends C, ? extends S>> list =
+ new ArrayList<AbstractManagedObjectDefinition<? extends C, ? extends S>>(children.values());
for (AbstractManagedObjectDefinition<? extends C, ? extends S> child : children.values()) {
list.addAll(child.getAllChildren());
@@ -237,7 +237,8 @@
// This method does not used a cached set of relations because
// relations may be updated after child definitions have been
// defined.
- List<RelationDefinition<? super C, ? super S>> rdlist = new LinkedList<RelationDefinition<? super C, ? super S>>();
+ List<RelationDefinition<? super C, ? super S>> rdlist =
+ new LinkedList<RelationDefinition<? super C, ? super S>>();
if (parent != null) {
rdlist.addAll(parent.getAllReverseRelationDefinitions());
@@ -310,8 +311,7 @@
* empty or if the requested subordinate managed object
* definition was not found.
*/
- public final AbstractManagedObjectDefinition<? extends C, ? extends S> getChild(String name)
- throws IllegalArgumentException {
+ public final AbstractManagedObjectDefinition<? extends C, ? extends S> getChild(String name) {
if ((name == null) || (name.length() == 0)) {
throw new IllegalArgumentException("null or empty managed object name");
}
@@ -369,7 +369,7 @@
* @throws UnsupportedOperationException
* If this managed object definition is the {@link TopCfgDefn}.
*/
- public final LocalizableMessage getDescription() throws UnsupportedOperationException {
+ public final LocalizableMessage getDescription() {
return getDescription(Locale.getDefault());
}
@@ -385,7 +385,7 @@
* @throws UnsupportedOperationException
* If this managed object definition is the {@link TopCfgDefn}.
*/
- public final LocalizableMessage getDescription(Locale locale) throws UnsupportedOperationException {
+ public final LocalizableMessage getDescription(Locale locale) {
try {
return ManagedObjectDefinitionI18NResource.getInstance().getMessage(this, "description", locale);
} catch (MissingResourceException e) {
@@ -425,7 +425,7 @@
* If the specified property name was null or empty or if the
* requested property definition was not found.
*/
- public final PropertyDefinition<?> getPropertyDefinition(String name) throws IllegalArgumentException {
+ public final PropertyDefinition<?> getPropertyDefinition(String name) {
if ((name == null) || (name.length() == 0)) {
throw new IllegalArgumentException("null or empty property name");
}
@@ -462,7 +462,7 @@
* If the specified relation name was null or empty or if the
* requested relation definition was not found.
*/
- public final RelationDefinition<?, ?> getRelationDefinition(String name) throws IllegalArgumentException {
+ public final RelationDefinition<?, ?> getRelationDefinition(String name) {
if ((name == null) || (name.length() == 0)) {
throw new IllegalArgumentException("null or empty relation name");
}
@@ -514,8 +514,7 @@
* or if the requested aggregation property definition was not
* found.
*/
- public final AggregationPropertyDefinition<?, ?> getAggregationPropertyDefinition(String name)
- throws IllegalArgumentException {
+ public final AggregationPropertyDefinition<?, ?> getAggregationPropertyDefinition(String name) {
if ((name == null) || (name.length() == 0)) {
throw new IllegalArgumentException("null or empty aggregation property name");
}
@@ -563,7 +562,7 @@
* @throws UnsupportedOperationException
* If this managed object definition is the {@link TopCfgDefn}.
*/
- public final LocalizableMessage getSynopsis() throws UnsupportedOperationException {
+ public final LocalizableMessage getSynopsis() {
return getSynopsis(Locale.getDefault());
}
@@ -578,7 +577,7 @@
* @throws UnsupportedOperationException
* If this managed object definition is the {@link TopCfgDefn}.
*/
- public final LocalizableMessage getSynopsis(Locale locale) throws UnsupportedOperationException {
+ public final LocalizableMessage getSynopsis(Locale locale) {
return ManagedObjectDefinitionI18NResource.getInstance().getMessage(this, "synopsis", locale);
}
@@ -591,7 +590,7 @@
* @throws UnsupportedOperationException
* If this managed object definition is the {@link TopCfgDefn}.
*/
- public final LocalizableMessage getUserFriendlyName() throws UnsupportedOperationException {
+ public final LocalizableMessage getUserFriendlyName() {
return getUserFriendlyName(Locale.getDefault());
}
@@ -606,9 +605,9 @@
* @throws UnsupportedOperationException
* If this managed object definition is the {@link TopCfgDefn}.
*/
- public final LocalizableMessage getUserFriendlyName(Locale locale) throws UnsupportedOperationException {
+ public final LocalizableMessage getUserFriendlyName(Locale locale) {
return LocalizableMessage.raw(ManagedObjectDefinitionI18NResource.getInstance().getMessage(this,
- "user-friendly-name", locale));
+ "user-friendly-name", locale));
}
/**
@@ -620,7 +619,7 @@
* @throws UnsupportedOperationException
* If this managed object definition is the {@link TopCfgDefn}.
*/
- public final LocalizableMessage getUserFriendlyPluralName() throws UnsupportedOperationException {
+ public final LocalizableMessage getUserFriendlyPluralName() {
return getUserFriendlyPluralName(Locale.getDefault());
}
@@ -635,9 +634,9 @@
* @throws UnsupportedOperationException
* If this managed object definition is the {@link TopCfgDefn}.
*/
- public final LocalizableMessage getUserFriendlyPluralName(Locale locale) throws UnsupportedOperationException {
- return ManagedObjectDefinitionI18NResource.getInstance().getMessage(this,
- "user-friendly-plural-name", locale);
+ public final LocalizableMessage getUserFriendlyPluralName(Locale locale) {
+ return ManagedObjectDefinitionI18NResource.getInstance()
+ .getMessage(this, "user-friendly-plural-name", locale);
}
/**
@@ -941,8 +940,8 @@
// Register a relation definition in the referenced managed object
// definition's reverse lookup table.
- private <CC extends ConfigurationClient, SS extends Configuration> void registerReverseRelationDefinition(
- RelationDefinition<CC, SS> rd) {
+ private <C1 extends ConfigurationClient, S1 extends Configuration> void registerReverseRelationDefinition(
+ RelationDefinition<C1, S1> rd) {
rd.getChildDefinition().reverseRelationDefinitions.add(rd);
}
@@ -957,13 +956,14 @@
// Recursively descend definition hierarchy to find the best match
// definition.
private AbstractManagedObjectDefinition<? extends C, ? extends S> resolveManagedObjectDefinitionAux(
- AbstractManagedObjectDefinition<? extends C, ? extends S> d, DefinitionResolver r) {
+ AbstractManagedObjectDefinition<? extends C, ? extends S> d, DefinitionResolver r) {
if (!r.matches(d)) {
return null;
}
for (AbstractManagedObjectDefinition<? extends C, ? extends S> child : d.getChildren()) {
- AbstractManagedObjectDefinition<? extends C, ? extends S> rd = resolveManagedObjectDefinitionAux(child, r);
+ AbstractManagedObjectDefinition<? extends C, ? extends S> rd =
+ resolveManagedObjectDefinitionAux(child, r);
if (rd != null) {
return rd;
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AggregationPropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AggregationPropertyDefinition.java
index 56c4ef1..1c7aacc 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AggregationPropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AggregationPropertyDefinition.java
@@ -99,7 +99,7 @@
* aggregation property definition refers to.
*/
public final class AggregationPropertyDefinition<C extends ConfigurationClient, S extends Configuration> extends
- PropertyDefinition<String> {
+ PropertyDefinition<String> {
/**
* An interface for incrementally constructing aggregation property
@@ -112,8 +112,8 @@
* The type of server managed object configuration that this
* aggregation property definition refers to.
*/
- public static class Builder<C extends ConfigurationClient, S extends Configuration> extends
- AbstractBuilder<String, AggregationPropertyDefinition<C, S>> {
+ public static final class Builder<C extends ConfigurationClient, S extends Configuration> extends
+ AbstractBuilder<String, AggregationPropertyDefinition<C, S>> {
// The string representation of the managed object path specifying
// the parent of the aggregated managed objects.
@@ -195,8 +195,8 @@
*/
@Override
protected AggregationPropertyDefinition<C, S> buildInstance(AbstractManagedObjectDefinition<?, ?> d,
- String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<String> defaultBehavior) {
+ String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<String> defaultBehavior) {
// Make sure that the parent path has been defined.
if (parentPathString == null) {
throw new IllegalStateException("Parent path undefined");
@@ -208,7 +208,7 @@
}
return new AggregationPropertyDefinition<C, S>(d, propertyName, options, adminAction, defaultBehavior,
- parentPathString, rdName, targetNeedsEnablingCondition, targetIsEnabledCondition);
+ parentPathString, rdName, targetNeedsEnablingCondition, targetIsEnabledCondition);
}
}
@@ -216,7 +216,7 @@
/**
* A change listener which prevents the named component from being disabled.
*/
- private class ReferentialIntegrityChangeListener implements ServerManagedObjectChangeListener<S> {
+ private final class ReferentialIntegrityChangeListener implements ServerManagedObjectChangeListener<S> {
// The error message which should be returned if an attempt is
// made to disable the referenced component.
@@ -247,14 +247,14 @@
// This should not happen - the previous call-back should have
// trapped this.
throw new IllegalStateException("Attempting to disable a referenced "
- + relationDefinition.getChildDefinition().getUserFriendlyName());
+ + relationDefinition.getChildDefinition().getUserFriendlyName());
}
/**
* {@inheritDoc}
*/
public boolean isConfigurationChangeAcceptable(ServerManagedObject<? extends S> mo,
- List<LocalizableMessage> unacceptableReasons) {
+ List<LocalizableMessage> unacceptableReasons) {
// Always prevent the referenced component from being
// disabled.
try {
@@ -267,11 +267,11 @@
} catch (ConfigException e) {
// The condition could not be evaluated.
debugLogger.trace("Unable to perform post add", e);
- LocalizableMessage message = ERR_REFINT_UNABLE_TO_EVALUATE_TARGET_CONDITION.get(mo
- .getManagedObjectDefinition().getUserFriendlyName(), String.valueOf(mo.getDN()),
- getExceptionMessage(e));
- LocalizedLogger logger = LocalizedLogger
- .getLocalizedLogger(ERR_REFINT_UNABLE_TO_EVALUATE_TARGET_CONDITION.resourceName());
+ LocalizableMessage message =
+ ERR_REFINT_UNABLE_TO_EVALUATE_TARGET_CONDITION.get(mo.getManagedObjectDefinition()
+ .getUserFriendlyName(), String.valueOf(mo.getDN()), getExceptionMessage(e));
+ LocalizedLogger logger =
+ LocalizedLogger.getLocalizedLogger(ERR_REFINT_UNABLE_TO_EVALUATE_TARGET_CONDITION.resourceName());
logger.error(message);
unacceptableReasons.add(message);
return false;
@@ -288,7 +288,7 @@
/**
* A delete listener which prevents the named component from being deleted.
*/
- private class ReferentialIntegrityDeleteListener implements ConfigurationDeleteListener<S> {
+ private final class ReferentialIntegrityDeleteListener implements ConfigurationDeleteListener<S> {
// The DN of the referenced configuration entry.
private final DN dn;
@@ -315,7 +315,7 @@
// isConfigurationDeleteAcceptable() call-back should have
// trapped this.
throw new IllegalStateException("Attempting to delete a referenced "
- + relationDefinition.getChildDefinition().getUserFriendlyName());
+ + relationDefinition.getChildDefinition().getUserFriendlyName());
} else {
return new ConfigChangeResult(ResultCode.SUCCESS, false);
}
@@ -345,8 +345,8 @@
* {@inheritDoc}
*/
@Override
- public boolean isUsable(ServerManagedObject<?> managedObject, Collection<LocalizableMessage> unacceptableReasons)
- throws ConfigException {
+ public boolean isUsable(ServerManagedObject<?> managedObject,
+ Collection<LocalizableMessage> unacceptableReasons) throws ConfigException {
SortedSet<String> names = managedObject.getPropertyValues(AggregationPropertyDefinition.this);
ServerManagementContext context = managedObject.getServerContext();
LocalizableMessage thisUFN = managedObject.getManagedObjectDefinition().getUserFriendlyName();
@@ -360,8 +360,8 @@
String thatDN = path.toDN().toString();
if (!context.managedObjectExists(path)) {
- LocalizableMessage msg = ERR_SERVER_REFINT_DANGLING_REFERENCE.get(name, getName(), thisUFN, thisDN, thatUFN,
- thatDN);
+ LocalizableMessage msg =
+ ERR_SERVER_REFINT_DANGLING_REFERENCE.get(name, getName(), thisUFN, thisDN, thatUFN, thatDN);
unacceptableReasons.add(msg);
isUsable = false;
} else if (needsEnabling) {
@@ -369,8 +369,8 @@
// required.
ServerManagedObject<? extends S> ref = context.getManagedObject(path);
if (!targetIsEnabledCondition.evaluate(ref)) {
- LocalizableMessage msg = ERR_SERVER_REFINT_TARGET_DISABLED.get(name, getName(), thisUFN, thisDN, thatUFN,
- thatDN);
+ LocalizableMessage msg =
+ ERR_SERVER_REFINT_TARGET_DISABLED.get(name, getName(), thisUFN, thisDN, thatUFN, thatDN);
unacceptableReasons.add(msg);
isUsable = false;
}
@@ -421,7 +421,8 @@
String thatDN = dn.toString();
// Register the delete listener.
- LocalizableMessage msg = ERR_SERVER_REFINT_CANNOT_DELETE.get(thatUFN, thatDN, getName(), thisUFN, thisDN);
+ LocalizableMessage msg =
+ ERR_SERVER_REFINT_CANNOT_DELETE.get(thatUFN, thatDN, getName(), thisUFN, thisDN);
ReferentialIntegrityDeleteListener dl = new ReferentialIntegrityDeleteListener(dn, msg);
parent.registerDeleteListener(getRelationDefinition(), dl);
dlist.add(dl);
@@ -493,7 +494,7 @@
*/
@Override
public boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject,
- Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
+ Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
// If all of this managed object's "enabled" properties are true
// then any referenced managed objects must also be enabled.
boolean needsEnabling = targetNeedsEnablingCondition.evaluate(context, managedObject);
@@ -510,14 +511,14 @@
try {
ref = context.getManagedObject(path);
} catch (DefinitionDecodingException e) {
- LocalizableMessage msg = ERR_CLIENT_REFINT_TARGET_INVALID.get(ufn, name, getName(),
- e.getMessageObject());
+ LocalizableMessage msg =
+ ERR_CLIENT_REFINT_TARGET_INVALID.get(ufn, name, getName(), e.getMessageObject());
unacceptableReasons.add(msg);
isAcceptable = false;
continue;
} catch (ManagedObjectDecodingException e) {
- LocalizableMessage msg = ERR_CLIENT_REFINT_TARGET_INVALID.get(ufn, name, getName(),
- e.getMessageObject());
+ LocalizableMessage msg =
+ ERR_CLIENT_REFINT_TARGET_INVALID.get(ufn, name, getName(), e.getMessageObject());
unacceptableReasons.add(msg);
isAcceptable = false;
continue;
@@ -545,7 +546,7 @@
*/
@Override
public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
- Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
+ Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
// The same constraint applies as for adds.
return isAddAcceptable(context, managedObject, unacceptableReasons);
}
@@ -564,21 +565,21 @@
*/
@Override
public boolean isDeleteAcceptable(ManagementContext context, ManagedObjectPath<?, ?> path,
- Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
+ Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
// Any references to the deleted managed object should cause a
// constraint violation.
boolean isAcceptable = true;
for (ManagedObject<?> mo : findReferences(context, getManagedObjectDefinition(), path.getName())) {
String name = mo.getManagedObjectPath().getName();
if (name == null) {
- LocalizableMessage msg = ERR_CLIENT_REFINT_CANNOT_DELETE_WITHOUT_NAME.get(getName(), mo
- .getManagedObjectDefinition().getUserFriendlyName(), getManagedObjectDefinition()
- .getUserFriendlyName());
+ LocalizableMessage msg =
+ ERR_CLIENT_REFINT_CANNOT_DELETE_WITHOUT_NAME.get(getName(), mo.getManagedObjectDefinition()
+ .getUserFriendlyName(), getManagedObjectDefinition().getUserFriendlyName());
unacceptableReasons.add(msg);
} else {
- LocalizableMessage msg = ERR_CLIENT_REFINT_CANNOT_DELETE_WITH_NAME.get(getName(), mo
- .getManagedObjectDefinition().getUserFriendlyName(), name, getManagedObjectDefinition()
- .getUserFriendlyName());
+ LocalizableMessage msg =
+ ERR_CLIENT_REFINT_CANNOT_DELETE_WITH_NAME.get(getName(), mo.getManagedObjectDefinition()
+ .getUserFriendlyName(), name, getManagedObjectDefinition().getUserFriendlyName());
unacceptableReasons.add(msg);
}
isAcceptable = false;
@@ -591,7 +592,7 @@
*/
@Override
public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
- Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
+ Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
// If the modified managed object is disabled and there are some
// active references then refuse the change.
if (targetIsEnabledCondition.evaluate(context, managedObject)) {
@@ -602,18 +603,20 @@
// active references.
boolean isAcceptable = true;
for (ManagedObject<?> mo : findReferences(context, getManagedObjectDefinition(), managedObject
- .getManagedObjectPath().getName())) {
+ .getManagedObjectPath().getName())) {
if (targetNeedsEnablingCondition.evaluate(context, mo)) {
String name = mo.getManagedObjectPath().getName();
if (name == null) {
- LocalizableMessage msg = ERR_CLIENT_REFINT_CANNOT_DISABLE_WITHOUT_NAME.get(managedObject
+ LocalizableMessage msg =
+ ERR_CLIENT_REFINT_CANNOT_DISABLE_WITHOUT_NAME.get(managedObject
.getManagedObjectDefinition().getUserFriendlyName(), getName(), mo
.getManagedObjectDefinition().getUserFriendlyName());
unacceptableReasons.add(msg);
} else {
- LocalizableMessage msg = ERR_CLIENT_REFINT_CANNOT_DISABLE_WITH_NAME.get(managedObject
- .getManagedObjectDefinition().getUserFriendlyName(), getName(), mo
- .getManagedObjectDefinition().getUserFriendlyName(), name);
+ LocalizableMessage msg =
+ ERR_CLIENT_REFINT_CANNOT_DISABLE_WITH_NAME.get(
+ managedObject.getManagedObjectDefinition().getUserFriendlyName(), getName(),
+ mo.getManagedObjectDefinition().getUserFriendlyName(), name);
unacceptableReasons.add(msg);
}
isAcceptable = false;
@@ -624,14 +627,14 @@
// Find all managed objects which reference the named managed
// object using this property.
- private <CC extends ConfigurationClient> List<ManagedObject<? extends CC>> findReferences(
- ManagementContext context, AbstractManagedObjectDefinition<CC, ?> mod, String name)
+ private <C1 extends ConfigurationClient> List<ManagedObject<? extends C1>> findReferences(
+ ManagementContext context, AbstractManagedObjectDefinition<C1, ?> mod, String name)
throws ErrorResultException {
- List<ManagedObject<? extends CC>> instances = findInstances(context, mod);
+ List<ManagedObject<? extends C1>> instances = findInstances(context, mod);
- Iterator<ManagedObject<? extends CC>> i = instances.iterator();
+ Iterator<ManagedObject<? extends C1>> i = instances.iterator();
while (i.hasNext()) {
- ManagedObject<? extends CC> mo = i.next();
+ ManagedObject<? extends C1> mo = i.next();
boolean hasReference = false;
for (String value : mo.getPropertyValues(AggregationPropertyDefinition.this)) {
@@ -651,35 +654,38 @@
// Find all instances of a specific type of managed object.
@SuppressWarnings("unchecked")
- private <CC extends ConfigurationClient> List<ManagedObject<? extends CC>> findInstances(
- ManagementContext context, AbstractManagedObjectDefinition<CC, ?> mod) throws ErrorResultException {
- List<ManagedObject<? extends CC>> instances = new LinkedList<ManagedObject<? extends CC>>();
+ private <C1 extends ConfigurationClient> List<ManagedObject<? extends C1>> findInstances(
+ ManagementContext context, AbstractManagedObjectDefinition<C1, ?> mod) throws ErrorResultException {
+ List<ManagedObject<? extends C1>> instances = new LinkedList<ManagedObject<? extends C1>>();
if (mod == RootCfgDefn.getInstance()) {
- instances.add((ManagedObject<? extends CC>) context.getRootConfigurationManagedObject());
+ instances.add((ManagedObject<? extends C1>) context.getRootConfigurationManagedObject());
} else {
- for (RelationDefinition<? super CC, ?> rd : mod.getAllReverseRelationDefinitions()) {
+ for (RelationDefinition<? super C1, ?> rd : mod.getAllReverseRelationDefinitions()) {
for (ManagedObject<?> parent : findInstances(context, rd.getParentDefinition())) {
try {
if (rd instanceof SingletonRelationDefinition) {
- SingletonRelationDefinition<? super CC, ?> srd = (SingletonRelationDefinition<? super CC, ?>) rd;
+ SingletonRelationDefinition<? super C1, ?> srd =
+ (SingletonRelationDefinition<? super C1, ?>) rd;
ManagedObject<?> mo = parent.getChild(srd);
if (mo.getManagedObjectDefinition().isChildOf(mod)) {
- instances.add((ManagedObject<? extends CC>) mo);
+ instances.add((ManagedObject<? extends C1>) mo);
}
} else if (rd instanceof OptionalRelationDefinition) {
- OptionalRelationDefinition<? super CC, ?> ord = (OptionalRelationDefinition<? super CC, ?>) rd;
+ OptionalRelationDefinition<? super C1, ?> ord =
+ (OptionalRelationDefinition<? super C1, ?>) rd;
ManagedObject<?> mo = parent.getChild(ord);
if (mo.getManagedObjectDefinition().isChildOf(mod)) {
- instances.add((ManagedObject<? extends CC>) mo);
+ instances.add((ManagedObject<? extends C1>) mo);
}
} else if (rd instanceof InstantiableRelationDefinition) {
- InstantiableRelationDefinition<? super CC, ?> ird = (InstantiableRelationDefinition<? super CC, ?>) rd;
+ InstantiableRelationDefinition<? super C1, ?> ird =
+ (InstantiableRelationDefinition<? super C1, ?>) rd;
for (String name : parent.listChildren(ird)) {
ManagedObject<?> mo = parent.getChild(ird, name);
if (mo.getManagedObjectDefinition().isChildOf(mod)) {
- instances.add((ManagedObject<? extends CC>) mo);
+ instances.add((ManagedObject<? extends C1>) mo);
}
}
}
@@ -711,7 +717,7 @@
* @return Returns the new aggregation property definition builder.
*/
public static <C extends ConfigurationClient, S extends Configuration> Builder<C, S> createBuilder(
- AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
+ AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
return new Builder<C, S>(d, propertyName);
}
@@ -719,11 +725,13 @@
// The active server-side referential integrity change listeners
// associated with this property.
- private final Map<DN, List<ReferentialIntegrityChangeListener>> changeListeners = new HashMap<DN, List<ReferentialIntegrityChangeListener>>();
+ private final Map<DN, List<ReferentialIntegrityChangeListener>> changeListeners =
+ new HashMap<DN, List<ReferentialIntegrityChangeListener>>();
// The active server-side referential integrity delete listeners
// associated with this property.
- private final Map<DN, List<ReferentialIntegrityDeleteListener>> deleteListeners = new HashMap<DN, List<ReferentialIntegrityDeleteListener>>();
+ private final Map<DN, List<ReferentialIntegrityDeleteListener>> deleteListeners =
+ new HashMap<DN, List<ReferentialIntegrityDeleteListener>>();
// The name of the managed object which is the parent of the
// aggregated managed objects.
@@ -754,9 +762,9 @@
// Private constructor.
private AggregationPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<String> defaultBehavior, String parentPathString, String rdName,
- Condition targetNeedsEnablingCondition, Condition targetIsEnabledCondition) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<String> defaultBehavior, String parentPathString, String rdName,
+ Condition targetNeedsEnablingCondition, Condition targetIsEnabledCondition) {
super(d, String.class, propertyName, options, adminAction, defaultBehavior);
this.parentPathString = parentPathString;
@@ -803,7 +811,7 @@
* {@inheritDoc}
*/
@Override
- public String decodeValue(String value) throws IllegalPropertyValueStringException {
+ public String decodeValue(String value) {
Reject.ifNull(value);
try {
@@ -938,7 +946,7 @@
* {@inheritDoc}
*/
@Override
- public String normalizeValue(String value) throws IllegalPropertyValueException {
+ public String normalizeValue(String value) {
try {
Reference<C, S> reference = Reference.parseName(parentPath, relationDefinition, value);
return reference.getNormalizedName();
@@ -971,7 +979,7 @@
* {@inheritDoc}
*/
@Override
- public void validateValue(String value) throws IllegalPropertyValueException {
+ public void validateValue(String value) {
try {
Reference.parseName(parentPath, relationDefinition, value);
} catch (IllegalArgumentException e) {
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java
index ba9cc30..bfb17b0 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java
@@ -42,7 +42,7 @@
* An interface for incrementally constructing attribute type property
* definitions.
*/
- public static class Builder extends AbstractBuilder<AttributeType, AttributeTypePropertyDefinition> {
+ public static final class Builder extends AbstractBuilder<AttributeType, AttributeTypePropertyDefinition> {
// Private constructor
private Builder(AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
@@ -54,8 +54,8 @@
*/
@Override
protected AttributeTypePropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d,
- String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<AttributeType> defaultBehavior) {
+ String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<AttributeType> defaultBehavior) {
return new AttributeTypePropertyDefinition(d, propertyName, options, adminAction, defaultBehavior);
}
}
@@ -105,8 +105,8 @@
// Private constructor.
private AttributeTypePropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<AttributeType> defaultBehavior) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<AttributeType> defaultBehavior) {
super(d, AttributeType.class, propertyName, options, adminAction, defaultBehavior);
}
@@ -138,7 +138,7 @@
* {@inheritDoc}
*/
@Override
- public AttributeType decodeValue(String value) throws IllegalPropertyValueStringException {
+ public AttributeType decodeValue(String value) {
Reject.ifNull(value);
String name = value.trim().toLowerCase();
@@ -160,7 +160,7 @@
* {@inheritDoc}
*/
@Override
- public String encodeValue(AttributeType value) throws IllegalPropertyValueException {
+ public String encodeValue(AttributeType value) {
return value.getNameOrOID();
}
@@ -168,7 +168,7 @@
* {@inheritDoc}
*/
@Override
- public void validateValue(AttributeType value) throws IllegalPropertyValueException {
+ public void validateValue(AttributeType value) {
Reject.ifNull(value);
// No implementation required.
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/BooleanPropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/BooleanPropertyDefinition.java
index c5d5e7c..3d6c90d 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/BooleanPropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/BooleanPropertyDefinition.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
import org.forgerock.util.Reject;
@@ -35,143 +34,113 @@
/**
* Boolean property definition.
*/
-public final class BooleanPropertyDefinition extends
- PropertyDefinition<Boolean> {
+public final class BooleanPropertyDefinition extends PropertyDefinition<Boolean> {
- /**
- * Mapping used for parsing boolean values. This mapping is more flexible than
- * the standard boolean string parser and supports common true/false synonyms
- * used in configuration.
- */
- private static final Map<String, Boolean> VALUE_MAP;
- static {
- VALUE_MAP = new HashMap<String, Boolean>();
+ /**
+ * Mapping used for parsing boolean values. This mapping is more flexible
+ * than the standard boolean string parser and supports common true/false
+ * synonyms used in configuration.
+ */
+ private static final Map<String, Boolean> VALUE_MAP;
+ static {
+ VALUE_MAP = new HashMap<String, Boolean>();
- // We could have more possibilities but decided against in issue 1960.
- VALUE_MAP.put("false", Boolean.FALSE);
- VALUE_MAP.put("true", Boolean.TRUE);
- }
-
-
-
- /**
- * An interface for incrementally constructing boolean property definitions.
- */
- public static class Builder extends
- AbstractBuilder<Boolean, BooleanPropertyDefinition> {
-
- // Private constructor
- private Builder(
- AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
- super(d, propertyName);
+ // We could have more possibilities but decided against in issue 1960.
+ VALUE_MAP.put("false", Boolean.FALSE);
+ VALUE_MAP.put("true", Boolean.TRUE);
}
+ /**
+ * An interface for incrementally constructing boolean property definitions.
+ */
+ public static final class Builder extends AbstractBuilder<Boolean, BooleanPropertyDefinition> {
+ // Private constructor
+ private Builder(AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
+ super(d, propertyName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected BooleanPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d,
+ String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<Boolean> defaultBehavior) {
+ return new BooleanPropertyDefinition(d, propertyName, options, adminAction, 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(AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
+ return new Builder(d, propertyName);
+ }
+
+ // Private constructor.
+ private BooleanPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<Boolean> defaultBehavior) {
+ super(d, Boolean.class, propertyName, options, adminAction, defaultBehavior);
+ }
/**
* {@inheritDoc}
*/
@Override
- protected BooleanPropertyDefinition buildInstance(
- AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options,
- AdministratorAction adminAction,
- DefaultBehaviorProvider<Boolean> defaultBehavior) {
- return new BooleanPropertyDefinition(d, propertyName, options,
- adminAction, defaultBehavior);
+ public void validateValue(Boolean value) {
+ Reject.ifNull(value);
+
+ // No additional validation required.
}
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Boolean decodeValue(String value) {
+ Reject.ifNull(value);
+ String nvalue = value.trim().toLowerCase();
+ Boolean b = VALUE_MAP.get(nvalue);
-
- /**
- * 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(
- AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
- return new Builder(d, propertyName);
- }
-
-
-
- // Private constructor.
- private BooleanPropertyDefinition(
- AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options,
- AdministratorAction adminAction,
- DefaultBehaviorProvider<Boolean> defaultBehavior) {
- super(d, Boolean.class, propertyName, options, adminAction,
- defaultBehavior);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void validateValue(Boolean value)
- throws IllegalPropertyValueException {
- Reject.ifNull(value);
-
- // No additional validation required.
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Boolean decodeValue(String value)
- throws IllegalPropertyValueStringException {
- Reject.ifNull(value);
-
- String nvalue = value.trim().toLowerCase();
- Boolean b = VALUE_MAP.get(nvalue);
-
- if (b == null) {
- throw new IllegalPropertyValueStringException(this, value);
- } else {
- return b;
+ if (b == null) {
+ throw new IllegalPropertyValueStringException(this, value);
+ } else {
+ return b;
+ }
}
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
+ return v.visitBoolean(this, p);
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <R, P> R accept(PropertyValueVisitor<R, P> v, Boolean value, P p) {
+ return v.visitBoolean(this, value, p);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
- return v.visitBoolean(this, p);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public <R, P> R accept(PropertyValueVisitor<R, P> v, Boolean value, P p) {
- return v.visitBoolean(this, value, p);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int compare(Boolean o1, Boolean o2) {
- return o1.compareTo(o2);
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int compare(Boolean o1, Boolean o2) {
+ return o1.compareTo(o2);
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ClassLoaderProvider.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ClassLoaderProvider.java
index c513465..62a916b 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ClassLoaderProvider.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ClassLoaderProvider.java
@@ -80,7 +80,8 @@
*/
public final class ClassLoaderProvider {
- private static final LocalizedLogger adminLogger = LocalizedLogger.getLocalizedLogger(AdminMessages.resourceName());
+ private static final LocalizedLogger adminLogger = LocalizedLogger.getLocalizedLogger(AdminMessages
+ .resourceName());
private static final Logger debugLogger = LoggerFactory.getLogger(ClassLoaderProvider.class);
/**
@@ -117,7 +118,7 @@
* @throws SecurityException
* If a required system property value cannot be accessed.
*/
- public void addJarFile(File jarFile) throws SecurityException, MalformedURLException {
+ public void addJarFile(File jarFile) throws MalformedURLException {
addURL(jarFile.toURI().toURL());
}
@@ -145,8 +146,8 @@
// The attribute names for build information is name, version and revision
// number
- private static final String[] BUILD_INFORMATION_ATTRIBUTE_NAMES = new String[] {
- Attributes.Name.EXTENSION_NAME.toString(), Attributes.Name.IMPLEMENTATION_VERSION.toString(),
+ private static final String[] BUILD_INFORMATION_ATTRIBUTE_NAMES =
+ new String[] { Attributes.Name.EXTENSION_NAME.toString(), Attributes.Name.IMPLEMENTATION_VERSION.toString(),
REVISION_NUMBER };
/**
@@ -192,8 +193,7 @@
* If one of the extension names was not a single relative path
* name element or was an absolute path.
*/
- public synchronized void addExtension(String... extensions) throws InitializationException, IllegalStateException,
- IllegalArgumentException {
+ public synchronized void addExtension(String... extensions) throws InitializationException {
Reject.ifNull(extensions);
if (loader == null) {
@@ -230,7 +230,7 @@
* @throws IllegalStateException
* If this class loader provider is already disabled.
*/
- public synchronized void disable() throws IllegalStateException {
+ public synchronized void disable() {
if (loader == null) {
throw new IllegalStateException("Class loader provider already disabled.");
}
@@ -248,7 +248,7 @@
* @throws IllegalStateException
* If this class loader provider is already enabled.
*/
- public synchronized void enable() throws InitializationException, IllegalStateException {
+ public synchronized void enable() throws InitializationException {
enable(RootCfgDefn.class.getClassLoader());
}
@@ -263,7 +263,7 @@
* @throws IllegalStateException
* If this class loader provider is already enabled.
*/
- public synchronized void enable(ClassLoader parent) throws InitializationException, IllegalStateException {
+ public synchronized void enable(ClassLoader parent) throws InitializationException {
if (loader != null) {
throw new IllegalStateException("Class loader provider already enabled.");
}
@@ -361,8 +361,9 @@
loader.addJarFile(extension);
} catch (Exception e) {
debugLogger.trace("Unable to register the jar file with the class loader", e);
- LocalizableMessage message = ERR_ADMIN_CANNOT_OPEN_JAR_FILE.get(extension.getName(),
- extension.getParent(), stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+ LocalizableMessage message =
+ ERR_ADMIN_CANNOT_OPEN_JAR_FILE.get(extension.getName(), extension.getParent(),
+ stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
throw new InitializationException(message);
}
jarFiles.add(extension);
@@ -381,8 +382,9 @@
* <code>null</code> if there is no information available.
*/
public String printExtensionInformation() {
- File extensionsPath = new File(new StringBuilder(DirectoryServer.getServerRoot()).append(File.separator)
- .append(LIB_DIR).append(File.separator).append(EXTENSIONS_DIR).toString());
+ File extensionsPath =
+ new File(new StringBuilder(DirectoryServer.getServerRoot()).append(File.separator).append(LIB_DIR)
+ .append(File.separator).append(EXTENSIONS_DIR).toString());
if (!extensionsPath.exists() || !extensionsPath.isDirectory()) {
// no extensions' directory
@@ -500,7 +502,8 @@
if (!extensionsPath.isDirectory()) {
// The extensions directory is not a directory. This is more
// critical.
- LocalizableMessage message = ERR_ADMIN_EXTENSIONS_DIR_NOT_DIRECTORY.get(String.valueOf(extensionsPath));
+ LocalizableMessage message =
+ ERR_ADMIN_EXTENSIONS_DIR_NOT_DIRECTORY.get(String.valueOf(extensionsPath));
throw new InitializationException(message);
}
@@ -528,7 +531,8 @@
throw e;
} catch (Exception e) {
debugLogger.trace("Unable to initialize all extensions", e);
- LocalizableMessage message = ERR_ADMIN_EXTENSIONS_CANNOT_LIST_FILES.get(String.valueOf(extensionsPath),
+ LocalizableMessage message =
+ ERR_ADMIN_EXTENSIONS_CANNOT_LIST_FILES.get(String.valueOf(extensionsPath),
stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
throw new InitializationException(message, e);
}
@@ -553,7 +557,8 @@
loadDefinitionClasses(is);
} catch (InitializationException e) {
debugLogger.trace("Unable to initialize core components", e);
- LocalizableMessage message = ERR_CLASS_LOADER_CANNOT_LOAD_CORE.get(CORE_MANIFEST,
+ LocalizableMessage message =
+ ERR_CLASS_LOADER_CANNOT_LOAD_CORE.get(CORE_MANIFEST,
stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
throw new InitializationException(message);
}
@@ -578,8 +583,9 @@
is = jarFile.getInputStream(entry);
} catch (Exception e) {
debugLogger.trace("Unable to get input stream from jar", e);
- LocalizableMessage message = ERR_ADMIN_CANNOT_READ_EXTENSION_MANIFEST.get(EXTENSION_MANIFEST,
- jarFile.getName(), stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+ LocalizableMessage message =
+ ERR_ADMIN_CANNOT_READ_EXTENSION_MANIFEST.get(EXTENSION_MANIFEST, jarFile.getName(),
+ stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
throw new InitializationException(message);
}
@@ -587,15 +593,16 @@
loadDefinitionClasses(is);
} catch (InitializationException e) {
debugLogger.trace("Unable to load classes from input stream", e);
- LocalizableMessage message = ERR_CLASS_LOADER_CANNOT_LOAD_EXTENSION.get(jarFile.getName(),
- EXTENSION_MANIFEST, stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+ LocalizableMessage message =
+ ERR_CLASS_LOADER_CANNOT_LOAD_EXTENSION.get(jarFile.getName(), EXTENSION_MANIFEST,
+ stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
throw new InitializationException(message);
}
try {
// Log build information of extensions in the error log
String[] information = getBuildInformation(jarFile);
- LocalizableMessage message = NOTE_LOG_EXTENSION_INFORMATION.get(jarFile.getName(), information[1],
- information[2]);
+ LocalizableMessage message =
+ NOTE_LOG_EXTENSION_INFORMATION.get(jarFile.getName(), information[1], information[2]);
LocalizedLogger.getLocalizedLogger(message.resourceName()).error(message);
} catch (Exception e) {
// Do not log information for that extension
@@ -615,13 +622,15 @@
*/
private void loadDefinitionClasses(InputStream is) throws InitializationException {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
- List<AbstractManagedObjectDefinition<?, ?>> definitions = new LinkedList<AbstractManagedObjectDefinition<?, ?>>();
+ List<AbstractManagedObjectDefinition<?, ?>> definitions =
+ new LinkedList<AbstractManagedObjectDefinition<?, ?>>();
while (true) {
String className;
try {
className = reader.readLine();
} catch (IOException e) {
- LocalizableMessage msg = ERR_CLASS_LOADER_CANNOT_READ_MANIFEST_FILE.get(String.valueOf(e.getMessage()));
+ LocalizableMessage msg =
+ ERR_CLASS_LOADER_CANNOT_READ_MANIFEST_FILE.get(String.valueOf(e.getMessage()));
throw new InitializationException(msg, e);
}
@@ -648,8 +657,8 @@
try {
theClass = Class.forName(className, true, loader);
} catch (Exception e) {
- LocalizableMessage msg = ERR_CLASS_LOADER_CANNOT_LOAD_CLASS.get(className,
- String.valueOf(e.getMessage()));
+ LocalizableMessage msg =
+ ERR_CLASS_LOADER_CANNOT_LOAD_CLASS.get(className, String.valueOf(e.getMessage()));
throw new InitializationException(msg, e);
}
if (AbstractManagedObjectDefinition.class.isAssignableFrom(theClass)) {
@@ -659,7 +668,8 @@
try {
method = theClass.getMethod("getInstance");
} catch (Exception e) {
- LocalizableMessage msg = ERR_CLASS_LOADER_CANNOT_FIND_GET_INSTANCE_METHOD.get(className,
+ LocalizableMessage msg =
+ ERR_CLASS_LOADER_CANNOT_FIND_GET_INSTANCE_METHOD.get(className,
String.valueOf(e.getMessage()));
throw new InitializationException(msg, e);
}
@@ -669,7 +679,8 @@
try {
d = (AbstractManagedObjectDefinition<?, ?>) method.invoke(null);
} catch (Exception e) {
- LocalizableMessage msg = ERR_CLASS_LOADER_CANNOT_INVOKE_GET_INSTANCE_METHOD.get(className,
+ LocalizableMessage msg =
+ ERR_CLASS_LOADER_CANNOT_INVOKE_GET_INSTANCE_METHOD.get(className,
String.valueOf(e.getMessage()));
throw new InitializationException(msg, e);
}
@@ -682,8 +693,9 @@
try {
d.initialize();
} catch (Exception e) {
- LocalizableMessage msg = ERR_CLASS_LOADER_CANNOT_INITIALIZE_DEFN.get(d.getName(), d.getClass()
- .getName(), String.valueOf(e.getMessage()));
+ LocalizableMessage msg =
+ ERR_CLASS_LOADER_CANNOT_INITIALIZE_DEFN.get(d.getName(), d.getClass().getName(),
+ String.valueOf(e.getMessage()));
throw new InitializationException(msg, e);
}
}
@@ -707,7 +719,8 @@
} catch (Exception e) {
debugLogger.trace("Unable to load jar file: " + jar, e);
- LocalizableMessage message = ERR_ADMIN_CANNOT_OPEN_JAR_FILE.get(jar.getName(), jar.getParent(),
+ LocalizableMessage message =
+ ERR_ADMIN_CANNOT_OPEN_JAR_FILE.get(jar.getName(), jar.getParent(),
stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
throw new InitializationException(message);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ClassPropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ClassPropertyDefinition.java
index 00d8d9f..766db83 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ClassPropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ClassPropertyDefinition.java
@@ -52,7 +52,7 @@
/**
* An interface for incrementally constructing class property definitions.
*/
- public static class Builder extends AbstractBuilder<String, ClassPropertyDefinition> {
+ public static final class Builder extends AbstractBuilder<String, ClassPropertyDefinition> {
// List of interfaces which property values must implement.
private List<String> instanceOfInterfaces;
@@ -107,10 +107,10 @@
*/
@Override
protected ClassPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<String> defaultBehavior) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<String> defaultBehavior) {
return new ClassPropertyDefinition(d, propertyName, options, adminAction, defaultBehavior,
- instanceOfInterfaces);
+ instanceOfInterfaces);
}
}
@@ -165,10 +165,8 @@
}
// Load a named class.
- private static Class<?> loadClass(String className, boolean initialize)
- throws ClassNotFoundException, LinkageError {
- return Class.forName(className, initialize, ClassLoaderProvider.getInstance()
- .getClassLoader());
+ private static Class<?> loadClass(String className, boolean initialize) throws ClassNotFoundException {
+ return Class.forName(className, initialize, ClassLoaderProvider.getInstance().getClassLoader());
}
// List of interfaces which property values must implement.
@@ -176,8 +174,8 @@
// Private constructor.
private ClassPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<String> defaultBehavior, List<String> instanceOfInterfaces) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<String> defaultBehavior, List<String> instanceOfInterfaces) {
super(d, String.class, propertyName, options, adminAction, defaultBehavior);
this.instanceOfInterfaces = Collections.unmodifiableList(new LinkedList<String>(instanceOfInterfaces));
@@ -203,7 +201,7 @@
* {@inheritDoc}
*/
@Override
- public String decodeValue(String value) throws IllegalPropertyValueStringException {
+ public String decodeValue(String value) {
Reject.ifNull(value);
try {
@@ -245,8 +243,7 @@
* If the referenced class does not implement the requested
* type.
*/
- public <T> Class<? extends T> loadClass(String className, Class<T> instanceOf)
- throws IllegalPropertyValueException, ClassCastException {
+ public <T> Class<? extends T> loadClass(String className, Class<T> instanceOf) {
Reject.ifNull(className, instanceOf);
// Make sure that the named class is valid.
@@ -261,7 +258,7 @@
* {@inheritDoc}
*/
@Override
- public String normalizeValue(String value) throws IllegalPropertyValueException {
+ public String normalizeValue(String value) {
Reject.ifNull(value);
return value.trim();
@@ -271,7 +268,7 @@
* {@inheritDoc}
*/
@Override
- public void validateValue(String value) throws IllegalPropertyValueException {
+ public void validateValue(String value) {
Reject.ifNull(value);
// Always make sure the name is a valid class name.
@@ -289,20 +286,18 @@
/*
* Do some basic checks to make sure the string representation is valid.
*/
- private void validateClassName(String className) throws IllegalPropertyValueException {
+ private void validateClassName(String className) {
String nvalue = className.trim();
if (!nvalue.matches(CLASS_RE)) {
throw new IllegalPropertyValueException(this, className);
}
}
-
/*
* Make sure that named class implements the interfaces named by this
* definition.
*/
- private Class<?> validateClassInterfaces(String className, boolean initialize)
- throws IllegalPropertyValueException {
+ private Class<?> validateClassInterfaces(String className, boolean initialize) {
Class<?> theClass = loadClassForValidation(className, className, initialize);
for (String i : instanceOfInterfaces) {
Class<?> instanceOfClass = loadClassForValidation(className, i, initialize);
@@ -313,8 +308,7 @@
return theClass;
}
- private Class<?> loadClassForValidation(String componentClassName, String classToBeLoaded,
- boolean initialize) {
+ private Class<?> loadClassForValidation(String componentClassName, String classToBeLoaded, boolean initialize) {
try {
return loadClass(classToBeLoaded.trim(), initialize);
} catch (ClassNotFoundException e) {
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Configuration.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Configuration.java
index 5cfe6e2..c91ed84 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Configuration.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Configuration.java
@@ -29,26 +29,23 @@
import org.forgerock.opendj.ldap.DN;
/**
- * A common base interface for all server managed object
- * configurations.
+ * A common base interface for all server managed object configurations.
*/
public interface Configuration {
- /**
- * Gets the DN of the LDAP entry associated with this configuration.
- *
- * @return Returns the DN of the LDAP entry associated with this
- * configuration.
- */
- DN dn();
+ /**
+ * Gets the DN of the LDAP entry associated with this configuration.
+ *
+ * @return Returns the DN of the LDAP entry associated with this
+ * configuration.
+ */
+ DN dn();
-
-
- /**
- * Gets the configuration class associated with this configuration.
- *
- * @return Returns the configuration class associated with this
- * configuration.
- */
- Class<? extends Configuration> configurationClass();
+ /**
+ * Gets the configuration class associated with this configuration.
+ *
+ * @return Returns the configuration class associated with this
+ * configuration.
+ */
+ Class<? extends Configuration> configurationClass();
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ConfigurationClient.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ConfigurationClient.java
index b32f038..21415c2 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ConfigurationClient.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ConfigurationClient.java
@@ -73,6 +73,6 @@
* If any other error occurs.
*/
void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
- ConcurrentModificationException, OperationRejectedException, ErrorResultException;
+ ConcurrentModificationException, OperationRejectedException, ErrorResultException;
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DNPropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DNPropertyDefinition.java
index cf1b829..377f403 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DNPropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DNPropertyDefinition.java
@@ -44,7 +44,7 @@
/**
* An interface for incrementally constructing DN property definitions.
*/
- public static class Builder extends AbstractBuilder<DN, DNPropertyDefinition> {
+ public static final class Builder extends AbstractBuilder<DN, DNPropertyDefinition> {
// Optional base DN which all valid values must be immediately
// subordinate to.
@@ -65,7 +65,7 @@
* If the provided string is not a valid DN string
* representation.
*/
- public void setBaseDN(String baseDN) throws IllegalArgumentException {
+ public void setBaseDN(String baseDN) {
if (baseDN == null) {
setBaseDN((DN) null);
} else {
@@ -91,8 +91,8 @@
*/
@Override
protected DNPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<DN> defaultBehavior) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<DN> defaultBehavior) {
return new DNPropertyDefinition(d, propertyName, options, adminAction, defaultBehavior, baseDN);
}
}
@@ -113,8 +113,8 @@
// Private constructor.
private DNPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<DN> defaultBehavior, DN baseDN) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<DN> defaultBehavior, DN baseDN) {
super(d, DN.class, propertyName, options, adminAction, defaultBehavior);
this.baseDN = baseDN;
}
@@ -134,7 +134,7 @@
* {@inheritDoc}
*/
@Override
- public void validateValue(DN value) throws IllegalPropertyValueException {
+ public void validateValue(DN value) {
Reject.ifNull(value);
if (baseDN != null) {
@@ -154,7 +154,7 @@
* {@inheritDoc}
*/
@Override
- public DN decodeValue(String value) throws IllegalPropertyValueStringException {
+ public DN decodeValue(String value) {
Reject.ifNull(value);
try {
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultBehaviorProvider.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultBehaviorProvider.java
index 910fbb5..5cf1848 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultBehaviorProvider.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultBehaviorProvider.java
@@ -25,79 +25,68 @@
*/
package org.opends.server.admin;
-
-
/**
- * An interface for determining the default behavior of a property. A
- * property exhibits default behavior when it has no values defined.
- * There are four different types of default behavior:
+ * An interface for determining the default behavior of a property. A property
+ * exhibits default behavior when it has no values defined. There are four
+ * different types of default behavior:
* <ol>
- * <li>there is no default behavior - e.g. leaving a "description"
- * unset has no side-effects. This default behavior is represented
- * using the {@link UndefinedDefaultBehaviorProvider} implementation
- * <li>the property defaults to one or more real values of the
- * property. This default behavior is represented using the
+ * <li>there is no default behavior - e.g. leaving a "description" unset has no
+ * side-effects. This default behavior is represented using the
+ * {@link UndefinedDefaultBehaviorProvider} implementation
+ * <li>the property defaults to one or more real values of the property. This
+ * default behavior is represented using the
* {@link DefinedDefaultBehaviorProvider} implementation
- * <li>the property defaults to some special behavior that cannot be
- * represented using real property values. This default behavior is
- * represented using the {@link AliasDefaultBehaviorProvider}
- * implementation
- * <li>the property inherits its values from property held in another
- * managed object (e.g. the parent managed object). This default
- * behavior is represented using the
- * {@link AbsoluteInheritedDefaultBehaviorProvider} and
+ * <li>the property defaults to some special behavior that cannot be represented
+ * using real property values. This default behavior is represented using the
+ * {@link AliasDefaultBehaviorProvider} implementation
+ * <li>the property inherits its values from property held in another managed
+ * object (e.g. the parent managed object). This default behavior is represented
+ * using the {@link AbsoluteInheritedDefaultBehaviorProvider} and
* {@link RelativeInheritedDefaultBehaviorProvider} implementations.
* </ol>
- * An application can perform actions based on the type of the default
- * behavior by implementing the {@link DefaultBehaviorProviderVisitor}
- * interface.
+ * An application can perform actions based on the type of the default behavior
+ * by implementing the {@link DefaultBehaviorProviderVisitor} interface.
*
* @param <T>
- * The type of values represented by this provider.
+ * The type of values represented by this provider.
*/
public abstract class DefaultBehaviorProvider<T> {
- /**
- * Creates a new default behavior provider.
- */
- protected DefaultBehaviorProvider() {
- // No implementation required.
- }
+ /**
+ * Creates a new default behavior provider.
+ */
+ protected DefaultBehaviorProvider() {
+ // No implementation required.
+ }
+ /**
+ * Apply a visitor to this default behavior provider.
+ *
+ * @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 default behavior visitor.
+ * @param p
+ * Optional additional visitor parameter.
+ * @return Returns a result as specified by the visitor.
+ */
+ public abstract <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p);
-
- /**
- * Apply a visitor to this default behavior provider.
- *
- * @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 default behavior visitor.
- * @param p
- * Optional additional visitor parameter.
- * @return Returns a result as specified by the visitor.
- */
- public abstract <R, P>
- R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p);
-
-
-
- /**
- * Performs any run-time initialization required by this default
- * behavior provider. This may include resolving managed object
- * paths and property names.
- * <p>
- * The default implementation is to do nothing.
- *
- * @throws Exception
- * If this default behavior provider could not be
- * initialized.
- */
- protected void initialize() throws Exception {
- // Default implementation is to do nothing.
- }
+ /**
+ * Performs any run-time initialization required by this default behavior
+ * provider. This may include resolving managed object paths and property
+ * names.
+ * <p>
+ * The default implementation is to do nothing.
+ *
+ * @throws Exception
+ * If this default behavior provider could not be initialized.
+ */
+ protected void initialize() throws Exception {
+ // Default implementation is to do nothing.
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultBehaviorProviderVisitor.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultBehaviorProviderVisitor.java
index a4e23bd..b9bf1cb 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultBehaviorProviderVisitor.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultBehaviorProviderVisitor.java
@@ -23,93 +23,82 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
-
-
/**
* A visitor of default behavior providers, in the style of the visitor design
* pattern. Classes implementing this interface can query default behavior
- * providers in a type-safe manner when the kind of default behavior provider
- * is unknown at compile time. When a visitor is passed to a default behavior
+ * providers in a type-safe manner when the kind of default behavior provider is
+ * unknown at compile time. When a visitor is passed to a default behavior
* provider's accept method, the corresponding visit method most applicable to
* that default behavior provider is invoked.
*
* @param <T>
- * The type of values represented by the default value provider.
+ * The type of values represented by the default value provider.
* @param <R>
- * The return type of this visitor's methods. Use
- * {@link java.lang.Void} for visitors that do not need to return
- * results.
+ * The return type of this visitor's methods. Use
+ * {@link java.lang.Void} for visitors that do not need to return
+ * results.
* @param <P>
- * The type of the additional parameter to this visitor's methods. Use
- * {@link java.lang.Void} for visitors that do not need an additional
- * parameter.
+ * The type of the additional parameter to this visitor's methods.
+ * Use {@link java.lang.Void} for visitors that do not need an
+ * additional parameter.
*/
public interface DefaultBehaviorProviderVisitor<T, R, P> {
- /**
- * Visit an absolute inherited default behavior provider.
- *
- * @param d
- * The absolute inherited default behavior provider to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- R visitAbsoluteInherited(AbsoluteInheritedDefaultBehaviorProvider<T> d, P p);
+ /**
+ * Visit an absolute inherited default behavior provider.
+ *
+ * @param d
+ * The absolute inherited default behavior provider to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ R visitAbsoluteInherited(AbsoluteInheritedDefaultBehaviorProvider<T> d, P p);
+ /**
+ * Visit an alias default behavior provider.
+ *
+ * @param d
+ * The alias default behavior provider to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ R visitAlias(AliasDefaultBehaviorProvider<T> d, P p);
+ /**
+ * Visit an defined default behavior provider.
+ *
+ * @param d
+ * The defined default behavior provider to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ R visitDefined(DefinedDefaultBehaviorProvider<T> d, P p);
- /**
- * Visit an alias default behavior provider.
- *
- * @param d
- * The alias default behavior provider to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- R visitAlias(AliasDefaultBehaviorProvider<T> d, P p);
+ /**
+ * Visit a relative inherited default behavior provider.
+ *
+ * @param d
+ * The relative inherited default behavior provider to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ R visitRelativeInherited(RelativeInheritedDefaultBehaviorProvider<T> d, P p);
-
-
- /**
- * Visit an defined default behavior provider.
- *
- * @param d
- * The defined default behavior provider to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- R visitDefined(DefinedDefaultBehaviorProvider<T> d, P p);
-
-
-
- /**
- * Visit a relative inherited default behavior provider.
- *
- * @param d
- * The relative inherited default behavior provider to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- R visitRelativeInherited(RelativeInheritedDefaultBehaviorProvider<T> d, P p);
-
-
-
- /**
- * Visit an undefined default behavior provider.
- *
- * @param d
- * The undefined default behavior provider to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- R visitUndefined(UndefinedDefaultBehaviorProvider<T> d, P p);
+ /**
+ * Visit an undefined default behavior provider.
+ *
+ * @param d
+ * The undefined default behavior provider to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ R visitUndefined(UndefinedDefaultBehaviorProvider<T> d, P p);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultManagedObject.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultManagedObject.java
index 09a16eb..3cb97c0 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultManagedObject.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefaultManagedObject.java
@@ -25,8 +25,6 @@
*/
package org.opends.server.admin;
-
-
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -34,166 +32,141 @@
import java.util.SortedSet;
import java.util.TreeSet;
-
-
/**
- * A default managed object which should be created when a parent
- * managed object is created. Default managed objects are associated
- * with a {@link RelationDefinition}.
+ * A default managed object which should be created when a parent managed object
+ * is created. Default managed objects are associated with a
+ * {@link RelationDefinition}.
*
* @param <C>
- * The type of client default managed object configuration.
+ * The type of client default managed object configuration.
* @param <S>
- * The type of server default managed object configuration.
+ * The type of server default managed object configuration.
*/
-public final class DefaultManagedObject
- <C extends ConfigurationClient, S extends Configuration>
- implements PropertyProvider {
+public final class DefaultManagedObject<C extends ConfigurationClient, S extends Configuration> implements
+ PropertyProvider {
- /**
- * An interface for incrementally constructing default managed
- * objects.
- *
- * @param <C>
- * The type of client default managed object configuration.
- * @param <S>
- * The type of server default managed object configuration.
- */
- public static final class Builder
- <C extends ConfigurationClient, S extends Configuration> {
+ /**
+ * An interface for incrementally constructing default managed objects.
+ *
+ * @param <C>
+ * The type of client default managed object configuration.
+ * @param <S>
+ * The type of server default managed object configuration.
+ */
+ public static final class Builder<C extends ConfigurationClient, S extends Configuration> {
+
+ // The default managed object's definition.
+ private final ManagedObjectDefinition<C, S> definition;
+
+ // The string encoded default managed object's properties.
+ private final Map<String, List<String>> propertyStringValues = new HashMap<String, List<String>>();
+
+ /**
+ * Creates a new default managed object builder.
+ *
+ * @param definition
+ * The default managed object's definition.
+ */
+ public Builder(ManagedObjectDefinition<C, S> definition) {
+ this.definition = definition;
+ }
+
+ /**
+ * Construct a default managed object based on the properties of this
+ * builder.
+ *
+ * @return Returns the new default managed object.
+ */
+ public DefaultManagedObject<C, S> getInstance() {
+ return new DefaultManagedObject<C, S>(definition, propertyStringValues);
+ }
+
+ /**
+ * Defines a property's values for the default managed object.
+ *
+ * @param name
+ * The name of the property.
+ * @param values
+ * One or more property values in the string representation.
+ */
+ public void setPropertyValues(String name, String... values) {
+ if (values == null || values.length == 0) {
+ throw new IllegalArgumentException("null or empty values specified for property " + name);
+ }
+
+ propertyStringValues.put(name, Arrays.asList(values));
+ }
+ }
// The default managed object's definition.
private final ManagedObjectDefinition<C, S> definition;
// The string encoded default managed object's properties.
- private final Map<String, List<String>> propertyStringValues =
- new HashMap<String, List<String>>();
+ private final Map<String, List<String>> propertyStringValues;
-
+ // Private constructor.
+ private DefaultManagedObject(ManagedObjectDefinition<C, S> definition,
+ Map<String, List<String>> propertyStringValues) {
+ this.definition = definition;
+ this.propertyStringValues = propertyStringValues;
+ }
/**
- * Creates a new default managed object builder.
+ * Gets the managed object definition associated with this default managed
+ * object.
*
- * @param definition
- * The default managed object's definition.
+ * @return Returns the managed object definition associated with this
+ * default managed object.
*/
- public Builder(ManagedObjectDefinition<C, S> definition) {
- this.definition = definition;
+ public ManagedObjectDefinition<C, S> getManagedObjectDefinition() {
+ return definition;
}
-
-
/**
- * Construct a default managed object based on the properties of
- * this builder.
+ * Gets a mutable copy of the set of property values for the specified
+ * property.
*
- * @return Returns the new default managed object.
+ * @param <T>
+ * The type of the property to be retrieved.
+ * @param pd
+ * The property to be retrieved.
+ * @return Returns a newly allocated set containing a copy of the property's
+ * values. An empty set indicates that the property has no values
+ * defined and any default behavior is applicable.
+ * @throws IllegalArgumentException
+ * If the property definition is not associated with this
+ * managed object's definition.
*/
- public DefaultManagedObject<C, S> getInstance() {
- return new DefaultManagedObject<C, S>(definition, propertyStringValues);
+ public <T> SortedSet<T> getPropertyValues(PropertyDefinition<T> pd) {
+ // Validate the property definition.
+ definition.getPropertyDefinition(pd.getName());
+
+ // Do a defensive copy.
+ SortedSet<T> values = new TreeSet<T>(pd);
+ List<String> stringValues = propertyStringValues.get(pd.getName());
+ if (stringValues != null) {
+ for (String stringValue : stringValues) {
+ values.add(pd.decodeValue(stringValue));
+ }
+ }
+ return values;
}
-
-
/**
- * Defines a property's values for the default managed object.
+ * Performs run-time initialization of properties.
*
- * @param name
- * The name of the property.
- * @param values
- * One or more property values in the string
- * representation.
+ * @throws Exception
+ * If this default managed object could not be initialized.
*/
- public void setPropertyValues(String name, String... values) {
- if (values == null || values.length == 0) {
- throw new IllegalArgumentException(
- "null or empty values specified for property " + name);
- }
+ void initialize() throws Exception {
+ // FIXME: it would be nice if we could decode all property values
+ // at this point. However this is not possible on the server side
+ // since some properties will be determined to be invalid since
+ // the schema is not loaded.
- propertyStringValues.put(name, Arrays.asList(values));
+ // Validate provided property names.
+ for (String name : propertyStringValues.keySet()) {
+ definition.getPropertyDefinition(name);
+ }
}
- }
-
- // The default managed object's definition.
- private final ManagedObjectDefinition<C, S> definition;
-
- // The string encoded default managed object's properties.
- private final Map<String, List<String>> propertyStringValues;
-
-
-
- // Private constructor.
- private DefaultManagedObject(ManagedObjectDefinition<C, S> definition,
- Map<String, List<String>> propertyStringValues) {
- this.definition = definition;
- this.propertyStringValues = propertyStringValues;
- }
-
-
-
- /**
- * Gets the managed object definition associated with this default
- * managed object.
- *
- * @return Returns the managed object definition associated with
- * this default managed object.
- */
- public ManagedObjectDefinition<C, S> getManagedObjectDefinition() {
- return definition;
- }
-
-
-
- /**
- * Gets a mutable copy of the set of property values for the
- * specified property.
- *
- * @param <T>
- * The type of the property to be retrieved.
- * @param pd
- * The property to be retrieved.
- * @return Returns a newly allocated set containing a copy of the
- * property's values. An empty set indicates that the
- * property has no values defined and any default behavior
- * is applicable.
- * @throws IllegalArgumentException
- * If the property definition is not associated with this
- * managed object's definition.
- */
- public <T> SortedSet<T> getPropertyValues(PropertyDefinition<T> pd)
- throws IllegalArgumentException {
- // Validate the property definition.
- definition.getPropertyDefinition(pd.getName());
-
- // Do a defensive copy.
- SortedSet<T> values = new TreeSet<T>(pd);
- List<String> stringValues = propertyStringValues.get(pd.getName());
- if (stringValues != null) {
- for (String stringValue : stringValues) {
- values.add(pd.decodeValue(stringValue));
- }
- }
- return values;
- }
-
-
-
- /**
- * Performs run-time initialization of properties.
- *
- * @throws Exception
- * If this default managed object could not be
- * initialized.
- */
- void initialize() throws Exception {
- // FIXME: it would be nice if we could decode all property values
- // at this point. However this is not possible on the server side
- // since some properties will be determined to be invalid since
- // the schema is not loaded.
-
- // Validate provided property names.
- for (String name : propertyStringValues.keySet()) {
- definition.getPropertyDefinition(name);
- }
- }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinedDefaultBehaviorProvider.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinedDefaultBehaviorProvider.java
index f6ece41..3ffc492 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinedDefaultBehaviorProvider.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinedDefaultBehaviorProvider.java
@@ -25,68 +25,55 @@
*/
package org.opends.server.admin;
-
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-
-
/**
* A default behavior provider which represents a well-defined set of default
* values. It should be used by properties which have default value(s) which are
* valid value(s) according to the constraints of the property's definition.
*
* @param <T>
- * The type of values represented by this provider.
+ * The type of values represented by this provider.
*/
-public final class DefinedDefaultBehaviorProvider<T> extends
- DefaultBehaviorProvider<T> {
+public final class DefinedDefaultBehaviorProvider<T> extends DefaultBehaviorProvider<T> {
- // The collection of default values.
- private final Collection<String> values;
+ // The collection of default values.
+ private final Collection<String> values;
-
-
- /**
- * Create a new defined default behavior provider associated with the
- * specified list of values.
- *
- * @param values
- * The list of values (must be non-<code>null</code> and not
- * empty) in their string representation.
- * @throws IllegalArgumentException
- * If the list of values was <code>null</code> or empty.
- */
- public DefinedDefaultBehaviorProvider(String... values)
- throws IllegalArgumentException {
- if (values == null || values.length == 0) {
- throw new IllegalArgumentException(
- "Null or empty list of default values");
+ /**
+ * Create a new defined default behavior provider associated with the
+ * specified list of values.
+ *
+ * @param values
+ * The list of values (must be non-<code>null</code> and not
+ * empty) in their string representation.
+ * @throws IllegalArgumentException
+ * If the list of values was <code>null</code> or empty.
+ */
+ public DefinedDefaultBehaviorProvider(String... values) {
+ if (values == null || values.length == 0) {
+ throw new IllegalArgumentException("Null or empty list of default values");
+ }
+ this.values = Arrays.asList(values);
}
- this.values = Arrays.asList(values);
- }
+ /**
+ * {@inheritDoc}
+ */
+ public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
+ return v.visitDefined(this, p);
+ }
-
- /**
- * {@inheritDoc}
- */
- public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
- return v.visitDefined(this, p);
- }
-
-
-
- /**
- * Get a copy of the default values.
- *
- * @return Returns a newly allocated collection containing a copy of the
- * default values.
- */
- public Collection<String> getDefaultValues() {
- return new ArrayList<String>(values);
- }
+ /**
+ * Get a copy of the default values.
+ *
+ * @return Returns a newly allocated collection containing a copy of the
+ * default values.
+ */
+ public Collection<String> getDefaultValues() {
+ return new ArrayList<String>(values);
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinitionDecodingException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinitionDecodingException.java
index ab087fc..df5ab5b 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinitionDecodingException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinitionDecodingException.java
@@ -31,101 +31,88 @@
import org.forgerock.i18n.LocalizableMessage;
/**
- * The requested managed object was found but its type could not be
- * determined.
+ * The requested managed object was found but its type could not be determined.
*/
public class DefinitionDecodingException extends DecodingException {
- /**
- * An enumeration defining the reasons why the definition could not
- * be resolved.
- */
- public static enum Reason {
/**
- * The managed object could be found but its type resolved to an
- * abstract managed object definition.
+ * An enumeration defining the reasons why the definition could not be
+ * resolved.
*/
- ABSTRACT_TYPE_INFORMATION(),
+ public static enum Reason {
+ /**
+ * The managed object could be found but its type resolved to an
+ * abstract managed object definition.
+ */
+ ABSTRACT_TYPE_INFORMATION(),
- /**
- * The managed object could be found but did not contain any type
- * information (eg missing object classes in LDAP).
- */
- NO_TYPE_INFORMATION(),
+ /**
+ * The managed object could be found but did not contain any type
+ * information (eg missing object classes in LDAP).
+ */
+ NO_TYPE_INFORMATION(),
- /**
- * The managed object could be found but did not contain the
- * expected type information (eg incorrect object classes in
- * LDAP).
- */
- WRONG_TYPE_INFORMATION();
+ /**
+ * The managed object could be found but did not contain the expected
+ * type information (eg incorrect object classes in LDAP).
+ */
+ WRONG_TYPE_INFORMATION();
- }
-
- /**
- * Version ID required by serializable classes.
- */
- private static final long serialVersionUID = 3459033551415663416L;
-
-
-
- // Create the message.
- private static LocalizableMessage createLocalizableMessage(AbstractManagedObjectDefinition<?, ?> d,
- Reason reason) {
- LocalizableMessage ufn = d.getUserFriendlyName();
- switch (reason) {
- case NO_TYPE_INFORMATION:
- return ERR_DECODING_EXCEPTION_NO_TYPE_INFO.get(ufn);
- case WRONG_TYPE_INFORMATION:
- return ERR_DECODING_EXCEPTION_WRONG_TYPE_INFO.get(ufn);
- default:
- return ERR_DECODING_EXCEPTION_ABSTRACT_TYPE_INFO.get(ufn);
}
- }
- // The expected type of managed object.
- private final AbstractManagedObjectDefinition<?, ?> d;
+ /**
+ * Version ID required by serializable classes.
+ */
+ private static final long serialVersionUID = 3459033551415663416L;
- // The reason why the definition could not be determined.
- private final Reason reason;
+ // Create the message.
+ private static LocalizableMessage createLocalizableMessage(AbstractManagedObjectDefinition<?, ?> d, Reason reason) {
+ LocalizableMessage ufn = d.getUserFriendlyName();
+ switch (reason) {
+ case NO_TYPE_INFORMATION:
+ return ERR_DECODING_EXCEPTION_NO_TYPE_INFO.get(ufn);
+ case WRONG_TYPE_INFORMATION:
+ return ERR_DECODING_EXCEPTION_WRONG_TYPE_INFO.get(ufn);
+ default:
+ return ERR_DECODING_EXCEPTION_ABSTRACT_TYPE_INFO.get(ufn);
+ }
+ }
+ // The expected type of managed object.
+ private final AbstractManagedObjectDefinition<?, ?> d;
+ // The reason why the definition could not be determined.
+ private final Reason reason;
- /**
- * Create a new definition decoding exception.
- *
- * @param d
- * The expected type of managed object.
- * @param reason
- * The reason why the definition could not be determined.
- */
- public DefinitionDecodingException(AbstractManagedObjectDefinition<?, ?> d,
- Reason reason) {
- super(createLocalizableMessage(d, reason));
- this.d = d;
- this.reason = reason;
- }
+ /**
+ * Create a new definition decoding exception.
+ *
+ * @param d
+ * The expected type of managed object.
+ * @param reason
+ * The reason why the definition could not be determined.
+ */
+ public DefinitionDecodingException(AbstractManagedObjectDefinition<?, ?> d, Reason reason) {
+ super(createLocalizableMessage(d, reason));
+ this.d = d;
+ this.reason = reason;
+ }
+ /**
+ * Gets the expected managed object definition.
+ *
+ * @return Returns the expected managed object definition.
+ */
+ public AbstractManagedObjectDefinition<?, ?> getManagedObjectDefinition() {
+ return d;
+ }
-
- /**
- * Gets the expected managed object definition.
- *
- * @return Returns the expected managed object definition.
- */
- public AbstractManagedObjectDefinition<?, ?> getManagedObjectDefinition() {
- return d;
- }
-
-
-
- /**
- * Gets the reason why the definition could not be determined.
- *
- * @return Returns the reason why the definition could not be
- * determined.
- */
- public Reason getReason() {
- return reason;
- }
+ /**
+ * Gets the reason why the definition could not be determined.
+ *
+ * @return Returns the reason why the definition could not be determined.
+ */
+ public Reason getReason() {
+ return reason;
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinitionResolver.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinitionResolver.java
index aef966c..2231d7e 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinitionResolver.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinitionResolver.java
@@ -25,47 +25,42 @@
*/
package org.opends.server.admin;
-
-
/**
* This interface is used to determine the "best match" managed object
* definition in a definition hierarchy.
* <p>
- * Managed object definitions, like Java classes, are arranged in an
- * inheritance hierarchy. When managed objects are decoded (e.g. from
- * LDAP entries), the driver implementation is provided with an
- * "expected managed object definition". However, the actual decoded
- * managed object is often an instance of a sub-type of this
- * definition. For example, when decoding a connection handler managed
- * object, the actual type can never be a connection handler because
- * it is an abstract managed object type. Instead, the decoded managed
- * object must be a "concrete" sub-type: an LDAP connection handler or
- * JMX connection handler.
+ * Managed object definitions, like Java classes, are arranged in an inheritance
+ * hierarchy. When managed objects are decoded (e.g. from LDAP entries), the
+ * driver implementation is provided with an
+ * "expected managed object definition". However, the actual decoded managed
+ * object is often an instance of a sub-type of this definition. For example,
+ * when decoding a connection handler managed object, the actual type can never
+ * be a connection handler because it is an abstract managed object type.
+ * Instead, the decoded managed object must be a "concrete" sub-type: an LDAP
+ * connection handler or JMX connection handler.
* <p>
* This resolution process is coordinated by the
- * <code>resolveManagedObjectDefinition</code> method in managed
- * object definitions, where it is passed a
- * <code>DefinitionResolver</code> implementation. The
- * <code>resolveManagedObjectDefinition</code> method takes care of
- * recursively descending through the definition hierarchy and invokes
- * the {@link #matches(AbstractManagedObjectDefinition)} method
- * against each potential sub-type. It is the job of the resolver to
- * indicate whether the provided managed object definition is a
- * candidate definition. For example, the LDAP driver provides a
- * definition resolver which uses the decoded LDAP entry's object
- * classes to determine the final appropriate managed object
+ * <code>resolveManagedObjectDefinition</code> method in managed object
+ * definitions, where it is passed a <code>DefinitionResolver</code>
+ * implementation. The <code>resolveManagedObjectDefinition</code> method takes
+ * care of recursively descending through the definition hierarchy and invokes
+ * the {@link #matches(AbstractManagedObjectDefinition)} method against each
+ * potential sub-type. It is the job of the resolver to indicate whether the
+ * provided managed object definition is a candidate definition. For example,
+ * the LDAP driver provides a definition resolver which uses the decoded LDAP
+ * entry's object classes to determine the final appropriate managed object
* definition.
*/
public interface DefinitionResolver {
- /**
- * Determines whether or not the provided managed object definition matches
- * this resolver's criteria.
- *
- * @param d
- * The managed object definition.
- * @return Returns <code>true</code> if the the provided managed object
- * definition matches this resolver's criteria.
- */
- boolean matches(AbstractManagedObjectDefinition<?, ?> d);
+ /**
+ * Determines whether or not the provided managed object definition matches
+ * this resolver's criteria.
+ *
+ * @param d
+ * The managed object definition.
+ * @return Returns <code>true</code> if the the provided managed object
+ * definition matches this resolver's criteria.
+ */
+ boolean matches(AbstractManagedObjectDefinition<?, ?> d);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DurationPropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DurationPropertyDefinition.java
index 04d7ac0..2f0838a 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DurationPropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DurationPropertyDefinition.java
@@ -82,7 +82,7 @@
* An interface for incrementally constructing duration property
* definitions.
*/
- public static class Builder extends AbstractBuilder<Long, DurationPropertyDefinition> {
+ public static final class Builder extends AbstractBuilder<Long, DurationPropertyDefinition> {
// The base unit for this property definition.
private DurationUnit baseUnit = DurationUnit.SECONDS;
@@ -120,7 +120,7 @@
* duration unit, or if the base unit is bigger than the
* maximum unit.
*/
- public final void setBaseUnit(String unit) throws IllegalArgumentException {
+ public final void setBaseUnit(String unit) {
Reject.ifNull(unit);
setBaseUnit(DurationUnit.getUnit(unit));
@@ -137,7 +137,7 @@
* If the provided base unit is bigger than the maximum
* unit.
*/
- public final void setBaseUnit(DurationUnit unit) throws IllegalArgumentException {
+ public final void setBaseUnit(DurationUnit unit) {
Reject.ifNull(unit);
// Make sure that the base unit is not bigger than the maximum
@@ -163,7 +163,7 @@
* duration unit, or if the maximum unit is smaller than the
* base unit.
*/
- public final void setMaximumUnit(String unit) throws IllegalArgumentException {
+ public final void setMaximumUnit(String unit) {
if (unit == null) {
setMaximumUnit((DurationUnit) null);
} else {
@@ -182,7 +182,7 @@
* If the provided maximum unit is smaller than the base
* unit.
*/
- public final void setMaximumUnit(DurationUnit unit) throws IllegalArgumentException {
+ public final void setMaximumUnit(DurationUnit unit) {
if (unit != null) {
// Make sure that the maximum unit is not smaller than the
// base unit.
@@ -203,7 +203,7 @@
* If a negative lower limit was specified, or the lower
* limit is greater than the upper limit.
*/
- public final void setLowerLimit(long lowerLimit) throws IllegalArgumentException {
+ public final void setLowerLimit(long lowerLimit) {
if (lowerLimit < 0) {
throw new IllegalArgumentException("Negative lower limit");
}
@@ -227,7 +227,7 @@
* lower limit was specified, or the lower limit is greater
* than the upper limit.
*/
- public final void setLowerLimit(String lowerLimit) throws IllegalArgumentException {
+ public final void setLowerLimit(String lowerLimit) {
setLowerLimit(DurationUnit.parseValue(lowerLimit, baseUnit));
}
@@ -242,7 +242,7 @@
* limit is greater than the upper limit or unlimited
* durations are permitted.
*/
- public final void setUpperLimit(Long upperLimit) throws IllegalArgumentException {
+ public final void setUpperLimit(Long upperLimit) {
if (upperLimit != null) {
if (upperLimit < 0) {
throw new IllegalArgumentException("Negative upper limit");
@@ -272,7 +272,7 @@
* If the upper limit could not be parsed, or if the lower
* limit is greater than the upper limit.
*/
- public final void setUpperLimit(String upperLimit) throws IllegalArgumentException {
+ public final void setUpperLimit(String upperLimit) {
if (upperLimit == null) {
setUpperLimit((Long) null);
} else {
@@ -291,7 +291,7 @@
* If unlimited values are to be permitted but there is an
* upper limit specified.
*/
- public final void setAllowUnlimited(boolean allowUnlimited) throws IllegalArgumentException {
+ public final void setAllowUnlimited(boolean allowUnlimited) {
if (allowUnlimited && upperLimit != null) {
throw new IllegalArgumentException("Upper limit specified when unlimited durations are permitted");
}
@@ -304,10 +304,10 @@
*/
@Override
protected DurationPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d,
- String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<Long> defaultBehavior) {
+ String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<Long> defaultBehavior) {
return new DurationPropertyDefinition(d, propertyName, options, adminAction, defaultBehavior, baseUnit,
- maximumUnit, lowerLimit, upperLimit, allowUnlimited);
+ maximumUnit, lowerLimit, upperLimit, allowUnlimited);
}
}
@@ -327,9 +327,9 @@
// 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) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<Long> defaultBehavior, DurationUnit baseUnit, DurationUnit maximumUnit,
+ Long lowerLimit, Long upperLimit, boolean allowUnlimited) {
super(d, Long.class, propertyName, options, adminAction, defaultBehavior);
this.baseUnit = baseUnit;
this.maximumUnit = maximumUnit;
@@ -392,7 +392,7 @@
* {@inheritDoc}
*/
@Override
- public void validateValue(Long value) throws IllegalPropertyValueException {
+ public void validateValue(Long value) {
Reject.ifNull(value);
long nvalue = baseUnit.toMilliSeconds(value);
@@ -413,7 +413,7 @@
* {@inheritDoc}
*/
@Override
- public String encodeValue(Long value) throws IllegalPropertyValueException {
+ public String encodeValue(Long value) {
Reject.ifNull(value);
// Make sure that we correctly encode negative values as
@@ -436,7 +436,7 @@
* {@inheritDoc}
*/
@Override
- public Long decodeValue(String value) throws IllegalPropertyValueStringException {
+ public Long decodeValue(String value) {
Reject.ifNull(value);
// First check for the special "unlimited" value when necessary.
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DurationUnit.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DurationUnit.java
index c9a0324..b7ee1d0 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DurationUnit.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DurationUnit.java
@@ -25,360 +25,325 @@
*/
package org.opends.server.admin;
-
-
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
-
/**
* This enumeration defines various duration units.
*/
public enum DurationUnit {
- /**
- * A day unit.
- */
- DAYS((long) 24 * 60 * 60 * 1000, "d", "days"),
+ /**
+ * A day unit.
+ */
+ DAYS((long) 24 * 60 * 60 * 1000, "d", "days"),
- /**
- * An hour unit.
- */
- HOURS((long) 60 * 60 * 1000, "h", "hours"),
+ /**
+ * An hour unit.
+ */
+ HOURS((long) 60 * 60 * 1000, "h", "hours"),
- /**
- * A millisecond unit.
- */
- MILLI_SECONDS(1L, "ms", "milliseconds"),
+ /**
+ * A millisecond unit.
+ */
+ MILLI_SECONDS(1L, "ms", "milliseconds"),
- /**
- * A minute unit.
- */
- MINUTES((long) 60 * 1000, "m", "minutes"),
+ /**
+ * A minute unit.
+ */
+ MINUTES((long) 60 * 1000, "m", "minutes"),
- /**
- * A second unit.
- */
- SECONDS(1000L, "s", "seconds"),
+ /**
+ * A second unit.
+ */
+ SECONDS(1000L, "s", "seconds"),
- /**
- * A week unit.
- */
- WEEKS((long) 7 * 24 * 60 * 60 * 1000, "w", "weeks");
+ /**
+ * A week unit.
+ */
+ WEEKS((long) 7 * 24 * 60 * 60 * 1000, "w", "weeks");
- // A lookup table for resolving a unit from its name.
- private static final Map<String, DurationUnit> nameToUnit;
- static {
- nameToUnit = new HashMap<String, DurationUnit>();
+ // A lookup table for resolving a unit from its name.
+ private static final Map<String, DurationUnit> NAME_TO_UNIT;
+ static {
+ NAME_TO_UNIT = new HashMap<String, DurationUnit>();
- for (DurationUnit unit : DurationUnit.values()) {
- nameToUnit.put(unit.shortName, unit);
- nameToUnit.put(unit.longName, unit);
- }
- }
-
-
-
- /**
- * Get the unit corresponding to the provided unit name.
- *
- * @param s
- * The name of the unit. Can be the abbreviated or long
- * name and can contain white space and mixed case
- * characters.
- * @return Returns the unit corresponding to the provided unit name.
- * @throws IllegalArgumentException
- * If the provided name did not correspond to a known
- * duration unit.
- */
- public static DurationUnit getUnit(String s) throws IllegalArgumentException {
- DurationUnit unit = nameToUnit.get(s.trim().toLowerCase());
- if (unit == null) {
- throw new IllegalArgumentException("Illegal duration unit \"" + s + "\"");
- }
- return unit;
- }
-
-
-
- /**
- * Parse the provided duration string and return its equivalent
- * duration in milliseconds. The duration string must specify the
- * unit e.g. "10s". This method will parse duration string
- * representations produced from the {@link #toString(long)} method.
- * Therefore, a duration can comprise of multiple duration
- * specifiers, for example <code>1d15m25s</code>.
- *
- * @param s
- * The duration string to be parsed.
- * @return Returns the parsed duration in milliseconds.
- * @throws NumberFormatException
- * If the provided duration string could not be parsed.
- * @see #toString(long)
- */
- public static long parseValue(String s) throws NumberFormatException {
- return parseValue(s, null);
- }
-
-
-
- /**
- * Parse the provided duration string and return its equivalent
- * duration in milliseconds. This method will parse duration string
- * representations produced from the {@link #toString(long)} method.
- * Therefore, a duration can comprise of multiple duration
- * specifiers, for example <code>1d15m25s</code>.
- *
- * @param s
- * The duration string to be parsed.
- * @param defaultUnit
- * The default unit to use if there is no unit specified in
- * the duration string, or <code>null</code> if the
- * string must always contain a unit.
- * @return Returns the parsed duration in milliseconds.
- * @throws NumberFormatException
- * If the provided duration string could not be parsed.
- * @see #toString(long)
- */
- public static long parseValue(String s, DurationUnit defaultUnit)
- throws NumberFormatException {
- String ns = s.trim();
- if (ns.length() == 0) {
- throw new NumberFormatException("Empty duration value \"" + s + "\"");
+ for (DurationUnit unit : DurationUnit.values()) {
+ NAME_TO_UNIT.put(unit.shortName, unit);
+ NAME_TO_UNIT.put(unit.longName, unit);
+ }
}
- Pattern p1 = Pattern.compile("^\\s*((\\d+)\\s*w)?" + "\\s*((\\d+)\\s*d)?"
- + "\\s*((\\d+)\\s*h)?" + "\\s*((\\d+)\\s*m)?" + "\\s*((\\d+)\\s*s)?"
- + "\\s*((\\d+)\\s*ms)?\\s*$", Pattern.CASE_INSENSITIVE);
- Matcher m1 = p1.matcher(ns);
- if (m1.matches()) {
- // Value must be of the form produced by toString(long).
- String weeks = m1.group(2);
- String days = m1.group(4);
- String hours = m1.group(6);
- String minutes = m1.group(8);
- String seconds = m1.group(10);
- String ms = m1.group(12);
+ /**
+ * Get the unit corresponding to the provided unit name.
+ *
+ * @param s
+ * The name of the unit. Can be the abbreviated or long name and
+ * can contain white space and mixed case characters.
+ * @return Returns the unit corresponding to the provided unit name.
+ * @throws IllegalArgumentException
+ * If the provided name did not correspond to a known duration
+ * unit.
+ */
+ public static DurationUnit getUnit(String s) {
+ DurationUnit unit = NAME_TO_UNIT.get(s.trim().toLowerCase());
+ if (unit == null) {
+ throw new IllegalArgumentException("Illegal duration unit \"" + s + "\"");
+ }
+ return unit;
+ }
- long duration = 0;
+ /**
+ * Parse the provided duration string and return its equivalent duration in
+ * milliseconds. The duration string must specify the unit e.g. "10s". This
+ * method will parse duration string representations produced from the
+ * {@link #toString(long)} method. Therefore, a duration can comprise of
+ * multiple duration specifiers, for example <code>1d15m25s</code>.
+ *
+ * @param s
+ * The duration string to be parsed.
+ * @return Returns the parsed duration in milliseconds.
+ * @throws NumberFormatException
+ * If the provided duration string could not be parsed.
+ * @see #toString(long)
+ */
+ public static long parseValue(String s) {
+ return parseValue(s, null);
+ }
- try {
- if (weeks != null) {
- duration += Long.valueOf(weeks) * WEEKS.getDuration();
+ /**
+ * Parse the provided duration string and return its equivalent duration in
+ * milliseconds. This method will parse duration string representations
+ * produced from the {@link #toString(long)} method. Therefore, a duration
+ * can comprise of multiple duration specifiers, for example
+ * <code>1d15m25s</code>.
+ *
+ * @param s
+ * The duration string to be parsed.
+ * @param defaultUnit
+ * The default unit to use if there is no unit specified in the
+ * duration string, or <code>null</code> if the string must
+ * always contain a unit.
+ * @return Returns the parsed duration in milliseconds.
+ * @throws NumberFormatException
+ * If the provided duration string could not be parsed.
+ * @see #toString(long)
+ */
+ public static long parseValue(String s, DurationUnit defaultUnit) {
+ String ns = s.trim();
+ if (ns.length() == 0) {
+ throw new NumberFormatException("Empty duration value \"" + s + "\"");
}
- if (days != null) {
- duration += Long.valueOf(days) * DAYS.getDuration();
- }
+ Pattern p1 =
+ Pattern.compile("^\\s*((\\d+)\\s*w)?" + "\\s*((\\d+)\\s*d)?" + "\\s*((\\d+)\\s*h)?"
+ + "\\s*((\\d+)\\s*m)?" + "\\s*((\\d+)\\s*s)?" + "\\s*((\\d+)\\s*ms)?\\s*$", Pattern.CASE_INSENSITIVE);
+ Matcher m1 = p1.matcher(ns);
+ if (m1.matches()) {
+ // Value must be of the form produced by toString(long).
+ String weeks = m1.group(2);
+ String days = m1.group(4);
+ String hours = m1.group(6);
+ String minutes = m1.group(8);
+ String seconds = m1.group(10);
+ String ms = m1.group(12);
- if (hours != null) {
- duration += Long.valueOf(hours) * HOURS.getDuration();
- }
+ long duration = 0;
- if (minutes != null) {
- duration += Long.valueOf(minutes) * MINUTES.getDuration();
- }
+ try {
+ if (weeks != null) {
+ duration += Long.valueOf(weeks) * WEEKS.getDuration();
+ }
- if (seconds != null) {
- duration += Long.valueOf(seconds) * SECONDS.getDuration();
- }
+ if (days != null) {
+ duration += Long.valueOf(days) * DAYS.getDuration();
+ }
- if (ms != null) {
- duration += Long.valueOf(ms) * MILLI_SECONDS.getDuration();
- }
- } catch (NumberFormatException e) {
- throw new NumberFormatException("Invalid duration value \"" + s + "\"");
- }
+ if (hours != null) {
+ duration += Long.valueOf(hours) * HOURS.getDuration();
+ }
- return duration;
- } else {
- // Value must be a floating point number followed by a unit.
- Pattern p2 = Pattern.compile("^\\s*(\\d+(\\.\\d+)?)\\s*(\\w+)?\\s*$");
- Matcher m2 = p2.matcher(ns);
+ if (minutes != null) {
+ duration += Long.valueOf(minutes) * MINUTES.getDuration();
+ }
- if (!m2.matches()) {
- throw new NumberFormatException("Invalid duration value \"" + s + "\"");
- }
+ if (seconds != null) {
+ duration += Long.valueOf(seconds) * SECONDS.getDuration();
+ }
- // Group 1 is the float.
- double d;
- try {
- d = Double.valueOf(m2.group(1));
- } catch (NumberFormatException e) {
- throw new NumberFormatException("Invalid duration value \"" + s + "\"");
- }
+ if (ms != null) {
+ duration += Long.valueOf(ms) * MILLI_SECONDS.getDuration();
+ }
+ } catch (NumberFormatException e) {
+ throw new NumberFormatException("Invalid duration value \"" + s + "\"");
+ }
- // Group 3 is the unit.
- String unitString = m2.group(3);
- DurationUnit unit;
- if (unitString == null) {
- if (defaultUnit == null) {
- throw new NumberFormatException("Invalid duration value \"" + s
- + "\"");
+ return duration;
} else {
- unit = defaultUnit;
+ // Value must be a floating point number followed by a unit.
+ Pattern p2 = Pattern.compile("^\\s*(\\d+(\\.\\d+)?)\\s*(\\w+)?\\s*$");
+ Matcher m2 = p2.matcher(ns);
+
+ if (!m2.matches()) {
+ throw new NumberFormatException("Invalid duration value \"" + s + "\"");
+ }
+
+ // Group 1 is the float.
+ double d;
+ try {
+ d = Double.valueOf(m2.group(1));
+ } catch (NumberFormatException e) {
+ throw new NumberFormatException("Invalid duration value \"" + s + "\"");
+ }
+
+ // Group 3 is the unit.
+ String unitString = m2.group(3);
+ DurationUnit unit;
+ if (unitString == null) {
+ if (defaultUnit == null) {
+ throw new NumberFormatException("Invalid duration value \"" + s + "\"");
+ } else {
+ unit = defaultUnit;
+ }
+ } else {
+ try {
+ unit = getUnit(unitString);
+ } catch (IllegalArgumentException e) {
+ throw new NumberFormatException("Invalid duration value \"" + s + "\"");
+ }
+ }
+
+ return unit.toMilliSeconds(d);
}
- } else {
- try {
- unit = getUnit(unitString);
- } catch (IllegalArgumentException e) {
- throw new NumberFormatException("Invalid duration value \"" + s
- + "\"");
+ }
+
+ /**
+ * Returns a string representation of the provided duration. The string
+ * representation can be parsed using the {@link #parseValue(String)}
+ * method. The string representation is comprised of one or more of the
+ * number of weeks, days, hours, minutes, seconds, and milliseconds. Here
+ * are some examples:
+ *
+ * <pre>
+ * toString(0) // 0 ms
+ * toString(999) // 999 ms
+ * toString(1000) // 1 s
+ * toString(1500) // 1 s 500 ms
+ * toString(3650000) // 1 h 50 s
+ * toString(3700000) // 1 h 1 m 40 s
+ * </pre>
+ *
+ * @param duration
+ * The duration in milliseconds.
+ * @return Returns a string representation of the provided duration.
+ * @throws IllegalArgumentException
+ * If the provided duration is negative.
+ * @see #parseValue(String)
+ * @see #parseValue(String, DurationUnit)
+ */
+ public static String toString(long duration) {
+ if (duration < 0) {
+ throw new IllegalArgumentException("Negative duration " + duration);
}
- }
- return unit.toMilliSeconds(d);
- }
- }
-
-
-
- /**
- * Returns a string representation of the provided duration. The
- * string representation can be parsed using the
- * {@link #parseValue(String)} method. The string representation is
- * comprised of one or more of the number of weeks, days, hours,
- * minutes, seconds, and milliseconds. Here are some examples:
- *
- * <pre>
- * toString(0) // 0 ms
- * toString(999) // 999 ms
- * toString(1000) // 1 s
- * toString(1500) // 1 s 500 ms
- * toString(3650000) // 1 h 50 s
- * toString(3700000) // 1 h 1 m 40 s
- * </pre>
- *
- * @param duration
- * The duration in milliseconds.
- * @return Returns a string representation of the provided duration.
- * @throws IllegalArgumentException
- * If the provided duration is negative.
- * @see #parseValue(String)
- * @see #parseValue(String, DurationUnit)
- */
- public static String toString(long duration) throws IllegalArgumentException {
- if (duration < 0) {
- throw new IllegalArgumentException("Negative duration " + duration);
- }
-
- if (duration == 0) {
- return "0 ms";
- }
-
- DurationUnit[] units = new DurationUnit[] { WEEKS, DAYS, HOURS, MINUTES,
- SECONDS, MILLI_SECONDS };
- long remainder = duration;
- StringBuilder builder = new StringBuilder();
- boolean isFirst = true;
- for (DurationUnit unit : units) {
- long count = remainder / unit.getDuration();
- if (count > 0) {
- if (!isFirst) {
- builder.append(' ');
+ if (duration == 0) {
+ return "0 ms";
}
- builder.append(count);
- builder.append(' ');
- builder.append(unit.getShortName());
- remainder = remainder - (count * unit.getDuration());
- isFirst = false;
- }
+
+ DurationUnit[] units = new DurationUnit[] { WEEKS, DAYS, HOURS, MINUTES, SECONDS, MILLI_SECONDS };
+ long remainder = duration;
+ StringBuilder builder = new StringBuilder();
+ boolean isFirst = true;
+ for (DurationUnit unit : units) {
+ long count = remainder / unit.getDuration();
+ if (count > 0) {
+ if (!isFirst) {
+ builder.append(' ');
+ }
+ builder.append(count);
+ builder.append(' ');
+ builder.append(unit.getShortName());
+ remainder = remainder - (count * unit.getDuration());
+ isFirst = false;
+ }
+ }
+ return builder.toString();
}
- return builder.toString();
- }
- // The long name of the unit.
- private final String longName;
+ // The long name of the unit.
+ private final String longName;
- // The abbreviation of the unit.
- private final String shortName;
+ // The abbreviation of the unit.
+ private final String shortName;
- // The size of the unit in milliseconds.
- private final long sz;
+ // The size of the unit in milliseconds.
+ private final long sz;
+ // Private constructor.
+ private DurationUnit(long sz, String shortName, String longName) {
+ this.sz = sz;
+ this.shortName = shortName;
+ this.longName = longName;
+ }
+ /**
+ * Converts the specified duration in milliseconds to this unit.
+ *
+ * @param duration
+ * The duration in milliseconds.
+ * @return Returns milliseconds in this unit.
+ */
+ public double fromMilliSeconds(long duration) {
+ return ((double) duration / sz);
+ }
- // Private constructor.
- private DurationUnit(long sz, String shortName, String longName) {
- this.sz = sz;
- this.shortName = shortName;
- this.longName = longName;
- }
+ /**
+ * Get the number of milliseconds that this unit represents.
+ *
+ * @return Returns the number of milliseconds that this unit represents.
+ */
+ public long getDuration() {
+ return sz;
+ }
+ /**
+ * Get the long name of this unit.
+ *
+ * @return Returns the long name of this unit.
+ */
+ public String getLongName() {
+ return longName;
+ }
+ /**
+ * Get the abbreviated name of this unit.
+ *
+ * @return Returns the abbreviated name of this unit.
+ */
+ public String getShortName() {
+ return shortName;
+ }
- /**
- * Converts the specified duration in milliseconds to this unit.
- *
- * @param duration
- * The duration in milliseconds.
- * @return Returns milliseconds in this unit.
- */
- public double fromMilliSeconds(long duration) {
- return ((double) duration / sz);
- }
+ /**
+ * Converts the specified duration in this unit to milliseconds.
+ *
+ * @param duration
+ * The duration as a quantity of this unit.
+ * @return Returns the number of milliseconds that the duration represents.
+ */
+ public long toMilliSeconds(double duration) {
+ return (long) (sz * duration);
+ }
-
-
- /**
- * Get the number of milliseconds that this unit represents.
- *
- * @return Returns the number of milliseconds that this unit
- * represents.
- */
- public long getDuration() {
- return sz;
- }
-
-
-
- /**
- * Get the long name of this unit.
- *
- * @return Returns the long name of this unit.
- */
- public String getLongName() {
- return longName;
- }
-
-
-
- /**
- * Get the abbreviated name of this unit.
- *
- * @return Returns the abbreviated name of this unit.
- */
- public String getShortName() {
- return shortName;
- }
-
-
-
- /**
- * Converts the specified duration in this unit to milliseconds.
- *
- * @param duration
- * The duration as a quantity of this unit.
- * @return Returns the number of milliseconds that the duration
- * represents.
- */
- public long toMilliSeconds(double duration) {
- return (long) (sz * duration);
- }
-
-
-
- /**
- * {@inheritDoc}
- * <p>
- * This implementation returns the abbreviated name of this duration
- * unit.
- */
- @Override
- public String toString() {
- return shortName;
- }
+ /**
+ * {@inheritDoc}
+ * <p>
+ * This implementation returns the abbreviated name of this duration unit.
+ */
+ @Override
+ public String toString() {
+ return shortName;
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/EnumPropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/EnumPropertyDefinition.java
index 362eccd..8006662 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/EnumPropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/EnumPropertyDefinition.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
import org.forgerock.util.Reject;
@@ -53,7 +52,7 @@
* The enumeration that should be used for values of this
* property definition.
*/
- public static class Builder<E extends Enum<E>> extends AbstractBuilder<E, EnumPropertyDefinition<E>> {
+ public final static class Builder<E extends Enum<E>> extends AbstractBuilder<E, EnumPropertyDefinition<E>> {
// The enumeration class.
private Class<E> enumClass;
@@ -80,9 +79,9 @@
* {@inheritDoc}
*/
@Override
- protected EnumPropertyDefinition<E> buildInstance(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<E> defaultBehavior) {
+ 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) {
throw new IllegalStateException("Enumeration class undefined");
@@ -106,7 +105,7 @@
* @return Returns the new enumeration property definition builder.
*/
public static <E extends Enum<E>> Builder<E> createBuilder(AbstractManagedObjectDefinition<?, ?> d,
- String propertyName) {
+ String propertyName) {
return new Builder<E>(d, propertyName);
}
@@ -118,8 +117,8 @@
// Private constructor.
private EnumPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<E> defaultBehavior, Class<E> enumClass) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction, DefaultBehaviorProvider<E> defaultBehavior,
+ Class<E> enumClass) {
super(d, enumClass, propertyName, options, adminAction, defaultBehavior);
this.enumClass = enumClass;
@@ -151,7 +150,7 @@
* {@inheritDoc}
*/
@Override
- public E decodeValue(String value) throws IllegalPropertyValueStringException {
+ public E decodeValue(String value) {
Reject.ifNull(value);
String nvalue = value.trim().toLowerCase();
@@ -210,7 +209,7 @@
* {@inheritDoc}
*/
@Override
- public String normalizeValue(E value) throws IllegalPropertyValueException {
+ public String normalizeValue(E value) {
Reject.ifNull(value);
return value.toString().trim().toLowerCase();
@@ -220,7 +219,7 @@
* {@inheritDoc}
*/
@Override
- public void validateValue(E value) throws IllegalPropertyValueException {
+ public void validateValue(E value) {
Reject.ifNull(value);
// No additional validation required.
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/GenericConstraint.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/GenericConstraint.java
index e2373c0..ba5f2c0 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/GenericConstraint.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/GenericConstraint.java
@@ -49,7 +49,7 @@
/**
* The client-side constraint handler.
*/
- private class ClientHandler extends ClientConstraintHandler {
+ private final class ClientHandler extends ClientConstraintHandler {
// Private constructor.
private ClientHandler() {
@@ -61,7 +61,7 @@
*/
@Override
public boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject,
- Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
+ Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
if (!condition.evaluate(context, managedObject)) {
unacceptableReasons.add(getSynopsis());
return false;
@@ -75,7 +75,7 @@
*/
@Override
public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
- Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
+ Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
if (!condition.evaluate(context, managedObject)) {
unacceptableReasons.add(getSynopsis());
return false;
@@ -89,7 +89,7 @@
/**
* The server-side constraint handler.
*/
- private class ServerHandler extends ServerConstraintHandler {
+ private final class ServerHandler extends ServerConstraintHandler {
// Private constructor.
private ServerHandler() {
@@ -100,8 +100,8 @@
* {@inheritDoc}
*/
@Override
- public boolean isUsable(ServerManagedObject<?> managedObject, Collection<LocalizableMessage> unacceptableReasons)
- throws ConfigException {
+ public boolean isUsable(ServerManagedObject<?> managedObject,
+ Collection<LocalizableMessage> unacceptableReasons) throws ConfigException {
if (!condition.evaluate(managedObject)) {
unacceptableReasons.add(getSynopsis());
return false;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IPAddressMaskPropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IPAddressMaskPropertyDefinition.java
index d6a5991..d88ef94 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IPAddressMaskPropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IPAddressMaskPropertyDefinition.java
@@ -42,7 +42,7 @@
* An interface for incrementally constructing IP address mask property
* definitions.
*/
- public static class Builder extends AbstractBuilder<AddressMask, IPAddressMaskPropertyDefinition> {
+ public static final class Builder extends AbstractBuilder<AddressMask, IPAddressMaskPropertyDefinition> {
// Private constructor
private Builder(AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
@@ -54,8 +54,8 @@
*/
@Override
protected IPAddressMaskPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d,
- String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<AddressMask> defaultBehavior) {
+ String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<AddressMask> defaultBehavior) {
return new IPAddressMaskPropertyDefinition(d, propertyName, options, adminAction, defaultBehavior);
}
@@ -77,8 +77,8 @@
// Private constructor.
private IPAddressMaskPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<AddressMask> defaultBehavior) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<AddressMask> defaultBehavior) {
super(d, AddressMask.class, propertyName, options, adminAction, defaultBehavior);
}
@@ -86,7 +86,7 @@
* {@inheritDoc}
*/
@Override
- public void validateValue(AddressMask value) throws IllegalPropertyValueException {
+ public void validateValue(AddressMask value) {
Reject.ifNull(value);
// No additional validation required.
@@ -96,7 +96,7 @@
* {@inheritDoc}
*/
@Override
- public AddressMask decodeValue(String value) throws IllegalPropertyValueStringException {
+ public AddressMask decodeValue(String value) {
Reject.ifNull(value);
try {
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IPAddressPropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IPAddressPropertyDefinition.java
index 306d157..f7f4650 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IPAddressPropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IPAddressPropertyDefinition.java
@@ -41,7 +41,7 @@
* An interface for incrementally constructing IP address property
* definitions.
*/
- public static class Builder extends AbstractBuilder<InetAddress, IPAddressPropertyDefinition> {
+ public static final class Builder extends AbstractBuilder<InetAddress, IPAddressPropertyDefinition> {
// Private constructor
private Builder(AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
@@ -53,8 +53,8 @@
*/
@Override
protected IPAddressPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d,
- String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<InetAddress> defaultBehavior) {
+ String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<InetAddress> defaultBehavior) {
return new IPAddressPropertyDefinition(d, propertyName, options, adminAction, defaultBehavior);
}
@@ -76,8 +76,8 @@
// Private constructor.
private IPAddressPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<InetAddress> defaultBehavior) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<InetAddress> defaultBehavior) {
super(d, InetAddress.class, propertyName, options, adminAction, defaultBehavior);
}
@@ -85,7 +85,7 @@
* {@inheritDoc}
*/
@Override
- public void validateValue(InetAddress value) throws IllegalPropertyValueException {
+ public void validateValue(InetAddress value) {
Reject.ifNull(value);
// No additional validation required.
@@ -95,7 +95,7 @@
* {@inheritDoc}
*/
@Override
- public InetAddress decodeValue(String value) throws IllegalPropertyValueStringException {
+ public InetAddress decodeValue(String value) {
Reject.ifNull(value);
try {
@@ -110,7 +110,7 @@
* {@inheritDoc}
*/
@Override
- public String encodeValue(InetAddress value) throws IllegalPropertyValueException {
+ public String encodeValue(InetAddress value) {
// We should return the host name if it is available, or the IP
// address if not.
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IllegalPropertyValueException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IllegalPropertyValueException.java
index d4e7403..87143f7 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IllegalPropertyValueException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IllegalPropertyValueException.java
@@ -24,7 +24,6 @@
* Copyright 2008 Sun Microsystems, Inc.
* Portions copyright 2013 ForgeRock AS.
*/
-
package org.opends.server.admin;
import static com.forgerock.opendj.ldap.AdminMessages.*;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IllegalPropertyValueStringException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IllegalPropertyValueStringException.java
index 27dda07..9d564c9 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IllegalPropertyValueStringException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IllegalPropertyValueStringException.java
@@ -24,7 +24,6 @@
* Copyright 2008 Sun Microsystems, Inc.
* Portions copyright 2013 ForgeRock AS.
*/
-
package org.opends.server.admin;
import org.forgerock.i18n.LocalizableMessage;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/InstantiableRelationDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/InstantiableRelationDefinition.java
index 970f316..779ae76 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/InstantiableRelationDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/InstantiableRelationDefinition.java
@@ -48,7 +48,7 @@
* definition refers to.
*/
public final class InstantiableRelationDefinition<C extends ConfigurationClient, S extends Configuration> extends
- RelationDefinition<C, S> {
+ RelationDefinition<C, S> {
/**
* An interface for incrementally constructing instantiable relation
@@ -62,7 +62,7 @@
* relation definition refers to.
*/
public static final class Builder<C extends ConfigurationClient, S extends Configuration> extends
- AbstractBuilder<C, S, InstantiableRelationDefinition<C, S>> {
+ AbstractBuilder<C, S, InstantiableRelationDefinition<C, S>> {
// The optional naming property definition.
private PropertyDefinition<?> namingPropertyDefinition = null;
@@ -72,7 +72,8 @@
// The optional default managed objects associated with this
// instantiable relation definition.
- private final Map<String, DefaultManagedObject<? extends C, ? extends S>> defaultManagedObjects = new HashMap<String, DefaultManagedObject<? extends C, ? extends S>>();
+ private final Map<String, DefaultManagedObject<? extends C, ? extends S>> defaultManagedObjects =
+ new HashMap<String, DefaultManagedObject<? extends C, ? extends S>>();
/**
* Creates a new builder which can be used to incrementally build an
@@ -88,7 +89,7 @@
* The child managed object definition.
*/
public Builder(AbstractManagedObjectDefinition<?, ?> pd, String name, String pluralName,
- AbstractManagedObjectDefinition<C, S> cd) {
+ AbstractManagedObjectDefinition<C, S> cd) {
super(pd, name, cd);
this.pluralName = pluralName;
}
@@ -103,7 +104,7 @@
* The default managed object.
*/
public void setDefaultManagedObject(String name,
- DefaultManagedObject<? extends C, ? extends S> defaultManagedObject) {
+ DefaultManagedObject<? extends C, ? extends S> defaultManagedObject) {
this.defaultManagedObjects.put(name, defaultManagedObject);
}
@@ -126,7 +127,7 @@
@Override
protected InstantiableRelationDefinition<C, S> buildInstance(Common<C, S> common) {
return new InstantiableRelationDefinition<C, S>(common, pluralName, namingPropertyDefinition,
- defaultManagedObjects);
+ defaultManagedObjects);
}
}
@@ -143,8 +144,8 @@
// Private constructor.
private InstantiableRelationDefinition(Common<C, S> common, String pluralName,
- PropertyDefinition<?> namingPropertyDefinition,
- Map<String, DefaultManagedObject<? extends C, ? extends S>> defaultManagedObjects) {
+ PropertyDefinition<?> namingPropertyDefinition,
+ Map<String, DefaultManagedObject<? extends C, ? extends S>> defaultManagedObjects) {
super(common);
this.pluralName = pluralName;
this.namingPropertyDefinition = namingPropertyDefinition;
@@ -170,8 +171,7 @@
* If there is no default managed object associated with the
* provided name.
*/
- public DefaultManagedObject<? extends C, ? extends S> getDefaultManagedObject(String name)
- throws IllegalArgumentException {
+ public DefaultManagedObject<? extends C, ? extends S> getDefaultManagedObject(String name) {
if (!defaultManagedObjects.containsKey(name)) {
throw new IllegalArgumentException("unrecognized default managed object \"" + name + "\"");
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IntegerPropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IntegerPropertyDefinition.java
index 13942a6..3dfb37f 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IntegerPropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/IntegerPropertyDefinition.java
@@ -59,7 +59,7 @@
/**
* An interface for incrementally constructing integer property definitions.
*/
- public static class Builder extends AbstractBuilder<Integer, IntegerPropertyDefinition> {
+ public static final class Builder extends AbstractBuilder<Integer, IntegerPropertyDefinition> {
// The lower limit of the property value.
private int lowerLimit = 0;
@@ -86,7 +86,7 @@
* If a negative lower limit was specified or the lower
* limit is greater than the upper limit.
*/
- public final void setLowerLimit(int lowerLimit) throws IllegalArgumentException {
+ public final void setLowerLimit(int lowerLimit) {
if (lowerLimit < 0) {
throw new IllegalArgumentException("Negative lower limit");
}
@@ -131,11 +131,11 @@
* {@inheritDoc}
*/
@Override
- protected IntegerPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<Integer> defaultBehavior) {
+ protected IntegerPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d,
+ String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<Integer> defaultBehavior) {
return new IntegerPropertyDefinition(d, propertyName, options, adminAction, defaultBehavior, lowerLimit,
- upperLimit, allowUnlimited);
+ upperLimit, allowUnlimited);
}
}
@@ -156,8 +156,8 @@
// Private constructor.
private IntegerPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<Integer> defaultBehavior, int lowerLimit, Integer upperLimit, boolean allowUnlimited) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<Integer> defaultBehavior, int lowerLimit, Integer upperLimit, boolean allowUnlimited) {
super(d, Integer.class, propertyName, options, adminAction, defaultBehavior);
this.lowerLimit = lowerLimit;
this.upperLimit = upperLimit;
@@ -229,7 +229,7 @@
* {@inheritDoc}
*/
@Override
- public void validateValue(Integer value) throws IllegalPropertyValueException {
+ public void validateValue(Integer value) {
Reject.ifNull(value);
if (!allowUnlimited && value < lowerLimit) {
@@ -249,7 +249,7 @@
* {@inheritDoc}
*/
@Override
- public String encodeValue(Integer value) throws IllegalPropertyValueException {
+ public String encodeValue(Integer value) {
Reject.ifNull(value);
// Make sure that we correctly encode negative values as "unlimited".
@@ -266,7 +266,7 @@
* {@inheritDoc}
*/
@Override
- public Integer decodeValue(String value) throws IllegalPropertyValueStringException {
+ public Integer decodeValue(String value) {
Reject.ifNull(value);
if (allowUnlimited) {
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/LDAPProfile.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/LDAPProfile.java
index b266f0a..16dd326 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/LDAPProfile.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/LDAPProfile.java
@@ -184,8 +184,7 @@
* If the LDAP profile properties file associated with the
* provided managed object definition could not be loaded.
*/
- public String getAttributeName(AbstractManagedObjectDefinition<?, ?> d, PropertyDefinition<?> pd)
- throws MissingResourceException {
+ public String getAttributeName(AbstractManagedObjectDefinition<?, ?> d, PropertyDefinition<?> pd) {
for (Wrapper profile : profiles) {
String attributeName = profile.getAttributeName(d, pd);
if (attributeName != null) {
@@ -207,7 +206,7 @@
* If the LDAP profile properties file associated with the
* provided managed object definition could not be loaded.
*/
- public String getRelationChildRDNType(InstantiableRelationDefinition<?, ?> r) throws MissingResourceException {
+ public String getRelationChildRDNType(InstantiableRelationDefinition<?, ?> r) {
if (r.getNamingPropertyDefinition() != null) {
// Use the attribute associated with the naming property.
return getAttributeName(r.getChildDefinition(), r.getNamingPropertyDefinition());
@@ -246,7 +245,7 @@
* If the LDAP profile properties file associated with the
* provided managed object definition could not be loaded.
*/
- public String getRelationChildRDNType(SetRelationDefinition<?, ?> r) throws MissingResourceException {
+ public String getRelationChildRDNType(SetRelationDefinition<?, ?> r) {
for (Wrapper profile : profiles) {
String rdnType = profile.getRelationChildRDNType(r);
if (rdnType != null) {
@@ -267,7 +266,7 @@
* If the LDAP profile properties file associated with the
* provided managed object definition could not be loaded.
*/
- public String getObjectClass(AbstractManagedObjectDefinition<?, ?> d) throws MissingResourceException {
+ public String getObjectClass(AbstractManagedObjectDefinition<?, ?> d) {
if (d.isTop()) {
return "top";
}
@@ -295,7 +294,7 @@
* If the LDAP profile properties file associated with the
* provided managed object definition could not be loaded.
*/
- public List<String> getObjectClasses(AbstractManagedObjectDefinition<?, ?> d) throws MissingResourceException {
+ public List<String> getObjectClasses(AbstractManagedObjectDefinition<?, ?> d) {
LinkedList<String> objectClasses = new LinkedList<String>();
Set<String> s = new HashSet<String>();
@@ -326,7 +325,7 @@
* If the LDAP profile properties file associated with the
* provided managed object definition could not be loaded.
*/
- public String getRelationRDNSequence(RelationDefinition<?, ?> r) throws MissingResourceException {
+ public String getRelationRDNSequence(RelationDefinition<?, ?> r) {
for (Wrapper profile : profiles) {
String rdnSequence = profile.getRelationRDNSequence(r);
if (rdnSequence != null) {
@@ -343,7 +342,7 @@
* @throws NoSuchElementException
* If there are no LDAP profile wrappers.
*/
- public void popWrapper() throws NoSuchElementException {
+ public void popWrapper() {
profiles.removeFirst();
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectAlreadyExistsException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectAlreadyExistsException.java
index 21d52b2..3f34310 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectAlreadyExistsException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectAlreadyExistsException.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
import static com.forgerock.opendj.ldap.AdminMessages.*;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinition.java
index c241f05..bc33ef7 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinition.java
@@ -23,82 +23,66 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
-
-
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.server.ServerManagedObject;
-
-
/**
- * Defines the structure of a managed object which can be
- * instantiated.
+ * Defines the structure of a managed object which can be instantiated.
*
* @param <C>
- * The type of client managed object configuration that this
- * definition represents.
+ * The type of client managed object configuration that this
+ * definition represents.
* @param <S>
- * The type of server managed object configuration that this
- * definition represents.
+ * The type of server managed object configuration that this
+ * definition represents.
*/
-public abstract class ManagedObjectDefinition
- <C extends ConfigurationClient, S extends Configuration>
- extends AbstractManagedObjectDefinition<C, S> {
+public abstract class ManagedObjectDefinition<C extends ConfigurationClient, S extends Configuration> extends
+ AbstractManagedObjectDefinition<C, S> {
- /**
- * Create a new managed object definition.
- *
- * @param name
- * The name of the definition.
- * @param parent
- * The parent definition, or <code>null</code> if there
- * is no parent.
- */
- protected ManagedObjectDefinition(String name,
- AbstractManagedObjectDefinition<? super C, ? super S> parent) {
- super(name, parent);
- }
+ /**
+ * Create a new managed object definition.
+ *
+ * @param name
+ * The name of the definition.
+ * @param parent
+ * The parent definition, or <code>null</code> if there is no
+ * parent.
+ */
+ protected ManagedObjectDefinition(String name, AbstractManagedObjectDefinition<? super C, ? super S> parent) {
+ super(name, parent);
+ }
+ /**
+ * Creates a client configuration view of the provided managed object.
+ * Modifications made to the underlying managed object will be reflected in
+ * the client configuration view and vice versa.
+ *
+ * @param managedObject
+ * The managed object.
+ * @return Returns a client configuration view of the provided managed
+ * object.
+ */
+ public abstract C createClientConfiguration(ManagedObject<? extends C> managedObject);
+ /**
+ * Creates a server configuration view of the provided server managed
+ * object.
+ *
+ * @param managedObject
+ * The server managed object.
+ * @return Returns a server configuration view of the provided server
+ * managed object.
+ */
+ public abstract S createServerConfiguration(ServerManagedObject<? extends S> managedObject);
- /**
- * Creates a client configuration view of the provided managed
- * object. Modifications made to the underlying managed object will
- * be reflected in the client configuration view and vice versa.
- *
- * @param managedObject
- * The managed object.
- * @return Returns a client configuration view of the provided
- * managed object.
- */
- public abstract C createClientConfiguration(
- ManagedObject<? extends C> managedObject);
-
-
-
- /**
- * Creates a server configuration view of the provided server
- * managed object.
- *
- * @param managedObject
- * The server managed object.
- * @return Returns a server configuration view of the provided
- * server managed object.
- */
- public abstract S createServerConfiguration(
- ServerManagedObject<? extends S> managedObject);
-
-
-
- /**
- * Gets the server configuration class instance associated with this
- * managed object definition.
- *
- * @return Returns the server configuration class instance
- * associated with this managed object definition.
- */
- public abstract Class<S> getServerConfigurationClass();
+ /**
+ * Gets the server configuration class instance associated with this managed
+ * object definition.
+ *
+ * @return Returns the server configuration class instance associated with
+ * this managed object definition.
+ */
+ public abstract Class<S> getServerConfigurationClass();
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java
index c722ce0..8c64aed 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java
@@ -43,7 +43,7 @@
// Application-wide set of instances.
private static final Map<String, ManagedObjectDefinitionI18NResource> INSTANCES =
- new HashMap<String, ManagedObjectDefinitionI18NResource>();
+ new HashMap<String, ManagedObjectDefinitionI18NResource>();
/**
* Gets the internationalized resource instance which can be used to
@@ -107,8 +107,7 @@
* If the provided managed object definition was the
* {@link TopCfgDefn}.
*/
- public LocalizableMessage getMessage(AbstractManagedObjectDefinition<?, ?> d, String key)
- throws MissingResourceException, UnsupportedOperationException {
+ public LocalizableMessage getMessage(AbstractManagedObjectDefinition<?, ?> d, String key) {
return getMessage(d, key, Locale.getDefault(), (String[]) null);
}
@@ -130,8 +129,7 @@
* If the provided managed object definition was the
* {@link TopCfgDefn}.
*/
- public LocalizableMessage getMessage(AbstractManagedObjectDefinition<?, ?> d, String key, Locale locale)
- throws MissingResourceException, UnsupportedOperationException {
+ public LocalizableMessage getMessage(AbstractManagedObjectDefinition<?, ?> d, String key, Locale locale) {
return getMessage(d, key, locale, (String[]) null);
}
@@ -156,7 +154,7 @@
* {@link TopCfgDefn}.
*/
public LocalizableMessage getMessage(AbstractManagedObjectDefinition<?, ?> d, String key, Locale locale,
- String... args) throws MissingResourceException, UnsupportedOperationException {
+ String... args) {
ResourceBundle resource = getResourceBundle(d, locale);
// TODO: use message framework directly
@@ -185,8 +183,7 @@
* If the provided managed object definition was the
* {@link TopCfgDefn}.
*/
- public LocalizableMessage getMessage(AbstractManagedObjectDefinition<?, ?> d, String key, String... args)
- throws MissingResourceException, UnsupportedOperationException {
+ public LocalizableMessage getMessage(AbstractManagedObjectDefinition<?, ?> d, String key, String... args) {
return getMessage(d, key, Locale.getDefault(), args);
}
@@ -250,7 +247,7 @@
* The resource bundle to be used.
*/
synchronized void setResourceBundle(AbstractManagedObjectDefinition<?, ?> d, Locale locale,
- ResourceBundle resoureBundle) {
+ ResourceBundle resoureBundle) {
// First get the locale-resource mapping, creating it if
// necessary.
Map<Locale, ResourceBundle> map = resources.get(d);
@@ -265,11 +262,10 @@
// Retrieve the resource bundle associated with a managed object and
// locale, lazily loading it if necessary.
- private synchronized ResourceBundle getResourceBundle(AbstractManagedObjectDefinition<?, ?> d, Locale locale)
- throws MissingResourceException, UnsupportedOperationException {
+ private synchronized ResourceBundle getResourceBundle(AbstractManagedObjectDefinition<?, ?> d, Locale locale) {
if (d.isTop()) {
throw new UnsupportedOperationException("I18n resources are not available for the "
- + "Top configuration definition");
+ + "Top configuration definition");
}
// First get the locale-resource mapping, creating it if
@@ -285,8 +281,8 @@
ResourceBundle resourceBundle = map.get(locale);
if (resourceBundle == null) {
String baseName = prefix + "." + d.getClass().getName();
- resourceBundle = ResourceBundle.getBundle(baseName, locale, ClassLoaderProvider.getInstance()
- .getClassLoader());
+ resourceBundle =
+ ResourceBundle.getBundle(baseName, locale, ClassLoaderProvider.getInstance().getClassLoader());
map.put(locale, resourceBundle);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinitionResource.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinitionResource.java
index b38b26d..92ddb05 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinitionResource.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectDefinitionResource.java
@@ -26,8 +26,6 @@
package org.opends.server.admin;
-
-
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -36,120 +34,97 @@
import java.util.MissingResourceException;
import java.util.Properties;
-
-
/**
- * A class for retrieving non-internationalized resource properties
- * associated with a managed object definition.
+ * A class for retrieving non-internationalized resource properties associated
+ * with a managed object definition.
* <p>
* Resource properties are not available for the {@link TopCfgDefn}.
*/
public final class ManagedObjectDefinitionResource {
- // Mapping from definition to property tables.
- private final Map<AbstractManagedObjectDefinition<?, ?>,
- Properties> properties;
+ // Mapping from definition to property tables.
+ private final Map<AbstractManagedObjectDefinition<?, ?>, Properties> properties;
- // The resource name prefix.
- private final String prefix;
+ // The resource name prefix.
+ private final String prefix;
-
-
- /**
- * Creates a new resource instance for the named profile.
- *
- * @param profile
- * The name of the profile.
- * @return Returns the resource instance for the named profile.
- */
- public static ManagedObjectDefinitionResource createForProfile(
- String profile) {
- return new ManagedObjectDefinitionResource("admin.profiles."
- + profile);
- }
-
-
-
- // Private constructor.
- private ManagedObjectDefinitionResource(String prefix) {
- this.properties =
- new HashMap<AbstractManagedObjectDefinition<?, ?>, Properties>();
- this.prefix = prefix;
- }
-
-
-
- /**
- * Get the resource value associated with the specified key.
- *
- * @param d
- * The managed object definition.
- * @param key
- * The resource key.
- * @return Returns the resource value associated with the specified
- * key.
- * @throws MissingResourceException
- * If the key was not found.
- * @throws UnsupportedOperationException
- * If the provided managed object definition was the
- * {@link TopCfgDefn}.
- */
- public String getString(AbstractManagedObjectDefinition<?, ?> d, String key)
- throws MissingResourceException, UnsupportedOperationException {
- if (d.isTop()) {
- throw new UnsupportedOperationException(
- "Profile resources are not available for the "
- + "Top configuration definition");
+ /**
+ * Creates a new resource instance for the named profile.
+ *
+ * @param profile
+ * The name of the profile.
+ * @return Returns the resource instance for the named profile.
+ */
+ public static ManagedObjectDefinitionResource createForProfile(String profile) {
+ return new ManagedObjectDefinitionResource("admin.profiles." + profile);
}
- Properties p = getProperties(d);
- String result = p.getProperty(key);
-
- if (result == null) {
- String baseName = prefix + "." + d.getClass().getName();
- String path = baseName.replace('.', '/') + ".properties";
-
- throw new MissingResourceException("Can't find resource "
- + path + ", key " + key, baseName, key);
+ // Private constructor.
+ private ManagedObjectDefinitionResource(String prefix) {
+ this.properties = new HashMap<AbstractManagedObjectDefinition<?, ?>, Properties>();
+ this.prefix = prefix;
}
- return result;
- }
+ /**
+ * Get the resource value associated with the specified key.
+ *
+ * @param d
+ * The managed object definition.
+ * @param key
+ * The resource key.
+ * @return Returns the resource value associated with the specified key.
+ * @throws MissingResourceException
+ * If the key was not found.
+ * @throws UnsupportedOperationException
+ * If the provided managed object definition was the
+ * {@link TopCfgDefn}.
+ */
+ public String getString(AbstractManagedObjectDefinition<?, ?> d, String key) {
+ if (d.isTop()) {
+ throw new UnsupportedOperationException("Profile resources are not available for the "
+ + "Top configuration definition");
+ }
+ Properties p = getProperties(d);
+ String result = p.getProperty(key);
+ if (result == null) {
+ String baseName = prefix + "." + d.getClass().getName();
+ String path = baseName.replace('.', '/') + ".properties";
- // Retrieve the properties table associated with a managed object,
- // lazily loading it if necessary.
- private synchronized Properties getProperties(
- AbstractManagedObjectDefinition<?, ?> d)
- throws MissingResourceException {
- Properties p = properties.get(d);
+ throw new MissingResourceException("Can't find resource " + path + ", key " + key, baseName, key);
+ }
- if (p == null) {
- // Load the resource file.
- String baseName = prefix + "." + d.getClass().getName();
- String path = baseName.replace('.', '/') + ".properties";
- InputStream stream = ClassLoaderProvider.getInstance()
- .getClassLoader().getResourceAsStream(path);
-
- if (stream == null) {
- throw new MissingResourceException("Can't find resource "
- + path, baseName, "");
- }
-
- p = new Properties();
- try {
- p.load(new BufferedInputStream(stream));
- } catch (IOException e) {
- throw new MissingResourceException("Can't load resource "
- + path + " due to IO exception: " + e.getMessage(),
- baseName, "");
- }
-
- // Cache the resource.
- properties.put(d, p);
+ return result;
}
- return p;
- }
+ // Retrieve the properties table associated with a managed object,
+ // lazily loading it if necessary.
+ private synchronized Properties getProperties(AbstractManagedObjectDefinition<?, ?> d) {
+ Properties p = properties.get(d);
+
+ if (p == null) {
+ // Load the resource file.
+ String baseName = prefix + "." + d.getClass().getName();
+ String path = baseName.replace('.', '/') + ".properties";
+ InputStream stream = ClassLoaderProvider.getInstance().getClassLoader().getResourceAsStream(path);
+
+ if (stream == null) {
+ throw new MissingResourceException("Can't find resource " + path, baseName, "");
+ }
+
+ p = new Properties();
+ try {
+ p.load(new BufferedInputStream(stream));
+ } catch (IOException e) {
+ throw new MissingResourceException("Can't load resource " + path + " due to IO exception: "
+ + e.getMessage(), baseName, "");
+ }
+
+ // Cache the resource.
+ properties.put(d, p);
+ }
+
+ return p;
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectNotFoundException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectNotFoundException.java
index a2829e6..79ff0a5 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectNotFoundException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectNotFoundException.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
import static com.forgerock.opendj.ldap.AdminMessages.*;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectOption.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectOption.java
index c2242e9..3206eca 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectOption.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectOption.java
@@ -26,23 +26,21 @@
package org.opends.server.admin;
-
-
/**
- * This enumeration contains various options that can be associated
- * with managed object definitions.
+ * This enumeration contains various options that can be associated with managed
+ * object definitions.
*/
public enum ManagedObjectOption {
- /**
- * Use this option to identify managed object types which should be
- * considered as advanced and should not be exposed by default in
- * client applications.
- */
- ADVANCED,
+ /**
+ * Use this option to identify managed object types which should be
+ * considered as advanced and should not be exposed by default in client
+ * applications.
+ */
+ ADVANCED,
- /**
- * Use this option to identify managed object types which must not
- * be directly exposed in client applications.
- */
- HIDDEN;
+ /**
+ * Use this option to identify managed object types which must not be
+ * directly exposed in client applications.
+ */
+ HIDDEN;
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectPath.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectPath.java
index e15be58..4dae1ab 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectPath.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectPath.java
@@ -133,8 +133,8 @@
* {@inheritDoc}
*/
public <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
- InstantiableRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d,
- String name) {
+ InstantiableRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d,
+ String name) {
// Add the RDN sequence representing the relation.
appendManagedObjectPathElement(r);
@@ -148,7 +148,7 @@
* {@inheritDoc}
*/
public <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
- SetRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
+ SetRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
// Add the RDN sequence representing the relation.
appendManagedObjectPathElement(r);
@@ -162,7 +162,7 @@
* {@inheritDoc}
*/
public <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
- OptionalRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
+ OptionalRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
// Add the RDN sequence representing the relation.
appendManagedObjectPathElement(r);
}
@@ -171,7 +171,7 @@
* {@inheritDoc}
*/
public <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
- SingletonRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
+ SingletonRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
// Add the RDN sequence representing the relation.
appendManagedObjectPathElement(r);
}
@@ -246,12 +246,12 @@
* A path element representing an instantiable managed object.
*/
private static final class InstantiableElement<C extends ConfigurationClient, S extends Configuration> extends
- Element<C, S> {
+ Element<C, S> {
// Factory method.
private static final <C extends ConfigurationClient, S extends Configuration> InstantiableElement<C, S> create(
- InstantiableRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d,
- String name) {
+ InstantiableRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d,
+ String name) {
return new InstantiableElement<C, S>(r, d, name);
}
@@ -263,7 +263,7 @@
// Private constructor.
private InstantiableElement(InstantiableRelationDefinition<? super C, ? super S> r,
- AbstractManagedObjectDefinition<C, S> d, String name) {
+ AbstractManagedObjectDefinition<C, S> d, String name) {
super(d);
this.r = r;
this.name = name;
@@ -298,11 +298,11 @@
* A path element representing an optional managed object.
*/
private static final class OptionalElement<C extends ConfigurationClient, S extends Configuration> extends
- Element<C, S> {
+ Element<C, S> {
// Factory method.
private static final <C extends ConfigurationClient, S extends Configuration> OptionalElement<C, S> create(
- OptionalRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
+ OptionalRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
return new OptionalElement<C, S>(r, d);
}
@@ -311,7 +311,7 @@
// Private constructor.
private OptionalElement(OptionalRelationDefinition<? super C, ? super S> r,
- AbstractManagedObjectDefinition<C, S> d) {
+ AbstractManagedObjectDefinition<C, S> d) {
super(d);
this.r = r;
}
@@ -336,11 +336,12 @@
/**
* A path element representing an set managed object.
*/
- private static final class SetElement<C extends ConfigurationClient, S extends Configuration> extends Element<C, S> {
+ private static final class SetElement<C extends ConfigurationClient, S extends Configuration> extends
+ Element<C, S> {
// Factory method.
private static final <C extends ConfigurationClient, S extends Configuration> SetElement<C, S> create(
- SetRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
+ SetRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
return new SetElement<C, S>(r, d);
}
@@ -374,11 +375,11 @@
* A path element representing a singleton managed object.
*/
private static final class SingletonElement<C extends ConfigurationClient, S extends Configuration> extends
- Element<C, S> {
+ Element<C, S> {
// Factory method.
private static final <C extends ConfigurationClient, S extends Configuration> SingletonElement<C, S> create(
- SingletonRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
+ SingletonRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
return new SingletonElement<C, S>(r, d);
}
@@ -387,7 +388,7 @@
// Private constructor.
private SingletonElement(SingletonRelationDefinition<? super C, ? super S> r,
- AbstractManagedObjectDefinition<C, S> d) {
+ AbstractManagedObjectDefinition<C, S> d) {
super(d);
this.r = r;
}
@@ -426,8 +427,8 @@
* {@inheritDoc}
*/
public <M extends ConfigurationClient, N extends Configuration> void appendManagedObjectPathElement(
- InstantiableRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d,
- String name) {
+ InstantiableRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d,
+ String name) {
serializeElement(r, d);
// Be careful to escape any forward slashes in the name.
@@ -439,7 +440,7 @@
* {@inheritDoc}
*/
public <M extends ConfigurationClient, N extends Configuration> void appendManagedObjectPathElement(
- OptionalRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d) {
+ OptionalRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d) {
serializeElement(r, d);
}
@@ -447,7 +448,7 @@
* {@inheritDoc}
*/
public <M extends ConfigurationClient, N extends Configuration> void appendManagedObjectPathElement(
- SingletonRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d) {
+ SingletonRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d) {
serializeElement(r, d);
}
@@ -455,7 +456,7 @@
* {@inheritDoc}
*/
public <M extends ConfigurationClient, N extends Configuration> void appendManagedObjectPathElement(
- SetRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d) {
+ SetRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d) {
serializeElement(r, d);
}
@@ -475,12 +476,13 @@
}
// Single instance of a root path.
- private static final ManagedObjectPath<RootCfgClient, RootCfg> EMPTY_PATH = new ManagedObjectPath<RootCfgClient, RootCfg>(
- new LinkedList<Element<?, ?>>(), null, RootCfgDefn.getInstance());
+ private static final ManagedObjectPath<RootCfgClient, RootCfg> EMPTY_PATH =
+ new ManagedObjectPath<RootCfgClient, RootCfg>(new LinkedList<Element<?, ?>>(), null,
+ RootCfgDefn.getInstance());
// A regular expression used to parse path elements.
private static final Pattern PE_REGEXP = Pattern.compile("^\\s*relation=\\s*([^+]+)\\s*"
- + "(\\+\\s*type=\\s*([^+]+)\\s*)?" + "(\\+\\s*name=\\s*([^+]+)\\s*)?$");
+ + "(\\+\\s*type=\\s*([^+]+)\\s*)?" + "(\\+\\s*name=\\s*([^+]+)\\s*)?$");
/**
* Creates a new managed object path representing the configuration root.
@@ -502,7 +504,7 @@
* @throws IllegalArgumentException
* If the string could not be parsed.
*/
- public static ManagedObjectPath<?, ?> valueOf(String s) throws IllegalArgumentException {
+ public static ManagedObjectPath<?, ?> valueOf(String s) {
String ns = s.trim();
// Check for root special case.
@@ -528,7 +530,7 @@
if (c == '/') {
if (end == (ns.length() - 1)) {
throw new IllegalArgumentException("Invalid path \"" + ns
- + "\": must not end with a trailing \"/\"");
+ + "\": must not end with a trailing \"/\"");
}
if (ns.charAt(end + 1) == '/') {
@@ -564,7 +566,7 @@
r = definition.getRelationDefinition(relation);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid path element \"" + es + "\" in path \"" + ns
- + "\": unknown relation \"" + relation + "\"");
+ + "\": unknown relation \"" + relation + "\"");
}
// Append the next element.
@@ -589,20 +591,21 @@
// Factory method required in order to allow generic wild-card
// construction of new paths.
private static <C extends ConfigurationClient, S extends Configuration> ManagedObjectPath<C, S> create(
- LinkedList<Element<?, ?>> elements, Element<C, S> lastElement) {
+ LinkedList<Element<?, ?>> elements, Element<C, S> lastElement) {
return new ManagedObjectPath<C, S>(elements, lastElement.getRelationDefinition(),
- lastElement.getManagedObjectDefinition());
+ lastElement.getManagedObjectDefinition());
}
// Decode an element.
+ // @Checkstyle:ignore
private static <C extends ConfigurationClient, S extends Configuration> Element<? extends C, ? extends S> createElement(
- RelationDefinition<C, S> r, String path, String element, String type, String name) {
+ RelationDefinition<C, S> r, String path, String element, String type, String name) {
// First determine the managed object definition.
AbstractManagedObjectDefinition<? extends C, ? extends S> d = null;
if (type != null) {
for (AbstractManagedObjectDefinition<? extends C, ? extends S> child : r.getChildDefinition()
- .getAllChildren()) {
+ .getAllChildren()) {
if (child.getName().equals(type)) {
d = child;
break;
@@ -611,7 +614,7 @@
if (d == null) {
throw new IllegalArgumentException("Invalid path element \"" + element + "\" in path \"" + path
- + "\": unknown sub-type \"" + type + "\"");
+ + "\": unknown sub-type \"" + type + "\"");
}
} else {
d = r.getChildDefinition();
@@ -622,7 +625,7 @@
if (name == null) {
throw new IllegalArgumentException("Invalid path element \"" + element + "\" in path \"" + path
- + "\": no instance name for instantiable relation");
+ + "\": no instance name for instantiable relation");
}
return InstantiableElement.create(ir, d, name);
@@ -631,7 +634,7 @@
if (name != null) {
throw new IllegalArgumentException("Invalid path element \"" + element + "\" in path \"" + path
- + "\": instance name specified for set relation");
+ + "\": instance name specified for set relation");
}
return SetElement.create(ir, d);
@@ -640,7 +643,7 @@
if (name != null) {
throw new IllegalArgumentException("Invalid path element \"" + element + "\" in path \"" + path
- + "\": instance name specified for optional relation");
+ + "\": instance name specified for optional relation");
}
return OptionalElement.create(or, d);
@@ -649,13 +652,13 @@
if (name != null) {
throw new IllegalArgumentException("Invalid path element \"" + element + "\" in path \"" + path
- + "\": instance name specified for singleton relation");
+ + "\": instance name specified for singleton relation");
}
return SingletonElement.create(sr, d);
} else {
throw new IllegalArgumentException("Invalid path element \"" + element + "\" in path \"" + path
- + "\": unsupported relation type");
+ + "\": unsupported relation type");
}
}
@@ -670,7 +673,7 @@
// Private constructor.
private ManagedObjectPath(LinkedList<Element<?, ?>> elements, RelationDefinition<? super C, ? super S> r,
- AbstractManagedObjectDefinition<C, S> d) {
+ AbstractManagedObjectDefinition<C, S> d) {
this.elements = Collections.unmodifiableList(elements);
this.r = r;
this.d = d;
@@ -681,10 +684,10 @@
* path except that the final path element is associated with the specified
* managed object definition.
*
- * @param <CC>
+ * @param <C1>
* The type of client managed object configuration that this path
* will reference.
- * @param <SS>
+ * @param <S1>
* The type of server managed object configuration that this path
* will reference.
* @param nd
@@ -693,10 +696,11 @@
* this path except that the final path element is associated with
* the specified managed object definition.
*/
- @SuppressWarnings("unchecked")
- public <CC extends C, SS extends S> ManagedObjectPath<CC, SS> asSubType(AbstractManagedObjectDefinition<CC, SS> nd) {
+ // @Checkstyle:ignore
+ public <C1 extends C, S1 extends S> ManagedObjectPath<C1, S1> asSubType(AbstractManagedObjectDefinition<C1, S1> nd) {
if (r instanceof InstantiableRelationDefinition) {
- InstantiableRelationDefinition<? super C, ? super S> ir = (InstantiableRelationDefinition<? super C, ? super S>) r;
+ InstantiableRelationDefinition<? super C, ? super S> ir =
+ (InstantiableRelationDefinition<? super C, ? super S>) r;
if (elements.size() == 0) {
return parent().child(ir, nd, "null");
} else {
@@ -706,10 +710,12 @@
SetRelationDefinition<? super C, ? super S> sr = (SetRelationDefinition<? super C, ? super S>) r;
return parent().child(sr, nd);
} else if (r instanceof OptionalRelationDefinition) {
- OptionalRelationDefinition<? super C, ? super S> or = (OptionalRelationDefinition<? super C, ? super S>) r;
+ OptionalRelationDefinition<? super C, ? super S> or =
+ (OptionalRelationDefinition<? super C, ? super S>) r;
return parent().child(or, nd);
} else {
- SingletonRelationDefinition<? super C, ? super S> sr = (SingletonRelationDefinition<? super C, ? super S>) r;
+ SingletonRelationDefinition<? super C, ? super S> sr =
+ (SingletonRelationDefinition<? super C, ? super S>) r;
return parent().child(sr, nd);
}
}
@@ -737,8 +743,7 @@
* If the provided name is empty or blank.
*/
public <M extends ConfigurationClient, N extends Configuration> ManagedObjectPath<M, N> child(
- InstantiableRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d, String name)
- throws IllegalArgumentException {
+ InstantiableRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d, String name) {
if (name.trim().length() == 0) {
throw new IllegalArgumentException("Empty or blank managed object names are not allowed");
}
@@ -767,7 +772,7 @@
* If the provided name is empty or blank.
*/
public <M extends ConfigurationClient, N extends Configuration> ManagedObjectPath<M, N> child(
- InstantiableRelationDefinition<M, N> r, String name) throws IllegalArgumentException {
+ InstantiableRelationDefinition<M, N> r, String name) {
return child(r, r.getChildDefinition(), name);
}
@@ -790,7 +795,7 @@
* parent path.
*/
public <M extends ConfigurationClient, N extends Configuration> ManagedObjectPath<M, N> child(
- OptionalRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d) {
+ OptionalRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d) {
LinkedList<Element<?, ?>> celements = new LinkedList<Element<?, ?>>(elements);
celements.add(new OptionalElement<M, N>(r, d));
return new ManagedObjectPath<M, N>(celements, r, d);
@@ -812,7 +817,7 @@
* parent path.
*/
public <M extends ConfigurationClient, N extends Configuration> ManagedObjectPath<M, N> child(
- OptionalRelationDefinition<M, N> r) {
+ OptionalRelationDefinition<M, N> r) {
return child(r, r.getChildDefinition());
}
@@ -835,7 +840,7 @@
* parent path.
*/
public <M extends ConfigurationClient, N extends Configuration> ManagedObjectPath<M, N> child(
- SingletonRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d) {
+ SingletonRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d) {
LinkedList<Element<?, ?>> celements = new LinkedList<Element<?, ?>>(elements);
celements.add(new SingletonElement<M, N>(r, d));
return new ManagedObjectPath<M, N>(celements, r, d);
@@ -857,7 +862,7 @@
* parent path.
*/
public <M extends ConfigurationClient, N extends Configuration> ManagedObjectPath<M, N> child(
- SingletonRelationDefinition<M, N> r) {
+ SingletonRelationDefinition<M, N> r) {
return child(r, r.getChildDefinition());
}
@@ -882,8 +887,7 @@
* If the provided name is empty or blank.
*/
public <M extends ConfigurationClient, N extends Configuration> ManagedObjectPath<M, N> child(
- SetRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d)
- throws IllegalArgumentException {
+ SetRelationDefinition<? super M, ? super N> r, AbstractManagedObjectDefinition<M, N> d) {
LinkedList<Element<?, ?>> celements = new LinkedList<Element<?, ?>>(elements);
celements.add(new SetElement<M, N>(r, d));
return new ManagedObjectPath<M, N>(celements, r, d);
@@ -912,7 +916,7 @@
* child definition.
*/
public <M extends ConfigurationClient, N extends Configuration> ManagedObjectPath<? extends M, ? extends N> child(
- SetRelationDefinition<M, N> r, String name) throws IllegalArgumentException {
+ SetRelationDefinition<M, N> r, String name) {
AbstractManagedObjectDefinition<M, N> d = r.getChildDefinition();
return child(r, d.getChild(name));
}
@@ -935,7 +939,7 @@
* If the provided name is empty or blank.
*/
public <M extends ConfigurationClient, N extends Configuration> ManagedObjectPath<M, N> child(
- SetRelationDefinition<M, N> r) throws IllegalArgumentException {
+ SetRelationDefinition<M, N> r) {
return child(r, r.getChildDefinition());
}
@@ -1044,7 +1048,7 @@
* If this path does not have a parent (i.e. it is the empty
* path).
*/
- public ManagedObjectPath<?, ?> parent() throws IllegalArgumentException {
+ public ManagedObjectPath<?, ?> parent() {
return parent(1);
}
@@ -1061,7 +1065,7 @@
* If the offset is less than 0, or greater than the number of
* path elements in this path.
*/
- public ManagedObjectPath<?, ?> parent(int offset) throws IllegalArgumentException {
+ public ManagedObjectPath<?, ?> parent(int offset) {
if (offset < 0) {
throw new IllegalArgumentException("Negative offset");
}
@@ -1080,8 +1084,8 @@
return emptyPath();
}
- LinkedList<Element<?, ?>> celements = new LinkedList<Element<?, ?>>(elements.subList(0, elements.size()
- - offset));
+ LinkedList<Element<?, ?>> celements =
+ new LinkedList<Element<?, ?>>(elements.subList(0, elements.size() - offset));
return create(celements, celements.getLast());
}
@@ -1098,14 +1102,14 @@
* If this managed object path is empty or if its final path
* element does not comprise of an instantiable relation.
*/
- @SuppressWarnings("unchecked")
- public ManagedObjectPath<C, S> rename(String newName) throws IllegalStateException {
+ public ManagedObjectPath<C, S> rename(String newName) {
if (elements.size() == 0) {
throw new IllegalStateException("Cannot rename an empty path");
}
if (r instanceof InstantiableRelationDefinition) {
- InstantiableRelationDefinition<? super C, ? super S> ir = (InstantiableRelationDefinition<? super C, ? super S>) r;
+ InstantiableRelationDefinition<? super C, ? super S> ir =
+ (InstantiableRelationDefinition<? super C, ? super S>) r;
return parent().child(ir, d, newName);
} else {
throw new IllegalStateException("Not an instantiable relation");
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectPathSerializer.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectPathSerializer.java
index 0e8cd40..a0edc95 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectPathSerializer.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/ManagedObjectPathSerializer.java
@@ -25,110 +25,90 @@
*/
package org.opends.server.admin;
-
-
/**
* A strategy for serializing managed object paths.
* <p>
- * This interface provides a generic means for serializing managed
- * object paths into application specific forms. For example, a JNDI
- * client would use this interface to construct <code>LdapName</code>
- * objects from a path. Similarly, on the server side, a serialization
- * strategy is used to construct <code>DN</code> instances from a
- * path.
+ * This interface provides a generic means for serializing managed object paths
+ * into application specific forms. For example, a JNDI client would use this
+ * interface to construct <code>LdapName</code> objects from a path. Similarly,
+ * on the server side, a serialization strategy is used to construct
+ * <code>DN</code> instances from a path.
* <p>
- * During serialization the serializer is invoked for each element in
- * the managed object path in big-endian order, starting from the root
- * and proceeding down to the leaf element.
+ * During serialization the serializer is invoked for each element in the
+ * managed object path in big-endian order, starting from the root and
+ * proceeding down to the leaf element.
*/
public interface ManagedObjectPathSerializer {
- /**
- * Append a managed object path element identified by an
- * instantiable relation and an instance name.
- *
- * @param <C>
- * The type of client managed object configuration that
- * this path element references.
- * @param <S>
- * The type of server managed object configuration that
- * this path element references.
- * @param r
- * The instantiable relation.
- * @param d
- * The managed object definition.
- * @param name
- * The instance name.
- */
- <C extends ConfigurationClient, S extends Configuration>
- void appendManagedObjectPathElement(
- InstantiableRelationDefinition<? super C, ? super S> r,
- AbstractManagedObjectDefinition<C, S> d, String name);
+ /**
+ * Append a managed object path element identified by an instantiable
+ * relation and an instance name.
+ *
+ * @param <C>
+ * The type of client managed object configuration that this path
+ * element references.
+ * @param <S>
+ * The type of server managed object configuration that this path
+ * element references.
+ * @param r
+ * The instantiable relation.
+ * @param d
+ * The managed object definition.
+ * @param name
+ * The instance name.
+ */
+ <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
+ InstantiableRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d, String name);
+ /**
+ * Append a managed object path element identified by an optional relation.
+ *
+ * @param <C>
+ * The type of client managed object configuration that this path
+ * element references.
+ * @param <S>
+ * The type of server managed object configuration that this path
+ * element references.
+ * @param r
+ * The optional relation.
+ * @param d
+ * The managed object definition.
+ */
+ <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
+ OptionalRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d);
+ /**
+ * Append a managed object path element identified by a singleton relation.
+ *
+ * @param <C>
+ * The type of client managed object configuration that this path
+ * element references.
+ * @param <S>
+ * The type of server managed object configuration that this path
+ * element references.
+ * @param r
+ * The singleton relation.
+ * @param d
+ * The managed object definition.
+ */
+ <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
+ SingletonRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d);
- /**
- * Append a managed object path element identified by an optional
- * relation.
- *
- * @param <C>
- * The type of client managed object configuration that
- * this path element references.
- * @param <S>
- * The type of server managed object configuration that
- * this path element references.
- * @param r
- * The optional relation.
- * @param d
- * The managed object definition.
- */
- <C extends ConfigurationClient, S extends Configuration>
- void appendManagedObjectPathElement(
- OptionalRelationDefinition<? super C, ? super S> r,
- AbstractManagedObjectDefinition<C, S> d);
-
-
-
- /**
- * Append a managed object path element identified by a singleton
- * relation.
- *
- * @param <C>
- * The type of client managed object configuration that
- * this path element references.
- * @param <S>
- * The type of server managed object configuration that
- * this path element references.
- * @param r
- * The singleton relation.
- * @param d
- * The managed object definition.
- */
- <C extends ConfigurationClient, S extends Configuration>
- void appendManagedObjectPathElement(
- SingletonRelationDefinition<? super C, ? super S> r,
- AbstractManagedObjectDefinition<C, S> d);
-
-
-
- /**
- * Append a managed object path element identified by a
- * set relation.
- *
- * @param <C>
- * The type of client managed object configuration that
- * this path element references.
- * @param <S>
- * The type of server managed object configuration that
- * this path element references.
- * @param r
- * The set relation.
- * @param d
- * The managed object definition.
- */
- <C extends ConfigurationClient, S extends Configuration>
- void appendManagedObjectPathElement(
- SetRelationDefinition<? super C, ? super S> r,
- AbstractManagedObjectDefinition<C, S> d);
+ /**
+ * Append a managed object path element identified by a set relation.
+ *
+ * @param <C>
+ * The type of client managed object configuration that this path
+ * element references.
+ * @param <S>
+ * The type of server managed object configuration that this path
+ * element references.
+ * @param r
+ * The set relation.
+ * @param d
+ * The managed object definition.
+ */
+ <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
+ SetRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/OptionalRelationDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/OptionalRelationDefinition.java
index 5ed838c..10aa694 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/OptionalRelationDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/OptionalRelationDefinition.java
@@ -26,157 +26,130 @@
package org.opends.server.admin;
-
-
/**
- * A managed object composite relationship definition which represents
- * a composition of an optional single managed object (i.e. the
- * referenced managed object may or may not be present).
+ * A managed object composite relationship definition which represents a
+ * composition of an optional single managed object (i.e. the referenced managed
+ * object may or may not be present).
*
* @param <C>
- * The type of client managed object configuration that this
- * relation definition refers to.
+ * The type of client managed object configuration that this relation
+ * definition refers to.
* @param <S>
- * The type of server managed object configuration that this
- * relation definition refers to.
+ * The type of server managed object configuration that this relation
+ * definition refers to.
*/
-public final class OptionalRelationDefinition
- <C extends ConfigurationClient, S extends Configuration>
- extends RelationDefinition<C, S> {
+public final class OptionalRelationDefinition<C extends ConfigurationClient, S extends Configuration> extends
+ RelationDefinition<C, S> {
- /**
- * An interface for incrementally constructing optional relation
- * definitions.
- *
- * @param <C>
- * The type of client managed object configuration that
- * this relation definition refers to.
- * @param <S>
- * The type of server managed object configuration that
- * this relation definition refers to.
- */
- public static final class Builder
- <C extends ConfigurationClient, S extends Configuration>
- extends AbstractBuilder<C, S, OptionalRelationDefinition<C, S>> {
+ /**
+ * An interface for incrementally constructing optional relation
+ * definitions.
+ *
+ * @param <C>
+ * The type of client managed object configuration that this
+ * relation definition refers to.
+ * @param <S>
+ * The type of server managed object configuration that this
+ * relation definition refers to.
+ */
+ public static final class Builder<C extends ConfigurationClient, S extends Configuration> extends
+ AbstractBuilder<C, S, OptionalRelationDefinition<C, S>> {
+
+ // The optional default managed object associated with this
+ // optional relation.
+ private DefaultManagedObject<? extends C, ? extends S> defaultManagedObject = null;
+
+ /**
+ * Creates a new builder which can be used to incrementally build an
+ * optional relation definition.
+ *
+ * @param pd
+ * The parent managed object definition.
+ * @param name
+ * The name of the relation.
+ * @param cd
+ * The child managed object definition.
+ */
+ // @Checkstyle:ignore
+ public Builder(AbstractManagedObjectDefinition<?, ?> pd, String name, AbstractManagedObjectDefinition<C, S> cd) {
+ super(pd, name, cd);
+ }
+
+ /**
+ * Sets the optional default managed object associated with this
+ * optional relation definition.
+ *
+ * @param defaultManagedObject
+ * The default managed object or <code>null</code> if there
+ * is no default managed object defined for this relation
+ * definition.
+ */
+ public void setDefaultManagedObject(DefaultManagedObject<? extends C, ? extends S> defaultManagedObject) {
+ this.defaultManagedObject = defaultManagedObject;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected OptionalRelationDefinition<C, S> buildInstance(Common<C, S> common) {
+ return new OptionalRelationDefinition<C, S>(common, defaultManagedObject);
+ }
+
+ }
// The optional default managed object associated with this
// optional relation.
- private DefaultManagedObject<? extends C, ? extends S>
- defaultManagedObject = null;
+ private final DefaultManagedObject<? extends C, ? extends S> defaultManagedObject;
-
-
- /**
- * Creates a new builder which can be used to incrementally build
- * an optional relation definition.
- *
- * @param pd
- * The parent managed object definition.
- * @param name
- * The name of the relation.
- * @param cd
- * The child managed object definition.
- */
- public Builder(AbstractManagedObjectDefinition<?, ?> pd, String name,
- AbstractManagedObjectDefinition<C, S> cd) {
- super(pd, name, cd);
- }
-
-
-
- /**
- * Sets the optional default managed object associated with this
- * optional relation definition.
- *
- * @param defaultManagedObject
- * The default managed object or <code>null</code> if
- * there is no default managed object defined for this
- * relation definition.
- */
- public void setDefaultManagedObject(
+ // Private constructor.
+ private OptionalRelationDefinition(Common<C, S> common,
DefaultManagedObject<? extends C, ? extends S> defaultManagedObject) {
- this.defaultManagedObject = defaultManagedObject;
+ super(common);
+ this.defaultManagedObject = defaultManagedObject;
}
-
-
/**
* {@inheritDoc}
*/
@Override
- protected OptionalRelationDefinition<C, S> buildInstance(
- Common<C, S> common) {
- return new OptionalRelationDefinition<C, S>(common, defaultManagedObject);
+ public <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p) {
+ return v.visitOptional(this, p);
}
- }
-
-
-
- // The optional default managed object associated with this
- // optional relation.
- private final DefaultManagedObject<? extends C, ? extends S>
- defaultManagedObject;
-
-
-
- // Private constructor.
- private OptionalRelationDefinition(Common<C, S> common,
- DefaultManagedObject<? extends C, ? extends S> defaultManagedObject) {
- super(common);
- this.defaultManagedObject = defaultManagedObject;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p) {
- return v.visitOptional(this, p);
- }
-
-
-
- /**
- * Gets the optional default managed object associated with this
- * optional relation definition.
- *
- * @return Returns the default managed object or <code>null</code>
- * if there is no default managed object defined for this
- * relation definition.
- */
- public DefaultManagedObject<? extends C, ? extends S>
- getDefaultManagedObject() {
- return defaultManagedObject;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void toString(StringBuilder builder) {
- builder.append("name=");
- builder.append(getName());
- builder.append(" type=optional parent=");
- builder.append(getParentDefinition().getName());
- builder.append(" child=");
- builder.append(getChildDefinition().getName());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void initialize() throws Exception {
- if (defaultManagedObject != null) {
- defaultManagedObject.initialize();
+ /**
+ * Gets the optional default managed object associated with this optional
+ * relation definition.
+ *
+ * @return Returns the default managed object or <code>null</code> if there
+ * is no default managed object defined for this relation
+ * definition.
+ */
+ public DefaultManagedObject<? extends C, ? extends S> getDefaultManagedObject() {
+ return defaultManagedObject;
}
- }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void toString(StringBuilder builder) {
+ builder.append("name=");
+ builder.append(getName());
+ builder.append(" type=optional parent=");
+ builder.append(getParentDefinition().getName());
+ builder.append(" child=");
+ builder.append(getChildDefinition().getName());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initialize() throws Exception {
+ if (defaultManagedObject != null) {
+ defaultManagedObject.initialize();
+ }
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinition.java
index d2ab415..ebd89fb 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinition.java
@@ -152,8 +152,8 @@
* @return The new property definition.
*/
protected abstract D buildInstance(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<T> defaultBehavior);
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<T> defaultBehavior);
}
// The administrator action.
@@ -192,7 +192,7 @@
* The default behavior provider.
*/
protected PropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, Class<T> theClass, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction, DefaultBehaviorProvider<T> defaultBehavior) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction, DefaultBehaviorProvider<T> defaultBehavior) {
Reject.ifNull(d, theClass, propertyName, options, adminAction, defaultBehavior);
this.definition = d;
@@ -260,7 +260,7 @@
* @throws ClassCastException
* If the provided property value did not have the correct type.
*/
- public final T castValue(Object object) throws ClassCastException {
+ public final T castValue(Object object) {
return theClass.cast(object);
}
@@ -322,7 +322,7 @@
* @throws IllegalPropertyValueStringException
* If the property value string is invalid.
*/
- public abstract T decodeValue(String value) throws IllegalPropertyValueStringException;
+ public abstract T decodeValue(String value);
/**
* Encode the provided property value into its string representation.
@@ -336,7 +336,7 @@
* @throws IllegalPropertyValueException
* If the property value is invalid.
*/
- public String encodeValue(T value) throws IllegalPropertyValueException {
+ public String encodeValue(T value) {
Reject.ifNull(value);
return value.toString();
@@ -521,7 +521,7 @@
* @throws IllegalPropertyValueException
* If the property value is invalid.
*/
- public String normalizeValue(T value) throws IllegalPropertyValueException {
+ public String normalizeValue(T value) {
Reject.ifNull(value);
return encodeValue(value);
@@ -565,7 +565,7 @@
* @throws IllegalPropertyValueException
* If the property value is invalid.
*/
- public abstract void validateValue(T value) throws IllegalPropertyValueException;
+ public abstract void validateValue(T value);
/**
* Performs any run-time initialization required by this property
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinitionUsageBuilder.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinitionUsageBuilder.java
index 659d7ee..fb34eff 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinitionUsageBuilder.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinitionUsageBuilder.java
@@ -42,7 +42,7 @@
/**
* Underlying implementation.
*/
- private class MyPropertyDefinitionVisitor extends PropertyDefinitionVisitor<LocalizableMessage, Void> {
+ private final class MyPropertyDefinitionVisitor extends PropertyDefinitionVisitor<LocalizableMessage, Void> {
// Flag indicating whether detailed syntax information will be
// generated.
@@ -65,7 +65,7 @@
*/
@Override
public <C extends ConfigurationClient, S extends Configuration> LocalizableMessage visitAggregation(
- AggregationPropertyDefinition<C, S> d, Void p) {
+ AggregationPropertyDefinition<C, S> d, Void p) {
return LocalizableMessage.raw("NAME");
}
@@ -307,8 +307,7 @@
* {@inheritDoc}
*/
@Override
- public <T> LocalizableMessage visitUnknown(PropertyDefinition<T> d, Void p)
- throws UnknownPropertyDefinitionException {
+ public <T> LocalizableMessage visitUnknown(PropertyDefinition<T> d, Void p) {
return LocalizableMessage.raw("?");
}
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinitionVisitor.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinitionVisitor.java
index b3bbdaf..f684ebf 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinitionVisitor.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyDefinitionVisitor.java
@@ -26,271 +26,237 @@
package org.opends.server.admin;
-
-
/**
- * A visitor of property definitions, in the style of the visitor
- * design pattern. Classes implementing this interface can query
- * property definitions in a type-safe manner when the kind of
- * property definition is unknown at compile time. When a visitor is
- * passed to a property definition's accept method, the corresponding
- * visit method most applicable to that property definition is
- * invoked.
+ * A visitor of property definitions, in the style of the visitor design
+ * pattern. Classes implementing this interface can query property definitions
+ * in a type-safe manner when the kind of property definition is unknown at
+ * compile time. When a visitor is passed to a property definition's accept
+ * method, the corresponding visit method most applicable to that property
+ * definition is invoked.
* <p>
- * Each <code>visitXXX</code> method is provided with a default
- * implementation which calls
- * {@link #visitUnknown(PropertyDefinition, Object)}. Sub-classes can
- * override any or all of the methods to provide their own
- * type-specific behavior.
+ * Each <code>visitXXX</code> method is provided with a default implementation
+ * which calls {@link #visitUnknown(PropertyDefinition, Object)}. Sub-classes
+ * can override any or all of the methods to provide their own type-specific
+ * behavior.
*
* @param <R>
- * The return type of this visitor's methods. Use
- * {@link java.lang.Void} for visitors that do not need to
- * return results.
+ * The return type of this visitor's methods. Use
+ * {@link java.lang.Void} for visitors that do not need to return
+ * results.
* @param <P>
- * The type of the additional parameter to this visitor's
- * methods. Use {@link java.lang.Void} for visitors that do
- * not need an additional parameter.
+ * The type of the additional parameter to this visitor's methods.
+ * Use {@link java.lang.Void} for visitors that do not need an
+ * additional parameter.
*/
public abstract class PropertyDefinitionVisitor<R, P> {
- /**
- * Default constructor.
- */
- protected PropertyDefinitionVisitor() {
- // No implementation required.
- }
+ /**
+ * Default constructor.
+ */
+ protected PropertyDefinitionVisitor() {
+ // No implementation required.
+ }
+ /**
+ * Visit a dseecompat Global ACI property definition.
+ *
+ * @param pd
+ * The Global ACI property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitACI(ACIPropertyDefinition pd, P p) {
+ return visitUnknown(pd, p);
+ }
+ /**
+ * Visit an aggregation property definition.
+ *
+ * @param <C>
+ * The type of client managed object configuration that this
+ * aggregation property definition refers to.
+ * @param <S>
+ * The type of server managed object configuration that this
+ * aggregation property definition refers to.
+ * @param pd
+ * The aggregation property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public <C extends ConfigurationClient, S extends Configuration> R visitAggregation(
+ AggregationPropertyDefinition<C, S> pd, P p) {
+ return visitUnknown(pd, p);
+ }
- /**
- * Visit a dseecompat Global ACI property definition.
- *
- * @param pd
- * The Global ACI property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitACI(ACIPropertyDefinition pd, P p) {
- return visitUnknown(pd, p);
- }
+ /**
+ * Visit an attribute type property definition.
+ *
+ * @param pd
+ * The attribute type property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitAttributeType(AttributeTypePropertyDefinition pd, P p) {
+ return visitUnknown(pd, p);
+ }
+ /**
+ * Visit a boolean property definition.
+ *
+ * @param pd
+ * The boolean property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitBoolean(BooleanPropertyDefinition pd, P p) {
+ return visitUnknown(pd, p);
+ }
+ /**
+ * Visit a class property definition.
+ *
+ * @param pd
+ * The class property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitClass(ClassPropertyDefinition pd, P p) {
+ return visitUnknown(pd, p);
+ }
- /**
- * Visit an aggregation property definition.
- *
- * @param <C>
- * The type of client managed object configuration that
- * this aggregation property definition refers to.
- * @param <S>
- * The type of server managed object configuration that
- * this aggregation property definition refers to.
- * @param pd
- * The aggregation property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public <C extends ConfigurationClient, S extends Configuration>
- R visitAggregation(AggregationPropertyDefinition<C, S> pd, P p) {
- return visitUnknown(pd, p);
- }
+ /**
+ * Visit a DN property definition.
+ *
+ * @param pd
+ * The DN property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitDN(DNPropertyDefinition pd, P p) {
+ return visitUnknown(pd, p);
+ }
+ /**
+ * Visit a duration property definition.
+ *
+ * @param pd
+ * The duration property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitDuration(DurationPropertyDefinition pd, P p) {
+ return visitUnknown(pd, p);
+ }
+ /**
+ * Visit an enumeration property definition.
+ *
+ * @param <E>
+ * The enumeration that should be used for values of the property
+ * definition.
+ * @param pd
+ * The enumeration property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public <E extends Enum<E>> R visitEnum(EnumPropertyDefinition<E> pd, P p) {
+ return visitUnknown(pd, p);
+ }
- /**
- * Visit an attribute type property definition.
- *
- * @param pd
- * The attribute type property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitAttributeType(AttributeTypePropertyDefinition pd, P p) {
- return visitUnknown(pd, p);
- }
+ /**
+ * Visit an integer property definition.
+ *
+ * @param pd
+ * The integer property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitInteger(IntegerPropertyDefinition pd, P p) {
+ return visitUnknown(pd, p);
+ }
+ /**
+ * Visit a IP address property definition.
+ *
+ * @param pd
+ * The IP address property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitIPAddress(IPAddressPropertyDefinition pd, P p) {
+ return visitUnknown(pd, p);
+ }
+ /**
+ * Visit a IP address mask property definition.
+ *
+ * @param pd
+ * The IP address mask property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitIPAddressMask(IPAddressMaskPropertyDefinition pd, P p) {
+ return visitUnknown(pd, p);
+ }
- /**
- * Visit a boolean property definition.
- *
- * @param pd
- * The boolean property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitBoolean(BooleanPropertyDefinition pd, P p) {
- return visitUnknown(pd, p);
- }
+ /**
+ * Visit a size property definition.
+ *
+ * @param pd
+ * The size property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitSize(SizePropertyDefinition pd, P p) {
+ return visitUnknown(pd, p);
+ }
+ /**
+ * Visit a string property definition.
+ *
+ * @param pd
+ * The string property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitString(StringPropertyDefinition pd, P p) {
+ return visitUnknown(pd, p);
+ }
-
- /**
- * Visit a class property definition.
- *
- * @param pd
- * The class property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitClass(ClassPropertyDefinition pd, P p) {
- return visitUnknown(pd, p);
- }
-
-
-
- /**
- * Visit a DN property definition.
- *
- * @param pd
- * The DN property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitDN(DNPropertyDefinition pd, P p) {
- return visitUnknown(pd, p);
- }
-
-
-
- /**
- * Visit a duration property definition.
- *
- * @param pd
- * The duration property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitDuration(DurationPropertyDefinition pd, P p) {
- return visitUnknown(pd, p);
- }
-
-
-
- /**
- * Visit an enumeration property definition.
- *
- * @param <E>
- * The enumeration that should be used for values of the
- * property definition.
- * @param pd
- * The enumeration property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public <E extends Enum<E>> R visitEnum(EnumPropertyDefinition<E> pd, P p) {
- return visitUnknown(pd, p);
- }
-
-
-
- /**
- * Visit an integer property definition.
- *
- * @param pd
- * The integer property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitInteger(IntegerPropertyDefinition pd, P p) {
- return visitUnknown(pd, p);
- }
-
-
-
- /**
- * Visit a IP address property definition.
- *
- * @param pd
- * The IP address property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitIPAddress(IPAddressPropertyDefinition pd, P p) {
- return visitUnknown(pd, p);
- }
-
-
-
- /**
- * Visit a IP address mask property definition.
- *
- * @param pd
- * The IP address mask property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitIPAddressMask(IPAddressMaskPropertyDefinition pd, P p) {
- return visitUnknown(pd, p);
- }
-
-
- /**
- * Visit a size property definition.
- *
- * @param pd
- * The size property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitSize(SizePropertyDefinition pd, P p) {
- return visitUnknown(pd, p);
- }
-
-
-
- /**
- * Visit a string property definition.
- *
- * @param pd
- * The string property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitString(StringPropertyDefinition pd, P p) {
- return visitUnknown(pd, p);
- }
-
-
-
-
- /**
- * Visit an unknown type of property definition. Implementations of
- * this method can provide default behavior for unknown property
- * definition types.
- * <p>
- * The default implementation of this method throws an
- * {@link UnknownPropertyDefinitionException}. Sub-classes can
- * override this method with their own default behavior.
- *
- * @param <T>
- * The type of the underlying property.
- * @param pd
- * The property definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- * @throws UnknownPropertyDefinitionException
- * Visitor implementations may optionally throw this
- * exception.
- */
- public <T> R visitUnknown(PropertyDefinition<T> pd, P p)
- throws UnknownPropertyDefinitionException {
- throw new UnknownPropertyDefinitionException(pd, p);
- }
+ /**
+ * Visit an unknown type of property definition. Implementations of this
+ * method can provide default behavior for unknown property definition
+ * types.
+ * <p>
+ * The default implementation of this method throws an
+ * {@link UnknownPropertyDefinitionException}. Sub-classes can override this
+ * method with their own default behavior.
+ *
+ * @param <T>
+ * The type of the underlying property.
+ * @param pd
+ * The property definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ * @throws UnknownPropertyDefinitionException
+ * Visitor implementations may optionally throw this exception.
+ */
+ public <T> R visitUnknown(PropertyDefinition<T> pd, P p) {
+ throw new UnknownPropertyDefinitionException(pd, p);
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsMandatoryException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsMandatoryException.java
index c649acf..d108c6d 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsMandatoryException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsMandatoryException.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
import static com.forgerock.opendj.ldap.AdminMessages.*;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsReadOnlyException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsReadOnlyException.java
index bb1bd43..dea72ef 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsReadOnlyException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsReadOnlyException.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
import static com.forgerock.opendj.ldap.AdminMessages.*;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsSingleValuedException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsSingleValuedException.java
index d314b69..bd748a4 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsSingleValuedException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyIsSingleValuedException.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
import static com.forgerock.opendj.ldap.AdminMessages.*;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyNotFoundException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyNotFoundException.java
index c537fc1..5d7cad1 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyNotFoundException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyNotFoundException.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
import static com.forgerock.opendj.ldap.AdminMessages.*;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyOption.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyOption.java
index d7cff92..655a284 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyOption.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyOption.java
@@ -26,45 +26,42 @@
package org.opends.server.admin;
-
-
/**
- * This enumeration contains various options that can be associated
- * with property definitions.
+ * This enumeration contains various options that can be associated with
+ * property definitions.
*/
public enum PropertyOption {
- /**
- * Use this option to identify properties which should be considered
- * as advanced and should not be exposed by default in client
- * applications.
- */
- ADVANCED,
+ /**
+ * Use this option to identify properties which should be considered as
+ * advanced and should not be exposed by default in client applications.
+ */
+ ADVANCED,
- /**
- * Use this option to identify properties which must not be directly
- * exposed in client applications.
- */
- HIDDEN,
+ /**
+ * Use this option to identify properties which must not be directly exposed
+ * in client applications.
+ */
+ HIDDEN,
- /**
- * Use this option to identify properties which must have a value.
- */
- MANDATORY,
+ /**
+ * Use this option to identify properties which must have a value.
+ */
+ MANDATORY,
- /**
- * Use this option to identify properties which are multi-valued.
- */
- MULTI_VALUED,
+ /**
+ * Use this option to identify properties which are multi-valued.
+ */
+ MULTI_VALUED,
- /**
- * Use this option to identify properties which can be initialized
- * once only and are read-only thereafter.
- */
- READ_ONLY,
+ /**
+ * Use this option to identify properties which can be initialized once only
+ * and are read-only thereafter.
+ */
+ READ_ONLY,
- /**
- * 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 are for monitoring purposes
+ * only and are generated automatically by the server..
+ */
+ MONITORING;
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyProvider.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyProvider.java
index 9194ddc..95c2fe6 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyProvider.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyProvider.java
@@ -26,63 +26,55 @@
package org.opends.server.admin;
-
-
import java.util.Collection;
import java.util.Collections;
-
-
/**
* An interface which can be used to initialize the contents of a managed
* object.
*/
public interface PropertyProvider {
- /**
- * A property provider which always returns empty property values, indicating
- * default behavior.
- */
- public static final PropertyProvider DEFAULT_PROVIDER =
- new PropertyProvider() {
+ /**
+ * A property provider which always returns empty property values,
+ * indicating default behavior.
+ */
+ public static final PropertyProvider DEFAULT_PROVIDER = new PropertyProvider() {
+
+ /**
+ * {@inheritDoc}
+ */
+ public <T> Collection<T> getPropertyValues(PropertyDefinition<T> d) {
+ return Collections.<T> emptySet();
+ }
+
+ };
/**
- * {@inheritDoc}
+ * Get the property values associated with the specified property
+ * definition.
+ * <p>
+ * Implementations are not required to validate the values that they
+ * provide. Specifically:
+ * <ul>
+ * <li>they do not need to guarantee that the provided values are valid
+ * according to the property's syntax
+ * <li>they do not need to provide values for mandatory properties
+ * <li>they do not need to ensure that single-valued properties do contain
+ * at most one value.
+ * </ul>
+ * The returned set of values is allowed to contain duplicates.
+ *
+ * @param <T>
+ * The underlying type of the property.
+ * @param d
+ * The Property definition.
+ * @return Returns a newly allocated set containing a copy of the property's
+ * values. An empty set indicates that the property has no values
+ * defined and any default behavior is applicable.
+ * @throws IllegalArgumentException
+ * If this property provider does not recognise the requested
+ * property definition.
*/
- public <T> Collection<T> getPropertyValues(PropertyDefinition<T> d)
- throws IllegalArgumentException {
- return Collections.<T> emptySet();
- }
-
- };
-
-
-
- /**
- * Get the property values associated with the specified property definition.
- * <p>
- * Implementations are not required to validate the values that they provide.
- * Specifically:
- * <ul>
- * <li>they do not need to guarantee that the provided values are valid
- * according to the property's syntax
- * <li>they do not need to provide values for mandatory properties
- * <li>they do not need to ensure that single-valued properties do contain at
- * most one value.
- * </ul>
- * The returned set of values is allowed to contain duplicates.
- *
- * @param <T>
- * The underlying type of the property.
- * @param d
- * The Property definition.
- * @return Returns a newly allocated set containing a copy of the property's
- * values. An empty set indicates that the property has no values
- * defined and any default behavior is applicable.
- * @throws IllegalArgumentException
- * If this property provider does not recognise the requested
- * property definition.
- */
- <T> Collection<T> getPropertyValues(PropertyDefinition<T> d)
- throws IllegalArgumentException;
+ <T> Collection<T> getPropertyValues(PropertyDefinition<T> d);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyValueVisitor.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyValueVisitor.java
index 7c82ed6..1f35e84 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyValueVisitor.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/PropertyValueVisitor.java
@@ -26,8 +26,6 @@
package org.opends.server.admin;
-
-
import java.net.InetAddress;
import org.forgerock.opendj.ldap.DN;
@@ -35,302 +33,264 @@
import org.opends.server.authorization.dseecompat.Aci;
import org.opends.server.types.AddressMask;
-
/**
- * A visitor of property values, in the style of the visitor design
- * pattern. Classes implementing this interface can query a property a
- * value and its associated property definition in a type-safe manner
- * when the kind of property value is unknown at compile time. When a
- * visitor is passed to a property definition's accept method, the
- * corresponding visit method most applicable to that property
- * definition is invoked.
+ * A visitor of property values, in the style of the visitor design pattern.
+ * Classes implementing this interface can query a property a value and its
+ * associated property definition in a type-safe manner when the kind of
+ * property value is unknown at compile time. When a visitor is passed to a
+ * property definition's accept method, the corresponding visit method most
+ * applicable to that property definition is invoked.
* <p>
- * Each <code>visitXXX</code> method is provided with a default
- * implementation which calls
- * {@link #visitUnknown(PropertyDefinition, Object, Object)}.
- * Sub-classes can override any or all of the methods to provide their
- * own type-specific behavior.
+ * Each <code>visitXXX</code> method is provided with a default implementation
+ * which calls {@link #visitUnknown(PropertyDefinition, Object, Object)}.
+ * Sub-classes can override any or all of the methods to provide their own
+ * type-specific behavior.
*
* @param <R>
- * The return type of this visitor's methods. Use
- * {@link java.lang.Void} for visitors that do not need to
- * return results.
+ * The return type of this visitor's methods. Use
+ * {@link java.lang.Void} for visitors that do not need to return
+ * results.
* @param <P>
- * The type of the additional parameter to this visitor's
- * methods. Use {@link java.lang.Void} for visitors that do
- * not need an additional parameter.
+ * The type of the additional parameter to this visitor's methods.
+ * Use {@link java.lang.Void} for visitors that do not need an
+ * additional parameter.
*/
public abstract class PropertyValueVisitor<R, P> {
- /**
- * Default constructor.
- */
- protected PropertyValueVisitor() {
- // No implementation required.
- }
+ /**
+ * Default constructor.
+ */
+ protected PropertyValueVisitor() {
+ // No implementation required.
+ }
+ /**
+ * Visit a dseecompat ACI.
+ *
+ * @param pd
+ * The dseecompat ACI property definition.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitACI(ACIPropertyDefinition pd, Aci v, P p) {
+ return visitUnknown(pd, v, p);
+ }
+ /**
+ * Visit an aggregation property value.
+ *
+ * @param <C>
+ * The type of client managed object configuration that this
+ * aggregation property definition refers to.
+ * @param <S>
+ * The type of server managed object configuration that this
+ * aggregation property definition refers to.
+ * @param pd
+ * The aggregation property definition to visit.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public <C extends ConfigurationClient, S extends Configuration> R visitAggregation(
+ AggregationPropertyDefinition<C, S> pd, String v, P p) {
+ return visitUnknown(pd, v, p);
+ }
- /**
- * Visit a dseecompat ACI.
- *
- * @param pd
- * The dseecompat ACI property definition.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitACI(ACIPropertyDefinition pd, Aci v,
- P p) {
- return visitUnknown(pd, v, p);
- }
+ /**
+ * Visit an attribute type.
+ *
+ * @param pd
+ * The attribute type property definition.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitAttributeType(AttributeTypePropertyDefinition pd, AttributeType v, P p) {
+ return visitUnknown(pd, v, p);
+ }
+ /**
+ * Visit a boolean.
+ *
+ * @param pd
+ * The boolean property definition.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitBoolean(BooleanPropertyDefinition pd, Boolean v, P p) {
+ return visitUnknown(pd, v, p);
+ }
+ /**
+ * Visit a class.
+ *
+ * @param pd
+ * The class property definition.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitClass(ClassPropertyDefinition pd, String v, P p) {
+ return visitUnknown(pd, v, p);
+ }
- /**
- * Visit an aggregation property value.
- *
- * @param <C>
- * The type of client managed object configuration that
- * this aggregation property definition refers to.
- * @param <S>
- * The type of server managed object configuration that
- * this aggregation property definition refers to.
- * @param pd
- * The aggregation property definition to visit.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public <C extends ConfigurationClient, S extends Configuration>
- R visitAggregation(
- AggregationPropertyDefinition<C, S> pd, String v, P p) {
- return visitUnknown(pd, v, p);
- }
+ /**
+ * Visit a DN.
+ *
+ * @param pd
+ * The DN property definition.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitDN(DNPropertyDefinition pd, DN v, P p) {
+ return visitUnknown(pd, v, p);
+ }
+ /**
+ * Visit a duration.
+ *
+ * @param pd
+ * The duration property definition.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitDuration(DurationPropertyDefinition pd, Long v, P p) {
+ return visitUnknown(pd, v, p);
+ }
+ /**
+ * Visit an enumeration.
+ *
+ * @param <E>
+ * The enumeration that should be used for values of the property
+ * definition.
+ * @param pd
+ * The enumeration property definition.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public <E extends Enum<E>> R visitEnum(EnumPropertyDefinition<E> pd, E v, P p) {
+ return visitUnknown(pd, v, p);
+ }
- /**
- * Visit an attribute type.
- *
- * @param pd
- * The attribute type property definition.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitAttributeType(AttributeTypePropertyDefinition pd,
- AttributeType v, P p) {
- return visitUnknown(pd, v, p);
- }
+ /**
+ * Visit an integer.
+ *
+ * @param pd
+ * The integer property definition.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitInteger(IntegerPropertyDefinition pd, Integer v, P p) {
+ return visitUnknown(pd, v, p);
+ }
+ /**
+ * Visit a IP address.
+ *
+ * @param pd
+ * The IP address property definition.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitIPAddress(IPAddressPropertyDefinition pd, InetAddress v, P p) {
+ return visitUnknown(pd, v, p);
+ }
+ /**
+ * Visit a IP address mask.
+ *
+ * @param pd
+ * The IP address mask property definition.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitIPAddressMask(IPAddressMaskPropertyDefinition pd, AddressMask v, P p) {
+ return visitUnknown(pd, v, p);
+ }
- /**
- * Visit a boolean.
- *
- * @param pd
- * The boolean property definition.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitBoolean(BooleanPropertyDefinition pd, Boolean v, P p) {
- return visitUnknown(pd, v, p);
- }
+ /**
+ * Visit a size.
+ *
+ * @param pd
+ * The size property definition.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitSize(SizePropertyDefinition pd, Long v, P p) {
+ return visitUnknown(pd, v, p);
+ }
+ /**
+ * Visit a string.
+ *
+ * @param pd
+ * The string property definition.
+ * @param v
+ * The property value to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ public R visitString(StringPropertyDefinition pd, String v, P p) {
+ return visitUnknown(pd, v, p);
+ }
-
- /**
- * Visit a class.
- *
- * @param pd
- * The class property definition.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitClass(ClassPropertyDefinition pd, String v, P p) {
- return visitUnknown(pd, v, p);
- }
-
-
-
- /**
- * Visit a DN.
- *
- * @param pd
- * The DN property definition.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitDN(DNPropertyDefinition pd, DN v, P p) {
- return visitUnknown(pd, v, p);
- }
-
-
-
- /**
- * Visit a duration.
- *
- * @param pd
- * The duration property definition.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitDuration(DurationPropertyDefinition pd, Long v, P p) {
- return visitUnknown(pd, v, p);
- }
-
-
-
- /**
- * Visit an enumeration.
- *
- * @param <E>
- * The enumeration that should be used for values of the
- * property definition.
- * @param pd
- * The enumeration property definition.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public <E extends Enum<E>>
- R visitEnum(EnumPropertyDefinition<E> pd, E v, P p) {
- return visitUnknown(pd, v, p);
- }
-
-
-
- /**
- * Visit an integer.
- *
- * @param pd
- * The integer property definition.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitInteger(IntegerPropertyDefinition pd, Integer v, P p) {
- return visitUnknown(pd, v, p);
- }
-
-
-
- /**
- * Visit a IP address.
- *
- * @param pd
- * The IP address property definition.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitIPAddress(IPAddressPropertyDefinition pd, InetAddress v, P p) {
- return visitUnknown(pd, v, p);
- }
-
-
-
- /**
- * Visit a IP address mask.
- *
- * @param pd
- * The IP address mask property definition.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitIPAddressMask(IPAddressMaskPropertyDefinition pd, AddressMask v,
- P p) {
- return visitUnknown(pd, v, p);
- }
-
-
- /**
- * Visit a size.
- *
- * @param pd
- * The size property definition.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitSize(SizePropertyDefinition pd, Long v, P p) {
- return visitUnknown(pd, v, p);
- }
-
-
-
- /**
- * Visit a string.
- *
- * @param pd
- * The string property definition.
- * @param v
- * The property value to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- public R visitString(StringPropertyDefinition pd, String v, P p) {
- return visitUnknown(pd, v, p);
- }
-
-
-
- /**
- * Visit an unknown type of property value. Implementations of this
- * method can provide default behavior for unknown types of
- * property.
- * <p>
- * The default implementation of this method throws an
- * {@link UnknownPropertyDefinitionException}. Sub-classes can
- * override this method with their own default behavior.
- *
- * @param <T>
- * The type of property value to visit.
- * @param pd
- * The property definition.
- * @param v
- * The property value.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- * @throws UnknownPropertyDefinitionException
- * Visitor implementations may optionally throw this
- * exception.
- */
- public <T> R visitUnknown(PropertyDefinition<T> pd, T v, P p)
- throws UnknownPropertyDefinitionException {
- throw new UnknownPropertyDefinitionException(pd, p);
- }
+ /**
+ * Visit an unknown type of property value. Implementations of this method
+ * can provide default behavior for unknown types of property.
+ * <p>
+ * The default implementation of this method throws an
+ * {@link UnknownPropertyDefinitionException}. Sub-classes can override this
+ * method with their own default behavior.
+ *
+ * @param <T>
+ * The type of property value to visit.
+ * @param pd
+ * The property definition.
+ * @param v
+ * The property value.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ * @throws UnknownPropertyDefinitionException
+ * Visitor implementations may optionally throw this exception.
+ */
+ public <T> R visitUnknown(PropertyDefinition<T> pd, T v, P p) {
+ throw new UnknownPropertyDefinitionException(pd, p);
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Reference.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Reference.java
index c00ccd7..d4c8f0d 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Reference.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Reference.java
@@ -66,14 +66,13 @@
* relation.
*/
public static <C extends ConfigurationClient, S extends Configuration> Reference<C, S> parseDN(
- ManagedObjectPath<?, ?> path, InstantiableRelationDefinition<C, S> relationDef, String dnAsString)
- throws IllegalArgumentException {
+ ManagedObjectPath<?, ?> path, InstantiableRelationDefinition<C, S> relationDef, String dnAsString) {
AbstractManagedObjectDefinition<?, ?> definition = path.getManagedObjectDefinition();
RelationDefinition<?, ?> tmp = definition.getRelationDefinition(relationDef.getName());
if (tmp != relationDef) {
// TODO : i18n ?
throw new IllegalArgumentException("The relation \"" + relationDef.getName()
- + "\" is not associated with the definition \"" + definition.getName() + "\"");
+ + "\" is not associated with the definition \"" + definition.getName() + "\"");
}
DN dn = DN.valueOf(dnAsString);
@@ -117,14 +116,13 @@
* definition, or if the provided name is empty.
*/
public static <C extends ConfigurationClient, S extends Configuration> Reference<C, S> parseName(
- ManagedObjectPath<?, ?> p, InstantiableRelationDefinition<C, S> rd, String s)
- throws IllegalArgumentException {
+ ManagedObjectPath<?, ?> p, InstantiableRelationDefinition<C, S> rd, String s) {
// Sanity checks.
AbstractManagedObjectDefinition<?, ?> d = p.getManagedObjectDefinition();
RelationDefinition<?, ?> tmp = d.getRelationDefinition(rd.getName());
if (tmp != rd) {
throw new IllegalArgumentException("The relation \"" + rd.getName()
- + "\" is not associated with the definition \"" + d.getName() + "\"");
+ + "\" is not associated with the definition \"" + d.getName() + "\"");
}
if (s.trim().length() == 0) {
@@ -145,8 +143,7 @@
private final InstantiableRelationDefinition<C, S> relation;
// Private constructor.
- private Reference(ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> relation, String name)
- throws IllegalArgumentException {
+ private Reference(ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> relation, String name) {
this.relation = relation;
this.name = name;
this.path = parent.child(relation, name);
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationDefinition.java
index 6849c43..2ab0034 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationDefinition.java
@@ -92,7 +92,8 @@
* @param <D>
* The type of relation definition constructed by this builder.
*/
- protected abstract static class AbstractBuilder<C extends ConfigurationClient, S extends Configuration, D extends RelationDefinition<C, S>> {
+ protected abstract static class AbstractBuilder<C extends ConfigurationClient, S extends Configuration,
+ D extends RelationDefinition<C, S>> {
// Common fields.
private final Common<C, S> common;
@@ -108,7 +109,7 @@
* The child managed object definition.
*/
protected AbstractBuilder(AbstractManagedObjectDefinition<?, ?> pd, String name,
- AbstractManagedObjectDefinition<C, S> cd) {
+ AbstractManagedObjectDefinition<C, S> cd) {
this.common = new Common<C, S>(pd, name, cd);
}
@@ -169,7 +170,8 @@
private final AbstractManagedObjectDefinition<?, ?> pd;
// Private constructor.
- private Common(AbstractManagedObjectDefinition<?, ?> pd, String name, AbstractManagedObjectDefinition<C, S> cd) {
+ private Common(AbstractManagedObjectDefinition<?, ?> pd, String name,
+ AbstractManagedObjectDefinition<C, S> cd) {
this.name = name;
this.pd = pd;
this.cd = cd;
@@ -240,8 +242,8 @@
public final LocalizableMessage getDescription(Locale locale) {
try {
String property = "relation." + common.name + ".description";
- return ManagedObjectDefinitionI18NResource.getInstance()
- .getMessage(getParentDefinition(), property, locale);
+ return ManagedObjectDefinitionI18NResource.getInstance().getMessage(getParentDefinition(), property,
+ locale);
} catch (MissingResourceException e) {
return null;
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationDefinitionVisitor.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationDefinitionVisitor.java
index a035834..1832573 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationDefinitionVisitor.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationDefinitionVisitor.java
@@ -26,104 +26,93 @@
package org.opends.server.admin;
-
-
/**
- * A visitor of relation definitions, in the style of the visitor
- * design pattern. Classes implementing this interface can query
- * relation definitions in a type-safe manner when the kind of
- * relation definition is unknown at compile time. When a visitor is
- * passed to a relation definition's accept method, the corresponding
- * visit method most applicable to that relation definition is
- * invoked.
+ * A visitor of relation definitions, in the style of the visitor design
+ * pattern. Classes implementing this interface can query relation definitions
+ * in a type-safe manner when the kind of relation definition is unknown at
+ * compile time. When a visitor is passed to a relation definition's accept
+ * method, the corresponding visit method most applicable to that relation
+ * definition is invoked.
*
* @param <R>
- * The return type of this visitor's methods. Use
- * {@link java.lang.Void} for visitors that do not need to
- * return results.
+ * The return type of this visitor's methods. Use
+ * {@link java.lang.Void} for visitors that do not need to return
+ * results.
* @param <P>
- * The type of the additional parameter to this visitor's
- * methods. Use {@link java.lang.Void} for visitors that do
- * not need an additional parameter.
+ * The type of the additional parameter to this visitor's methods.
+ * Use {@link java.lang.Void} for visitors that do not need an
+ * additional parameter.
*/
public interface RelationDefinitionVisitor<R, P> {
- /**
- * Visit an instantiable relation definition.
- *
- * @param <C>
- * The type of client managed object configuration that the
- * relation definition refers to.
- * @param <S>
- * The type of server managed object configuration that the
- * relation definition refers to.
- * @param rd
- * The instantiable relation definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- <C extends ConfigurationClient, S extends Configuration> R visitInstantiable(
- InstantiableRelationDefinition<C, S> rd, P p);
+ /**
+ * Visit an instantiable relation definition.
+ *
+ * @param <C>
+ * The type of client managed object configuration that the
+ * relation definition refers to.
+ * @param <S>
+ * The type of server managed object configuration that the
+ * relation definition refers to.
+ * @param rd
+ * The instantiable relation definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ <C extends ConfigurationClient, S extends Configuration> R visitInstantiable(
+ InstantiableRelationDefinition<C, S> rd, P p);
+ /**
+ * Visit a set relation definition.
+ *
+ * @param <C>
+ * The type of client managed object configuration that the
+ * relation definition refers to.
+ * @param <S>
+ * The type of server managed object configuration that the
+ * relation definition refers to.
+ * @param rd
+ * The set relation definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ <C extends ConfigurationClient, S extends Configuration> R visitSet(SetRelationDefinition<C, S> rd, P p);
+ /**
+ * Visit an optional relation definition.
+ *
+ * @param <C>
+ * The type of client managed object configuration that the
+ * relation definition refers to.
+ * @param <S>
+ * The type of server managed object configuration that the
+ * relation definition refers to.
+ * @param rd
+ * The optional relation definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ <C extends ConfigurationClient, S extends Configuration> R visitOptional(OptionalRelationDefinition<C, S> rd, P p);
- /**
- * Visit a set relation definition.
- *
- * @param <C>
- * The type of client managed object configuration that the
- * relation definition refers to.
- * @param <S>
- * The type of server managed object configuration that the
- * relation definition refers to.
- * @param rd
- * The set relation definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- <C extends ConfigurationClient, S extends Configuration> R visitSet(
- SetRelationDefinition<C, S> rd, P p);
-
-
-
- /**
- * Visit an optional relation definition.
- *
- * @param <C>
- * The type of client managed object configuration that the
- * relation definition refers to.
- * @param <S>
- * The type of server managed object configuration that the
- * relation definition refers to.
- * @param rd
- * The optional relation definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- <C extends ConfigurationClient, S extends Configuration> R visitOptional(
- OptionalRelationDefinition<C, S> rd, P p);
-
-
-
- /**
- * Visit a singleton relation definition.
- *
- * @param <C>
- * The type of client managed object configuration that the
- * relation definition refers to.
- * @param <S>
- * The type of server managed object configuration that the
- * relation definition refers to.
- * @param rd
- * The singleton relation definition to visit.
- * @param p
- * A visitor specified parameter.
- * @return Returns a visitor specified result.
- */
- <C extends ConfigurationClient, S extends Configuration> R visitSingleton(
- SingletonRelationDefinition<C, S> rd, P p);
+ /**
+ * Visit a singleton relation definition.
+ *
+ * @param <C>
+ * The type of client managed object configuration that the
+ * relation definition refers to.
+ * @param <S>
+ * The type of server managed object configuration that the
+ * relation definition refers to.
+ * @param rd
+ * The singleton relation definition to visit.
+ * @param p
+ * A visitor specified parameter.
+ * @return Returns a visitor specified result.
+ */
+ <C extends ConfigurationClient, S extends Configuration> R visitSingleton(SingletonRelationDefinition<C, S> rd,
+ P p);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationOption.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationOption.java
index 1d8336a..ec758b7 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationOption.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelationOption.java
@@ -26,23 +26,20 @@
package org.opends.server.admin;
-
-
/**
- * This enumeration contains various options that can be associated
- * with relation definitions.
+ * This enumeration contains various options that can be associated with
+ * relation definitions.
*/
public enum RelationOption {
- /**
- * Use this option to identify relations which should be considered
- * as advanced and should not be exposed by default in client
- * applications.
- */
- ADVANCED,
+ /**
+ * Use this option to identify relations which should be considered as
+ * advanced and should not be exposed by default in client applications.
+ */
+ ADVANCED,
- /**
- * Use this option to identify relations which must not be directly
- * exposed in client applications.
- */
- HIDDEN;
+ /**
+ * Use this option to identify relations which must not be directly exposed
+ * in client applications.
+ */
+ HIDDEN;
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelativeInheritedDefaultBehaviorProvider.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelativeInheritedDefaultBehaviorProvider.java
index 2107fc6..a5fd94e 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelativeInheritedDefaultBehaviorProvider.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/RelativeInheritedDefaultBehaviorProvider.java
@@ -25,125 +25,106 @@
*/
package org.opends.server.admin;
-
-
/**
- * A default behavior provider which retrieves default values from a
- * parent managed object. It should be used by properties which
- * inherit their default value(s) from properties held in an other
- * managed object.
+ * A default behavior provider which retrieves default values from a parent
+ * managed object. It should be used by properties which inherit their default
+ * value(s) from properties held in an other managed object.
*
* @param <T>
- * The type of values represented by this provider.
+ * The type of values represented by this provider.
*/
-public final class RelativeInheritedDefaultBehaviorProvider<T> extends
- DefaultBehaviorProvider<T> {
+public final class RelativeInheritedDefaultBehaviorProvider<T> extends DefaultBehaviorProvider<T> {
- // The type of managed object expected at the relative offset.
- private final AbstractManagedObjectDefinition<?, ?> d;
+ // The type of managed object expected at the relative offset.
+ private final AbstractManagedObjectDefinition<?, ?> d;
- // The relative offset (where 1 = parent, 2 = grandparent) of the
- // managed object containing the property.
- private final int offset;
+ // The relative offset (where 1 = parent, 2 = grandparent) of the
+ // managed object containing the property.
+ private final int offset;
- // The name of the property containing the inherited default values.
- private final String propertyName;
+ // The name of the property containing the inherited default values.
+ private final String propertyName;
-
-
- /**
- * Create a relative inherited default behavior provider associated
- * with a parent managed object.
- *
- * @param d
- * The type of parent managed object expected at the
- * relative location.
- * @param propertyName
- * The name of the property containing the inherited
- * default values.
- * @param offset
- * The relative location of the parent managed object
- * (where 0 is the managed object itself, 1 is the parent,
- * and 2 is the grand-parent).
- * @throws IllegalArgumentException
- * If the offset is less than 0.
- */
- public RelativeInheritedDefaultBehaviorProvider(
- AbstractManagedObjectDefinition<?, ?> d, String propertyName, int offset)
- throws IllegalArgumentException {
- // We do not decode the property name now because the property
- // might not have been constructed at this point (e.g. when the
- // offset is 0).
- if (offset < 0) {
- throw new IllegalArgumentException("Negative offset");
+ /**
+ * Create a relative inherited default behavior provider associated with a
+ * parent managed object.
+ *
+ * @param d
+ * The type of parent managed object expected at the relative
+ * location.
+ * @param propertyName
+ * The name of the property containing the inherited default
+ * values.
+ * @param offset
+ * The relative location of the parent managed object (where 0 is
+ * the managed object itself, 1 is the parent, and 2 is the
+ * grand-parent).
+ * @throws IllegalArgumentException
+ * If the offset is less than 0.
+ */
+ public RelativeInheritedDefaultBehaviorProvider(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
+ int offset) {
+ // We do not decode the property name now because the property
+ // might not have been constructed at this point (e.g. when the
+ // offset is 0).
+ if (offset < 0) {
+ throw new IllegalArgumentException("Negative offset");
+ }
+ this.d = d;
+ this.propertyName = propertyName;
+ this.offset = offset;
}
- this.d = d;
- this.propertyName = propertyName;
- this.offset = offset;
- }
+ /**
+ * {@inheritDoc}
+ */
+ public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
+ return v.visitRelativeInherited(this, p);
+ }
+ /**
+ * Get the definition of the parent managed object containing the inherited
+ * default values.
+ *
+ * @return Returns the definition of the parent managed object containing
+ * the inherited default values.
+ */
+ public AbstractManagedObjectDefinition<?, ?> getManagedObjectDefinition() {
+ return d;
+ }
- /**
- * {@inheritDoc}
- */
- public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
- return v.visitRelativeInherited(this, p);
- }
+ /**
+ * Get the absolute path of the managed object containing the property which
+ * has the default values.
+ *
+ * @param path
+ * The path of the current managed object from which the relative
+ * path should be determined.
+ * @return Returns the absolute path of the managed object containing the
+ * property which has the default values.
+ */
+ public ManagedObjectPath<?, ?> getManagedObjectPath(ManagedObjectPath<?, ?> path) {
+ return path.parent(offset);
+ }
+ /**
+ * Gets the name of the property containing the inherited default values.
+ *
+ * @return Returns the name of the property containing the inherited default
+ * values.
+ */
+ public String getPropertyName() {
+ return propertyName;
+ }
-
- /**
- * Get the definition of the parent managed object containing the
- * inherited default values.
- *
- * @return Returns the definition of the parent managed object
- * containing the inherited default values.
- */
- public AbstractManagedObjectDefinition<?, ?> getManagedObjectDefinition() {
- return d;
- }
-
-
-
- /**
- * Get the absolute path of the managed object containing the
- * property which has the default values.
- *
- * @param path
- * The path of the current managed object from which the
- * relative path should be determined.
- * @return Returns the absolute path of the managed object
- * containing the property which has the default values.
- */
- public ManagedObjectPath<?, ?> getManagedObjectPath(
- ManagedObjectPath<?, ?> path) {
- return path.parent(offset);
- }
-
-
-
- /**
- * Gets the name of the property containing the inherited default
- * values.
- *
- * @return Returns the name of the property containing the inherited
- * default values.
- */
- public String getPropertyName() {
- return propertyName;
- }
-
-
-
- /**
- * Get the relative location of the parent managed object.
- *
- * @return Returns the relative location of the parent managed
- * object (where 0 is the managed object itself, 1 is the
- * parent, and 2 is the grand-parent).
- */
- public int getRelativeOffset() {
- return offset;
- }
+ /**
+ * Get the relative location of the parent managed object.
+ *
+ * @return Returns the relative location of the parent managed object (where
+ * 0 is the managed object itself, 1 is the parent, and 2 is the
+ * grand-parent).
+ */
+ public int getRelativeOffset() {
+ return offset;
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SetRelationDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SetRelationDefinition.java
index bbe0762..aafa42e 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SetRelationDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SetRelationDefinition.java
@@ -47,7 +47,7 @@
* definition refers to.
*/
public final class SetRelationDefinition<C extends ConfigurationClient, S extends Configuration> extends
- RelationDefinition<C, S> {
+ RelationDefinition<C, S> {
/**
* An interface for incrementally constructing set relation definitions.
@@ -60,14 +60,15 @@
* relation definition refers to.
*/
public static final class Builder<C extends ConfigurationClient, S extends Configuration> extends
- AbstractBuilder<C, S, SetRelationDefinition<C, S>> {
+ AbstractBuilder<C, S, SetRelationDefinition<C, S>> {
// The plural name of the relation.
private final String pluralName;
// The optional default managed objects associated with this
// set relation definition.
- private final Map<String, DefaultManagedObject<? extends C, ? extends S>> defaultManagedObjects = new HashMap<String, DefaultManagedObject<? extends C, ? extends S>>();
+ private final Map<String, DefaultManagedObject<? extends C, ? extends S>> defaultManagedObjects =
+ new HashMap<String, DefaultManagedObject<? extends C, ? extends S>>();
/**
* Creates a new builder which can be used to incrementally build a set
@@ -83,7 +84,7 @@
* The child managed object definition.
*/
public Builder(AbstractManagedObjectDefinition<?, ?> pd, String name, String pluralName,
- AbstractManagedObjectDefinition<C, S> cd) {
+ AbstractManagedObjectDefinition<C, S> cd) {
super(pd, name, cd);
this.pluralName = pluralName;
}
@@ -96,7 +97,7 @@
*/
public void setDefaultManagedObject(DefaultManagedObject<? extends C, ? extends S> defaultManagedObject) {
this.defaultManagedObjects.put(defaultManagedObject.getManagedObjectDefinition().getName(),
- defaultManagedObject);
+ defaultManagedObject);
}
/**
@@ -118,7 +119,7 @@
// Private constructor.
private SetRelationDefinition(Common<C, S> common, String pluralName,
- Map<String, DefaultManagedObject<? extends C, ? extends S>> defaultManagedObjects) {
+ Map<String, DefaultManagedObject<? extends C, ? extends S>> defaultManagedObjects) {
super(common);
this.pluralName = pluralName;
this.defaultManagedObjects = defaultManagedObjects;
@@ -144,8 +145,7 @@
* If there is no default managed object associated with the
* provided name.
*/
- public DefaultManagedObject<? extends C, ? extends S> getDefaultManagedObject(String name)
- throws IllegalArgumentException {
+ public DefaultManagedObject<? extends C, ? extends S> getDefaultManagedObject(String name) {
if (!defaultManagedObjects.containsKey(name)) {
throw new IllegalArgumentException("unrecognized default managed object \"" + name + "\"");
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SingletonRelationDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SingletonRelationDefinition.java
index c1b525c..8631a66 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SingletonRelationDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SingletonRelationDefinition.java
@@ -26,158 +26,130 @@
package org.opends.server.admin;
-
-
/**
- * A managed object composite relationship definition which represents
- * a composition of a single managed object (i.e. the managed object
- * must be present).
+ * A managed object composite relationship definition which represents a
+ * composition of a single managed object (i.e. the managed object must be
+ * present).
*
* @param <C>
- * The type of client managed object configuration that this
- * relation definition refers to.
+ * The type of client managed object configuration that this relation
+ * definition refers to.
* @param <S>
- * The type of server managed object configuration that this
- * relation definition refers to.
+ * The type of server managed object configuration that this relation
+ * definition refers to.
*/
-public final class SingletonRelationDefinition
- <C extends ConfigurationClient, S extends Configuration>
- extends RelationDefinition<C, S> {
+public final class SingletonRelationDefinition<C extends ConfigurationClient, S extends Configuration> extends
+ RelationDefinition<C, S> {
- /**
- * An interface for incrementally constructing singleton relation
- * definitions.
- *
- * @param <C>
- * The type of client managed object configuration that
- * this relation definition refers to.
- * @param <S>
- * The type of server managed object configuration that
- * this relation definition refers to.
- */
- public static final class Builder
- <C extends ConfigurationClient, S extends Configuration>
- extends AbstractBuilder<C, S, SingletonRelationDefinition<C, S>> {
+ /**
+ * An interface for incrementally constructing singleton relation
+ * definitions.
+ *
+ * @param <C>
+ * The type of client managed object configuration that this
+ * relation definition refers to.
+ * @param <S>
+ * The type of server managed object configuration that this
+ * relation definition refers to.
+ */
+ public static final class Builder<C extends ConfigurationClient, S extends Configuration> extends
+ AbstractBuilder<C, S, SingletonRelationDefinition<C, S>> {
+
+ // The optional default managed object associated with this
+ // singleton relation.
+ private DefaultManagedObject<? extends C, ? extends S> defaultManagedObject = null;
+
+ /**
+ * Creates a new builder which can be used to incrementally build an
+ * singleton relation definition.
+ *
+ * @param pd
+ * The parent managed object definition.
+ * @param name
+ * The name of the relation.
+ * @param cd
+ * The child managed object definition.
+ */
+ // @Checkstyle:ignore
+ public Builder(AbstractManagedObjectDefinition<?, ?> pd, String name, AbstractManagedObjectDefinition<C, S> cd) {
+ super(pd, name, cd);
+ }
+
+ /**
+ * Sets the optional default managed object associated with this
+ * singleton relation definition.
+ *
+ * @param defaultManagedObject
+ * The default managed object or <code>null</code> if there
+ * is no default managed object defined for this relation
+ * definition.
+ */
+ public void setDefaultManagedObject(DefaultManagedObject<? extends C, ? extends S> defaultManagedObject) {
+ this.defaultManagedObject = defaultManagedObject;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected SingletonRelationDefinition<C, S> buildInstance(Common<C, S> common) {
+ return new SingletonRelationDefinition<C, S>(common, defaultManagedObject);
+ }
+
+ }
// The optional default managed object associated with this
// singleton relation.
- private DefaultManagedObject<? extends C, ? extends S>
- defaultManagedObject = null;
+ private final DefaultManagedObject<? extends C, ? extends S> defaultManagedObject;
-
-
- /**
- * Creates a new builder which can be used to incrementally build
- * an singleton relation definition.
- *
- * @param pd
- * The parent managed object definition.
- * @param name
- * The name of the relation.
- * @param cd
- * The child managed object definition.
- */
- public Builder(AbstractManagedObjectDefinition<?, ?> pd, String name,
- AbstractManagedObjectDefinition<C, S> cd) {
- super(pd, name, cd);
- }
-
-
-
- /**
- * Sets the optional default managed object associated with this
- * singleton relation definition.
- *
- * @param defaultManagedObject
- * The default managed object or <code>null</code> if
- * there is no default managed object defined for this
- * relation definition.
- */
- public void setDefaultManagedObject(
+ // Private constructor.
+ private SingletonRelationDefinition(Common<C, S> common,
DefaultManagedObject<? extends C, ? extends S> defaultManagedObject) {
- this.defaultManagedObject = defaultManagedObject;
+ super(common);
+ this.defaultManagedObject = defaultManagedObject;
}
-
-
/**
* {@inheritDoc}
*/
@Override
- protected SingletonRelationDefinition<C, S> buildInstance(
- Common<C, S> common) {
- return new SingletonRelationDefinition<C, S>(common,
- defaultManagedObject);
+ public <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p) {
+ return v.visitSingleton(this, p);
}
- }
-
-
-
- // The optional default managed object associated with this
- // singleton relation.
- private final DefaultManagedObject<? extends C, ? extends S>
- defaultManagedObject;
-
-
-
- // Private constructor.
- private SingletonRelationDefinition(Common<C, S> common,
- DefaultManagedObject<? extends C, ? extends S> defaultManagedObject) {
- super(common);
- this.defaultManagedObject = defaultManagedObject;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p) {
- return v.visitSingleton(this, p);
- }
-
-
-
- /**
- * Gets the optional default managed object associated with this
- * singleton relation definition.
- *
- * @return Returns the default managed object or <code>null</code>
- * if there is no default managed object defined for this
- * relation definition.
- */
- public DefaultManagedObject<? extends C, ? extends S>
- getDefaultManagedObject() {
- return defaultManagedObject;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void toString(StringBuilder builder) {
- builder.append("name=");
- builder.append(getName());
- builder.append(" type=singleton parent=");
- builder.append(getParentDefinition().getName());
- builder.append(" child=");
- builder.append(getChildDefinition().getName());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void initialize() throws Exception {
- if (defaultManagedObject != null) {
- defaultManagedObject.initialize();
+ /**
+ * Gets the optional default managed object associated with this singleton
+ * relation definition.
+ *
+ * @return Returns the default managed object or <code>null</code> if there
+ * is no default managed object defined for this relation
+ * definition.
+ */
+ public DefaultManagedObject<? extends C, ? extends S> getDefaultManagedObject() {
+ return defaultManagedObject;
}
- }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void toString(StringBuilder builder) {
+ builder.append("name=");
+ builder.append(getName());
+ builder.append(" type=singleton parent=");
+ builder.append(getParentDefinition().getName());
+ builder.append(" child=");
+ builder.append(getChildDefinition().getName());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initialize() throws Exception {
+ if (defaultManagedObject != null) {
+ defaultManagedObject.initialize();
+ }
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SizePropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SizePropertyDefinition.java
index 08364ca..b5382c3 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SizePropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SizePropertyDefinition.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
import org.forgerock.util.Reject;
@@ -59,7 +58,7 @@
* An interface for incrementally constructing memory size property
* definitions.
*/
- public static class Builder extends AbstractBuilder<Long, SizePropertyDefinition> {
+ public static final class Builder extends AbstractBuilder<Long, SizePropertyDefinition> {
// The lower limit of the property value in bytes.
private long lowerLimit = 0L;
@@ -86,7 +85,7 @@
* If a negative lower limit was specified, or if the lower
* limit is greater than the upper limit.
*/
- public final void setLowerLimit(long lowerLimit) throws IllegalArgumentException {
+ public final void setLowerLimit(long lowerLimit) {
if (lowerLimit < 0) {
throw new IllegalArgumentException("Negative lower limit");
}
@@ -106,7 +105,7 @@
* lower limit was specified, or the lower limit is greater
* than the upper limit.
*/
- public final void setLowerLimit(String lowerLimit) throws IllegalArgumentException {
+ public final void setLowerLimit(String lowerLimit) {
setLowerLimit(SizeUnit.parseValue(lowerLimit, SizeUnit.BYTES));
}
@@ -119,7 +118,7 @@
* @throws IllegalArgumentException
* If the lower limit is greater than the upper limit.
*/
- public final void setUpperLimit(Long upperLimit) throws IllegalArgumentException {
+ public final void setUpperLimit(Long upperLimit) {
if (upperLimit != null) {
if (upperLimit < 0) {
throw new IllegalArgumentException("Negative upper limit");
@@ -141,7 +140,7 @@
* If the upper limit could not be parsed, or if the lower
* limit is greater than the upper limit.
*/
- public final void setUpperLimit(String upperLimit) throws IllegalArgumentException {
+ public final void setUpperLimit(String upperLimit) {
if (upperLimit == null) {
setUpperLimit((Long) null);
} else {
@@ -166,10 +165,10 @@
*/
@Override
protected SizePropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<Long> defaultBehavior) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<Long> defaultBehavior) {
return new SizePropertyDefinition(d, propertyName, options, adminAction, defaultBehavior, lowerLimit,
- upperLimit, allowUnlimited);
+ upperLimit, allowUnlimited);
}
}
@@ -190,8 +189,8 @@
// Private constructor.
private SizePropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<Long> defaultBehavior, Long lowerLimit, Long upperLimit, boolean allowUnlimited) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<Long> defaultBehavior, Long lowerLimit, Long upperLimit, boolean allowUnlimited) {
super(d, Long.class, propertyName, options, adminAction, defaultBehavior);
this.lowerLimit = lowerLimit;
this.upperLimit = upperLimit;
@@ -231,7 +230,7 @@
* {@inheritDoc}
*/
@Override
- public void validateValue(Long value) throws IllegalPropertyValueException {
+ public void validateValue(Long value) {
Reject.ifNull(value);
if (!allowUnlimited && value < lowerLimit) {
@@ -251,7 +250,7 @@
* {@inheritDoc}
*/
@Override
- public String encodeValue(Long value) throws IllegalPropertyValueException {
+ public String encodeValue(Long value) {
Reject.ifNull(value);
// Make sure that we correctly encode negative values as "unlimited".
@@ -277,7 +276,7 @@
* {@inheritDoc}
*/
@Override
- public Long decodeValue(String value) throws IllegalPropertyValueStringException {
+ public Long decodeValue(String value) {
Reject.ifNull(value);
// First check for the special "unlimited" value when necessary.
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SizeUnit.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SizeUnit.java
index 29668e2..43a9249 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SizeUnit.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/SizeUnit.java
@@ -25,369 +25,328 @@
*/
package org.opends.server.admin;
-
-
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
-
/**
* This enumeration defines various memory size units.
*/
public enum SizeUnit {
- /**
- * A byte unit.
- */
- BYTES(1L, "b", "bytes"),
+ /**
+ * A byte unit.
+ */
+ BYTES(1L, "b", "bytes"),
- /**
- * A gibi-byte unit.
- */
- GIBI_BYTES((long) 1024 * 1024 * 1024, "gib", "gibibytes"),
+ /**
+ * A gibi-byte unit.
+ */
+ GIBI_BYTES((long) 1024 * 1024 * 1024, "gib", "gibibytes"),
- /**
- * A giga-byte unit.
- */
- GIGA_BYTES((long) 1000 * 1000 * 1000, "gb", "gigabytes"),
+ /**
+ * A giga-byte unit.
+ */
+ GIGA_BYTES((long) 1000 * 1000 * 1000, "gb", "gigabytes"),
- /**
- * A kibi-byte unit.
- */
- KIBI_BYTES(1024L, "kib", "kibibytes"),
+ /**
+ * A kibi-byte unit.
+ */
+ KIBI_BYTES(1024L, "kib", "kibibytes"),
- /**
- * A kilo-byte unit.
- */
- KILO_BYTES(1000L, "kb", "kilobytes"),
+ /**
+ * A kilo-byte unit.
+ */
+ KILO_BYTES(1000L, "kb", "kilobytes"),
- /**
- * A mebi-byte unit.
- */
- MEBI_BYTES((long) 1024 * 1024, "mib", "mebibytes"),
+ /**
+ * A mebi-byte unit.
+ */
+ MEBI_BYTES((long) 1024 * 1024, "mib", "mebibytes"),
- /**
- * A mega-byte unit.
- */
- MEGA_BYTES((long) 1000 * 1000, "mb", "megabytes"),
+ /**
+ * A mega-byte unit.
+ */
+ MEGA_BYTES((long) 1000 * 1000, "mb", "megabytes"),
- /**
- * A tebi-byte unit.
- */
- TEBI_BYTES((long) 1024 * 1024 * 1024 * 1024, "tib", "tebibytes"),
+ /**
+ * A tebi-byte unit.
+ */
+ TEBI_BYTES((long) 1024 * 1024 * 1024 * 1024, "tib", "tebibytes"),
- /**
- * A tera-byte unit.
- */
- TERA_BYTES((long) 1000 * 1000 * 1000 * 1000, "tb", "terabytes");
+ /**
+ * A tera-byte unit.
+ */
+ TERA_BYTES((long) 1000 * 1000 * 1000 * 1000, "tb", "terabytes");
- // A lookup table for resolving a unit from its name.
- private static final Map<String, SizeUnit> nameToUnit;
- static {
- nameToUnit = new HashMap<String, SizeUnit>();
+ // A lookup table for resolving a unit from its name.
+ private static final Map<String, SizeUnit> NAME_TO_UNIT;
+ static {
+ NAME_TO_UNIT = new HashMap<String, SizeUnit>();
- for (SizeUnit unit : SizeUnit.values()) {
- nameToUnit.put(unit.shortName, unit);
- nameToUnit.put(unit.longName, unit);
- }
- }
-
-
-
- /**
- * Gets the best-fit unit for the specified number of bytes. The
- * returned unit will be able to represent the number of bytes using
- * a decimal number comprising of an integer part which is greater
- * than zero. Bigger units are chosen in preference to smaller units
- * and binary units are only returned if they are an exact fit. If
- * the number of bytes is zero then the {@link #BYTES} unit is
- * always returned. For example:
- *
- * <pre>
- * getBestFitUnit(0) // BYTES
- * getBestFitUnit(999) // BYTES
- * getBestFitUnit(1000) // KILO_BYTES
- * getBestFitUnit(1024) // KIBI_BYTES
- * getBestFitUnit(1025) // KILO_BYTES
- * getBestFitUnit(999999) // KILO_BYTES
- * getBestFitUnit(1000000) // MEGA_BYTES
- * </pre>
- *
- * @param bytes
- * The number of bytes.
- * @return Returns the best fit unit.
- * @throws IllegalArgumentException
- * If <code>bytes</code> is negative.
- * @see #getBestFitUnitExact(long)
- */
- public static SizeUnit getBestFitUnit(long bytes)
- throws IllegalArgumentException {
- if (bytes < 0) {
- throw new IllegalArgumentException("negative number of bytes: " + bytes);
- } else if (bytes == 0) {
- // Always use bytes for zero values.
- return BYTES;
- } else {
- // Determine best fit: prefer non-binary units unless binary
- // fits exactly.
- SizeUnit[] nonBinary = new SizeUnit[] { TERA_BYTES, GIGA_BYTES,
- MEGA_BYTES, KILO_BYTES };
- SizeUnit[] binary = new SizeUnit[] { TEBI_BYTES, GIBI_BYTES, MEBI_BYTES,
- KIBI_BYTES };
-
- for (int i = 0; i < nonBinary.length; i++) {
- if ((bytes % binary[i].getSize()) == 0) {
- return binary[i];
- } else if ((bytes / nonBinary[i].getSize()) > 0) {
- return nonBinary[i];
+ for (SizeUnit unit : SizeUnit.values()) {
+ NAME_TO_UNIT.put(unit.shortName, unit);
+ NAME_TO_UNIT.put(unit.longName, unit);
}
- }
-
- return BYTES;
}
- }
+ /**
+ * Gets the best-fit unit for the specified number of bytes. The returned
+ * unit will be able to represent the number of bytes using a decimal number
+ * comprising of an integer part which is greater than zero. Bigger units
+ * are chosen in preference to smaller units and binary units are only
+ * returned if they are an exact fit. If the number of bytes is zero then
+ * the {@link #BYTES} unit is always returned. For example:
+ *
+ * <pre>
+ * getBestFitUnit(0) // BYTES
+ * getBestFitUnit(999) // BYTES
+ * getBestFitUnit(1000) // KILO_BYTES
+ * getBestFitUnit(1024) // KIBI_BYTES
+ * getBestFitUnit(1025) // KILO_BYTES
+ * getBestFitUnit(999999) // KILO_BYTES
+ * getBestFitUnit(1000000) // MEGA_BYTES
+ * </pre>
+ *
+ * @param bytes
+ * The number of bytes.
+ * @return Returns the best fit unit.
+ * @throws IllegalArgumentException
+ * If <code>bytes</code> is negative.
+ * @see #getBestFitUnitExact(long)
+ */
+ public static SizeUnit getBestFitUnit(long bytes) {
+ if (bytes < 0) {
+ throw new IllegalArgumentException("negative number of bytes: " + bytes);
+ } else if (bytes == 0) {
+ // Always use bytes for zero values.
+ return BYTES;
+ } else {
+ // Determine best fit: prefer non-binary units unless binary
+ // fits exactly.
+ SizeUnit[] nonBinary = new SizeUnit[] { TERA_BYTES, GIGA_BYTES, MEGA_BYTES, KILO_BYTES };
+ SizeUnit[] binary = new SizeUnit[] { TEBI_BYTES, GIBI_BYTES, MEBI_BYTES, KIBI_BYTES };
+ for (int i = 0; i < nonBinary.length; i++) {
+ if ((bytes % binary[i].getSize()) == 0) {
+ return binary[i];
+ } else if ((bytes / nonBinary[i].getSize()) > 0) {
+ return nonBinary[i];
+ }
+ }
- /**
- * Gets the best-fit unit for the specified number of bytes which
- * can represent the provided value using an integral value. Bigger
- * units are chosen in preference to smaller units. If the number of
- * bytes is zero then the {@link #BYTES} unit is always returned.
- * For example:
- *
- * <pre>
- * getBestFitUnitExact(0) // BYTES
- * getBestFitUnitExact(999) // BYTES
- * getBestFitUnitExact(1000) // KILO_BYTES
- * getBestFitUnitExact(1024) // KIBI_BYTES
- * getBestFitUnitExact(1025) // BYTES
- * getBestFitUnitExact(999999) // BYTES
- * getBestFitUnitExact(1000000) // MEGA_BYTES
- * </pre>
- *
- * @param bytes
- * The number of bytes.
- * @return Returns the best fit unit can represent the provided
- * value using an integral value.
- * @throws IllegalArgumentException
- * If <code>bytes</code> is negative.
- * @see #getBestFitUnit(long)
- */
- public static SizeUnit getBestFitUnitExact(long bytes)
- throws IllegalArgumentException {
- if (bytes < 0) {
- throw new IllegalArgumentException("negative number of bytes: " + bytes);
- } else if (bytes == 0) {
- // Always use bytes for zero values.
- return BYTES;
- } else {
- // Determine best fit.
- SizeUnit[] units = new SizeUnit[] { TEBI_BYTES, TERA_BYTES, GIBI_BYTES,
- GIGA_BYTES, MEBI_BYTES, MEGA_BYTES, KIBI_BYTES, KILO_BYTES };
-
- for (SizeUnit unit : units) {
- if ((bytes % unit.getSize()) == 0) {
- return unit;
+ return BYTES;
}
- }
-
- return BYTES;
- }
- }
-
-
-
- /**
- * Get the unit corresponding to the provided unit name.
- *
- * @param s
- * The name of the unit. Can be the abbreviated or long
- * name and can contain white space and mixed case
- * characters.
- * @return Returns the unit corresponding to the provided unit name.
- * @throws IllegalArgumentException
- * If the provided name did not correspond to a known
- * memory size unit.
- */
- public static SizeUnit getUnit(String s) throws IllegalArgumentException {
- SizeUnit unit = nameToUnit.get(s.trim().toLowerCase());
- if (unit == null) {
- throw new IllegalArgumentException("Illegal memory size unit \"" + s
- + "\"");
- }
- return unit;
- }
-
-
-
- /**
- * Parse the provided size string and return its equivalent size in
- * bytes. The size string must specify the unit e.g. "10kb".
- *
- * @param s
- * The size string to be parsed.
- * @return Returns the parsed duration in bytes.
- * @throws NumberFormatException
- * If the provided size string could not be parsed.
- */
- public static long parseValue(String s) throws NumberFormatException {
- return parseValue(s, null);
- }
-
-
-
- /**
- * Parse the provided size string and return its equivalent size in
- * bytes.
- *
- * @param s
- * The size string to be parsed.
- * @param defaultUnit
- * The default unit to use if there is no unit specified in
- * the size string, or <code>null</code> if the string
- * must always contain a unit.
- * @return Returns the parsed size in bytes.
- * @throws NumberFormatException
- * If the provided size string could not be parsed.
- */
- public static long parseValue(String s, SizeUnit defaultUnit)
- throws NumberFormatException {
- // Value must be a floating point number followed by a unit.
- Pattern p = Pattern.compile("^\\s*(\\d+(\\.\\d+)?)\\s*(\\w+)?\\s*$");
- Matcher m = p.matcher(s);
-
- if (!m.matches()) {
- throw new NumberFormatException("Invalid size value \"" + s + "\"");
}
- // Group 1 is the float.
- double d;
- try {
- d = Double.valueOf(m.group(1));
- } catch (NumberFormatException e) {
- throw new NumberFormatException("Invalid size value \"" + s + "\"");
+ /**
+ * Gets the best-fit unit for the specified number of bytes which can
+ * represent the provided value using an integral value. Bigger units are
+ * chosen in preference to smaller units. If the number of bytes is zero
+ * then the {@link #BYTES} unit is always returned. For example:
+ *
+ * <pre>
+ * getBestFitUnitExact(0) // BYTES
+ * getBestFitUnitExact(999) // BYTES
+ * getBestFitUnitExact(1000) // KILO_BYTES
+ * getBestFitUnitExact(1024) // KIBI_BYTES
+ * getBestFitUnitExact(1025) // BYTES
+ * getBestFitUnitExact(999999) // BYTES
+ * getBestFitUnitExact(1000000) // MEGA_BYTES
+ * </pre>
+ *
+ * @param bytes
+ * The number of bytes.
+ * @return Returns the best fit unit can represent the provided value using
+ * an integral value.
+ * @throws IllegalArgumentException
+ * If <code>bytes</code> is negative.
+ * @see #getBestFitUnit(long)
+ */
+ public static SizeUnit getBestFitUnitExact(long bytes) {
+ if (bytes < 0) {
+ throw new IllegalArgumentException("negative number of bytes: " + bytes);
+ } else if (bytes == 0) {
+ // Always use bytes for zero values.
+ return BYTES;
+ } else {
+ // Determine best fit.
+ SizeUnit[] units =
+ new SizeUnit[] { TEBI_BYTES, TERA_BYTES, GIBI_BYTES, GIGA_BYTES, MEBI_BYTES, MEGA_BYTES, KIBI_BYTES,
+ KILO_BYTES };
+
+ for (SizeUnit unit : units) {
+ if ((bytes % unit.getSize()) == 0) {
+ return unit;
+ }
+ }
+
+ return BYTES;
+ }
}
- // Group 3 is the unit.
- String unitString = m.group(3);
- SizeUnit unit;
- if (unitString == null) {
- if (defaultUnit == null) {
- throw new NumberFormatException("Invalid size value \"" + s + "\"");
- } else {
- unit = defaultUnit;
- }
- } else {
- try {
- unit = getUnit(unitString);
- } catch (IllegalArgumentException e) {
- throw new NumberFormatException("Invalid size value \"" + s + "\"");
- }
+ /**
+ * Get the unit corresponding to the provided unit name.
+ *
+ * @param s
+ * The name of the unit. Can be the abbreviated or long name and
+ * can contain white space and mixed case characters.
+ * @return Returns the unit corresponding to the provided unit name.
+ * @throws IllegalArgumentException
+ * If the provided name did not correspond to a known memory
+ * size unit.
+ */
+ public static SizeUnit getUnit(String s) {
+ SizeUnit unit = NAME_TO_UNIT.get(s.trim().toLowerCase());
+ if (unit == null) {
+ throw new IllegalArgumentException("Illegal memory size unit \"" + s + "\"");
+ }
+ return unit;
}
- return unit.toBytes(d);
- }
-
- // The long name of the unit.
- private final String longName;
-
- // The abbreviation of the unit.
- private final String shortName;
-
- // The size of the unit in bytes.
- private final long sz;
-
-
-
- // Private constructor.
- private SizeUnit(long sz, String shortName, String longName) {
- this.sz = sz;
- this.shortName = shortName;
- this.longName = longName;
- }
-
-
-
- /**
- * Converts the specified size in bytes to this unit.
- *
- * @param amount
- * The size in bytes.
- * @return Returns size in this unit.
- */
- public double fromBytes(long amount) {
- return ((double) amount / sz);
- }
-
-
-
- /**
- * Get the long name of this unit.
- *
- * @return Returns the long name of this unit.
- */
- public String getLongName() {
- return longName;
- }
-
-
-
- /**
- * Get the abbreviated name of this unit.
- *
- * @return Returns the abbreviated name of this unit.
- */
- public String getShortName() {
- return shortName;
- }
-
-
-
- /**
- * Get the number of bytes that this unit represents.
- *
- * @return Returns the number of bytes that this unit represents.
- */
- public long getSize() {
- return sz;
- }
-
-
-
- /**
- * Converts the specified size in this unit to bytes.
- *
- * @param amount
- * The size as a quantity of this unit.
- * @return Returns the number of bytes that the size represents.
- *
- * @throws NumberFormatException
- * If the provided size exceeded long.MAX_VALUE.
- */
- public long toBytes(double amount) throws NumberFormatException {
- double value = sz * amount;
- if (value > Long.MAX_VALUE)
- {
- throw new NumberFormatException
- ("number too big (exceeded long.MAX_VALUE");
+ /**
+ * Parse the provided size string and return its equivalent size in bytes.
+ * The size string must specify the unit e.g. "10kb".
+ *
+ * @param s
+ * The size string to be parsed.
+ * @return Returns the parsed duration in bytes.
+ * @throws NumberFormatException
+ * If the provided size string could not be parsed.
+ */
+ public static long parseValue(String s) {
+ return parseValue(s, null);
}
- return (long) (value);
- }
+ /**
+ * Parse the provided size string and return its equivalent size in bytes.
+ *
+ * @param s
+ * The size string to be parsed.
+ * @param defaultUnit
+ * The default unit to use if there is no unit specified in the
+ * size string, or <code>null</code> if the string must always
+ * contain a unit.
+ * @return Returns the parsed size in bytes.
+ * @throws NumberFormatException
+ * If the provided size string could not be parsed.
+ */
+ public static long parseValue(String s, SizeUnit defaultUnit) {
+ // Value must be a floating point number followed by a unit.
+ Pattern p = Pattern.compile("^\\s*(\\d+(\\.\\d+)?)\\s*(\\w+)?\\s*$");
+ Matcher m = p.matcher(s);
+ if (!m.matches()) {
+ throw new NumberFormatException("Invalid size value \"" + s + "\"");
+ }
- /**
- * {@inheritDoc}
- * <p>
- * This implementation returns the abbreviated name of this size
- * unit.
- */
- @Override
- public String toString() {
- return shortName;
- }
+ // Group 1 is the float.
+ double d;
+ try {
+ d = Double.valueOf(m.group(1));
+ } catch (NumberFormatException e) {
+ throw new NumberFormatException("Invalid size value \"" + s + "\"");
+ }
+
+ // Group 3 is the unit.
+ String unitString = m.group(3);
+ SizeUnit unit;
+ if (unitString == null) {
+ if (defaultUnit == null) {
+ throw new NumberFormatException("Invalid size value \"" + s + "\"");
+ } else {
+ unit = defaultUnit;
+ }
+ } else {
+ try {
+ unit = getUnit(unitString);
+ } catch (IllegalArgumentException e) {
+ throw new NumberFormatException("Invalid size value \"" + s + "\"");
+ }
+ }
+
+ return unit.toBytes(d);
+ }
+
+ // The long name of the unit.
+ private final String longName;
+
+ // The abbreviation of the unit.
+ private final String shortName;
+
+ // The size of the unit in bytes.
+ private final long sz;
+
+ // Private constructor.
+ private SizeUnit(long sz, String shortName, String longName) {
+ this.sz = sz;
+ this.shortName = shortName;
+ this.longName = longName;
+ }
+
+ /**
+ * Converts the specified size in bytes to this unit.
+ *
+ * @param amount
+ * The size in bytes.
+ * @return Returns size in this unit.
+ */
+ public double fromBytes(long amount) {
+ return ((double) amount / sz);
+ }
+
+ /**
+ * Get the long name of this unit.
+ *
+ * @return Returns the long name of this unit.
+ */
+ public String getLongName() {
+ return longName;
+ }
+
+ /**
+ * Get the abbreviated name of this unit.
+ *
+ * @return Returns the abbreviated name of this unit.
+ */
+ public String getShortName() {
+ return shortName;
+ }
+
+ /**
+ * Get the number of bytes that this unit represents.
+ *
+ * @return Returns the number of bytes that this unit represents.
+ */
+ public long getSize() {
+ return sz;
+ }
+
+ /**
+ * Converts the specified size in this unit to bytes.
+ *
+ * @param amount
+ * The size as a quantity of this unit.
+ * @return Returns the number of bytes that the size represents.
+ * @throws NumberFormatException
+ * If the provided size exceeded long.MAX_VALUE.
+ */
+ public long toBytes(double amount) {
+ double value = sz * amount;
+ if (value > Long.MAX_VALUE) {
+ throw new NumberFormatException("number too big (exceeded long.MAX_VALUE");
+ }
+ return (long) (value);
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * This implementation returns the abbreviated name of this size unit.
+ */
+ @Override
+ public String toString() {
+ return shortName;
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/StringPropertyDefinition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/StringPropertyDefinition.java
index 92eeaf4..2e21341 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/StringPropertyDefinition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/StringPropertyDefinition.java
@@ -45,7 +45,7 @@
/**
* An interface for incrementally constructing string property definitions.
*/
- public static class Builder extends AbstractBuilder<String, StringPropertyDefinition> {
+ public static final class Builder extends AbstractBuilder<String, StringPropertyDefinition> {
// Flag indicating whether values of this property are
// case-insensitive.
@@ -91,7 +91,7 @@
* If the provided regular expression pattern has an invalid
* syntax.
*/
- public final void setPattern(String pattern, String patternUsage) throws PatternSyntaxException {
+ public final void setPattern(String pattern, String patternUsage) {
if (pattern == null) {
this.pattern = null;
this.patternUsage = null;
@@ -105,11 +105,11 @@
* {@inheritDoc}
*/
@Override
- protected StringPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<String> defaultBehavior) {
+ protected StringPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d,
+ String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<String> defaultBehavior) {
return new StringPropertyDefinition(d, propertyName, options, adminAction, defaultBehavior,
- isCaseInsensitive, pattern, patternUsage);
+ isCaseInsensitive, pattern, patternUsage);
}
}
@@ -141,9 +141,9 @@
// Private constructor.
private StringPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
- EnumSet<PropertyOption> options, AdministratorAction adminAction,
- DefaultBehaviorProvider<String> defaultBehavior, boolean isCaseInsensitive, Pattern pattern,
- String patternUsage) {
+ EnumSet<PropertyOption> options, AdministratorAction adminAction,
+ DefaultBehaviorProvider<String> defaultBehavior, boolean isCaseInsensitive, Pattern pattern,
+ String patternUsage) {
super(d, String.class, propertyName, options, adminAction, defaultBehavior);
this.isCaseInsensitive = isCaseInsensitive;
this.pattern = pattern;
@@ -170,7 +170,7 @@
* {@inheritDoc}
*/
@Override
- public String decodeValue(String value) throws IllegalPropertyValueStringException {
+ public String decodeValue(String value) {
Reject.ifNull(value);
try {
@@ -255,7 +255,7 @@
* {@inheritDoc}
*/
@Override
- public String normalizeValue(String value) throws IllegalPropertyValueException {
+ public String normalizeValue(String value) {
Reject.ifNull(value);
if (isCaseInsensitive()) {
@@ -269,7 +269,7 @@
* {@inheritDoc}
*/
@Override
- public void validateValue(String value) throws IllegalPropertyValueException {
+ public void validateValue(String value) {
Reject.ifNull(value);
if (pattern != null) {
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Tag.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Tag.java
index 85196a2..cbea691 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Tag.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/Tag.java
@@ -37,7 +37,6 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.admin.meta.RootCfgDefn;
-
/**
* An interface for querying the properties of a tag.
* <p>
@@ -45,8 +44,8 @@
*/
public final class Tag implements Comparable<Tag> {
- // All the tags.
- private static final Map<String, Tag> tags = new HashMap<String, Tag>();
+ /** All the tags. */
+ private static final Map<String, Tag> TAGS = new HashMap<String, Tag>();
/**
* Defines a new tag with the specified name.
@@ -58,7 +57,7 @@
Tag tag = new Tag(name);
// Register the tag.
- tags.put(name, tag);
+ TAGS.put(name, tag);
}
/**
@@ -70,13 +69,13 @@
* @throws IllegalArgumentException
* If the tag name was not recognized.
*/
- public static Tag valueOf(String name) throws IllegalArgumentException {
+ public static Tag valueOf(String name) {
Reject.ifNull(name);
// Hack to force initialization of the tag definitions.
RootCfgDefn.getInstance();
- Tag tag = tags.get(name.toLowerCase());
+ Tag tag = TAGS.get(name.toLowerCase());
if (tag == null) {
throw new IllegalArgumentException("Unknown tag \"" + name + "\"");
@@ -95,27 +94,23 @@
// Hack to force initialization of the tag definitions.
RootCfgDefn.getInstance();
- return Collections.unmodifiableCollection(tags.values());
+ return Collections.unmodifiableCollection(TAGS.values());
}
- // The name of the tag.
+ /** The name of the tag. */
private final String name;
- // Private constructor.
+ /** Private constructor. */
private Tag(String name) {
this.name = name;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public final int compareTo(Tag o) {
return name.compareTo(o.name);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public final boolean equals(Object obj) {
if (this == obj) {
@@ -165,17 +160,13 @@
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public final int hashCode() {
return name.hashCode();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public final String toString() {
return name;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/UndefinedDefaultBehaviorProvider.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/UndefinedDefaultBehaviorProvider.java
index 64589ff..ab292ff 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/UndefinedDefaultBehaviorProvider.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/UndefinedDefaultBehaviorProvider.java
@@ -25,34 +25,29 @@
*/
package org.opends.server.admin;
-
-
/**
- * A default behavior provider which indicates undefined behavior. It should
- * be used by properties which have no default values or behavior as such. For
+ * A default behavior provider which indicates undefined behavior. It should be
+ * used by properties which have no default values or behavior as such. For
* example, a description property, when left unset, has no default value and no
* side-effects.
*
* @param <T>
- * The type of values represented by this provider.
+ * The type of values represented by this provider.
*/
-public final class UndefinedDefaultBehaviorProvider<T> extends
- DefaultBehaviorProvider<T> {
+public final class UndefinedDefaultBehaviorProvider<T> extends DefaultBehaviorProvider<T> {
- /**
- * Create an undefined default behavior provider.
- */
- public UndefinedDefaultBehaviorProvider() {
- // No implementation required.
- }
+ /**
+ * Create an undefined default behavior provider.
+ */
+ public UndefinedDefaultBehaviorProvider() {
+ // No implementation required.
+ }
-
-
- /**
- * {@inheritDoc}
- */
- public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
- return v.visitUndefined(this, p);
- }
+ /**
+ * {@inheritDoc}
+ */
+ public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
+ return v.visitUndefined(this, p);
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/UnknownPropertyDefinitionException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/UnknownPropertyDefinitionException.java
index 10cade1..e9ccea0 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/UnknownPropertyDefinitionException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/UnknownPropertyDefinitionException.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin;
import static com.forgerock.opendj.ldap.AdminMessages.*;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AdminClientException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AdminClientException.java
index c78b3a7..a376316 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AdminClientException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AdminClientException.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin.client;
import org.forgerock.i18n.LocalizableMessage;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AuthenticationException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AuthenticationException.java
index c0dd0e9..070d310 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AuthenticationException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AuthenticationException.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin.client;
import org.forgerock.i18n.LocalizableMessage;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AuthenticationNotSupportedException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AuthenticationNotSupportedException.java
index a624e72..66a3bea 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AuthenticationNotSupportedException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/AuthenticationNotSupportedException.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin.client;
import org.forgerock.i18n.LocalizableMessage;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ClientConstraintHandler.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ClientConstraintHandler.java
index 2cc86e6..24c6411 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ClientConstraintHandler.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ClientConstraintHandler.java
@@ -70,15 +70,11 @@
* A list of messages to which error messages should be added.
* @return Returns <code>true</code> if this constraint is satisfied, or
* <code>false</code> if it is not.
- * @throws AuthorizationException
- * If an authorization failure prevented this constraint from
- * being evaluated.
- * @throws CommunicationException
- * If a communications problem prevented this constraint from
- * being evaluated.
+ * @throws ErrorResultException
+ * If an error occurs.
*/
public boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject,
- Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
+ Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
return true;
}
@@ -101,15 +97,11 @@
* A list of messages to which error messages should be added.
* @return Returns <code>true</code> if this modify is satisfied, or
* <code>false</code> if it is not.
- * @throws AuthorizationException
- * If an authorization failure prevented this constraint from
- * being evaluated.
- * @throws CommunicationException
- * If a communications problem prevented this constraint from
- * being evaluated.
+ * @throws ErrorResultException
+ * If an error occurs.
*/
public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
- Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
+ Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
return true;
}
@@ -135,7 +127,7 @@
* If an error occurs.
*/
public boolean isDeleteAcceptable(ManagementContext context, ManagedObjectPath<?, ?> path,
- Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
+ Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
return true;
}
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ConcurrentModificationException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ConcurrentModificationException.java
index f51ad8b..bc0dba0 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ConcurrentModificationException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ConcurrentModificationException.java
@@ -23,77 +23,62 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin.client;
-
-
import static com.forgerock.opendj.ldap.AdminMessages.*;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.admin.OperationsException;
-
-
/**
- * This exception is thrown when a critical concurrent modification is
- * detected by the client. This may be caused by another client
- * application removing a managed object whilst it is being managed.
+ * This exception is thrown when a critical concurrent modification is detected
+ * by the client. This may be caused by another client application removing a
+ * managed object whilst it is being managed.
*/
public class ConcurrentModificationException extends OperationsException {
- /**
- * Serialization ID.
- */
- private static final long serialVersionUID = -1467024486347612820L;
+ /**
+ * Serialization ID.
+ */
+ private static final long serialVersionUID = -1467024486347612820L;
+ /**
+ * Create a concurrent modification exception with a default message.
+ */
+ public ConcurrentModificationException() {
+ super(ERR_CONCURRENT_MODIFICATION_EXCEPTION_DEFAULT.get());
+ }
+ /**
+ * Create a concurrent modification exception with a cause and a default
+ * message.
+ *
+ * @param cause
+ * The cause.
+ */
+ public ConcurrentModificationException(Throwable cause) {
+ super(ERR_CONCURRENT_MODIFICATION_EXCEPTION_DEFAULT.get(), cause);
+ }
- /**
- * Create a concurrent modification exception with a default
- * message.
- */
- public ConcurrentModificationException() {
- super(ERR_CONCURRENT_MODIFICATION_EXCEPTION_DEFAULT.get());
- }
+ /**
+ * Create a concurrent modification exception with a message and cause.
+ *
+ * @param message
+ * The message.
+ * @param cause
+ * The cause.
+ */
+ public ConcurrentModificationException(LocalizableMessage message, Throwable cause) {
+ super(message, cause);
+ }
-
-
- /**
- * Create a concurrent modification exception with a cause and a
- * default message.
- *
- * @param cause
- * The cause.
- */
- public ConcurrentModificationException(Throwable cause) {
- super(ERR_CONCURRENT_MODIFICATION_EXCEPTION_DEFAULT.get(), cause);
- }
-
-
-
- /**
- * Create a concurrent modification exception with a message and
- * cause.
- *
- * @param message
- * The message.
- * @param cause
- * The cause.
- */
- public ConcurrentModificationException(LocalizableMessage message, Throwable cause) {
- super(message, cause);
- }
-
-
-
- /**
- * Create a concurrent modification exception with a message.
- *
- * @param message
- * The message.
- */
- public ConcurrentModificationException(LocalizableMessage message) {
- super(message);
- }
+ /**
+ * Create a concurrent modification exception with a message.
+ *
+ * @param message
+ * The message.
+ */
+ public ConcurrentModificationException(LocalizableMessage message) {
+ super(message);
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/IllegalManagedObjectNameException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/IllegalManagedObjectNameException.java
index 6b632d5..cca8526 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/IllegalManagedObjectNameException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/IllegalManagedObjectNameException.java
@@ -23,11 +23,8 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin.client;
-
-
import static com.forgerock.opendj.ldap.AdminMessages.*;
import org.forgerock.i18n.LocalizableMessage;
@@ -36,107 +33,90 @@
import org.opends.server.admin.PropertyDefinition;
import org.opends.server.admin.PropertyDefinitionUsageBuilder;
-
-
/**
- * Thrown when an attempt is made to create a new managed object with
- * an illegal name.
+ * Thrown when an attempt is made to create a new managed object with an illegal
+ * name.
* <p>
- * This exception can occur when a new managed object is given a name
- * which is either an empty string, a string containing just
- * white-spaces, or a string which is invalid according to the managed
- * object's naming property (if it has one).
+ * This exception can occur when a new managed object is given a name which is
+ * either an empty string, a string containing just white-spaces, or a string
+ * which is invalid according to the managed object's naming property (if it has
+ * one).
*/
public class IllegalManagedObjectNameException extends OperationsException {
- /**
- * Serialization ID.
- */
- private static final long serialVersionUID = 7491748228684293291L;
+ /**
+ * Serialization ID.
+ */
+ private static final long serialVersionUID = 7491748228684293291L;
+ /** Create the message. */
+ // @Checkstyle:ignore
+ private static LocalizableMessage createMessage(String illegalName, PropertyDefinition<?> namingPropertyDefinition) {
+ if (illegalName.length() == 0) {
+ return ERR_ILLEGAL_MANAGED_OBJECT_NAME_EXCEPTION_EMPTY.get();
+ } else if (illegalName.trim().length() == 0) {
+ return ERR_ILLEGAL_MANAGED_OBJECT_NAME_EXCEPTION_BLANK.get();
+ } else if (namingPropertyDefinition != null) {
+ try {
+ namingPropertyDefinition.decodeValue(illegalName);
+ } catch (IllegalPropertyValueStringException e) {
+ PropertyDefinitionUsageBuilder builder = new PropertyDefinitionUsageBuilder(true);
+ return ERR_ILLEGAL_MANAGED_OBJECT_NAME_EXCEPTION_SYNTAX.get(illegalName,
+ namingPropertyDefinition.getName(), builder.getUsage(namingPropertyDefinition));
+ }
+ }
-
- // Create the message
- private static LocalizableMessage createMessage(String illegalName,
- PropertyDefinition<?> namingPropertyDefinition) {
- if (illegalName.length() == 0) {
- return ERR_ILLEGAL_MANAGED_OBJECT_NAME_EXCEPTION_EMPTY.get();
- } else if (illegalName.trim().length() == 0) {
- return ERR_ILLEGAL_MANAGED_OBJECT_NAME_EXCEPTION_BLANK.get();
- } else if (namingPropertyDefinition != null) {
- try {
- namingPropertyDefinition.decodeValue(illegalName);
- } catch (IllegalPropertyValueStringException e) {
- PropertyDefinitionUsageBuilder builder =
- new PropertyDefinitionUsageBuilder(true);
- return ERR_ILLEGAL_MANAGED_OBJECT_NAME_EXCEPTION_SYNTAX.get(
- illegalName, namingPropertyDefinition.getName(), builder
- .getUsage(namingPropertyDefinition));
- }
+ return ERR_ILLEGAL_MANAGED_OBJECT_NAME_EXCEPTION_OTHER.get(illegalName);
}
- return ERR_ILLEGAL_MANAGED_OBJECT_NAME_EXCEPTION_OTHER.get(illegalName);
- }
+ /** The illegal name. */
+ private final String illegalName;
- // The illegal name.
- private final String illegalName;
+ /** The naming property definition if applicable. */
+ private final PropertyDefinition<?> namingPropertyDefinition;
- // The naming property definition if applicable.
- private final PropertyDefinition<?> namingPropertyDefinition;
+ /**
+ * Create a new illegal name exception and no naming property definition.
+ *
+ * @param illegalName
+ * The illegal managed object name.
+ */
+ public IllegalManagedObjectNameException(String illegalName) {
+ this(illegalName, null);
+ }
+ /**
+ * Create a new illegal name exception and a naming property definition.
+ *
+ * @param illegalName
+ * The illegal managed object name.
+ * @param namingPropertyDefinition
+ * The naming property definition.
+ */
+ public IllegalManagedObjectNameException(String illegalName, PropertyDefinition<?> namingPropertyDefinition) {
+ super(createMessage(illegalName, namingPropertyDefinition));
+ this.illegalName = illegalName;
+ this.namingPropertyDefinition = namingPropertyDefinition;
+ }
- /**
- * Create a new illegal name exception and no naming property
- * definition.
- *
- * @param illegalName
- * The illegal managed object name.
- */
- public IllegalManagedObjectNameException(String illegalName) {
- this(illegalName, null);
- }
+ /**
+ * Get the illegal managed object name.
+ *
+ * @return Returns the illegal managed object name.
+ */
+ public String getIllegalName() {
+ return illegalName;
+ }
-
-
- /**
- * Create a new illegal name exception and a naming property
- * definition.
- *
- * @param illegalName
- * The illegal managed object name.
- * @param namingPropertyDefinition
- * The naming property definition.
- */
- public IllegalManagedObjectNameException(String illegalName,
- PropertyDefinition<?> namingPropertyDefinition) {
- super(createMessage(illegalName, namingPropertyDefinition));
-
- this.illegalName = illegalName;
- this.namingPropertyDefinition = namingPropertyDefinition;
- }
-
-
-
- /**
- * Get the illegal managed object name.
- *
- * @return Returns the illegal managed object name.
- */
- public String getIllegalName() {
- return illegalName;
- }
-
-
-
- /**
- * Get the naming property definition if applicable.
- *
- * @return Returns naming property definition, or <code>null</code>
- * if none was specified.
- */
- public PropertyDefinition<?> getNamingPropertyDefinition() {
- return namingPropertyDefinition;
- }
+ /**
+ * Get the naming property definition if applicable.
+ *
+ * @return Returns naming property definition, or <code>null</code> if none
+ * was specified.
+ */
+ public PropertyDefinition<?> getNamingPropertyDefinition() {
+ return namingPropertyDefinition;
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagedObject.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagedObject.java
index f66a446..262f52f 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagedObject.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagedObject.java
@@ -34,7 +34,6 @@
import org.opends.server.admin.Configuration;
import org.opends.server.admin.DefaultBehaviorException;
import org.opends.server.admin.DefinitionDecodingException;
-import org.opends.server.admin.IllegalPropertyValueException;
import org.opends.server.admin.InstantiableRelationDefinition;
import org.opends.server.admin.ManagedObjectAlreadyExistsException;
import org.opends.server.admin.ManagedObjectDefinition;
@@ -140,7 +139,7 @@
* @param <S>
* The expected type of the child managed object server
* configuration.
- * @param <CC>
+ * @param <C1>
* The actual type of the added managed object configuration
* client.
* @param r
@@ -161,10 +160,9 @@
* If the relation definition is not associated with this
* managed object's definition.
*/
- <C extends ConfigurationClient, S extends Configuration, CC extends C> ManagedObject<CC> createChild(
- InstantiableRelationDefinition<C, S> r, ManagedObjectDefinition<CC, ? extends S> d, String name,
- Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException,
- IllegalArgumentException;
+ <C extends ConfigurationClient, S extends Configuration, C1 extends C> ManagedObject<C1> createChild(
+ InstantiableRelationDefinition<C, S> r, ManagedObjectDefinition<C1, ? extends S> d, String name,
+ Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException;
/**
* Creates a new child managed object bound to the specified optional
@@ -179,7 +177,7 @@
* @param <S>
* The expected type of the child managed object server
* configuration.
- * @param <CC>
+ * @param <C1>
* The actual type of the added managed object configuration
* client.
* @param r
@@ -196,9 +194,9 @@
* If the relation definition is not associated with this
* managed object's definition.
*/
- <C extends ConfigurationClient, S extends Configuration, CC extends C> ManagedObject<CC> createChild(
- OptionalRelationDefinition<C, S> r, ManagedObjectDefinition<CC, ? extends S> d,
- Collection<DefaultBehaviorException> exceptions) throws IllegalArgumentException;
+ <C extends ConfigurationClient, S extends Configuration, C1 extends C> ManagedObject<C1> createChild(
+ OptionalRelationDefinition<C, S> r, ManagedObjectDefinition<C1, ? extends S> d,
+ Collection<DefaultBehaviorException> exceptions);
/**
* Creates a new child managed object bound to the specified set relation.
@@ -213,7 +211,7 @@
* @param <S>
* The expected type of the child managed object server
* configuration.
- * @param <CC>
+ * @param <C1>
* The actual type of the added managed object configuration
* client.
* @param r
@@ -230,9 +228,9 @@
* If the relation definition is not associated with this
* managed object's definition.
*/
- <C extends ConfigurationClient, S extends Configuration, CC extends C> ManagedObject<CC> createChild(
- SetRelationDefinition<C, S> r, ManagedObjectDefinition<CC, ? extends S> d,
- Collection<DefaultBehaviorException> exceptions) throws IllegalArgumentException;
+ <C extends ConfigurationClient, S extends Configuration, C1 extends C> ManagedObject<C1> createChild(
+ SetRelationDefinition<C, S> r, ManagedObjectDefinition<C1, ? extends S> d,
+ Collection<DefaultBehaviorException> exceptions);
/**
* Retrieves an instantiable child managed object.
@@ -267,7 +265,7 @@
* If any other error occurs.
*/
<C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
- InstantiableRelationDefinition<C, S> r, String name) throws IllegalArgumentException,
+ InstantiableRelationDefinition<C, S> r, String name) throws
DefinitionDecodingException, ManagedObjectDecodingException, ManagedObjectNotFoundException,
ConcurrentModificationException, ErrorResultException;
@@ -302,7 +300,7 @@
* If any other error occurs.
*/
<C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
- OptionalRelationDefinition<C, S> r) throws IllegalArgumentException, DefinitionDecodingException,
+ OptionalRelationDefinition<C, S> r) throws DefinitionDecodingException,
ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
ErrorResultException;
@@ -337,7 +335,7 @@
* If any other error occurs.
*/
<C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
- SingletonRelationDefinition<C, S> r) throws IllegalArgumentException, DefinitionDecodingException,
+ SingletonRelationDefinition<C, S> r) throws DefinitionDecodingException,
ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
ErrorResultException;
@@ -374,7 +372,7 @@
* If any other error occurs.
*/
<C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
- SetRelationDefinition<C, S> r, String name) throws IllegalArgumentException, DefinitionDecodingException,
+ SetRelationDefinition<C, S> r, String name) throws DefinitionDecodingException,
ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
ErrorResultException;
@@ -405,7 +403,7 @@
* Gets a mutable copy of the set of default values for the specified
* property.
*
- * @param <PD>
+ * @param <P>
* The type of the property to be retrieved.
* @param pd
* The property to be retrieved.
@@ -415,7 +413,7 @@
* If the property definition is not associated with this
* managed object's definition.
*/
- <PD> SortedSet<PD> getPropertyDefaultValues(PropertyDefinition<PD> pd) throws IllegalArgumentException;
+ <P> SortedSet<P> getPropertyDefaultValues(PropertyDefinition<P> pd);
/**
* Gets the effective value of the specified property.
@@ -423,7 +421,7 @@
* See the class description for more information about how the effective
* property value is derived.
*
- * @param <PD>
+ * @param <P>
* The type of the property to be retrieved.
* @param pd
* The property to be retrieved.
@@ -433,7 +431,7 @@
* If the property definition is not associated with this
* managed object's definition.
*/
- <PD> PD getPropertyValue(PropertyDefinition<PD> pd) throws IllegalArgumentException;
+ <P> P getPropertyValue(PropertyDefinition<P> pd);
/**
* Gets a mutable copy of the set of effective values for the specified
@@ -442,7 +440,7 @@
* See the class description for more information about how the effective
* property values are derived.
*
- * @param <PD>
+ * @param <P>
* The type of the property to be retrieved.
* @param pd
* The property to be retrieved.
@@ -452,7 +450,8 @@
* If the property definition is not associated with this
* managed object's definition.
*/
- <PD> SortedSet<PD> getPropertyValues(PropertyDefinition<PD> pd) throws IllegalArgumentException;
+ @Override
+ <P> SortedSet<P> getPropertyValues(PropertyDefinition<P> pd);
/**
* Determines whether or not the specified property is set. If the property
@@ -467,7 +466,7 @@
* If the property definition is not associated with this
* managed object's definition.
*/
- boolean isPropertyPresent(PropertyDefinition<?> pd) throws IllegalArgumentException;
+ boolean isPropertyPresent(PropertyDefinition<?> pd);
/**
* Determines whether or not the optional managed object associated with the
@@ -483,9 +482,6 @@
* The optional relation definition.
* @return Returns <code>true</code> if the optional managed object exists,
* <code>false</code> otherwise.
- * @throws IllegalArgumentException
- * If the relation definition is not associated with this
- * managed object's definition.
* @throws ConcurrentModificationException
* If this managed object has been removed from the server by
* another client.
@@ -493,7 +489,7 @@
* If there is any other error.
*/
<C extends ConfigurationClient, S extends Configuration> boolean hasChild(OptionalRelationDefinition<C, S> r)
- throws IllegalArgumentException, ConcurrentModificationException, ErrorResultException;
+ throws ConcurrentModificationException, ErrorResultException;
/**
* Lists the child managed objects associated with the specified
@@ -518,7 +514,7 @@
* If any other error occurs.
*/
<C extends ConfigurationClient, S extends Configuration> String[] listChildren(
- InstantiableRelationDefinition<C, S> r) throws IllegalArgumentException, ConcurrentModificationException,
+ InstantiableRelationDefinition<C, S> r) throws ConcurrentModificationException,
ErrorResultException;
/**
@@ -538,9 +534,6 @@
* The managed object definition.
* @return Returns the names of the child managed objects which are a
* sub-type of the specified managed object definition.
- * @throws IllegalArgumentException
- * If the relation definition is not associated with this
- * managed object's definition.
* @throws ConcurrentModificationException
* If this managed object has been removed from the server by
* another client.
@@ -549,7 +542,7 @@
*/
<C extends ConfigurationClient, S extends Configuration> String[] listChildren(
InstantiableRelationDefinition<C, S> r, AbstractManagedObjectDefinition<? extends C, ? extends S> d)
- throws IllegalArgumentException, ConcurrentModificationException, ErrorResultException;
+ throws ConcurrentModificationException, ErrorResultException;
/**
* Lists the child managed objects associated with the specified set
@@ -565,9 +558,6 @@
* The set relation definition.
* @return Returns the names of the child managed objects which for set
* relations are the definition names of each managed object.
- * @throws IllegalArgumentException
- * If the relation definition is not associated with this
- * managed object's definition.
* @throws ConcurrentModificationException
* If this managed object has been removed from the server by
* another client.
@@ -575,7 +565,7 @@
* If any other error occurs.
*/
<C extends ConfigurationClient, S extends Configuration> String[] listChildren(SetRelationDefinition<C, S> r)
- throws IllegalArgumentException, ConcurrentModificationException, ErrorResultException;
+ throws ConcurrentModificationException, ErrorResultException;
/**
* Lists the child managed objects associated with the specified set
@@ -603,7 +593,7 @@
* If any other error occurs.
*/
<C extends ConfigurationClient, S extends Configuration> String[] listChildren(SetRelationDefinition<C, S> r,
- AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws IllegalArgumentException,
+ AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws
ConcurrentModificationException, ErrorResultException;
/**
@@ -637,7 +627,7 @@
* If any other error occurs.
*/
<C extends ConfigurationClient, S extends Configuration> void removeChild(InstantiableRelationDefinition<C, S> r,
- String name) throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
+ String name) throws ManagedObjectNotFoundException, OperationRejectedException,
ConcurrentModificationException, ErrorResultException;
/**
@@ -651,9 +641,6 @@
* relation definition refers to.
* @param r
* The optional relation definition.
- * @throws IllegalArgumentException
- * If the relation definition is not associated with this
- * managed object's definition.
* @throws ManagedObjectNotFoundException
* If the managed object could not be removed because it could
* not found on the server.
@@ -669,7 +656,7 @@
* If any other error occurs.
*/
<C extends ConfigurationClient, S extends Configuration> void removeChild(OptionalRelationDefinition<C, S> r)
- throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
+ throws ManagedObjectNotFoundException, OperationRejectedException,
ConcurrentModificationException, ErrorResultException;
/**
@@ -685,9 +672,6 @@
* The set relation definition.
* @param name
* The name of the child managed object to be removed.
- * @throws IllegalArgumentException
- * If the relation definition is not associated with this
- * managed object's definition.
* @throws ManagedObjectNotFoundException
* If the managed object could not be removed because it could
* not found on the server.
@@ -702,8 +686,8 @@
* @throws ErrorResultException
* If any other error occurs.
*/
- <C extends ConfigurationClient, S extends Configuration> void removeChild(SetRelationDefinition<C, S> r, String name)
- throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
+ <C extends ConfigurationClient, S extends Configuration> void removeChild(SetRelationDefinition<C, S> r,
+ String name) throws ManagedObjectNotFoundException, OperationRejectedException,
ConcurrentModificationException, ErrorResultException;
/**
@@ -711,34 +695,27 @@
* <p>
* See the class description for more information regarding pending values.
*
- * @param <PD>
+ * @param <P>
* The type of the property to be modified.
* @param pd
* The property to be modified.
* @param value
* The new pending value for the property, or <code>null</code>
* if the property should be reset to its default behavior.
- * @throws IllegalPropertyValueException
- * If the new pending value is deemed to be invalid according to
- * the property definition.
* @throws PropertyIsReadOnlyException
* If this is not a new managed object and the property is
* read-only or for monitoring purposes.
* @throws PropertyIsMandatoryException
* If an attempt was made to remove a mandatory property.
- * @throws IllegalArgumentException
- * If the specified property definition is not associated with
- * this managed object.
*/
- <PD> void setPropertyValue(PropertyDefinition<PD> pd, PD value) throws IllegalPropertyValueException,
- PropertyIsReadOnlyException, PropertyIsMandatoryException, IllegalArgumentException;
+ <P> void setPropertyValue(PropertyDefinition<P> pd, P value);
/**
* Sets a new pending values for the specified property.
* <p>
* See the class description for more information regarding pending values.
*
- * @param <PD>
+ * @param <P>
* The type of the property to be modified.
* @param pd
* The property to be modified.
@@ -747,9 +724,6 @@
* property (an empty set indicates that the property should be
* reset to its default behavior). The set will not be referenced
* by this managed object.
- * @throws IllegalPropertyValueException
- * If a new pending value is deemed to be invalid according to
- * the property definition.
* @throws PropertyIsSingleValuedException
* If an attempt was made to add multiple pending values to a
* single-valued property.
@@ -758,12 +732,7 @@
* read-only or for monitoring purposes.
* @throws PropertyIsMandatoryException
* If an attempt was made to remove a mandatory property.
- * @throws IllegalArgumentException
- * If the specified property definition is not associated with
- * this managed object.
*/
- <PD> void setPropertyValues(PropertyDefinition<PD> pd, Collection<PD> values) throws IllegalPropertyValueException,
- PropertyIsSingleValuedException, PropertyIsReadOnlyException, PropertyIsMandatoryException,
- IllegalArgumentException;
+ <P> void setPropertyValues(PropertyDefinition<P> pd, Collection<P> values);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagedObjectDecodingException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagedObjectDecodingException.java
index 6cda369..9c78524 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagedObjectDecodingException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagedObjectDecodingException.java
@@ -23,11 +23,8 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin.client;
-
-
import static com.forgerock.opendj.ldap.AdminMessages.*;
import java.util.Collection;
@@ -41,104 +38,88 @@
import org.opends.server.admin.ManagedObjectDefinition;
import org.opends.server.admin.PropertyException;
-
-
/**
- * The requested managed object was found but one or more of its
- * properties could not be decoded successfully.
+ * The requested managed object was found but one or more of its properties
+ * could not be decoded successfully.
*/
public class ManagedObjectDecodingException extends DecodingException {
- /**
- * Version ID required by serializable classes.
- */
- private static final long serialVersionUID = -4268510652395945357L;
+ /**
+ * Version ID required by serializable classes.
+ */
+ private static final long serialVersionUID = -4268510652395945357L;
+ // Create the message.
+ private static LocalizableMessage createMessage(ManagedObject<?> partialManagedObject,
+ Collection<PropertyException> causes) {
+ Reject.ifNull(causes);
+ Reject.ifFalse(!causes.isEmpty(), "causes should not be empty");
+ ManagedObjectDefinition<?, ?> d = partialManagedObject.getManagedObjectDefinition();
+ if (causes.size() == 1) {
+ return ERR_MANAGED_OBJECT_DECODING_EXCEPTION_SINGLE.get(d.getUserFriendlyName(), causes.iterator().next()
+ .getLocalizableMessageObject());
+ } else {
+ LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
- // Create the message.
- private static LocalizableMessage createMessage(ManagedObject<?> partialManagedObject,
- Collection<PropertyException> causes) {
- Reject.ifNull(causes);
- Reject.ifFalse(!causes.isEmpty(), "causes should not be empty");
+ boolean isFirst = true;
+ for (PropertyException cause : causes) {
+ if (!isFirst) {
+ builder.append("; ");
+ }
+ builder.append(cause.getLocalizableMessageObject());
+ isFirst = false;
+ }
- ManagedObjectDefinition<?, ?> d = partialManagedObject
- .getManagedObjectDefinition();
- if (causes.size() == 1) {
- return ERR_MANAGED_OBJECT_DECODING_EXCEPTION_SINGLE.get(d
- .getUserFriendlyName(), causes.iterator().next().getLocalizableMessageObject());
- } else {
- LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
-
- boolean isFirst = true;
- for (PropertyException cause : causes) {
- if (!isFirst) {
- builder.append("; ");
+ return ERR_MANAGED_OBJECT_DECODING_EXCEPTION_PLURAL.get(d.getUserFriendlyName(), builder.toMessage());
}
- builder.append(cause.getLocalizableMessageObject());
- isFirst = false;
- }
-
- return ERR_MANAGED_OBJECT_DECODING_EXCEPTION_PLURAL.get(d
- .getUserFriendlyName(), builder.toMessage());
}
- }
- // The exception(s) that caused this decoding exception.
- private final Collection<PropertyException> causes;
+ // The exception(s) that caused this decoding exception.
+ private final Collection<PropertyException> causes;
- // The partially created managed object.
- private final ManagedObject<?> partialManagedObject;
+ // The partially created managed object.
+ private final ManagedObject<?> partialManagedObject;
+ /**
+ * Create a new property decoding exception.
+ *
+ * @param partialManagedObject
+ * The partially created managed object containing properties
+ * which were successfully decoded and empty properties for those
+ * which were not (this may include empty mandatory properties).
+ * @param causes
+ * The exception(s) that caused this decoding exception.
+ */
+ public ManagedObjectDecodingException(ManagedObject<?> partialManagedObject, Collection<PropertyException> causes) {
+ super(createMessage(partialManagedObject, causes));
+ this.partialManagedObject = partialManagedObject;
+ this.causes = Collections.unmodifiableList(new LinkedList<PropertyException>(causes));
+ }
- /**
- * Create a new property decoding exception.
- *
- * @param partialManagedObject
- * The partially created managed object containing
- * properties which were successfully decoded and empty
- * properties for those which were not (this may include
- * empty mandatory properties).
- * @param causes
- * The exception(s) that caused this decoding exception.
- */
- public ManagedObjectDecodingException(ManagedObject<?> partialManagedObject,
- Collection<PropertyException> causes) {
- super(createMessage(partialManagedObject, causes));
+ /**
+ * Get an unmodifiable collection view of the causes of this exception.
+ *
+ * @return Returns an unmodifiable collection view of the causes of this
+ * exception.
+ */
+ public Collection<PropertyException> getCauses() {
+ return causes;
+ }
- this.partialManagedObject = partialManagedObject;
- this.causes = Collections
- .unmodifiableList(new LinkedList<PropertyException>(causes));
- }
-
-
-
- /**
- * Get an unmodifiable collection view of the causes of this
- * exception.
- *
- * @return Returns an unmodifiable collection view of the causes of
- * this exception.
- */
- public Collection<PropertyException> getCauses() {
- return causes;
- }
-
-
-
- /**
- * Get the partially created managed object containing properties
- * which were successfully decoded and empty properties for those
- * which were not (this may include empty mandatory properties).
- *
- * @return Returns the partially created managed object containing
- * properties which were successfully decoded and empty
- * properties for those which were not (this may include
- * empty mandatory properties).
- */
- public ManagedObject<?> getPartialManagedObject() {
- return partialManagedObject;
- }
+ /**
+ * Get the partially created managed object containing properties which were
+ * successfully decoded and empty properties for those which were not (this
+ * may include empty mandatory properties).
+ *
+ * @return Returns the partially created managed object containing
+ * properties which were successfully decoded and empty properties
+ * for those which were not (this may include empty mandatory
+ * properties).
+ */
+ public ManagedObject<?> getPartialManagedObject() {
+ return partialManagedObject;
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagementContext.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagementContext.java
index 8f0ef36..1890048 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagementContext.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ManagementContext.java
@@ -89,7 +89,7 @@
*/
public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd, String name)
- throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
+ throws ManagedObjectNotFoundException, OperationRejectedException,
ErrorResultException {
return getDriver().deleteManagedObject(parent, rd, name);
}
@@ -124,7 +124,7 @@
* If any other error occurs.
*/
public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
- ManagedObjectPath<?, ?> parent, OptionalRelationDefinition<C, S> rd) throws IllegalArgumentException,
+ ManagedObjectPath<?, ?> parent, OptionalRelationDefinition<C, S> rd) throws
ManagedObjectNotFoundException, OperationRejectedException, ErrorResultException {
return getDriver().deleteManagedObject(parent, rd);
}
@@ -161,7 +161,7 @@
*/
public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd, String name)
- throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
+ throws ManagedObjectNotFoundException, OperationRejectedException,
ErrorResultException {
return getDriver().deleteManagedObject(parent, rd, name);
}
@@ -205,7 +205,7 @@
/**
* Gets the effective value of a property in the named managed object.
*
- * @param <PD>
+ * @param <P>
* The type of the property to be retrieved.
* @param path
* The path of the managed object containing the property.
@@ -228,10 +228,9 @@
* @throws ErrorResultException
* If any other error occurs.
*/
- public final <PD> PD getPropertyValue(ManagedObjectPath<?, ?> path, PropertyDefinition<PD> pd)
- throws IllegalArgumentException, DefinitionDecodingException, ErrorResultException,
- ManagedObjectNotFoundException, PropertyException {
- Set<PD> values = getPropertyValues(path, pd);
+ public final <P> P getPropertyValue(ManagedObjectPath<?, ?> path, PropertyDefinition<P> pd)
+ throws DefinitionDecodingException, ErrorResultException, ManagedObjectNotFoundException {
+ Set<P> values = getPropertyValues(path, pd);
if (values.isEmpty()) {
return null;
} else {
@@ -242,7 +241,7 @@
/**
* Gets the effective values of a property in the named managed object.
*
- * @param <PD>
+ * @param <P>
* The type of the property to be retrieved.
* @param path
* The path of the managed object containing the property.
@@ -265,9 +264,8 @@
* @throws ErrorResultException
* If any other error occurs.
*/
- public final <PD> SortedSet<PD> getPropertyValues(ManagedObjectPath<?, ?> path, PropertyDefinition<PD> pd)
- throws IllegalArgumentException, DefinitionDecodingException, ErrorResultException,
- ManagedObjectNotFoundException, PropertyException {
+ public final <P> SortedSet<P> getPropertyValues(ManagedObjectPath<?, ?> path, PropertyDefinition<P> pd)
+ throws DefinitionDecodingException, ErrorResultException, ManagedObjectNotFoundException {
return getDriver().getPropertyValues(path, pd);
}
@@ -316,7 +314,7 @@
* If any other error occurs.
*/
public final <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
- ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd) throws IllegalArgumentException,
+ ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd) throws
ManagedObjectNotFoundException, ErrorResultException {
return listManagedObjects(parent, rd, rd.getChildDefinition());
}
@@ -349,7 +347,7 @@
*/
public final <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd,
- AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws IllegalArgumentException,
+ AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws
ManagedObjectNotFoundException, ErrorResultException {
return getDriver().listManagedObjects(parent, rd, d);
}
@@ -377,7 +375,7 @@
* If any other error occurs.
*/
public final <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
- ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd) throws IllegalArgumentException,
+ ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd) throws
ManagedObjectNotFoundException, ErrorResultException {
return getDriver().listManagedObjects(parent, rd, rd.getChildDefinition());
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/MissingMandatoryPropertiesException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/MissingMandatoryPropertiesException.java
index a50d738..086101e 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/MissingMandatoryPropertiesException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/MissingMandatoryPropertiesException.java
@@ -23,11 +23,8 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin.client;
-
-
import static com.forgerock.opendj.ldap.AdminMessages.*;
import java.util.ArrayList;
@@ -40,133 +37,114 @@
import org.opends.server.admin.OperationsException;
import org.opends.server.admin.PropertyIsMandatoryException;
-
-
/**
- * This exception is thrown when an attempt is made to add or modify a
- * managed object when one or more of its mandatory properties are
- * undefined.
+ * This exception is thrown when an attempt is made to add or modify a managed
+ * object when one or more of its mandatory properties are undefined.
*/
public class MissingMandatoryPropertiesException extends OperationsException {
- /**
- * Serialization ID.
- */
- private static final long serialVersionUID = 6342522125252055588L;
+ /**
+ * Serialization ID.
+ */
+ private static final long serialVersionUID = 6342522125252055588L;
+ // Create the message.
+ private static LocalizableMessage createMessage(Collection<PropertyIsMandatoryException> causes) {
+ Reject.ifNull(causes);
+ Reject.ifFalse(!causes.isEmpty(), "causes should not be empty");
+ if (causes.size() == 1) {
+ return ERR_MISSING_MANDATORY_PROPERTIES_EXCEPTION_SINGLE.get(causes.iterator().next()
+ .getPropertyDefinition().getName());
+ } else {
+ LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
- // Create the message.
- private static LocalizableMessage createMessage(
- Collection<PropertyIsMandatoryException> causes) {
- Reject.ifNull(causes);
- Reject.ifFalse(!causes.isEmpty(), "causes should not be empty");
+ boolean isFirst = true;
+ for (PropertyIsMandatoryException cause : causes) {
+ if (!isFirst) {
+ builder.append(", ");
+ }
+ builder.append(cause.getPropertyDefinition().getName());
+ isFirst = false;
+ }
- if (causes.size() == 1) {
- return ERR_MISSING_MANDATORY_PROPERTIES_EXCEPTION_SINGLE.get(causes
- .iterator().next().getPropertyDefinition().getName());
- } else {
- LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
-
- boolean isFirst = true;
- for (PropertyIsMandatoryException cause : causes) {
- if (!isFirst) {
- builder.append(", ");
+ return ERR_MISSING_MANDATORY_PROPERTIES_EXCEPTION_PLURAL.get(builder.toMessage());
}
- builder.append(cause.getPropertyDefinition().getName());
- isFirst = false;
- }
-
- return ERR_MISSING_MANDATORY_PROPERTIES_EXCEPTION_PLURAL.get(builder
- .toMessage());
}
- }
- // The causes of this exception.
- private final Collection<PropertyIsMandatoryException> causes;
+ // The causes of this exception.
+ private final Collection<PropertyIsMandatoryException> causes;
- // Indicates whether the exception occurred during managed object
- // creation.
- private final boolean isCreate;
+ // Indicates whether the exception occurred during managed object
+ // creation.
+ private final boolean isCreate;
- // The user friendly name of the component that caused this
- // exception.
- private final LocalizableMessage ufn;
+ // The user friendly name of the component that caused this
+ // exception.
+ private final LocalizableMessage ufn;
+ /**
+ * Creates a new missing mandatory properties exception with the provided
+ * causes.
+ *
+ * @param ufn
+ * The user friendly name of the component that caused this
+ * exception.
+ * @param causes
+ * The causes of this exception (must be non-<code>null</code>
+ * and non-empty).
+ * @param isCreate
+ * Indicates whether the exception occurred during managed object
+ * creation.
+ */
+ public MissingMandatoryPropertiesException(LocalizableMessage ufn,
+ Collection<PropertyIsMandatoryException> causes, boolean isCreate) {
+ super(createMessage(causes));
+ this.causes = new ArrayList<PropertyIsMandatoryException>(causes);
+ this.ufn = ufn;
+ this.isCreate = isCreate;
+ }
- /**
- * Creates a new missing mandatory properties exception with the
- * provided causes.
- *
- * @param ufn
- * The user friendly name of the component that caused this
- * exception.
- * @param causes
- * The causes of this exception (must be non-<code>null</code>
- * and non-empty).
- * @param isCreate
- * Indicates whether the exception occurred during managed
- * object creation.
- */
- public MissingMandatoryPropertiesException(LocalizableMessage ufn,
- Collection<PropertyIsMandatoryException> causes, boolean isCreate) {
- super(createMessage(causes));
+ /**
+ * Gets the first exception that caused this exception.
+ *
+ * @return Returns the first exception that caused this exception.
+ */
+ @Override
+ public PropertyIsMandatoryException getCause() {
+ return causes.iterator().next();
+ }
- this.causes = new ArrayList<PropertyIsMandatoryException>(causes);
- this.ufn = ufn;
- this.isCreate = isCreate;
- }
+ /**
+ * Gets an unmodifiable collection view of the causes of this exception.
+ *
+ * @return Returns an unmodifiable collection view of the causes of this
+ * exception.
+ */
+ public Collection<PropertyIsMandatoryException> getCauses() {
+ return Collections.unmodifiableCollection(causes);
+ }
+ /**
+ * Gets the user friendly name of the component that caused this exception.
+ *
+ * @return Returns the user friendly name of the component that caused this
+ * exception.
+ */
+ public LocalizableMessage getUserFriendlyName() {
+ return ufn;
+ }
-
- /**
- * Gets the first exception that caused this exception.
- *
- * @return Returns the first exception that caused this exception.
- */
- @Override
- public PropertyIsMandatoryException getCause() {
- return causes.iterator().next();
- }
-
-
-
- /**
- * Gets an unmodifiable collection view of the causes of this
- * exception.
- *
- * @return Returns an unmodifiable collection view of the causes of
- * this exception.
- */
- public Collection<PropertyIsMandatoryException> getCauses() {
- return Collections.unmodifiableCollection(causes);
- }
-
-
-
- /**
- * Gets the user friendly name of the component that caused this
- * exception.
- *
- * @return Returns the user friendly name of the component that
- * caused this exception.
- */
- public LocalizableMessage getUserFriendlyName() {
- return ufn;
- }
-
-
-
- /**
- * Indicates whether or not this exception was thrown during managed
- * object creation or during modification.
- *
- * @return Returns <code>true</code> if this exception was thrown
- * during managed object creation.
- */
- public boolean isCreate() {
- return isCreate;
- }
+ /**
+ * Indicates whether or not this exception was thrown during managed object
+ * creation or during modification.
+ *
+ * @return Returns <code>true</code> if this exception was thrown during
+ * managed object creation.
+ */
+ public boolean isCreate() {
+ return isCreate;
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/OperationRejectedException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/OperationRejectedException.java
index ea150d0..1b91658 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/OperationRejectedException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/OperationRejectedException.java
@@ -23,7 +23,6 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin.client;
import static com.forgerock.opendj.ldap.AdminMessages.*;
@@ -141,7 +140,8 @@
* The messages describing the constraint violations that
* occurred (must be non-<code>null</code> and non-empty).
*/
- public OperationRejectedException(OperationType type, LocalizableMessage ufn, Collection<LocalizableMessage> messages) {
+ public OperationRejectedException(OperationType type, LocalizableMessage ufn,
+ Collection<LocalizableMessage> messages) {
super(getDefaultMessage(messages));
this.messages = new ArrayList<LocalizableMessage>(messages);
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPDriver.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPDriver.java
index 3bbd727..3814328 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPDriver.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPDriver.java
@@ -67,7 +67,6 @@
import org.opends.server.admin.Reference;
import org.opends.server.admin.RelationDefinition;
import org.opends.server.admin.SetRelationDefinition;
-import org.opends.server.admin.UnknownPropertyDefinitionException;
import org.opends.server.admin.DefinitionDecodingException.Reason;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagedObjectDecodingException;
@@ -89,7 +88,7 @@
/**
* Decodes the provided property LDAP value.
*
- * @param <PD>
+ * @param <P>
* The type of the property.
* @param pd
* The property definition.
@@ -100,8 +99,7 @@
* If the property value could not be decoded because it was
* invalid.
*/
- public static <PD> PD decode(PropertyDefinition<PD> pd, Object value)
- throws IllegalPropertyValueStringException {
+ public static <P> P decode(PropertyDefinition<P> pd, Object value) {
String s = String.valueOf(value);
return pd.castValue(pd.accept(new ValueDecoder(), s));
}
@@ -116,7 +114,7 @@
*/
@Override
public <C extends ConfigurationClient, S extends Configuration> Object visitAggregation(
- AggregationPropertyDefinition<C, S> d, String p) {
+ AggregationPropertyDefinition<C, S> d, String p) {
// Aggregations values are stored as full DNs in LDAP, but
// just their common name is exposed in the admin framework.
try {
@@ -131,7 +129,7 @@
* {@inheritDoc}
*/
@Override
- public <T> Object visitUnknown(PropertyDefinition<T> d, String p) throws UnknownPropertyDefinitionException {
+ public <T> Object visitUnknown(PropertyDefinition<T> d, String p) {
// By default the property definition's decoder will do.
return d.decodeValue(p);
}
@@ -177,8 +175,8 @@
*/
@Override
public <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getManagedObject(
- ManagedObjectPath<C, S> path) throws DefinitionDecodingException, ManagedObjectDecodingException,
- ManagedObjectNotFoundException, ErrorResultException {
+ ManagedObjectPath<C, S> path) throws DefinitionDecodingException, ManagedObjectDecodingException,
+ ManagedObjectNotFoundException, ErrorResultException {
if (!managedObjectExists(path)) {
throw new ManagedObjectNotFoundException();
}
@@ -231,16 +229,16 @@
*/
@SuppressWarnings("unchecked")
@Override
- public <C extends ConfigurationClient, S extends Configuration, PD> SortedSet<PD> getPropertyValues(
- ManagedObjectPath<C, S> path, PropertyDefinition<PD> propertyDef) throws IllegalArgumentException,
- DefinitionDecodingException, ManagedObjectNotFoundException, ErrorResultException, PropertyException {
+ public <C extends ConfigurationClient, S extends Configuration, P> SortedSet<P> getPropertyValues(
+ ManagedObjectPath<C, S> path, PropertyDefinition<P> propertyDef) throws DefinitionDecodingException,
+ ManagedObjectNotFoundException, ErrorResultException {
// Check that the requested property is from the definition
// associated with the path.
AbstractManagedObjectDefinition<C, S> d = path.getManagedObjectDefinition();
PropertyDefinition<?> tmp = d.getPropertyDefinition(propertyDef.getName());
if (tmp != propertyDef) {
throw new IllegalArgumentException("The property " + propertyDef.getName() + " is not associated with a "
- + d.getName());
+ + d.getName());
}
if (!managedObjectExists(path)) {
@@ -255,17 +253,17 @@
// Make sure we use the correct property definition, the
// provided one might have been overridden in the resolved
// definition.
- propertyDef = (PropertyDefinition<PD>) objectDef.getPropertyDefinition(propertyDef.getName());
+ propertyDef = (PropertyDefinition<P>) objectDef.getPropertyDefinition(propertyDef.getName());
String attrID = profile.getAttributeName(objectDef, propertyDef);
SearchResultEntry resultEntry = connection.readEntry(dn, Collections.singleton(attrID));
Attribute attribute = resultEntry.getAttribute(attrID);
// Decode the values.
- SortedSet<PD> values = new TreeSet<PD>(propertyDef);
+ SortedSet<P> values = new TreeSet<P>(propertyDef);
if (attribute != null) {
for (ByteString byteValue : attribute) {
- PD value = ValueDecoder.decode(propertyDef, byteValue);
+ P value = ValueDecoder.decode(propertyDef, byteValue);
values.add(value);
}
}
@@ -299,7 +297,7 @@
@Override
public ManagedObject<RootCfgClient> getRootConfigurationManagedObject() {
return new LDAPManagedObject<RootCfgClient>(this, RootCfgDefn.getInstance(), ManagedObjectPath.emptyPath(),
- new PropertySet(), true, null);
+ new PropertySet(), true, null);
}
/**
@@ -307,9 +305,9 @@
*/
@Override
public <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
- ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd,
- AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws IllegalArgumentException,
- ManagedObjectNotFoundException, ErrorResultException {
+ ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd,
+ AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws ManagedObjectNotFoundException,
+ ErrorResultException {
validateRelationDefinition(parent, rd);
if (!managedObjectExists(parent)) {
@@ -349,9 +347,9 @@
*/
@Override
public <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
- ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd,
- AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws IllegalArgumentException,
- ManagedObjectNotFoundException, ErrorResultException {
+ ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd,
+ AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws ManagedObjectNotFoundException,
+ ErrorResultException {
validateRelationDefinition(parent, rd);
if (!managedObjectExists(parent)) {
@@ -392,7 +390,7 @@
*/
@Override
public boolean managedObjectExists(ManagedObjectPath<?, ?> path) throws ManagedObjectNotFoundException,
- ErrorResultException {
+ ErrorResultException {
if (path.isEmpty()) {
return true;
}
@@ -412,13 +410,13 @@
*/
@Override
protected <C extends ConfigurationClient, S extends Configuration> void deleteManagedObject(
- ManagedObjectPath<C, S> path) throws OperationRejectedException, ErrorResultException {
+ ManagedObjectPath<C, S> path) throws OperationRejectedException, ErrorResultException {
// Delete the entry and any subordinate entries.
DN dn = LDAPNameBuilder.create(path, profile);
try {
connection.deleteSubtree(dn);
- } catch(ErrorResultException e) {
- if (e.getResult().getResultCode()==ResultCode.UNWILLING_TO_PERFORM) {
+ } catch (ErrorResultException e) {
+ if (e.getResult().getResultCode() == ResultCode.UNWILLING_TO_PERFORM) {
AbstractManagedObjectDefinition<?, ?> d = path.getManagedObjectDefinition();
LocalizableMessage m = LocalizableMessage.raw("%s", e.getMessage());
throw new OperationRejectedException(OperationType.DELETE, d.getUserFriendlyName(), m);
@@ -470,7 +468,7 @@
// Create a managed object which already exists on the server.
private <M extends ConfigurationClient, N extends Configuration> ManagedObject<M> createExistingManagedObject(
- ManagedObjectDefinition<M, N> d, ManagedObjectPath<? super M, ? super N> p, PropertySet properties) {
+ ManagedObjectDefinition<M, N> d, ManagedObjectPath<? super M, ? super N> p, PropertySet properties) {
RelationDefinition<?, ?> rd = p.getRelationDefinition();
PropertyDefinition<?> pd = null;
if (rd instanceof InstantiableRelationDefinition) {
@@ -481,15 +479,15 @@
}
// Create a property using the provided string values.
- private <PD> void decodeProperty(PropertySet newProperties, ManagedObjectPath<?, ?> path,
- PropertyDefinition<PD> propertyDef, Attribute attribute) throws PropertyException {
+ private <P> void decodeProperty(PropertySet newProperties, ManagedObjectPath<?, ?> path,
+ PropertyDefinition<P> propertyDef, Attribute attribute) {
PropertyException exception = null;
// Get the property's active values.
- SortedSet<PD> activeValues = new TreeSet<PD>(propertyDef);
+ SortedSet<P> activeValues = new TreeSet<P>(propertyDef);
if (attribute != null) {
for (ByteString byteValue : attribute) {
- PD value = ValueDecoder.decode(propertyDef, byteValue);
+ P value = ValueDecoder.decode(propertyDef, byteValue);
activeValues.add(value);
}
}
@@ -497,13 +495,13 @@
if (activeValues.size() > 1 && !propertyDef.hasOption(PropertyOption.MULTI_VALUED)) {
// This exception takes precedence over previous exceptions.
exception = new PropertyIsSingleValuedException(propertyDef);
- PD value = activeValues.first();
+ P value = activeValues.first();
activeValues.clear();
activeValues.add(value);
}
// Get the property's default values.
- Collection<PD> defaultValues;
+ Collection<P> defaultValues;
try {
defaultValues = findDefaultValues(path, propertyDef, false);
} catch (DefaultBehaviorException e) {
@@ -528,8 +526,11 @@
// Determine the type of managed object associated with the named
// entry.
- private <C extends ConfigurationClient, S extends Configuration> ManagedObjectDefinition<? extends C, ? extends S> getEntryDefinition(
- AbstractManagedObjectDefinition<C, S> d, DN dn) throws ErrorResultException, DefinitionDecodingException {
+ // @Checkstyle:off
+ private <C extends ConfigurationClient, S extends Configuration> ManagedObjectDefinition<? extends C, ? extends S>
+ getEntryDefinition(AbstractManagedObjectDefinition<C, S> d, DN dn) throws ErrorResultException,
+ DefinitionDecodingException {
+ // @Checkstyle:on
SearchResultEntry searchResultEntry = connection.readEntry(dn, Collections.singleton("objectclass"));
Attribute objectClassAttr = searchResultEntry.getAttribute("objectclass");
@@ -550,6 +551,7 @@
// Resolve the appropriate sub-type based on the object classes.
DefinitionResolver resolver = new DefinitionResolver() {
+ @Override
public boolean matches(AbstractManagedObjectDefinition<?, ?> d) {
String objectClass = profile.getObjectClass(d);
return objectClasses.contains(objectClass);
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPManagedObject.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPManagedObject.java
index 8d66bd2..f785f2e 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPManagedObject.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPManagedObject.java
@@ -54,7 +54,6 @@
import org.opends.server.admin.Reference;
import org.opends.server.admin.RelationDefinition;
import org.opends.server.admin.SetRelationDefinition;
-import org.opends.server.admin.UnknownPropertyDefinitionException;
import org.opends.server.admin.client.ConcurrentModificationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.OperationRejectedException;
@@ -99,9 +98,8 @@
* {@inheritDoc}
*/
@Override
- public <PD> Object visitUnknown(PropertyDefinition<PD> pd, PD v, Void p)
- throws UnknownPropertyDefinitionException {
- return pd.encodeValue(v);
+ public <P> Object visitUnknown(PropertyDefinition<P> propertyDef, P value, Void p) {
+ return propertyDef.encodeValue(value);
}
}
@@ -295,18 +293,18 @@
}
// Encode a property into LDAP string values.
- private <PD> void encodeProperty(Attribute attribute, PropertyDefinition<PD> propertyDef) {
+ private <P> void encodeProperty(Attribute attribute, PropertyDefinition<P> propertyDef) {
PropertyValueVisitor<Object, Void> visitor = new ValueEncoder();
- Property<PD> property = getProperty(propertyDef);
+ Property<P> property = getProperty(propertyDef);
if (propertyDef.hasOption(PropertyOption.MANDATORY)) {
// For mandatory properties we fall-back to the default values
// if defined which can sometimes be the case e.g when a
// mandatory property is overridden.
- for (PD value : property.getEffectiveValues()) {
+ for (P value : property.getEffectiveValues()) {
attribute.add(propertyDef.accept(visitor, value, null));
}
} else {
- for (PD value : property.getPendingValues()) {
+ for (P value : property.getPendingValues()) {
attribute.add(propertyDef.accept(visitor, value, null));
}
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPNameBuilder.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPNameBuilder.java
index f8fba78..074f3ff 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPNameBuilder.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPNameBuilder.java
@@ -126,7 +126,8 @@
* {@inheritDoc}
*/
public <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
- InstantiableRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d, String name) {
+ InstantiableRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d,
+ String name) {
// Add the RDN sequence representing the relation.
appendManagedObjectPathElement(r);
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/AbstractManagedObject.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/AbstractManagedObject.java
index c0c74a9..03cac45 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/AbstractManagedObject.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/AbstractManagedObject.java
@@ -42,7 +42,6 @@
import org.opends.server.admin.DefaultBehaviorException;
import org.opends.server.admin.DefaultManagedObject;
import org.opends.server.admin.DefinitionDecodingException;
-import org.opends.server.admin.IllegalPropertyValueException;
import org.opends.server.admin.IllegalPropertyValueStringException;
import org.opends.server.admin.InstantiableRelationDefinition;
import org.opends.server.admin.ManagedObjectAlreadyExistsException;
@@ -53,7 +52,6 @@
import org.opends.server.admin.PropertyDefinition;
import org.opends.server.admin.PropertyIsMandatoryException;
import org.opends.server.admin.PropertyIsReadOnlyException;
-import org.opends.server.admin.PropertyIsSingleValuedException;
import org.opends.server.admin.PropertyOption;
import org.opends.server.admin.RelationDefinition;
import org.opends.server.admin.RelationDefinitionVisitor;
@@ -99,8 +97,9 @@
/**
* {@inheritDoc}
*/
+ @Override
public <C extends ConfigurationClient, S extends Configuration> Void visitInstantiable(
- InstantiableRelationDefinition<C, S> rd, Void p) {
+ InstantiableRelationDefinition<C, S> rd, Void p) {
for (String name : rd.getDefaultManagedObjectNames()) {
DefaultManagedObject<? extends C, ? extends S> dmo = rd.getDefaultManagedObject(name);
ManagedObjectDefinition<? extends C, ? extends S> d = dmo.getManagedObjectDefinition();
@@ -119,8 +118,9 @@
/**
* {@inheritDoc}
*/
+ @Override
public <C extends ConfigurationClient, S extends Configuration> Void visitOptional(
- OptionalRelationDefinition<C, S> rd, Void p) {
+ OptionalRelationDefinition<C, S> rd, Void p) {
if (rd.getDefaultManagedObject() != null) {
DefaultManagedObject<? extends C, ? extends S> dmo = rd.getDefaultManagedObject();
ManagedObjectDefinition<? extends C, ? extends S> d = dmo.getManagedObjectDefinition();
@@ -133,8 +133,9 @@
/**
* {@inheritDoc}
*/
+ @Override
public <C extends ConfigurationClient, S extends Configuration> Void visitSingleton(
- SingletonRelationDefinition<C, S> rd, Void p) {
+ SingletonRelationDefinition<C, S> rd, Void p) {
// Do nothing - not possible to create singletons
// dynamically.
return null;
@@ -143,8 +144,9 @@
/**
* {@inheritDoc}
*/
+ @Override
public <C extends ConfigurationClient, S extends Configuration> Void visitSet(SetRelationDefinition<C, S> rd,
- Void p) {
+ Void p) {
for (String name : rd.getDefaultManagedObjectNames()) {
DefaultManagedObject<? extends C, ? extends S> dmo = rd.getDefaultManagedObject(name);
ManagedObjectDefinition<? extends C, ? extends S> d = dmo.getManagedObjectDefinition();
@@ -156,7 +158,7 @@
// Create the child managed object.
private void createDefaultManagedObject(ManagedObjectDefinition<?, ?> d, ManagedObject<?> child,
- DefaultManagedObject<?, ?> dmo) {
+ DefaultManagedObject<?, ?> dmo) {
for (PropertyDefinition<?> pd : d.getAllPropertyDefinitions()) {
setPropertyValues(child, pd, dmo);
}
@@ -184,8 +186,8 @@
* The relation definition.
*/
private void createDefaultManagedObjects(RelationDefinition<?, ?> rd) throws ErrorResultException,
- ConcurrentModificationException, MissingMandatoryPropertiesException,
- ManagedObjectAlreadyExistsException, OperationRejectedException {
+ ConcurrentModificationException, MissingMandatoryPropertiesException,
+ ManagedObjectAlreadyExistsException, OperationRejectedException {
rd.accept(this, null);
if (ere != null) {
@@ -202,8 +204,8 @@
}
// Set property values.
- private <PD> void setPropertyValues(ManagedObject<?> mo, PropertyDefinition<PD> pd,
- DefaultManagedObject<?, ?> dmo) {
+ private <P> void setPropertyValues(ManagedObject<?> mo, PropertyDefinition<P> pd,
+ DefaultManagedObject<?, ?> dmo) {
mo.setPropertyValues(pd, dmo.getPropertyValues(pd));
}
}
@@ -243,8 +245,8 @@
* Optional naming property definition.
*/
protected AbstractManagedObject(ManagedObjectDefinition<T, ? extends Configuration> d,
- ManagedObjectPath<T, ? extends Configuration> path, PropertySet properties, boolean existsOnServer,
- PropertyDefinition<?> namingPropertyDefinition) {
+ ManagedObjectPath<T, ? extends Configuration> path, PropertySet properties, boolean existsOnServer,
+ PropertyDefinition<?> namingPropertyDefinition) {
this.definition = d;
this.path = path;
this.properties = properties;
@@ -255,8 +257,9 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
- ConcurrentModificationException, OperationRejectedException, ErrorResultException {
+ ConcurrentModificationException, OperationRejectedException, ErrorResultException {
// First make sure all mandatory properties are defined.
List<PropertyIsMandatoryException> exceptions = new LinkedList<PropertyIsMandatoryException>();
@@ -268,7 +271,8 @@
}
if (!exceptions.isEmpty()) {
- throw new MissingMandatoryPropertiesException(definition.getUserFriendlyName(), exceptions, !existsOnServer);
+ throw new MissingMandatoryPropertiesException(definition.getUserFriendlyName(), exceptions,
+ !existsOnServer);
}
// Now enforce any constraints.
@@ -326,10 +330,10 @@
/**
* {@inheritDoc}
*/
- public final <C extends ConfigurationClient, S extends Configuration, CC extends C> ManagedObject<CC> createChild(
- InstantiableRelationDefinition<C, S> r, ManagedObjectDefinition<CC, ? extends S> d, String name,
- Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException,
- IllegalArgumentException {
+ @Override
+ public final <C extends ConfigurationClient, S extends Configuration, C1 extends C> ManagedObject<C1> createChild(
+ InstantiableRelationDefinition<C, S> r, ManagedObjectDefinition<C1, ? extends S> d, String name,
+ Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException {
validateRelationDefinition(r);
// Empty names are not allowed.
@@ -348,40 +352,43 @@
}
}
- ManagedObjectPath<CC, ? extends S> childPath = path.child(r, d, name);
+ ManagedObjectPath<C1, ? extends S> childPath = path.child(r, d, name);
return createNewManagedObject(d, childPath, pd, name, exceptions);
}
/**
* {@inheritDoc}
*/
- public final <C extends ConfigurationClient, S extends Configuration, CC extends C> ManagedObject<CC> createChild(
- OptionalRelationDefinition<C, S> r, ManagedObjectDefinition<CC, ? extends S> d,
- Collection<DefaultBehaviorException> exceptions) throws IllegalArgumentException {
+ @Override
+ public final <C extends ConfigurationClient, S extends Configuration, C1 extends C> ManagedObject<C1> createChild(
+ OptionalRelationDefinition<C, S> r, ManagedObjectDefinition<C1, ? extends S> d,
+ Collection<DefaultBehaviorException> exceptions) {
validateRelationDefinition(r);
- ManagedObjectPath<CC, ? extends S> childPath = path.child(r, d);
+ ManagedObjectPath<C1, ? extends S> childPath = path.child(r, d);
return createNewManagedObject(d, childPath, null, null, exceptions);
}
/**
* {@inheritDoc}
*/
- public final <C extends ConfigurationClient, S extends Configuration, CC extends C> ManagedObject<CC> createChild(
- SetRelationDefinition<C, S> r, ManagedObjectDefinition<CC, ? extends S> d,
- Collection<DefaultBehaviorException> exceptions) throws IllegalArgumentException {
+ @Override
+ public final <C extends ConfigurationClient, S extends Configuration, C1 extends C> ManagedObject<C1> createChild(
+ SetRelationDefinition<C, S> r, ManagedObjectDefinition<C1, ? extends S> d,
+ Collection<DefaultBehaviorException> exceptions) {
validateRelationDefinition(r);
- ManagedObjectPath<CC, ? extends S> childPath = path.child(r, d);
+ ManagedObjectPath<C1, ? extends S> childPath = path.child(r, d);
return createNewManagedObject(d, childPath, null, null, exceptions);
}
/**
* {@inheritDoc}
*/
+ @Override
public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
- InstantiableRelationDefinition<C, S> r, String name) throws IllegalArgumentException,
- DefinitionDecodingException, ManagedObjectDecodingException, ManagedObjectNotFoundException,
- ConcurrentModificationException, ErrorResultException {
+ InstantiableRelationDefinition<C, S> r, String name) throws DefinitionDecodingException,
+ ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
+ ErrorResultException {
validateRelationDefinition(r);
ensureThisManagedObjectExists();
Driver ctx = getDriver();
@@ -391,10 +398,10 @@
/**
* {@inheritDoc}
*/
+ @Override
public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
- OptionalRelationDefinition<C, S> r) throws IllegalArgumentException, DefinitionDecodingException,
- ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
- ErrorResultException {
+ OptionalRelationDefinition<C, S> r) throws DefinitionDecodingException, ManagedObjectDecodingException,
+ ManagedObjectNotFoundException, ConcurrentModificationException, ErrorResultException {
validateRelationDefinition(r);
ensureThisManagedObjectExists();
Driver ctx = getDriver();
@@ -404,10 +411,10 @@
/**
* {@inheritDoc}
*/
+ @Override
public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
- SingletonRelationDefinition<C, S> r) throws IllegalArgumentException, DefinitionDecodingException,
- ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
- ErrorResultException {
+ SingletonRelationDefinition<C, S> r) throws DefinitionDecodingException, ManagedObjectDecodingException,
+ ManagedObjectNotFoundException, ConcurrentModificationException, ErrorResultException {
validateRelationDefinition(r);
ensureThisManagedObjectExists();
Driver ctx = getDriver();
@@ -417,10 +424,11 @@
/**
* {@inheritDoc}
*/
+ @Override
public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
- SetRelationDefinition<C, S> r, String name) throws IllegalArgumentException, DefinitionDecodingException,
- ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
- ErrorResultException {
+ SetRelationDefinition<C, S> r, String name) throws DefinitionDecodingException,
+ ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
+ ErrorResultException {
validateRelationDefinition(r);
ensureThisManagedObjectExists();
Driver ctx = getDriver();
@@ -442,6 +450,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final T getConfiguration() {
return definition.createClientConfiguration(this);
}
@@ -449,6 +458,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ManagedObjectDefinition<T, ? extends Configuration> getManagedObjectDefinition() {
return definition;
}
@@ -456,6 +466,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ManagedObjectPath<T, ? extends Configuration> getManagedObjectPath() {
return path;
}
@@ -463,15 +474,17 @@
/**
* {@inheritDoc}
*/
- public final <PD> SortedSet<PD> getPropertyDefaultValues(PropertyDefinition<PD> pd) throws IllegalArgumentException {
- return new TreeSet<PD>(getProperty(pd).getDefaultValues());
+ @Override
+ public final <P> SortedSet<P> getPropertyDefaultValues(PropertyDefinition<P> pd) {
+ return new TreeSet<P>(getProperty(pd).getDefaultValues());
}
/**
* {@inheritDoc}
*/
- public final <PD> PD getPropertyValue(PropertyDefinition<PD> pd) throws IllegalArgumentException {
- Set<PD> values = getProperty(pd).getEffectiveValues();
+ @Override
+ public final <P> P getPropertyValue(PropertyDefinition<P> pd) {
+ Set<P> values = getProperty(pd).getEffectiveValues();
if (values.isEmpty()) {
return null;
} else {
@@ -482,16 +495,17 @@
/**
* {@inheritDoc}
*/
- public final <PD> SortedSet<PD> getPropertyValues(PropertyDefinition<PD> pd) throws IllegalArgumentException {
- return new TreeSet<PD>(getProperty(pd).getEffectiveValues());
+ @Override
+ public final <P> SortedSet<P> getPropertyValues(PropertyDefinition<P> pd) {
+ return new TreeSet<P>(getProperty(pd).getEffectiveValues());
}
/**
* {@inheritDoc}
*/
+ @Override
public final <C extends ConfigurationClient, S extends Configuration> boolean hasChild(
- OptionalRelationDefinition<C, S> r) throws IllegalArgumentException, ConcurrentModificationException,
- ErrorResultException {
+ OptionalRelationDefinition<C, S> r) throws ConcurrentModificationException, ErrorResultException {
validateRelationDefinition(r);
Driver ctx = getDriver();
try {
@@ -504,25 +518,27 @@
/**
* {@inheritDoc}
*/
- public final boolean isPropertyPresent(PropertyDefinition<?> pd) throws IllegalArgumentException {
+ @Override
+ public final boolean isPropertyPresent(PropertyDefinition<?> pd) {
return !getProperty(pd).isEmpty();
}
/**
* {@inheritDoc}
*/
+ @Override
public final <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
- InstantiableRelationDefinition<C, S> r) throws IllegalArgumentException, ConcurrentModificationException,
- ErrorResultException {
+ InstantiableRelationDefinition<C, S> r) throws ConcurrentModificationException, ErrorResultException {
return listChildren(r, r.getChildDefinition());
}
/**
* {@inheritDoc}
*/
+ @Override
public final <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
- InstantiableRelationDefinition<C, S> r, AbstractManagedObjectDefinition<? extends C, ? extends S> d)
- throws IllegalArgumentException, ConcurrentModificationException, ErrorResultException {
+ InstantiableRelationDefinition<C, S> r, AbstractManagedObjectDefinition<? extends C, ? extends S> d)
+ throws ConcurrentModificationException, ErrorResultException {
validateRelationDefinition(r);
Driver ctx = getDriver();
try {
@@ -535,18 +551,19 @@
/**
* {@inheritDoc}
*/
+ @Override
public final <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
- SetRelationDefinition<C, S> r) throws IllegalArgumentException, ConcurrentModificationException,
- ErrorResultException {
+ SetRelationDefinition<C, S> r) throws ConcurrentModificationException, ErrorResultException {
return listChildren(r, r.getChildDefinition());
}
/**
* {@inheritDoc}
*/
+ @Override
public final <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
- SetRelationDefinition<C, S> r, AbstractManagedObjectDefinition<? extends C, ? extends S> d)
- throws IllegalArgumentException, ConcurrentModificationException, ErrorResultException {
+ SetRelationDefinition<C, S> r, AbstractManagedObjectDefinition<? extends C, ? extends S> d)
+ throws ConcurrentModificationException, ErrorResultException {
validateRelationDefinition(r);
Driver ctx = getDriver();
try {
@@ -559,10 +576,10 @@
/**
* {@inheritDoc}
*/
+ @Override
public final <C extends ConfigurationClient, S extends Configuration> void removeChild(
- InstantiableRelationDefinition<C, S> r, String name) throws IllegalArgumentException,
- ManagedObjectNotFoundException, OperationRejectedException, ConcurrentModificationException,
- ErrorResultException {
+ InstantiableRelationDefinition<C, S> r, String name) throws ManagedObjectNotFoundException,
+ OperationRejectedException, ConcurrentModificationException, ErrorResultException {
validateRelationDefinition(r);
Driver ctx = getDriver();
boolean found;
@@ -581,9 +598,10 @@
/**
* {@inheritDoc}
*/
+ @Override
public final <C extends ConfigurationClient, S extends Configuration> void removeChild(
- OptionalRelationDefinition<C, S> r) throws IllegalArgumentException, ManagedObjectNotFoundException,
- OperationRejectedException, ConcurrentModificationException, ErrorResultException {
+ OptionalRelationDefinition<C, S> r) throws ManagedObjectNotFoundException, OperationRejectedException,
+ ConcurrentModificationException, ErrorResultException {
validateRelationDefinition(r);
Driver ctx = getDriver();
boolean found;
@@ -602,10 +620,10 @@
/**
* {@inheritDoc}
*/
+ @Override
public final <C extends ConfigurationClient, S extends Configuration> void removeChild(
- SetRelationDefinition<C, S> r, String name) throws IllegalArgumentException,
- ManagedObjectNotFoundException, OperationRejectedException, ConcurrentModificationException,
- ErrorResultException {
+ SetRelationDefinition<C, S> r, String name) throws ManagedObjectNotFoundException,
+ OperationRejectedException, ConcurrentModificationException, ErrorResultException {
validateRelationDefinition(r);
Driver ctx = getDriver();
boolean found;
@@ -624,10 +642,10 @@
/**
* {@inheritDoc}
*/
- public final <PD> void setPropertyValue(PropertyDefinition<PD> pd, PD value) throws IllegalPropertyValueException,
- PropertyIsReadOnlyException, PropertyIsMandatoryException, IllegalArgumentException {
+ @Override
+ public final <P> void setPropertyValue(PropertyDefinition<P> pd, P value) {
if (value == null) {
- setPropertyValues(pd, Collections.<PD> emptySet());
+ setPropertyValues(pd, Collections.<P> emptySet());
} else {
setPropertyValues(pd, Collections.singleton(value));
}
@@ -636,9 +654,8 @@
/**
* {@inheritDoc}
*/
- public final <PD> void setPropertyValues(PropertyDefinition<PD> pd, Collection<PD> values)
- throws IllegalPropertyValueException, PropertyIsSingleValuedException, PropertyIsReadOnlyException,
- PropertyIsMandatoryException, IllegalArgumentException {
+ @Override
+ public final <P> void setPropertyValues(PropertyDefinition<P> pd, Collection<P> values) {
if (pd.hasOption(PropertyOption.MONITORING)) {
throw new PropertyIsReadOnlyException(pd);
}
@@ -695,8 +712,8 @@
* @throws ErrorResultException
* If any other error occurs.
*/
- protected abstract void addNewManagedObject() throws ErrorResultException,
- OperationRejectedException, ConcurrentModificationException, ManagedObjectAlreadyExistsException;
+ protected abstract void addNewManagedObject() throws ErrorResultException, OperationRejectedException,
+ ConcurrentModificationException, ManagedObjectAlreadyExistsException;
/**
* Gets the management context driver associated with this managed object.
@@ -720,7 +737,7 @@
/**
* Gets the property associated with the specified property definition.
*
- * @param <PD>
+ * @param <P>
* The underlying type of the property.
* @param pd
* The Property definition.
@@ -730,7 +747,7 @@
* If this property provider does not recognize the requested
* property definition.
*/
- protected final <PD> Property<PD> getProperty(PropertyDefinition<PD> pd) throws IllegalArgumentException {
+ protected final <P> Property<P> getProperty(PropertyDefinition<P> pd) {
return properties.getProperty(pd);
}
@@ -743,15 +760,11 @@
* @throws OperationRejectedException
* If the managed object cannot be added due to some client-side
* or server-side constraint which cannot be satisfied.
- * @throws AuthorizationException
- * If the server refuses to modify this managed object because
- * the client does not have the correct privileges.
- * @throws CommunicationException
- * If the client cannot contact the server due to an underlying
- * communication problem.
+ * @throws ErrorResultException
+ * If any other error occurs.
*/
protected abstract void modifyExistingManagedObject() throws ConcurrentModificationException,
- OperationRejectedException, ErrorResultException;
+ OperationRejectedException, ErrorResultException;
/**
* Creates a new managed object.
@@ -774,15 +787,14 @@
* @return Returns the new managed object.
*/
protected abstract <M extends ConfigurationClient> ManagedObject<M> newInstance(ManagedObjectDefinition<M, ?> d,
- ManagedObjectPath<M, ?> path, PropertySet properties, boolean existsOnServer,
- PropertyDefinition<?> namingPropertyDefinition);
+ ManagedObjectPath<M, ?> path, PropertySet properties, boolean existsOnServer,
+ PropertyDefinition<?> namingPropertyDefinition);
// Creates a new managed object with no active values, just default
// values.
- private <M extends ConfigurationClient, PD> ManagedObject<M> createNewManagedObject(
- ManagedObjectDefinition<M, ?> d, ManagedObjectPath<M, ?> p,
- PropertyDefinition<PD> namingPropertyDefinition, String name,
- Collection<DefaultBehaviorException> exceptions) {
+ private <M extends ConfigurationClient, P> ManagedObject<M> createNewManagedObject(
+ ManagedObjectDefinition<M, ?> d, ManagedObjectPath<M, ?> p, PropertyDefinition<P> namingPropertyDefinition,
+ String name, Collection<DefaultBehaviorException> exceptions) {
PropertySet childProperties = new PropertySet();
for (PropertyDefinition<?> pd : d.getAllPropertyDefinitions()) {
try {
@@ -797,7 +809,7 @@
// Set the naming property if there is one.
if (namingPropertyDefinition != null) {
- PD value = namingPropertyDefinition.decodeValue(name);
+ P value = namingPropertyDefinition.decodeValue(name);
childProperties.setPropertyValues(namingPropertyDefinition, Collections.singleton(value));
}
@@ -805,15 +817,14 @@
}
// Create an empty property.
- private <PD> void createProperty(PropertySet properties, ManagedObjectPath<?, ?> p, PropertyDefinition<PD> pd)
- throws DefaultBehaviorException {
+ private <P> void createProperty(PropertySet properties, ManagedObjectPath<?, ?> p, PropertyDefinition<P> pd) {
try {
Driver context = getDriver();
- Collection<PD> defaultValues = context.findDefaultValues(p, pd, true);
- properties.addProperty(pd, defaultValues, Collections.<PD> emptySet());
+ Collection<P> defaultValues = context.findDefaultValues(p, pd, true);
+ properties.addProperty(pd, defaultValues, Collections.<P> emptySet());
} catch (DefaultBehaviorException e) {
// Make sure that we have still created the property.
- properties.addProperty(pd, Collections.<PD> emptySet(), Collections.<PD> emptySet());
+ properties.addProperty(pd, Collections.<P> emptySet(), Collections.<P> emptySet());
throw e;
}
}
@@ -835,12 +846,12 @@
// Validate that a relation definition belongs to this managed
// object.
- private void validateRelationDefinition(RelationDefinition<?, ?> rd) throws IllegalArgumentException {
+ private void validateRelationDefinition(RelationDefinition<?, ?> rd) {
ManagedObjectDefinition<T, ?> d = getManagedObjectDefinition();
RelationDefinition<?, ?> tmp = d.getRelationDefinition(rd.getName());
if (tmp != rd) {
throw new IllegalArgumentException("The relation " + rd.getName() + " is not associated with a "
- + d.getName());
+ + d.getName());
}
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/Driver.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/Driver.java
index 8c20cae..ecae3a8 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/Driver.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/Driver.java
@@ -23,7 +23,6 @@
*
* Copyright 2008-2009 Sun Microsystems, Inc.
*/
-
package org.opends.server.admin.client.spi;
import java.util.ArrayList;
@@ -81,7 +80,7 @@
* @param <T>
* The type of the property.
*/
- private class DefaultValueFinder<T> implements DefaultBehaviorProviderVisitor<T, Collection<T>, Void> {
+ private final class DefaultValueFinder<T> implements DefaultBehaviorProviderVisitor<T, Collection<T>, Void> {
// Any exception that occurred whilst retrieving inherited default
// values.
@@ -108,10 +107,11 @@
/**
* {@inheritDoc}
*/
+ @Override
public Collection<T> visitAbsoluteInherited(AbsoluteInheritedDefaultBehaviorProvider<T> d, Void p) {
try {
return getInheritedProperty(d.getManagedObjectPath(), d.getManagedObjectDefinition(),
- d.getPropertyName());
+ d.getPropertyName());
} catch (DefaultBehaviorException e) {
exception = e;
return Collections.emptySet();
@@ -121,6 +121,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Collection<T> visitAlias(AliasDefaultBehaviorProvider<T> d, Void p) {
return Collections.emptySet();
}
@@ -128,6 +129,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Collection<T> visitDefined(DefinedDefaultBehaviorProvider<T> d, Void p) {
Collection<String> stringValues = d.getDefaultValues();
List<T> values = new ArrayList<T>(stringValues.size());
@@ -147,10 +149,11 @@
/**
* {@inheritDoc}
*/
+ @Override
public Collection<T> visitRelativeInherited(RelativeInheritedDefaultBehaviorProvider<T> d, Void p) {
try {
return getInheritedProperty(d.getManagedObjectPath(nextPath), d.getManagedObjectDefinition(),
- d.getPropertyName());
+ d.getPropertyName());
} catch (DefaultBehaviorException e) {
exception = e;
return Collections.emptySet();
@@ -160,12 +163,13 @@
/**
* {@inheritDoc}
*/
+ @Override
public Collection<T> visitUndefined(UndefinedDefaultBehaviorProvider<T> d, Void p) {
return Collections.emptySet();
}
// Find the default values for the next path/property.
- private Collection<T> find(ManagedObjectPath<?, ?> p, PropertyDefinition<T> pd) throws DefaultBehaviorException {
+ private Collection<T> find(ManagedObjectPath<?, ?> p, PropertyDefinition<T> pd) {
this.nextPath = p;
this.nextProperty = pd;
@@ -185,13 +189,13 @@
// Get an inherited property value.
@SuppressWarnings("unchecked")
private Collection<T> getInheritedProperty(ManagedObjectPath target, AbstractManagedObjectDefinition<?, ?> d,
- String propertyName) throws DefaultBehaviorException {
+ String propertyName) {
// First check that the requested type of managed object
// corresponds to the path.
AbstractManagedObjectDefinition<?, ?> supr = target.getManagedObjectDefinition();
if (!supr.isParentOf(d)) {
throw new DefaultBehaviorException(nextProperty, new DefinitionDecodingException(supr,
- Reason.WRONG_TYPE_INFORMATION));
+ Reason.WRONG_TYPE_INFORMATION));
}
// Save the current property in case of recursion.
@@ -296,9 +300,8 @@
* If any other error occurs.
*/
public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
- ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd, String name)
- throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
- ErrorResultException {
+ ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd, String name)
+ throws ManagedObjectNotFoundException, OperationRejectedException, ErrorResultException {
validateRelationDefinition(parent, rd);
ManagedObjectPath<?, ?> child = parent.child(rd, name);
return doDeleteManagedObject(child);
@@ -334,8 +337,8 @@
* If any other error occurs.
*/
public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
- ManagedObjectPath<?, ?> parent, OptionalRelationDefinition<C, S> rd) throws IllegalArgumentException,
- ManagedObjectNotFoundException, OperationRejectedException, ErrorResultException {
+ ManagedObjectPath<?, ?> parent, OptionalRelationDefinition<C, S> rd) throws ManagedObjectNotFoundException,
+ OperationRejectedException, ErrorResultException {
validateRelationDefinition(parent, rd);
ManagedObjectPath<?, ?> child = parent.child(rd);
return doDeleteManagedObject(child);
@@ -373,9 +376,8 @@
* If any other error occurs.
*/
public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
- ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd, String name)
- throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
- ErrorResultException {
+ ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd, String name)
+ throws ManagedObjectNotFoundException, OperationRejectedException, ErrorResultException {
validateRelationDefinition(parent, rd);
ManagedObjectPath<?, ?> child = parent.child(rd, name);
return doDeleteManagedObject(child);
@@ -406,9 +408,10 @@
* @throws ErrorResultException
* If any other error occurs.
*/
+ // @Checkstyle:ignore
public abstract <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getManagedObject(
- ManagedObjectPath<C, S> path) throws DefinitionDecodingException, ManagedObjectDecodingException,
- ManagedObjectNotFoundException, ErrorResultException;
+ ManagedObjectPath<C, S> path) throws DefinitionDecodingException, ManagedObjectDecodingException,
+ ManagedObjectNotFoundException, ErrorResultException;
/**
* Gets the effective values of a property in the named managed object.
@@ -427,7 +430,7 @@
* @param <S>
* The type of server managed object configuration that the path
* definition refers to.
- * @param <PD>
+ * @param <P>
* The type of the property to be retrieved.
* @param path
* The path of the managed object containing the property.
@@ -450,9 +453,9 @@
* @throws ErrorResultException
* If any other error occurs.
*/
- public abstract <C extends ConfigurationClient, S extends Configuration, PD> SortedSet<PD> getPropertyValues(
- ManagedObjectPath<C, S> path, PropertyDefinition<PD> pd) throws IllegalArgumentException,
- DefinitionDecodingException, ManagedObjectNotFoundException, ErrorResultException, PropertyException;
+ public abstract <C extends ConfigurationClient, S extends Configuration, P> SortedSet<P> getPropertyValues(
+ ManagedObjectPath<C, S> path, PropertyDefinition<P> pd) throws DefinitionDecodingException,
+ ManagedObjectNotFoundException, ErrorResultException;
/**
* Gets the root configuration managed object associated with this
@@ -490,9 +493,9 @@
* If any other error occurs.
*/
public abstract <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
- ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd,
- AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws IllegalArgumentException,
- ManagedObjectNotFoundException, ErrorResultException;
+ ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd,
+ AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws ManagedObjectNotFoundException,
+ ErrorResultException;
/**
* Lists the child managed objects of the named parent managed object which
@@ -521,9 +524,9 @@
* If any other error occurs.
*/
public abstract <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
- ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd,
- AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws IllegalArgumentException,
- ManagedObjectNotFoundException, ErrorResultException;
+ ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd,
+ AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws ManagedObjectNotFoundException,
+ ErrorResultException;
/**
* Determines whether or not the named managed object exists.
@@ -541,7 +544,7 @@
* If any other error occurs.
*/
public abstract boolean managedObjectExists(ManagedObjectPath<?, ?> path) throws ManagedObjectNotFoundException,
- ErrorResultException;
+ ErrorResultException;
/**
* Deletes the named managed object.
@@ -565,12 +568,12 @@
* If any other error occurs.
*/
protected abstract <C extends ConfigurationClient, S extends Configuration> void deleteManagedObject(
- ManagedObjectPath<C, S> path) throws OperationRejectedException, ErrorResultException;
+ ManagedObjectPath<C, S> path) throws OperationRejectedException, ErrorResultException;
/**
* Gets the default values for the specified property.
*
- * @param <PD>
+ * @param <P>
* The type of the property.
* @param p
* The managed object path of the current managed object.
@@ -583,9 +586,9 @@
* If the default values could not be retrieved or decoded
* properly.
*/
- protected final <PD> Collection<PD> findDefaultValues(ManagedObjectPath<?, ?> p, PropertyDefinition<PD> pd,
- boolean isCreate) throws DefaultBehaviorException {
- DefaultValueFinder<PD> v = new DefaultValueFinder<PD>(p, isCreate);
+ protected final <P> Collection<P> findDefaultValues(ManagedObjectPath<?, ?> p, PropertyDefinition<P> pd,
+ boolean isCreate) {
+ DefaultValueFinder<P> v = new DefaultValueFinder<P>(p, isCreate);
return v.find(p, pd);
}
@@ -608,13 +611,12 @@
* If the relation definition does not belong to the managed
* object definition.
*/
- protected final void validateRelationDefinition(ManagedObjectPath<?, ?> path, RelationDefinition<?, ?> rd)
- throws IllegalArgumentException {
+ protected final void validateRelationDefinition(ManagedObjectPath<?, ?> path, RelationDefinition<?, ?> rd) {
AbstractManagedObjectDefinition<?, ?> d = path.getManagedObjectDefinition();
RelationDefinition<?, ?> tmp = d.getRelationDefinition(rd.getName());
if (tmp != rd) {
throw new IllegalArgumentException("The relation " + rd.getName() + " is not associated with a "
- + d.getName());
+ + d.getName());
}
}
@@ -622,8 +624,8 @@
// then ensuring that the child exists, before ensuring that any
// constraints are satisfied.
private <C extends ConfigurationClient, S extends Configuration> boolean doDeleteManagedObject(
- ManagedObjectPath<C, S> path) throws ManagedObjectNotFoundException, OperationRejectedException,
- ErrorResultException {
+ ManagedObjectPath<C, S> path) throws ManagedObjectNotFoundException, OperationRejectedException,
+ ErrorResultException {
// First make sure that the parent exists.
if (!managedObjectExists(path.parent())) {
throw new ManagedObjectNotFoundException();
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/Property.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/Property.java
index 1bddfa6..7d93746 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/Property.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/Property.java
@@ -26,114 +26,92 @@
package org.opends.server.admin.client.spi;
-
-
import java.util.SortedSet;
import org.opends.server.admin.PropertyDefinition;
-
-
/**
- * A managed object property comprising of the property's definition
- * and its set of values.
+ * A managed object property comprising of the property's definition and its set
+ * of values.
* <p>
- * The property stores the values in a sorted set in which values are
- * compared using the comparator defined by the property definition.
+ * The property stores the values in a sorted set in which values are compared
+ * using the comparator defined by the property definition.
* <p>
- * The property keeps track of whether or not its pending set of
- * values differs from its active values.
+ * The property keeps track of whether or not its pending set of values differs
+ * from its active values.
*
* @param <T>
- * The type of the property.
+ * The type of the property.
*/
public interface Property<T> {
- /**
- * Get an immutable set view of this property's active values.
- *
- * @return Returns an immutable set view of this property's active
- * values. An empty set indicates that there are no active
- * values, and any default values are applicable.
- */
- SortedSet<T> getActiveValues();
+ /**
+ * Get an immutable set view of this property's active values.
+ *
+ * @return Returns an immutable set view of this property's active values.
+ * An empty set indicates that there are no active values, and any
+ * default values are applicable.
+ */
+ SortedSet<T> getActiveValues();
+ /**
+ * Get an immutable set view of this property's default values.
+ *
+ * @return Returns an immutable set view of this property's default values.
+ * An empty set indicates that there are no default values.
+ */
+ SortedSet<T> getDefaultValues();
+ /**
+ * Get an immutable set view of this property's effective values.
+ *
+ * @return Returns an immutable set view of this property's effective
+ * values.
+ */
+ SortedSet<T> getEffectiveValues();
- /**
- * Get an immutable set view of this property's default values.
- *
- * @return Returns an immutable set view of this property's default
- * values. An empty set indicates that there are no default
- * values.
- */
- SortedSet<T> getDefaultValues();
+ /**
+ * Get an immutable set view of this property's pending values.
+ * <p>
+ * Immediately after construction, the pending values matches the active
+ * values.
+ *
+ * @return Returns an immutable set view of this property's pending values.
+ * An empty set indicates that there are no pending values, and any
+ * default values are applicable.
+ */
+ SortedSet<T> getPendingValues();
+ /**
+ * Get the property definition associated with this property.
+ *
+ * @return Returns the property definition associated with this property.
+ */
+ PropertyDefinition<T> getPropertyDefinition();
+ /**
+ * Determines whether or not this property contains any pending values.
+ *
+ * @return Returns <code>true</code> if this property does not contain any
+ * pending values.
+ */
+ boolean isEmpty();
- /**
- * Get an immutable set view of this property's effective values.
- *
- * @return Returns an immutable set view of this property's
- * effective values.
- */
- SortedSet<T> getEffectiveValues();
+ /**
+ * Determines whether or not this property has been modified since it was
+ * constructed. In other words, whether or not the set of pending values
+ * differs from the set of active values.
+ *
+ * @return Returns <code>true</code> if this property has been modified
+ * since it was constructed.
+ */
+ boolean isModified();
-
-
- /**
- * Get an immutable set view of this property's pending values.
- * <p>
- * Immediately after construction, the pending values matches the
- * active values.
- *
- * @return Returns an immutable set view of this property's pending
- * values. An empty set indicates that there are no pending
- * values, and any default values are applicable.
- */
- SortedSet<T> getPendingValues();
-
-
-
- /**
- * Get the property definition associated with this property.
- *
- * @return Returns the property definition associated with this
- * property.
- */
- PropertyDefinition<T> getPropertyDefinition();
-
-
-
- /**
- * Determines whether or not this property contains any pending
- * values.
- *
- * @return Returns <code>true</code> if this property does not
- * contain any pending values.
- */
- boolean isEmpty();
-
-
-
- /**
- * Determines whether or not this property has been modified since
- * it was constructed. In other words, whether or not the set of
- * pending values differs from the set of active values.
- *
- * @return Returns <code>true</code> if this property has been
- * modified since it was constructed.
- */
- boolean isModified();
-
-
-
- /**
- * Determines whether or not this property contains any active
- * values.
- *
- * @return Returns <code>true</code> if this property does not
- * contain any active values.
- */
- boolean wasEmpty();
+ /**
+ * Determines whether or not this property contains any active values.
+ *
+ * @return Returns <code>true</code> if this property does not contain any
+ * active values.
+ */
+ boolean wasEmpty();
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/PropertySet.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/PropertySet.java
index 42185e8..7795959 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/PropertySet.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/PropertySet.java
@@ -26,8 +26,6 @@
package org.opends.server.admin.client.spi;
-
-
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -41,330 +39,285 @@
import org.opends.server.admin.PropertyIsSingleValuedException;
import org.opends.server.admin.PropertyOption;
-
-
/**
- * A set of properties. Instances of this class can be used as the
- * core of a managed object implementation.
+ * A set of properties. Instances of this class can be used as the core of a
+ * managed object implementation.
*/
public final class PropertySet {
- /**
- * Internal property implementation.
- *
- * @param <T>
- * The type of the property.
- */
- private static final class MyProperty<T> implements Property<T> {
+ /**
+ * Internal property implementation.
+ *
+ * @param <T>
+ * The type of the property.
+ */
+ private static final class MyProperty<T> implements Property<T> {
- // The active set of values.
- private final SortedSet<T> activeValues;
+ // The active set of values.
+ private final SortedSet<T> activeValues;
- // The definition associated with this property.
- private final PropertyDefinition<T> d;
+ // The definition associated with this property.
+ private final PropertyDefinition<T> d;
- // The default set of values (read-only).
- private final SortedSet<T> defaultValues;
+ // The default set of values (read-only).
+ private final SortedSet<T> defaultValues;
- // The pending set of values.
- private final SortedSet<T> pendingValues;
+ // The pending set of values.
+ private final SortedSet<T> pendingValues;
+ /**
+ * Create a property with the provided sets of pre-validated default and
+ * active values.
+ *
+ * @param pd
+ * The property definition.
+ * @param defaultValues
+ * The set of default values for the property.
+ * @param activeValues
+ * The set of active values for the property.
+ */
+ public MyProperty(PropertyDefinition<T> pd, Collection<T> defaultValues, Collection<T> activeValues) {
+ this.d = pd;
+ SortedSet<T> sortedDefaultValues = new TreeSet<T>(pd);
+ sortedDefaultValues.addAll(defaultValues);
+ this.defaultValues = Collections.unmodifiableSortedSet(sortedDefaultValues);
+
+ this.activeValues = new TreeSet<T>(pd);
+ this.activeValues.addAll(activeValues);
+
+ // Initially the pending values is the same as the active
+ // values.
+ this.pendingValues = new TreeSet<T>(this.activeValues);
+ }
+
+ /**
+ * Makes the pending values active.
+ */
+ public void commit() {
+ activeValues.clear();
+ activeValues.addAll(pendingValues);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public SortedSet<T> getActiveValues() {
+ return Collections.unmodifiableSortedSet(activeValues);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public SortedSet<T> getDefaultValues() {
+ return defaultValues;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public SortedSet<T> getEffectiveValues() {
+ SortedSet<T> values = getPendingValues();
+
+ if (values.isEmpty()) {
+ values = getDefaultValues();
+ }
+
+ return values;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public SortedSet<T> getPendingValues() {
+ return Collections.unmodifiableSortedSet(pendingValues);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public PropertyDefinition<T> getPropertyDefinition() {
+ return d;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isEmpty() {
+ return pendingValues.isEmpty();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isModified() {
+ if (activeValues.size() == pendingValues.size() && activeValues.containsAll(pendingValues)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Replace all pending values of this property with the provided values.
+ *
+ * @param c
+ * The new set of pending property values.
+ */
+ public void setPendingValues(Collection<T> c) {
+ pendingValues.clear();
+ pendingValues.addAll(c);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return getEffectiveValues().toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean wasEmpty() {
+ return activeValues.isEmpty();
+ }
+ }
+
+ // The properties.
+ private final Map<PropertyDefinition<?>, MyProperty<?>> properties;
/**
- * Create a property with the provided sets of pre-validated
- * default and active values.
+ * Creates a new empty property set.
+ */
+ public PropertySet() {
+ this.properties = new HashMap<PropertyDefinition<?>, MyProperty<?>>();
+ }
+
+ /**
+ * Creates a property with the provided sets of pre-validated default and
+ * active values.
*
+ * @param <T>
+ * The type of the property.
* @param pd
- * The property definition.
+ * The property definition.
* @param defaultValues
- * The set of default values for the property.
+ * The set of default values for the property.
* @param activeValues
- * The set of active values for the property.
+ * The set of active values for the property.
*/
- public MyProperty(PropertyDefinition<T> pd, Collection<T> defaultValues,
- Collection<T> activeValues) {
- this.d = pd;
-
- SortedSet<T> sortedDefaultValues = new TreeSet<T>(pd);
- sortedDefaultValues.addAll(defaultValues);
- this.defaultValues = Collections
- .unmodifiableSortedSet(sortedDefaultValues);
-
- this.activeValues = new TreeSet<T>(pd);
- this.activeValues.addAll(activeValues);
-
- // Initially the pending values is the same as the active
- // values.
- this.pendingValues = new TreeSet<T>(this.activeValues);
+ public <T> void addProperty(PropertyDefinition<T> pd, Collection<T> defaultValues, Collection<T> activeValues) {
+ MyProperty<T> p = new MyProperty<T>(pd, defaultValues, activeValues);
+ properties.put(pd, p);
}
-
-
/**
- * Makes the pending values active.
- */
- public void commit() {
- activeValues.clear();
- activeValues.addAll(pendingValues);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public SortedSet<T> getActiveValues() {
- return Collections.unmodifiableSortedSet(activeValues);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public SortedSet<T> getDefaultValues() {
- return defaultValues;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public SortedSet<T> getEffectiveValues() {
- SortedSet<T> values = getPendingValues();
-
- if (values.isEmpty()) {
- values = getDefaultValues();
- }
-
- return values;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public SortedSet<T> getPendingValues() {
- return Collections.unmodifiableSortedSet(pendingValues);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public PropertyDefinition<T> getPropertyDefinition() {
- return d;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isEmpty() {
- return pendingValues.isEmpty();
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isModified() {
- if (activeValues.size() == pendingValues.size()
- && activeValues.containsAll(pendingValues)) {
- return false;
- }
- return true;
- }
-
-
-
- /**
- * Replace all pending values of this property with the provided
- * values.
+ * Get the property associated with the specified property definition.
*
- * @param c
- * The new set of pending property values.
+ * @param <T>
+ * The underlying type of the property.
+ * @param d
+ * The Property definition.
+ * @return Returns the property associated with the specified property
+ * definition.
+ * @throws IllegalArgumentException
+ * If this property provider does not recognise the requested
+ * property definition.
*/
- public void setPendingValues(Collection<T> c) {
- pendingValues.clear();
- pendingValues.addAll(c);
+ @SuppressWarnings("unchecked")
+ public <T> Property<T> getProperty(PropertyDefinition<T> d) {
+ if (!properties.containsKey(d)) {
+ throw new IllegalArgumentException("Unknown property " + d.getName());
+ }
+
+ return (Property<T>) properties.get(d);
}
-
-
/**
* {@inheritDoc}
*/
@Override
public String toString() {
- return getEffectiveValues().toString();
+ StringBuilder builder = new StringBuilder();
+ builder.append('{');
+ for (Map.Entry<PropertyDefinition<?>, MyProperty<?>> entry : properties.entrySet()) {
+ builder.append(entry.getKey().getName());
+ builder.append('=');
+ builder.append(entry.getValue().toString());
+ builder.append(' ');
+ }
+ builder.append('}');
+ return builder.toString();
}
-
-
/**
- * {@inheritDoc}
+ * Makes all pending values active.
*/
- public boolean wasEmpty() {
- return activeValues.isEmpty();
- }
- }
-
- // The properties.
- private final Map<PropertyDefinition<?>, MyProperty<?>> properties;
-
-
-
- /**
- * Creates a new empty property set.
- */
- public PropertySet() {
- this.properties = new HashMap<PropertyDefinition<?>, MyProperty<?>>();
- }
-
-
-
- /**
- * Creates a property with the provided sets of pre-validated
- * default and active values.
- *
- * @param <T>
- * The type of the property.
- * @param pd
- * The property definition.
- * @param defaultValues
- * The set of default values for the property.
- * @param activeValues
- * The set of active values for the property.
- */
- public <T> void addProperty(PropertyDefinition<T> pd,
- Collection<T> defaultValues, Collection<T> activeValues) {
- MyProperty<T> p = new MyProperty<T>(pd, defaultValues, activeValues);
- properties.put(pd, p);
- }
-
-
-
- /**
- * Get the property associated with the specified property
- * definition.
- *
- * @param <T>
- * The underlying type of the property.
- * @param d
- * The Property definition.
- * @return Returns the property associated with the specified
- * property definition.
- * @throws IllegalArgumentException
- * If this property provider does not recognise the
- * requested property definition.
- */
- @SuppressWarnings("unchecked")
- public <T> Property<T> getProperty(PropertyDefinition<T> d)
- throws IllegalArgumentException {
- if (!properties.containsKey(d)) {
- throw new IllegalArgumentException("Unknown property " + d.getName());
+ void commit() {
+ for (MyProperty<?> p : properties.values()) {
+ p.commit();
+ }
}
- return (Property<T>) properties.get(d);
- }
+ /**
+ * Set a new pending values for the specified property.
+ * <p>
+ * See the class description for more information regarding pending values.
+ *
+ * @param <T>
+ * The type of the property to be modified.
+ * @param d
+ * The property to be modified.
+ * @param values
+ * A non-<code>null</code> set of new pending values for the
+ * property (an empty set indicates that the property should be
+ * reset to its default behavior). The set will not be referenced
+ * by this managed object.
+ * @throws IllegalPropertyValueException
+ * If a new pending value is deemed to be invalid according to
+ * the property definition.
+ * @throws PropertyIsSingleValuedException
+ * If an attempt was made to add multiple pending values to a
+ * single-valued property.
+ * @throws PropertyIsMandatoryException
+ * If an attempt was made to remove a mandatory property.
+ * @throws IllegalArgumentException
+ * If the specified property definition is not associated with
+ * this managed object.
+ */
+ <T> void setPropertyValues(PropertyDefinition<T> d, Collection<T> values) {
+ MyProperty<T> property = (MyProperty<T>) getProperty(d);
+ if (values.size() > 1 && !d.hasOption(PropertyOption.MULTI_VALUED)) {
+ throw new PropertyIsSingleValuedException(d);
+ }
+ if (values.isEmpty() && d.hasOption(PropertyOption.MANDATORY)) {
+ // But only if there are no default values.
+ if (property.getDefaultValues().isEmpty()) {
+ throw new PropertyIsMandatoryException(d);
+ }
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append('{');
- for (Map.Entry<PropertyDefinition<?>, MyProperty<?>> entry : properties
- .entrySet()) {
- builder.append(entry.getKey().getName());
- builder.append('=');
- builder.append(entry.getValue().toString());
- builder.append(' ');
+ // Validate each value.
+ for (T e : values) {
+ if (e == null) {
+ throw new NullPointerException();
+ }
+
+ d.validateValue(e);
+ }
+
+ // Update the property.
+ property.setPendingValues(values);
}
- builder.append('}');
- return builder.toString();
- }
-
-
-
-
-
-
- /**
- * Makes all pending values active.
- */
- void commit() {
- for (MyProperty<?> p : properties.values()) {
- p.commit();
- }
- }
-
-
-
- /**
- * Set a new pending values for the specified property.
- * <p>
- * See the class description for more information regarding pending
- * values.
- *
- * @param <T>
- * The type of the property to be modified.
- * @param d
- * The property to be modified.
- * @param values
- * A non-<code>null</code> set of new pending values for
- * the property (an empty set indicates that the property
- * should be reset to its default behavior). The set will
- * not be referenced by this managed object.
- * @throws IllegalPropertyValueException
- * If a new pending value is deemed to be invalid
- * according to the property definition.
- * @throws PropertyIsSingleValuedException
- * If an attempt was made to add multiple pending values
- * to a single-valued property.
- * @throws PropertyIsMandatoryException
- * If an attempt was made to remove a mandatory property.
- * @throws IllegalArgumentException
- * If the specified property definition is not associated
- * with this managed object.
- */
- <T> void setPropertyValues(PropertyDefinition<T> d,
- Collection<T> values) throws IllegalPropertyValueException,
- PropertyIsSingleValuedException, PropertyIsMandatoryException,
- IllegalArgumentException {
- MyProperty<T> property = (MyProperty<T>) getProperty(d);
-
- if (values.size() > 1 && !d.hasOption(PropertyOption.MULTI_VALUED)) {
- throw new PropertyIsSingleValuedException(d);
- }
-
- if (values.isEmpty() && d.hasOption(PropertyOption.MANDATORY)) {
- // But only if there are no default values.
- if (property.getDefaultValues().isEmpty()) {
- throw new PropertyIsMandatoryException(d);
- }
- }
-
- // Validate each value.
- for (T e : values) {
- if (e == null) {
- throw new NullPointerException();
- }
-
- d.validateValue(e);
- }
-
- // Update the property.
- property.setPendingValues(values);
- }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/package-info.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/package-info.java
index 643bf42..a4120e8 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/package-info.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/client/spi/package-info.java
@@ -24,8 +24,6 @@
* Copyright 2008 Sun Microsystems, Inc.
*/
-
-
/**
* Client side driver implementation interfaces.
* <p>
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/condition/ContainsCondition.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/condition/ContainsCondition.java
index 54f8f56..cef06e9 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/condition/ContainsCondition.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/condition/ContainsCondition.java
@@ -30,7 +30,6 @@
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.util.Reject;
import org.opends.server.admin.AbstractManagedObjectDefinition;
-import org.opends.server.admin.IllegalPropertyValueStringException;
import org.opends.server.admin.PropertyDefinition;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagementContext;
@@ -58,7 +57,7 @@
final T value;
// Private constructor.
- private Impl(PropertyDefinition<T> pd, T value) throws IllegalPropertyValueStringException {
+ private Impl(PropertyDefinition<T> pd, T value) {
this.pd = pd;
this.value = value;
}
@@ -150,7 +149,7 @@
}
// Creates the new private implementation.
- private <T> void buildImpl(PropertyDefinition<T> pd) throws IllegalPropertyValueStringException {
+ private <T> void buildImpl(PropertyDefinition<T> pd) {
T value = pd.decodeValue(propertyStringValue);
this.impl = new Impl<T>(pd, value);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java
index 885ecd0..7a27ad2 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java
@@ -77,27 +77,31 @@
* It is based on the Admin Framework Introspection API
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
-public class ConfigGuideGeneration {
+public final class ConfigGuideGeneration {
// Note : still to be done :
// I18n support. Today all the strings are hardcoded in this file
private final static String ACI_SYNTAX_REL_URL = "/doc/admin-guide/#about-acis";
private final static String DURATION_SYNTAX_REL_URL = "duration-syntax.html";
- private final String CSS_FILE = "opendj-config.css";
+ private static final String CSS_FILE = "opendj-config.css";
- private final String MAIN_FILE = "index.html";
- private final String INHERITANCE_TREE_FILE = "ManagedObjectInheritanceTree.html";
- private final String RELATION_TREE_FILE = "ManagedObjectRelationTree.html";
- private final String MO_LIST_FILE = "ManagedObjectList.html";
- private final String PROPERTIES_INDEX_FILE = "PropertiesIndex.html";
- private final String WELCOME_FILE = "welcome.html";
- private final String MAINTOP_FILE = "maintop.html";
- private final String INDEX_FILE = "index.html";
- private final String FAVICON = "http://forgerock.org/favicon.ico";
+ private static final String MAIN_FILE = "index.html";
+ private static final String INHERITANCE_TREE_FILE = "ManagedObjectInheritanceTree.html";
+ private static final String RELATION_TREE_FILE = "ManagedObjectRelationTree.html";
+ private static final String MO_LIST_FILE = "ManagedObjectList.html";
+ private static final String PROPERTIES_INDEX_FILE = "PropertiesIndex.html";
+ private static final String WELCOME_FILE = "welcome.html";
+ private static final String MAINTOP_FILE = "maintop.html";
+ private static final String INDEX_FILE = "index.html";
+ private static final String FAVICON = "http://forgerock.org/favicon.ico";
private static final String CONFIG_GUIDE_DIR = "opendj_config_guide";
- private final String MAIN_FRAME = "mainFrame";
+ private static final String MAIN_FRAME = "mainFrame";
+
+ private ConfigGuideGeneration() {
+ // no implementation required.
+ }
/**
* Entry point for documentation generation. Properties: GenerationDir - The
@@ -133,19 +137,19 @@
ldapMapping = true;
}
- OpenDJWiki = properties.getProperty("OpenDJWiki");
- if (OpenDJWiki == null) {
+ openDJWiki = properties.getProperty("OpenDJWiki");
+ if (openDJWiki == null) {
// Default is current wiki
- OpenDJWiki = "http://wikis.forgerock.org/confluence/display/OPENDJ";
+ openDJWiki = "http://wikis.forgerock.org/confluence/display/OPENDJ";
}
- OpenDJHome = properties.getProperty("OpenDJHome");
- if (OpenDJHome == null) {
+ openDJHome = properties.getProperty("OpenDJHome");
+ if (openDJHome == null) {
// Default is current OpenDJ project home
- OpenDJHome = "http://opendj.forgerock.org";
+ openDJHome = "http://opendj.forgerock.org";
}
- aciSyntaxPage = OpenDJHome + ACI_SYNTAX_REL_URL;
+ aciSyntaxPage = openDJHome + ACI_SYNTAX_REL_URL;
durationSyntaxPage = DURATION_SYNTAX_REL_URL;
ConfigGuideGeneration myGen = new ConfigGuideGeneration();
@@ -252,7 +256,7 @@
*/
private void genManagedObjectInheritanceTree(
- TreeMap<String, TreeMap<String, AbstractManagedObjectDefinition>> list) {
+ TreeMap<String, TreeMap<String, AbstractManagedObjectDefinition>> list) {
htmlHeader(DynamicConstants.PRODUCT_NAME + " " + "Configuration Reference - Inheritance View");
tabMenu(INHERITANCE_TREE_FILE);
@@ -265,7 +269,7 @@
TreeMap<String, AbstractManagedObjectDefinition> catList = list.get(catName);
for (AbstractManagedObjectDefinition mo : catList.values()) {
if ((relList.get(mo.getName()) != null)
- && (relList.get(mo.getName()).hasOption(RelationOption.HIDDEN))) {
+ && (relList.get(mo.getName()).hasOption(RelationOption.HIDDEN))) {
continue;
}
paragraph(getLink(mo.getUserFriendlyName().toString(), mo.getName() + ".html", MAIN_FRAME));
@@ -313,7 +317,7 @@
htmlHeader(DynamicConstants.PRODUCT_NAME + " Configuration Reference - Structure View");
tabMenu(RELATION_TREE_FILE);
viewHelp("This view represents the structural relationships between "
- + "components and indicates how certain components can exist only within " + "container components.");
+ + "components and indicates how certain components can exist only within " + "container components.");
jumpSection();
for (String catName : list.keySet()) {
@@ -338,11 +342,12 @@
if (rel.hasOption(RelationOption.HIDDEN)) {
continue;
}
- String linkStr = getLink(childMo.getUserFriendlyName().toString(), childMo.getName() + ".html",
- MAIN_FRAME);
+ String linkStr =
+ getLink(childMo.getUserFriendlyName().toString(), childMo.getName() + ".html", MAIN_FRAME);
String fromStr = "";
if (!parentMo.getName().equals("")) {
- fromStr = " (from "
+ fromStr =
+ " (from "
+ getLink(parentMo.getUserFriendlyName().toString(), parentMo.getName() + ".html", MAIN_FRAME)
+ ")";
}
@@ -430,7 +435,7 @@
if (!mo.getParent().isTop()) {
heading3("Parent Component");
paragraph("The " + mo.getUserFriendlyName() + " component inherits from the "
- + getLink(mo.getParent().getUserFriendlyName().toString(), mo.getParent().getName() + ".html"));
+ + getLink(mo.getParent().getUserFriendlyName().toString(), mo.getParent().getName() + ".html"));
}
// Relations
@@ -510,8 +515,8 @@
private void homeLink() {
htmlBuff.append("<div style=\"font-size:11px;margin-top:-10px;"
- + "margin-bottom:-10px; text-align:right\"><a href=\"" + MAIN_FILE
- + "\" target=\"_top\">Configuration Reference Home</a></div>");
+ + "margin-bottom:-10px; text-align:right\"><a href=\"" + MAIN_FILE
+ + "\" target=\"_top\">Configuration Reference Home</a></div>");
}
private void generateRelationsSection(AbstractManagedObjectDefinition mo) {
@@ -579,7 +584,7 @@
if (!isCompRelsEmpty) {
paragraph("The following components have a direct COMPOSITION relation FROM "
- + mo.getUserFriendlyPluralName() + " :");
+ + mo.getUserFriendlyPluralName() + " :");
for (RelationDefinition rel : compRels) {
if (rel.hasOption(RelationOption.HIDDEN)) {
continue;
@@ -592,8 +597,9 @@
}
if (!aggregProps.isEmpty()) {
paragraph("The following components have a direct AGGREGATION relation FROM "
- + mo.getUserFriendlyPluralName() + " :");
- TreeMap<String, AbstractManagedObjectDefinition> componentList = new TreeMap<String, AbstractManagedObjectDefinition>();
+ + mo.getUserFriendlyPluralName() + " :");
+ TreeMap<String, AbstractManagedObjectDefinition> componentList =
+ new TreeMap<String, AbstractManagedObjectDefinition>();
for (AggregationPropertyDefinition agg : aggregProps) {
RelationDefinition rel = agg.getRelationDefinition();
AbstractManagedObjectDefinition childRel = rel.getChildDefinition();
@@ -617,7 +623,7 @@
if (!mo.getReverseRelationDefinitions().isEmpty()) {
if (!isReverseCompRelsEmpty) {
paragraph("The following components have a direct COMPOSITION relation TO "
- + mo.getUserFriendlyPluralName() + " :");
+ + mo.getUserFriendlyPluralName() + " :");
for (RelationDefinition rel : reverseCompRels) {
beginList();
AbstractManagedObjectDefinition childRel = rel.getParentDefinition();
@@ -628,8 +634,9 @@
}
if (!isReverseAggregPropsEmpty) {
paragraph("The following components have a direct AGGREGATION relation TO "
- + mo.getUserFriendlyPluralName() + " :");
- TreeMap<String, AbstractManagedObjectDefinition> componentList = new TreeMap<String, AbstractManagedObjectDefinition>();
+ + mo.getUserFriendlyPluralName() + " :");
+ TreeMap<String, AbstractManagedObjectDefinition> componentList =
+ new TreeMap<String, AbstractManagedObjectDefinition>();
for (AggregationPropertyDefinition agg : reverseAggregProps) {
AbstractManagedObjectDefinition fromMo = agg.getManagedObjectDefinition();
componentList.put(fromMo.getName(), fromMo);
@@ -652,8 +659,8 @@
// Property table
startTable();
tableRow("Description",
- ((prop.getSynopsis() != null) ? prop.getSynopsis().toString() + " " : "")
- + ((prop.getDescription() != null) ? prop.getDescription().toString() : ""));
+ ((prop.getSynopsis() != null) ? prop.getSynopsis().toString() + " " : "")
+ + ((prop.getDescription() != null) ? prop.getDescription().toString() : ""));
// Default value
String defValueStr = getDefaultBehaviorString(prop);
@@ -675,7 +682,8 @@
Type actionType = prop.getAdministratorAction().getType();
String actionStr = "";
if (actionType == Type.COMPONENT_RESTART) {
- actionStr = "The " + mo.getUserFriendlyName()
+ actionStr =
+ "The " + mo.getUserFriendlyName()
+ " must be disabled and re-enabled for changes to this setting " + "to take effect";
} else if (actionType == Type.SERVER_RESTART) {
actionStr = "Restart the server";
@@ -704,9 +712,9 @@
}
private void propertiesLinkTable(TreeMap<String, PropertyDefinition> basicProps,
- TreeMap<String, PropertyDefinition> advancedProps) {
+ TreeMap<String, PropertyDefinition> advancedProps) {
htmlBuff.append("<table border=\"0\" cellspacing=\"0\" class=\"jump-table\">\n" + " <tr>\n"
- + " <th>Basic Properties:</th>\n" + " <th>Advanced Properties:</th>\n" + " </tr>\n");
+ + " <th>Basic Properties:</th>\n" + " <th>Advanced Properties:</th>\n" + " </tr>\n");
PropertyDefinition[] basicPropsArray = basicProps.values().toArray(new PropertyDefinition[0]);
PropertyDefinition[] advancedPropsArray = advancedProps.values().toArray(new PropertyDefinition[0]);
@@ -717,8 +725,8 @@
String basicHtmlCell = "";
if (basicPropName != null) {
- basicHtmlCell = " <td>↓ <a href=\"#" + basicPropName + "\">" + basicPropName
- + "</a></td>\n";
+ basicHtmlCell =
+ " <td>↓ <a href=\"#" + basicPropName + "\">" + basicPropName + "</a></td>\n";
} else if ((basicPropsArray.length == 0) && (ii == 0)) {
basicHtmlCell = " <td> None</td>\n";
} else if (ii >= basicPropsArray.length) {
@@ -728,8 +736,8 @@
String advancedHtmlCell = "";
if (advancedPropName != null) {
- advancedHtmlCell = " <td>↓ <a href=\"#" + advancedPropName + "\">" + advancedPropName
- + "</a></td>\n";
+ advancedHtmlCell =
+ " <td>↓ <a href=\"#" + advancedPropName + "\">" + advancedPropName + "</a></td>\n";
} else if ((advancedPropsArray.length == 0) && (ii == 0)) {
advancedHtmlCell = " <td> None</td>\n";
}
@@ -748,10 +756,10 @@
heading3("LDAP Mapping");
paragraph("Each configuration property can be mapped to a specific "
- + "LDAP attribute under the \"cn=config\" entry. "
- + "The mappings that follow are provided for information only. "
- + "In general, you should avoid changing the server configuration "
- + "by manipulating the LDAP attributes directly.");
+ + "LDAP attribute under the \"cn=config\" entry. "
+ + "The mappings that follow are provided for information only. "
+ + "In general, you should avoid changing the server configuration "
+ + "by manipulating the LDAP attributes directly.");
// Managed object table
startTable();
@@ -807,7 +815,7 @@
lettersPointers += getLink(letter, "#" + letter) + " ";
}
moPointers.append("<p> "
- + getLink(mo.getUserFriendlyName().toString(), mo.getName() + ".html", MAIN_FRAME) + "</p>\n");
+ + getLink(mo.getUserFriendlyName().toString(), mo.getName() + ".html", MAIN_FRAME) + "</p>\n");
}
paragraph(lettersPointers);
htmlBuff.append(moPointers);
@@ -847,8 +855,7 @@
htmlHeader(DynamicConstants.PRODUCT_NAME + " Configuration Reference - Properties View");
tabMenu(PROPERTIES_INDEX_FILE);
viewHelp("This view provides a list of all configuration properties, "
- + "in alphabetical order, and indicates the configuration component to "
- + "which each property applies.");
+ + "in alphabetical order, and indicates the configuration component to " + "which each property applies.");
newline();
paragraph(lettersPointers);
@@ -861,9 +868,9 @@
htmlHeader(DynamicConstants.PRODUCT_NAME + " Configuration Reference - Welcome");
heading2("About This Reference");
paragraph("This reference " + "describes the " + DynamicConstants.PRODUCT_NAME
- + " configuration properties that can be manipulated " + "with the dsconfig command.");
+ + " configuration properties that can be manipulated " + "with the dsconfig command.");
paragraph("Configuration components are grouped according to the area of "
- + "the server in which they are used, as follows:");
+ + "the server in which they are used, as follows:");
beginList();
for (String catName : catTopMoList.keySet()) {
@@ -872,29 +879,29 @@
endList();
paragraph("For ease of reference, the configuration is described on multiple "
- + "tabs. These tabs provide alternative views of the configuration " + "components:");
+ + "tabs. These tabs provide alternative views of the configuration " + "components:");
beginList();
bullet("The <strong>Inheritance</strong> view represents the inheritance "
- + "relationships between configuration components. A sub-component "
- + "inherits all of the properties of its parent component.");
+ + "relationships between configuration components. A sub-component "
+ + "inherits all of the properties of its parent component.");
bullet("The <strong>Structure</strong> view represents the structural "
- + "relationships between components and indicates how certain components "
- + "can exist only within container components. When a container "
- + "component is deleted, all of the components within it are also " + "deleted.");
+ + "relationships between components and indicates how certain components "
+ + "can exist only within container components. When a container "
+ + "component is deleted, all of the components within it are also " + "deleted.");
bullet("The <strong>Components</strong> view provides an alphabetical list "
- + "of all configuration components.");
+ + "of all configuration components.");
bullet("The <strong>Properties</strong> view provides an alphabetical list "
- + "of all configuration properties, and indicates the configuration "
- + "component to which each property applies.");
+ + "of all configuration properties, and indicates the configuration "
+ + "component to which each property applies.");
endList();
newline();
paragraph("When you set up " + DynamicConstants.PRODUCT_NAME + ", certain components are created in the "
- + "configuration by default. These components are configured with "
- + "specific values, which are not necessarily the same as the "
- + "\"default values\" of new components that you create using dsconfig. "
- + "The \"default values\" listed in this document refer to the values "
- + "of the new components that you create using dsconfig.");
+ + "configuration by default. These components are configured with "
+ + "specific values, which are not necessarily the same as the "
+ + "\"default values\" of new components that you create using dsconfig. "
+ + "The \"default values\" listed in this document refer to the values "
+ + "of the new components that you create using dsconfig.");
htmlFooter();
generateFile(WELCOME_FILE);
@@ -903,15 +910,15 @@
private void genMainTopPage() {
htmlHeader(DynamicConstants.PRODUCT_NAME + " Configuration Reference - Main Top");
- htmlBuff.append("<div class=\"breadcrumb\"><span class=\"pageactions\">" + "<a href=\"" + OpenDJHome
- + "\" target=\"_parent\">" + "<span style=\"font-size: 12px;\">« </span>"
- + "Back to " + DynamicConstants.PRODUCT_NAME + " Home</a></span> </div>\n");
+ htmlBuff.append("<div class=\"breadcrumb\"><span class=\"pageactions\">" + "<a href=\"" + openDJHome
+ + "\" target=\"_parent\">" + "<span style=\"font-size: 12px;\">« </span>" + "Back to "
+ + DynamicConstants.PRODUCT_NAME + " Home</a></span> </div>\n");
htmlBuff.append("<table class=\"titletable\" cellspacing=\"0\" " + "width=\"100%\">\n");
htmlBuff.append("<tbody><tr>\n");
htmlBuff.append(" <td><h2>" + DynamicConstants.PRODUCT_NAME + " Configuration Reference</h2></td>\n");
- htmlBuff.append(" <td valign=\"bottom\" width=\"10%\">" + "<a href=\"" + OpenDJHome
- + "\" target=\"_parent\">" + "<img src=\"opendj_logo_sm.png\" alt=\"OpenDJ Logo\" align=\"bottom\" "
- + "border=\"0\" height=\"33\" width=\"114\"></a></td>\n");
+ htmlBuff.append(" <td valign=\"bottom\" width=\"10%\">" + "<a href=\"" + openDJHome
+ + "\" target=\"_parent\">" + "<img src=\"opendj_logo_sm.png\" alt=\"OpenDJ Logo\" align=\"bottom\" "
+ + "border=\"0\" height=\"33\" width=\"114\"></a></td>\n");
htmlBuff.append("</tr>\n");
htmlBuff.append("</tbody></table>\n");
@@ -924,14 +931,15 @@
htmlBuff.append(getHtmlHeader(DynamicConstants.PRODUCT_NAME + " Configuration Reference"));
htmlBuff.append("<frameset rows=\"80,*\" framespacing=\"1\" "
- + "frameborder=\"yes\" border=\"1\" bordercolor=\"#333333\">\n");
+ + "frameborder=\"yes\" border=\"1\" bordercolor=\"#333333\">\n");
htmlBuff.append(" <frame src=\"" + MAINTOP_FILE + "\" name=\"topFrame\" "
- + "id=\"topFrame\" border=\"1\" title=\"topFrame\" scrolling=\"no\">\n");
- htmlBuff.append(" <frameset cols=\"375,*\" frameborder=\"yes\" " + "border=\"1\" " + "framespacing=\"1\">\n");
+ + "id=\"topFrame\" border=\"1\" title=\"topFrame\" scrolling=\"no\">\n");
+ htmlBuff
+ .append(" <frameset cols=\"375,*\" frameborder=\"yes\" " + "border=\"1\" " + "framespacing=\"1\">\n");
htmlBuff.append(" <frame src=\"" + INHERITANCE_TREE_FILE + "\" "
- + "name=\"leftFrame\" id=\"leftFrame\" title=\"leftFrame\" " + "scrolling=\"auto\">\n");
+ + "name=\"leftFrame\" id=\"leftFrame\" title=\"leftFrame\" " + "scrolling=\"auto\">\n");
htmlBuff.append(" <frame src=\"" + WELCOME_FILE + "\" name=\"mainFrame\" "
- + "id=\"mainFrame\" title=\"mainFrame\" scrolling=\"auto\">\n");
+ + "id=\"mainFrame\" title=\"mainFrame\" scrolling=\"auto\">\n");
htmlBuff.append(" </frameset>\n");
htmlBuff.append("</frameset>\n");
htmlBuff.append("<noframes><body>\n");
@@ -977,10 +985,10 @@
RelationDefinition rel = prop.getRelationDefinition();
String linkStr = getLink(rel.getUserFriendlyName().toString(), rel.getName() + ".html");
return "The DN of any "
- + linkStr
- + ". "
- + ((prop.getSourceConstraintSynopsis() != null) ? prop.getSourceConstraintSynopsis()
- .toString() : "");
+ + linkStr
+ + ". "
+ + ((prop.getSourceConstraintSynopsis() != null) ? prop.getSourceConstraintSynopsis().toString()
+ : "");
}
@Override
@@ -1022,12 +1030,12 @@
if (prop.getMaximumUnit() != null) {
durationStr += "Maximum unit is \"" + prop.getMaximumUnit().getLongName() + "\". ";
}
- long lowerLimitStr = new Double(prop.getBaseUnit().fromMilliSeconds(prop.getLowerLimit()))
- .longValue();
+ long lowerLimitStr =
+ new Double(prop.getBaseUnit().fromMilliSeconds(prop.getLowerLimit())).longValue();
durationStr += "Lower limit is " + lowerLimitStr + " " + prop.getBaseUnit().getLongName() + ". ";
if (prop.getUpperLimit() != null) {
- long upperLimitStr = new Double(prop.getBaseUnit().fromMilliSeconds(prop.getUpperLimit()))
- .longValue();
+ long upperLimitStr =
+ new Double(prop.getBaseUnit().fromMilliSeconds(prop.getUpperLimit())).longValue();
durationStr += "Upper limit is " + upperLimitStr + " " + prop.getBaseUnit().getLongName() + ". ";
}
@@ -1126,19 +1134,23 @@
AliasDefaultBehaviorProvider aliasBehav = (AliasDefaultBehaviorProvider) defaultBehav;
defValueStr = aliasBehav.getSynopsis().toString();
} else if (defaultBehav instanceof RelativeInheritedDefaultBehaviorProvider) {
- RelativeInheritedDefaultBehaviorProvider relativBehav = (RelativeInheritedDefaultBehaviorProvider) defaultBehav;
- defValueStr = getDefaultBehaviorString(relativBehav.getManagedObjectDefinition().getPropertyDefinition(
+ RelativeInheritedDefaultBehaviorProvider relativBehav =
+ (RelativeInheritedDefaultBehaviorProvider) defaultBehav;
+ defValueStr =
+ getDefaultBehaviorString(relativBehav.getManagedObjectDefinition().getPropertyDefinition(
relativBehav.getPropertyName()));
} else if (defaultBehav instanceof AbsoluteInheritedDefaultBehaviorProvider) {
- AbsoluteInheritedDefaultBehaviorProvider absoluteBehav = (AbsoluteInheritedDefaultBehaviorProvider) defaultBehav;
- defValueStr = getDefaultBehaviorString(absoluteBehav.getManagedObjectDefinition().getPropertyDefinition(
+ AbsoluteInheritedDefaultBehaviorProvider absoluteBehav =
+ (AbsoluteInheritedDefaultBehaviorProvider) defaultBehav;
+ defValueStr =
+ getDefaultBehaviorString(absoluteBehav.getManagedObjectDefinition().getPropertyDefinition(
absoluteBehav.getPropertyName()));
}
return defValueStr;
}
private TreeMap<String, AbstractManagedObjectDefinition> makeMOTreeMap(
- Collection<AbstractManagedObjectDefinition> coll) {
+ Collection<AbstractManagedObjectDefinition> coll) {
if (coll == null) {
return null;
@@ -1224,34 +1236,35 @@
}
- private final String Now = new Date().toString();
+ private static final String NOW = new Date().toString();
private String getHtmlHeader(String pageTitle) {
return ("<html>\n" + "<head>\n" + "<meta http-equiv=\"content-type\"\n"
- + "content=\"text/html; charset=ISO-8859-1\">\n" + "<title>" + pageTitle + "</title>\n"
- + "<link rel=\"stylesheet\" type=\"text/css\"\n" + "href=\"" + CSS_FILE + "\">\n"
- + "<link rel=\"shortcut icon\" href=\"" + FAVICON + "\">\n"
- + "<meta name=\"date generated\" content=\"" + Now + "\">\n" + "</head>\n");
+ + "content=\"text/html; charset=ISO-8859-1\">\n" + "<title>" + pageTitle + "</title>\n"
+ + "<link rel=\"stylesheet\" type=\"text/css\"\n" + "href=\"" + CSS_FILE + "\">\n"
+ + "<link rel=\"shortcut icon\" href=\"" + FAVICON + "\">\n" + "<meta name=\"date generated\" content=\""
+ + NOW + "\">\n" + "</head>\n");
}
// Add a Tab Menu, the active tab is the one given as parameter
private void tabMenu(String activeTab) {
+ // @Checkstyle:off
htmlBuff.append("<div class=\"tabmenu\"> " +
"<span><a " + (activeTab.equals(INHERITANCE_TREE_FILE) ? "class=\"activetab\" " : "") + "href=\""
- + INHERITANCE_TREE_FILE + "\"" + " title=\"Inheritance View of Components\">Inheritance</a></span> " +
+ + INHERITANCE_TREE_FILE + "\"" + " title=\"Inheritance View of Components\">Inheritance</a></span> " +
- "<span><a " + (activeTab.equals(RELATION_TREE_FILE) ? "class=\"activetab\" " : "") + "href=\""
- + RELATION_TREE_FILE + "\"" + " title=\"Relational View of Components\">Structure</a></span> " +
+ "<span><a " + (activeTab.equals(RELATION_TREE_FILE) ? "class=\"activetab\" " : "") + "href=\""
+ + RELATION_TREE_FILE + "\"" + " title=\"Relational View of Components\">Structure</a></span> " +
- "<span><a " + (activeTab.equals(MO_LIST_FILE) ? "class=\"activetab\" " : "") + "href=\""
- + MO_LIST_FILE + "\"" + " title=\"Alphabetical Index of Components\">Components</a></span> " +
+ "<span><a " + (activeTab.equals(MO_LIST_FILE) ? "class=\"activetab\" " : "") + "href=\"" + MO_LIST_FILE
+ + "\"" + " title=\"Alphabetical Index of Components\">Components</a></span> " +
- "<span><a " + (activeTab.equals(PROPERTIES_INDEX_FILE) ? "class=\"activetab\" " : "") + "href=\""
- + PROPERTIES_INDEX_FILE + "\"" + " title=\"Alphabetical Index of Properties\" >Properties</a></span>"
- +
+ "<span><a " + (activeTab.equals(PROPERTIES_INDEX_FILE) ? "class=\"activetab\" " : "") + "href=\""
+ + PROPERTIES_INDEX_FILE + "\"" + " title=\"Alphabetical Index of Properties\" >Properties</a></span>" +
- "</div>" + "\n");
+ "</div>" + "\n");
+ // @Checkstyle:on
}
private String getLink(String str, String link) {
@@ -1264,7 +1277,7 @@
private String getLink(String str, String link, String target, String color) {
return "<a " + (color != null ? "style=\"color:" + color + "\" " : "") + "href=\"" + link + "\""
- + (target == null ? "" : " target=\"" + target + "\"") + ">" + str + "</a>";
+ + (target == null ? "" : " target=\"" + target + "\"") + ">" + str + "</a>";
}
private void link(String str, String link) {
@@ -1341,7 +1354,7 @@
private void startTable() {
htmlBuff.append("<table " + "style=\"width: 100%; text-align: left;\"" + "border=\"1\"" + "cellpadding=\"1\""
- + "cellspacing=\"0\"" + ">\n");
+ + "cellspacing=\"0\"" + ">\n");
htmlBuff.append("<tbody>\n");
}
@@ -1369,7 +1382,7 @@
for (int ii = 0; ii < strings.length; ii++) {
String string = strings[ii];
htmlBuff.append("<td style=\"" + "vertical-align: top; " + ((ii == 0) ? "width: 20%;" : "") + "\">"
- + string + "<br></td>");
+ + string + "<br></td>");
}
htmlBuff.append("</tr>\n");
}
@@ -1407,8 +1420,8 @@
private void generateFile(String fileName) {
// Write the html buffer in a file
try {
- PrintWriter file = new java.io.PrintWriter(new java.io.FileWriter(generationDir + File.separator
- + fileName));
+ PrintWriter file =
+ new java.io.PrintWriter(new java.io.FileWriter(generationDir + File.separator + fileName));
file.write(htmlBuff.toString());
file.close();
} catch (Exception e) {
@@ -1422,17 +1435,21 @@
// Relation List from RootConfiguration
private final TreeMap<String, RelationDefinition> topRelList = new TreeMap<String, RelationDefinition>();
private final TreeMap<String, RelationDefinition> relList = new TreeMap<String, RelationDefinition>();
- private final TreeMap<String, TreeMap<String, RelationDefinition>> catTopRelList = new TreeMap<String, TreeMap<String, RelationDefinition>>();
+ private final TreeMap<String, TreeMap<String, RelationDefinition>> catTopRelList =
+ new TreeMap<String, TreeMap<String, RelationDefinition>>();
// managed object list
- private final TreeMap<String, AbstractManagedObjectDefinition> moList = new TreeMap<String, AbstractManagedObjectDefinition>();
- private final TreeMap<String, AbstractManagedObjectDefinition> topMoList = new TreeMap<String, AbstractManagedObjectDefinition>();
- private final TreeMap<String, TreeMap<String, AbstractManagedObjectDefinition>> catTopMoList = new TreeMap<String, TreeMap<String, AbstractManagedObjectDefinition>>();
+ private final TreeMap<String, AbstractManagedObjectDefinition> moList =
+ new TreeMap<String, AbstractManagedObjectDefinition>();
+ private final TreeMap<String, AbstractManagedObjectDefinition> topMoList =
+ new TreeMap<String, AbstractManagedObjectDefinition>();
+ private final TreeMap<String, TreeMap<String, AbstractManagedObjectDefinition>> catTopMoList =
+ new TreeMap<String, TreeMap<String, AbstractManagedObjectDefinition>>();
private final int ind = 0;
private StringBuffer htmlBuff = new StringBuffer();
private static String generationDir;
private static boolean ldapMapping = false;
- private static String OpenDJWiki;
- private static String OpenDJHome;
+ private static String openDJWiki;
+ private static String openDJHome;
private static String aciSyntaxPage;
private static String durationSyntaxPage;
private boolean inList = false;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/package-info.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/package-info.java
index 1590b05..d4b946e 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/package-info.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/package-info.java
@@ -24,8 +24,6 @@
* Copyright 2008 Sun Microsystems, Inc.
*/
-
-
/**
* Common administration classes.
* <p>
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ConfigChangeListenerAdaptor.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ConfigChangeListenerAdaptor.java
index 8092a17..c46ca0a 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ConfigChangeListenerAdaptor.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ConfigChangeListenerAdaptor.java
@@ -195,7 +195,7 @@
/** The managed object path. */
private final ManagedObjectPath<?, S> path;
- /** Repository of configuration entries */
+ /** Repository of configuration entries. */
private final ConfigurationRepository configRepository;
private final ServerManagementContext serverContext;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ConfigurationAddListener.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ConfigurationAddListener.java
index 653afe4..46ea3e8 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ConfigurationAddListener.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ConfigurationAddListener.java
@@ -24,52 +24,45 @@
* Copyright 2007-2008 Sun Microsystems, Inc.
*/
package org.opends.server.admin.server;
+
import org.forgerock.i18n.LocalizableMessage;
-
-
import java.util.List;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
-
-
/**
- * This interface defines the methods that a Directory Server
- * configurable component should implement if it wishes to be able to
- * receive notifications when a new configuration is added.
+ * This interface defines the methods that a Directory Server configurable
+ * component should implement if it wishes to be able to receive notifications
+ * when a new configuration is added.
*
* @param <T>
- * The type of configuration that this listener should be
- * notified about.
+ * The type of configuration that this listener should be notified
+ * about.
*/
public interface ConfigurationAddListener<T extends Configuration> {
- /**
- * Indicates whether the proposed addition of a new configuration is
- * acceptable to this add listener.
- *
- * @param configuration
- * The configuration that will be added.
- * @param unacceptableReasons
- * A list that can be used to hold messages about why the
- * provided configuration is not acceptable.
- * @return Returns <code>true</code> if the proposed addition is
- * acceptable, or <code>false</code> if it is not.
- */
- public boolean isConfigurationAddAcceptable(T configuration,
- List<LocalizableMessage> unacceptableReasons);
+ /**
+ * Indicates whether the proposed addition of a new configuration is
+ * acceptable to this add listener.
+ *
+ * @param configuration
+ * The configuration that will be added.
+ * @param unacceptableReasons
+ * A list that can be used to hold messages about why the
+ * provided configuration is not acceptable.
+ * @return Returns <code>true</code> if the proposed addition is acceptable,
+ * or <code>false</code> if it is not.
+ */
+ public boolean isConfigurationAddAcceptable(T configuration, List<LocalizableMessage> unacceptableReasons);
-
-
- /**
- * Adds a new configuration to this add listener.
- *
- * @param configuration
- * The configuration that will be added.
- * @return Returns information about the result of adding the
- * configuration.
- */
- public ConfigChangeResult applyConfigurationAdd(T configuration);
+ /**
+ * Adds a new configuration to this add listener.
+ *
+ * @param configuration
+ * The configuration that will be added.
+ * @return Returns information about the result of adding the configuration.
+ */
+ public ConfigChangeResult applyConfigurationAdd(T configuration);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/DelayedConfigAddListener.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/DelayedConfigAddListener.java
index 6188729..a59cb90 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/DelayedConfigAddListener.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/DelayedConfigAddListener.java
@@ -74,7 +74,8 @@
* @param addListener
* The add listener to be added to the subordinate entry when it
* is added.
- * @param configRepository TODO
+ * @param configRepository
+ * Repository of config entries.
*/
public DelayedConfigAddListener(DN child, ConfigAddListener addListener, ConfigurationRepository configRepository) {
this.parent = child.parent();
@@ -94,9 +95,11 @@
* @param deleteListener
* The delete listener to be added to the subordinate entry when
* it is added.
- * @param configRepository TODO
+ * @param configRepository
+ * Repository of config entries.
*/
- public DelayedConfigAddListener(DN child, ConfigDeleteListener deleteListener, ConfigurationRepository configRepository) {
+ public DelayedConfigAddListener(DN child, ConfigDeleteListener deleteListener,
+ ConfigurationRepository configRepository) {
this.parent = child.parent();
this.child = child;
this.delayedAddListener = null;
@@ -107,6 +110,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public ConfigChangeResult applyConfigurationAdd(Entry configEntry) {
if (configEntry.getName().equals(child)) {
// The subordinate entry matched our criteria so register the
@@ -137,6 +141,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean configAddIsAcceptable(Entry configEntry, LocalizableMessageBuilder unacceptableReason) {
// Always acceptable.
return true;
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObject.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObject.java
index 49396ee..2d605c7 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObject.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObject.java
@@ -82,7 +82,7 @@
private final ManagedObjectDefinition<?, S> definition;
- /** The managed object path identifying this managed object's location */
+ /** The managed object path identifying this managed object's location. */
private final ManagedObjectPath<?, S> path;
private final Map<PropertyDefinition<?>, SortedSet<?>> properties;
@@ -126,7 +126,7 @@
* with this managed object's definition.
*/
public <M extends Configuration> void deregisterAddListener(InstantiableRelationDefinition<?, M> d,
- ConfigurationAddListener<M> listener) throws IllegalArgumentException {
+ ConfigurationAddListener<M> listener) {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d);
deregisterAddListener(baseDN, listener);
@@ -146,7 +146,7 @@
* with this managed object's definition.
*/
public <M extends Configuration> void deregisterAddListener(InstantiableRelationDefinition<?, M> d,
- ServerManagedObjectAddListener<M> listener) throws IllegalArgumentException {
+ ServerManagedObjectAddListener<M> listener) {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d);
deregisterAddListener(baseDN, listener);
@@ -166,7 +166,7 @@
* this managed object's definition.
*/
public <M extends Configuration> void deregisterAddListener(OptionalRelationDefinition<?, M> d,
- ConfigurationAddListener<M> listener) throws IllegalArgumentException {
+ ConfigurationAddListener<M> listener) {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d).parent();
deregisterAddListener(baseDN, listener);
@@ -186,7 +186,7 @@
* this managed object's definition.
*/
public <M extends Configuration> void deregisterAddListener(OptionalRelationDefinition<?, M> d,
- ServerManagedObjectAddListener<M> listener) throws IllegalArgumentException {
+ ServerManagedObjectAddListener<M> listener) {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d).parent();
deregisterAddListener(baseDN, listener);
@@ -206,7 +206,7 @@
* managed object's definition.
*/
public <M extends Configuration> void deregisterAddListener(SetRelationDefinition<?, M> d,
- ConfigurationAddListener<M> listener) throws IllegalArgumentException {
+ ConfigurationAddListener<M> listener) {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d);
deregisterAddListener(baseDN, listener);
@@ -226,7 +226,7 @@
* managed object's definition.
*/
public <M extends Configuration> void deregisterAddListener(SetRelationDefinition<?, M> d,
- ServerManagedObjectAddListener<M> listener) throws IllegalArgumentException {
+ ServerManagedObjectAddListener<M> listener) {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d);
deregisterAddListener(baseDN, listener);
@@ -244,7 +244,8 @@
ConfigChangeListenerAdaptor<?> adaptor = (ConfigChangeListenerAdaptor<?>) l;
ServerManagedObjectChangeListener<?> l2 = adaptor.getServerManagedObjectChangeListener();
if (l2 instanceof ServerManagedObjectChangeListenerAdaptor<?>) {
- ServerManagedObjectChangeListenerAdaptor<?> adaptor2 = (ServerManagedObjectChangeListenerAdaptor<?>) l2;
+ ServerManagedObjectChangeListenerAdaptor<?> adaptor2 =
+ (ServerManagedObjectChangeListenerAdaptor<?>) l2;
if (adaptor2.getConfigurationChangeListener() == listener) {
adaptor.finalizeChangeListener();
configRepository.deregisterChangeListener(configDN, adaptor);
@@ -286,7 +287,7 @@
* with this managed object's definition.
*/
public <M extends Configuration> void deregisterDeleteListener(InstantiableRelationDefinition<?, M> d,
- ConfigurationDeleteListener<M> listener) throws IllegalArgumentException {
+ ConfigurationDeleteListener<M> listener) {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d);
@@ -307,7 +308,7 @@
* with this managed object's definition.
*/
public <M extends Configuration> void deregisterDeleteListener(InstantiableRelationDefinition<?, M> d,
- ServerManagedObjectDeleteListener<M> listener) throws IllegalArgumentException {
+ ServerManagedObjectDeleteListener<M> listener) {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d);
@@ -328,7 +329,7 @@
* this managed object's definition.
*/
public <M extends Configuration> void deregisterDeleteListener(OptionalRelationDefinition<?, M> d,
- ConfigurationDeleteListener<M> listener) throws IllegalArgumentException {
+ ConfigurationDeleteListener<M> listener) {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d).parent();
@@ -349,7 +350,7 @@
* this managed object's definition.
*/
public <M extends Configuration> void deregisterDeleteListener(OptionalRelationDefinition<?, M> d,
- ServerManagedObjectDeleteListener<M> listener) throws IllegalArgumentException {
+ ServerManagedObjectDeleteListener<M> listener) {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d).parent();
@@ -370,7 +371,7 @@
* managed object's definition.
*/
public <M extends Configuration> void deregisterDeleteListener(SetRelationDefinition<?, M> d,
- ConfigurationDeleteListener<M> listener) throws IllegalArgumentException {
+ ConfigurationDeleteListener<M> listener) {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d);
@@ -391,7 +392,7 @@
* managed object's definition.
*/
public <M extends Configuration> void deregisterDeleteListener(SetRelationDefinition<?, M> d,
- ServerManagedObjectDeleteListener<M> listener) throws IllegalArgumentException {
+ ServerManagedObjectDeleteListener<M> listener) {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d);
@@ -417,7 +418,7 @@
* not be decoded.
*/
public <M extends Configuration> ServerManagedObject<? extends M> getChild(InstantiableRelationDefinition<?, M> d,
- String name) throws IllegalArgumentException, ConfigException {
+ String name) throws ConfigException {
validateRelationDefinition(d);
return serverContext.getManagedObject(path.child(d, name));
}
@@ -439,7 +440,7 @@
* not be decoded.
*/
public <M extends Configuration> ServerManagedObject<? extends M> getChild(OptionalRelationDefinition<?, M> d)
- throws IllegalArgumentException, ConfigException {
+ throws ConfigException {
validateRelationDefinition(d);
return serverContext.getManagedObject(path.child(d));
}
@@ -465,7 +466,7 @@
* not be decoded.
*/
public <M extends Configuration> ServerManagedObject<? extends M> getChild(SetRelationDefinition<?, M> d,
- String name) throws IllegalArgumentException, ConfigException {
+ String name) throws ConfigException {
validateRelationDefinition(d);
return serverContext.getManagedObject(path.child(d, name));
@@ -488,7 +489,7 @@
* not be decoded.
*/
public <M extends Configuration> ServerManagedObject<? extends M> getChild(SingletonRelationDefinition<?, M> d)
- throws IllegalArgumentException, ConfigException {
+ throws ConfigException {
validateRelationDefinition(d);
return serverContext.getManagedObject(path.child(d));
}
@@ -560,7 +561,7 @@
* If the property definition is not associated with this
* managed object's definition.
*/
- public <T> T getPropertyValue(PropertyDefinition<T> d) throws IllegalArgumentException {
+ public <T> T getPropertyValue(PropertyDefinition<T> d) {
Set<T> values = getPropertyValues(d);
if (values.isEmpty()) {
return null;
@@ -586,7 +587,7 @@
* managed object's definition.
*/
@SuppressWarnings("unchecked")
- public <T> SortedSet<T> getPropertyValues(PropertyDefinition<T> d) throws IllegalArgumentException {
+ public <T> SortedSet<T> getPropertyValues(PropertyDefinition<T> d) {
if (!properties.containsKey(d)) {
throw new IllegalArgumentException("Unknown property " + d.getName());
}
@@ -605,7 +606,7 @@
* If the optional relation definition is not associated with
* this managed object's definition.
*/
- public boolean hasChild(OptionalRelationDefinition<?, ?> d) throws IllegalArgumentException {
+ public boolean hasChild(OptionalRelationDefinition<?, ?> d) {
validateRelationDefinition(d);
return serverContext.managedObjectExists(path.child(d));
}
@@ -621,7 +622,7 @@
* If the relation definition is not associated with this
* managed object's definition.
*/
- public String[] listChildren(InstantiableRelationDefinition<?, ?> d) throws IllegalArgumentException {
+ public String[] listChildren(InstantiableRelationDefinition<?, ?> d) {
validateRelationDefinition(d);
return serverContext.listManagedObjects(path, d);
}
@@ -637,7 +638,7 @@
* If the relation definition is not associated with this
* managed object's definition.
*/
- public String[] listChildren(SetRelationDefinition<?, ?> d) throws IllegalArgumentException {
+ public String[] listChildren(SetRelationDefinition<?, ?> d) {
validateRelationDefinition(d);
return serverContext.listManagedObjects(path, d);
}
@@ -660,7 +661,7 @@
* relation could not be retrieved.
*/
public <M extends Configuration> void registerAddListener(InstantiableRelationDefinition<?, M> d,
- ConfigurationAddListener<M> listener) throws IllegalArgumentException, ConfigException {
+ ConfigurationAddListener<M> listener) throws ConfigException {
registerAddListener(d, new ServerManagedObjectAddListenerAdaptor<M>(listener));
}
@@ -682,7 +683,7 @@
* relation could not be retrieved.
*/
public <M extends Configuration> void registerAddListener(InstantiableRelationDefinition<?, M> d,
- ServerManagedObjectAddListener<M> listener) throws IllegalArgumentException, ConfigException {
+ ServerManagedObjectAddListener<M> listener) throws ConfigException {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d);
ConfigAddListener adaptor = new ConfigAddListenerAdaptor<M>(serverContext, path, d, listener);
@@ -707,7 +708,7 @@
* relation could not be retrieved.
*/
public <M extends Configuration> void registerAddListener(OptionalRelationDefinition<?, M> d,
- ConfigurationAddListener<M> listener) throws IllegalArgumentException, ConfigException {
+ ConfigurationAddListener<M> listener) throws ConfigException {
registerAddListener(d, new ServerManagedObjectAddListenerAdaptor<M>(listener));
}
@@ -729,7 +730,7 @@
* relation could not be retrieved.
*/
public <M extends Configuration> void registerAddListener(OptionalRelationDefinition<?, M> d,
- ServerManagedObjectAddListener<M> listener) throws IllegalArgumentException, ConfigException {
+ ServerManagedObjectAddListener<M> listener) throws ConfigException {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d).parent();
ConfigAddListener adaptor = new ConfigAddListenerAdaptor<M>(serverContext, path, d, listener);
@@ -754,7 +755,7 @@
* could not be retrieved.
*/
public <M extends Configuration> void registerAddListener(SetRelationDefinition<?, M> d,
- ConfigurationAddListener<M> listener) throws IllegalArgumentException, ConfigException {
+ ConfigurationAddListener<M> listener) throws ConfigException {
registerAddListener(d, new ServerManagedObjectAddListenerAdaptor<M>(listener));
}
@@ -776,7 +777,7 @@
* could not be retrieved.
*/
public <M extends Configuration> void registerAddListener(SetRelationDefinition<?, M> d,
- ServerManagedObjectAddListener<M> listener) throws IllegalArgumentException, ConfigException {
+ ServerManagedObjectAddListener<M> listener) throws ConfigException {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d);
ConfigAddListener adaptor = new ConfigAddListenerAdaptor<M>(serverContext, path, d, listener);
@@ -843,7 +844,7 @@
* relation could not be retrieved.
*/
public <M extends Configuration> void registerDeleteListener(InstantiableRelationDefinition<?, M> d,
- ConfigurationDeleteListener<M> listener) throws IllegalArgumentException, ConfigException {
+ ConfigurationDeleteListener<M> listener) throws ConfigException {
registerDeleteListener(d, new ServerManagedObjectDeleteListenerAdaptor<M>(listener));
}
@@ -865,7 +866,7 @@
* relation could not be retrieved.
*/
public <M extends Configuration> void registerDeleteListener(InstantiableRelationDefinition<?, M> d,
- ServerManagedObjectDeleteListener<M> listener) throws IllegalArgumentException, ConfigException {
+ ServerManagedObjectDeleteListener<M> listener) throws ConfigException {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d);
ConfigDeleteListener adaptor = new ConfigDeleteListenerAdaptor<M>(serverContext, path, d, listener);
@@ -890,7 +891,7 @@
* relation could not be retrieved.
*/
public <M extends Configuration> void registerDeleteListener(OptionalRelationDefinition<?, M> d,
- ConfigurationDeleteListener<M> listener) throws IllegalArgumentException, ConfigException {
+ ConfigurationDeleteListener<M> listener) throws ConfigException {
registerDeleteListener(d, new ServerManagedObjectDeleteListenerAdaptor<M>(listener));
}
@@ -912,7 +913,7 @@
* relation could not be retrieved.
*/
public <M extends Configuration> void registerDeleteListener(OptionalRelationDefinition<?, M> d,
- ServerManagedObjectDeleteListener<M> listener) throws IllegalArgumentException, ConfigException {
+ ServerManagedObjectDeleteListener<M> listener) throws ConfigException {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d).parent();
ConfigDeleteListener adaptor = new ConfigDeleteListenerAdaptor<M>(serverContext, path, d, listener);
@@ -937,7 +938,7 @@
* could not be retrieved.
*/
public <M extends Configuration> void registerDeleteListener(SetRelationDefinition<?, M> d,
- ConfigurationDeleteListener<M> listener) throws IllegalArgumentException, ConfigException {
+ ConfigurationDeleteListener<M> listener) throws ConfigException {
registerDeleteListener(d, new ServerManagedObjectDeleteListenerAdaptor<M>(listener));
}
@@ -959,7 +960,7 @@
* could not be retrieved.
*/
public <M extends Configuration> void registerDeleteListener(SetRelationDefinition<?, M> d,
- ServerManagedObjectDeleteListener<M> listener) throws IllegalArgumentException, ConfigException {
+ ServerManagedObjectDeleteListener<M> listener) throws ConfigException {
validateRelationDefinition(d);
DN baseDN = DNBuilder.create(path, d);
ConfigDeleteListener adaptor = new ConfigDeleteListenerAdaptor<M>(serverContext, path, d, listener);
@@ -1040,7 +1041,8 @@
ConfigAddListenerAdaptor<?> adaptor = (ConfigAddListenerAdaptor<?>) configListener;
ServerManagedObjectAddListener<?> smoListener = adaptor.getServerManagedObjectAddListener();
if (smoListener instanceof ServerManagedObjectAddListenerAdaptor<?>) {
- ServerManagedObjectAddListenerAdaptor<?> adaptor2 = (ServerManagedObjectAddListenerAdaptor<?>) smoListener;
+ ServerManagedObjectAddListenerAdaptor<?> adaptor2 =
+ (ServerManagedObjectAddListenerAdaptor<?>) smoListener;
if (adaptor2.getConfigurationAddListener() == listener) {
configRepository.deregisterAddListener(baseDN, adaptor);
}
@@ -1059,7 +1061,8 @@
}
// Deregister an add listener.
- private <M extends Configuration> void deregisterAddListener(DN baseDN, ServerManagedObjectAddListener<M> listener) {
+ private <M extends Configuration> void deregisterAddListener(DN baseDN,
+ ServerManagedObjectAddListener<M> listener) {
try {
if (configRepository.hasEntry(baseDN)) {
for (ConfigAddListener configListener : configRepository.getAddListeners(baseDN)) {
@@ -1092,8 +1095,10 @@
* @return a pair of (intermediate adaptor, intermediate listener) or
* {@code Pair.EMPTY} if listener can't be extracted
*/
+ // @Checkstyle:off
static <T extends Configuration> Pair<ConfigAddListenerAdaptor<T>, ConfigurationAddListener<T>>
extractInitialListener(ConfigAddListener configListener) {
+ // @Checkstyle:on
Pair<ConfigAddListenerAdaptor<T>, ServerManagedObjectAddListener<T>> pair =
extractIntermediateListener(configListener);
if (!pair.equals(Pair.EMPTY) && pair.getSecond() instanceof ServerManagedObjectAddListenerAdaptor) {
@@ -1116,8 +1121,10 @@
* {@code Pair.EMPTY} if listener can't be extracted
*/
@SuppressWarnings("unchecked")
+ // @Checkstyle:off
static <T extends Configuration> Pair<ConfigAddListenerAdaptor<T>, ServerManagedObjectAddListener<T>>
extractIntermediateListener(ConfigAddListener configListener) {
+ // @Checkstyle:on
if (configListener instanceof ConfigAddListenerAdaptor) {
ConfigAddListenerAdaptor<T> adaptor = ((ConfigAddListenerAdaptor<T>) configListener);
return Pair.of(adaptor, adaptor.getServerManagedObjectAddListener());
@@ -1126,7 +1133,8 @@
}
// Deregister a delete listener.
- private <M extends Configuration> void deregisterDeleteListener(DN baseDN, ConfigurationDeleteListener<M> listener) {
+ private <M extends Configuration> void deregisterDeleteListener(DN baseDN,
+ ConfigurationDeleteListener<M> listener) {
try {
if (configRepository.hasEntry(baseDN)) {
for (ConfigDeleteListener l : configRepository.getDeleteListeners(baseDN)) {
@@ -1134,7 +1142,8 @@
ConfigDeleteListenerAdaptor<?> adaptor = (ConfigDeleteListenerAdaptor<?>) l;
ServerManagedObjectDeleteListener<?> l2 = adaptor.getServerManagedObjectDeleteListener();
if (l2 instanceof ServerManagedObjectDeleteListenerAdaptor<?>) {
- ServerManagedObjectDeleteListenerAdaptor<?> adaptor2 = (ServerManagedObjectDeleteListenerAdaptor<?>) l2;
+ ServerManagedObjectDeleteListenerAdaptor<?> adaptor2 =
+ (ServerManagedObjectDeleteListenerAdaptor<?>) l2;
if (adaptor2.getConfigurationDeleteListener() == listener) {
configRepository.deregisterDeleteListener(baseDN, adaptor);
}
@@ -1177,8 +1186,8 @@
}
// Register an instantiable or optional relation add listener.
- private void registerAddListener(DN baseDN, ConfigAddListener adaptor) throws IllegalArgumentException,
- ConfigException {
+ private void registerAddListener(DN baseDN, ConfigAddListener adaptor) throws
+ ConfigException {
if (configRepository.hasEntry(baseDN)) {
configRepository.registerAddListener(baseDN, adaptor);
} else {
@@ -1212,8 +1221,8 @@
// Deregister a delayed listener with the nearest existing parent
// entry to the provided base DN.
- private <M extends Configuration> void deregisterDelayedAddListener(DN baseDN, ConfigurationAddListener<M> listener)
- throws ConfigException {
+ private <M extends Configuration> void deregisterDelayedAddListener(DN baseDN,
+ ConfigurationAddListener<M> listener) throws ConfigException {
DN parentDN = baseDN.parent();
int delayWrappers = 0;
while (parentDN != null) {
@@ -1248,7 +1257,8 @@
ConfigAddListenerAdaptor<?> adaptor = (ConfigAddListenerAdaptor<?>) delayedListener;
ServerManagedObjectAddListener<?> l2 = adaptor.getServerManagedObjectAddListener();
if (l2 instanceof ServerManagedObjectAddListenerAdaptor<?>) {
- ServerManagedObjectAddListenerAdaptor<?> adaptor2 = (ServerManagedObjectAddListenerAdaptor<?>) l2;
+ ServerManagedObjectAddListenerAdaptor<?> adaptor2 =
+ (ServerManagedObjectAddListenerAdaptor<?>) l2;
if (adaptor2.getConfigurationAddListener() == listener) {
configRepository.deregisterAddListener(parentDN, configListener);
}
@@ -1299,7 +1309,8 @@
ConfigDeleteListenerAdaptor<?> adaptor = (ConfigDeleteListenerAdaptor<?>) delayedListener;
ServerManagedObjectDeleteListener<?> l2 = adaptor.getServerManagedObjectDeleteListener();
if (l2 instanceof ServerManagedObjectDeleteListenerAdaptor<?>) {
- ServerManagedObjectDeleteListenerAdaptor<?> adaptor2 = (ServerManagedObjectDeleteListenerAdaptor<?>) l2;
+ ServerManagedObjectDeleteListenerAdaptor<?> adaptor2 =
+ (ServerManagedObjectDeleteListenerAdaptor<?>) l2;
if (adaptor2.getConfigurationDeleteListener() == listener) {
configRepository.deregisterAddListener(parentDN, l);
}
@@ -1420,7 +1431,7 @@
// Validate that a relation definition belongs to this managed
// object.
- private void validateRelationDefinition(RelationDefinition<?, ?> rd) throws IllegalArgumentException {
+ private void validateRelationDefinition(RelationDefinition<?, ?> rd) {
RelationDefinition<?, ?> tmp = definition.getRelationDefinition(rd.getName());
if (tmp != rd) {
throw new IllegalArgumentException("The relation " + rd.getName() + " is not associated with a "
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectAddListenerAdaptor.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectAddListenerAdaptor.java
index 3f296fb..f47eb77 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectAddListenerAdaptor.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectAddListenerAdaptor.java
@@ -39,7 +39,8 @@
* The type of server managed object that this listener should be
* notified about.
*/
-final class ServerManagedObjectAddListenerAdaptor<T extends Configuration> implements ServerManagedObjectAddListener<T> {
+final class ServerManagedObjectAddListenerAdaptor<T extends Configuration> implements
+ ServerManagedObjectAddListener<T> {
// The underlying add listener.
private final ConfigurationAddListener<T> listener;
@@ -75,7 +76,7 @@
* {@inheritDoc}
*/
public boolean isConfigurationAddAcceptable(ServerManagedObject<? extends T> mo,
- List<LocalizableMessage> unacceptableReasons) {
+ List<LocalizableMessage> unacceptableReasons) {
return listener.isConfigurationAddAcceptable(mo.getConfiguration(), unacceptableReasons);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListener.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListener.java
index 4d0ff48..c2215bf 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListener.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListener.java
@@ -25,8 +25,6 @@
*/
package org.opends.server.admin.server;
-
-
import org.forgerock.i18n.LocalizableMessage;
import java.util.List;
@@ -34,46 +32,39 @@
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
-
-
/**
- * This interface defines the methods that a Directory Server
- * configurable component should implement if it wishes to be able to
- * receive notifications when a its associated server managed object
- * is changed.
+ * This interface defines the methods that a Directory Server configurable
+ * component should implement if it wishes to be able to receive notifications
+ * when a its associated server managed object is changed.
*
* @param <T>
- * The type of server managed object that this listener
- * should be notified about.
+ * The type of server managed object that this listener should be
+ * notified about.
*/
public interface ServerManagedObjectChangeListener<T extends Configuration> {
- /**
- * Indicates whether the proposed change to the server managed
- * object is acceptable to this change listener.
- *
- * @param mo
- * The new server managed object containing the changes.
- * @param unacceptableReasons
- * A list that can be used to hold messages about why the
- * provided server managed object is not acceptable.
- * @return Returns <code>true</code> if the proposed change is
- * acceptable, or <code>false</code> if it is not.
- */
- public boolean isConfigurationChangeAcceptable(
- ServerManagedObject<? extends T> mo, List<LocalizableMessage> unacceptableReasons);
+ /**
+ * Indicates whether the proposed change to the server managed object is
+ * acceptable to this change listener.
+ *
+ * @param mo
+ * The new server managed object containing the changes.
+ * @param unacceptableReasons
+ * A list that can be used to hold messages about why the
+ * provided server managed object is not acceptable.
+ * @return Returns <code>true</code> if the proposed change is acceptable,
+ * or <code>false</code> if it is not.
+ */
+ public boolean isConfigurationChangeAcceptable(ServerManagedObject<? extends T> mo,
+ List<LocalizableMessage> unacceptableReasons);
-
-
- /**
- * Applies the server managed object changes to this change
- * listener.
- *
- * @param mo
- * The new server managed object containing the changes.
- * @return Returns information about the result of changing the
- * server managed object.
- */
- public ConfigChangeResult applyConfigurationChange(
- ServerManagedObject<? extends T> mo);
+ /**
+ * Applies the server managed object changes to this change listener.
+ *
+ * @param mo
+ * The new server managed object containing the changes.
+ * @return Returns information about the result of changing the server
+ * managed object.
+ */
+ public ConfigChangeResult applyConfigurationChange(ServerManagedObject<? extends T> mo);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListenerAdaptor.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListenerAdaptor.java
index 0744c61..8c70945 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListenerAdaptor.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListenerAdaptor.java
@@ -40,7 +40,7 @@
* notified about.
*/
final class ServerManagedObjectChangeListenerAdaptor<T extends Configuration> implements
- ServerManagedObjectChangeListener<T> {
+ ServerManagedObjectChangeListener<T> {
// The underlying change listener.
private final ConfigurationChangeListener<? super T> listener;
@@ -58,6 +58,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public ConfigChangeResult applyConfigurationChange(ServerManagedObject<? extends T> mo) {
return listener.applyConfigurationChange(mo.getConfiguration());
}
@@ -75,8 +76,9 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isConfigurationChangeAcceptable(ServerManagedObject<? extends T> mo,
- List<LocalizableMessage> unacceptableReasons) {
+ List<LocalizableMessage> unacceptableReasons) {
return listener.isConfigurationChangeAcceptable(mo.getConfiguration(), unacceptableReasons);
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagementContext.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagementContext.java
index 7021d13..29e4164 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagementContext.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagementContext.java
@@ -68,7 +68,6 @@
import org.opends.server.admin.RelationDefinition;
import org.opends.server.admin.RelativeInheritedDefaultBehaviorProvider;
import org.opends.server.admin.UndefinedDefaultBehaviorProvider;
-import org.opends.server.admin.UnknownPropertyDefinitionException;
import org.opends.server.admin.DefinitionDecodingException.Reason;
import org.opends.server.config.ConfigException;
import org.opends.server.config.ConfigurationRepository;
@@ -97,7 +96,7 @@
* @param <T>
* The type of the property.
*/
- private class DefaultValueFinder<T> implements DefaultBehaviorProviderVisitor<T, Collection<T>, Void> {
+ private final class DefaultValueFinder<T> implements DefaultBehaviorProviderVisitor<T, Collection<T>, Void> {
// Any exception that occurred whilst retrieving inherited default
// values.
@@ -178,8 +177,7 @@
}
// Find the default values for the next path/property.
- private Collection<T> find(ManagedObjectPath<?, ?> path, PropertyDefinition<T> propertyDef)
- throws DefaultBehaviorException {
+ private Collection<T> find(ManagedObjectPath<?, ?> path, PropertyDefinition<T> propertyDef) {
nextPath = path;
nextProperty = propertyDef;
@@ -198,9 +196,8 @@
// Get an inherited property value.
@SuppressWarnings("unchecked")
- private Collection<T> getInheritedProperty(ManagedObjectPath<?,?> target,
- AbstractManagedObjectDefinition<?, ?> definition, String propertyName)
- throws DefaultBehaviorException {
+ private Collection<T> getInheritedProperty(ManagedObjectPath<?, ?> target,
+ AbstractManagedObjectDefinition<?, ?> definition, String propertyName) {
// First check that the requested type of managed object
// corresponds to the path.
AbstractManagedObjectDefinition<?, ?> supr = target.getManagedObjectDefinition();
@@ -271,7 +268,7 @@
* A definition resolver that determines the managed object definition from
* the object classes of a ConfigEntry.
*/
- private class MyDefinitionResolver implements DefinitionResolver {
+ private final class MyDefinitionResolver implements DefinitionResolver {
// The config entry.
private final Entry entry;
@@ -306,7 +303,7 @@
/**
* Decodes the provided property LDAP value.
*
- * @param <PD>
+ * @param <P>
* The type of the property.
* @param propertyDef
* The property definition.
@@ -317,8 +314,7 @@
* If the property value could not be decoded because it was
* invalid.
*/
- public static <PD> PD decode(PropertyDefinition<PD> propertyDef, String value)
- throws IllegalPropertyValueStringException {
+ public static <P> P decode(PropertyDefinition<P> propertyDef, String value) {
return propertyDef.castValue(propertyDef.accept(new ValueDecoder(), value));
}
@@ -347,7 +343,7 @@
* {@inheritDoc}
*/
@Override
- public <T> Object visitUnknown(PropertyDefinition<T> d, String p) throws UnknownPropertyDefinitionException {
+ public <T> Object visitUnknown(PropertyDefinition<T> d, String p) {
// By default the property definition's decoder will do.
return d.decodeValue(p);
}
@@ -360,7 +356,7 @@
*/
private volatile ServerManagedObject<RootCfg> root;
- /** Repository of configuration entries */
+ /** Repository of configuration entries. */
private final ConfigurationRepository configRepository;
/**
@@ -426,7 +422,7 @@
* @param <S>
* The type of server managed object configuration that the path
* definition refers to.
- * @param <PD>
+ * @param <P>
* The type of the property to be retrieved.
* @param path
* The path of the managed object containing the property.
@@ -444,10 +440,9 @@
* If the named managed object could not be found or if it could
* not be decoded.
*/
- public <C extends ConfigurationClient, S extends Configuration, PD> PD getPropertyValue(
- ManagedObjectPath<C, S> path, PropertyDefinition<PD> pd) throws IllegalArgumentException, ConfigException,
- PropertyException {
- SortedSet<PD> values = getPropertyValues(path, pd);
+ public <C extends ConfigurationClient, S extends Configuration, P> P getPropertyValue(
+ ManagedObjectPath<C, S> path, PropertyDefinition<P> pd) throws ConfigException {
+ SortedSet<P> values = getPropertyValues(path, pd);
if (values.isEmpty()) {
return null;
} else {
@@ -464,7 +459,7 @@
* @param <S>
* The type of server managed object configuration that the path
* definition refers to.
- * @param <PD>
+ * @param <P>
* The type of the property to be retrieved.
* @param path
* The path of the managed object containing the property.
@@ -483,9 +478,8 @@
* not be decoded.
*/
@SuppressWarnings("unchecked")
- public <C extends ConfigurationClient, S extends Configuration, PD> SortedSet<PD> getPropertyValues(
- ManagedObjectPath<C, S> path, PropertyDefinition<PD> propertyDef) throws IllegalArgumentException, ConfigException,
- PropertyException {
+ public <C extends ConfigurationClient, S extends Configuration, P> SortedSet<P> getPropertyValues(
+ ManagedObjectPath<C, S> path, PropertyDefinition<P> propertyDef) throws ConfigException {
// Check that the requested property is from the definition
// associated with the path.
AbstractManagedObjectDefinition<C, S> definition = path.getManagedObjectDefinition();
@@ -512,7 +506,7 @@
// Make sure we use the correct property definition, the
// provided one might have been overridden in the resolved
// definition.
- propertyDef = (PropertyDefinition<PD>) managedObjDef.getPropertyDefinition(propertyDef.getName());
+ propertyDef = (PropertyDefinition<P>) managedObjDef.getPropertyDefinition(propertyDef.getName());
List<String> attributeValues = getAttributeValues(managedObjDef, propertyDef, configEntry);
return decodeProperty(path.asSubType(managedObjDef), propertyDef, attributeValues, null);
@@ -536,15 +530,17 @@
* @return the root configuration server managed object
*/
public ServerManagedObject<RootCfg> getRootConfigurationManagedObject() {
- // Use lazy initialisation because it needs a reference to this server context.
+ // Use lazy initialisation because it needs a reference to this server
+ // context.
ServerManagedObject<RootCfg> rootObject = root;
if (rootObject == null) {
- synchronized(this) {
+ synchronized (this) {
rootObject = root;
if (rootObject == null) {
- root = rootObject = new ServerManagedObject<RootCfg>(ManagedObjectPath.emptyPath(),
- RootCfgDefn.getInstance(), Collections.<PropertyDefinition<?>, SortedSet<?>> emptyMap(),
- null, this);
+ root = rootObject =
+ new ServerManagedObject<RootCfg>(ManagedObjectPath.emptyPath(),
+ RootCfgDefn.getInstance(), Collections.<PropertyDefinition<?>,
+ SortedSet<?>> emptyMap(), null, this);
}
}
}
@@ -707,7 +703,7 @@
/** Decode a property using the provided attribute values. */
private <T> SortedSet<T> decodeProperty(ManagedObjectPath<?, ?> path, PropertyDefinition<T> propertyDef,
- List<String> attributeValues, Entry newConfigEntry) throws PropertyException {
+ List<String> attributeValues, Entry newConfigEntry) {
PropertyException exception = null;
SortedSet<T> pvalues = new TreeSet<T>(propertyDef);
@@ -751,7 +747,7 @@
}
}
- /** Gets the attribute values associated with a property from a ConfigEntry */
+ /** Gets the attribute values associated with a property from a ConfigEntry. */
private List<String> getAttributeValues(ManagedObjectDefinition<?, ?> d, PropertyDefinition<?> pd,
Entry configEntry) {
// TODO: we create a default attribute type if it is undefined.
@@ -771,7 +767,7 @@
// Get the default values for the specified property.
private <T> Collection<T> getDefaultValues(ManagedObjectPath<?, ?> p, PropertyDefinition<T> pd,
- Entry newConfigEntry) throws DefaultBehaviorException {
+ Entry newConfigEntry) {
DefaultValueFinder<T> v = new DefaultValueFinder<T>(newConfigEntry);
return v.find(p, pd);
}
@@ -823,8 +819,7 @@
}
// Validate that a relation definition belongs to the path.
- private void validateRelationDefinition(ManagedObjectPath<?, ?> path, RelationDefinition<?, ?> rd)
- throws IllegalArgumentException {
+ private void validateRelationDefinition(ManagedObjectPath<?, ?> path, RelationDefinition<?, ?> rd) {
AbstractManagedObjectDefinition<?, ?> d = path.getManagedObjectDefinition();
RelationDefinition<?, ?> tmp = d.getRelationDefinition(rd.getName());
if (tmp != rd) {
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/api/package-info.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/api/package-info.java
new file mode 100644
index 0000000..6a59dbc
--- /dev/null
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/api/package-info.java
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2006-2008 Sun Microsystems, Inc.
+ */
+
+/**
+ * Contains a number of API declarations for use throughout the
+ * Directory Server. Whenever possible, these APIs should be declared
+ * using abstract classes rather than interfaces so that they can be
+ * altered in future versions without impacting backward
+ * compatibility.
+ * <BR><BR>
+ * Note that the mere existence of a class or interface in this
+ * package does not in itself imply that it is intended for use by
+ * third party code. Please refer to the official product
+ * documentation to indicate which APIs may be safely used by anyone
+ * other than the core Directory Server developers. Failure to heed
+ * this warning may result in code that could have unintended side
+ * effects or that does not work properly across different Directory
+ * Server versions.
+ */
+package org.opends.server.api;
+
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/Aci.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/Aci.java
index 70b099d..712de07 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/Aci.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/Aci.java
@@ -40,7 +40,18 @@
throw new RuntimeException("This class is not implemented");
}
- public static Aci decode(ByteString valueOf, DN rootDN) throws AciException {
+ /**
+ * Decode an ACI byte string.
+ *
+ * @param byteString
+ * The ByteString containing the ACI string.
+ * @param dn
+ * DN of the ACI entry.
+ * @return Returns a decoded ACI representing the string argument.
+ * @throws AciException
+ * If the parsing of the ACI string fails.
+ */
+ public static Aci decode(ByteString byteString, DN dn) throws AciException {
throw new RuntimeException("This class is not implemented");
}
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/AciException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/AciException.java
index 0cbec5f..e702826 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/AciException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/AciException.java
@@ -24,25 +24,24 @@
* Copyright 2008 Sun Microsystems, Inc.
*/
package org.opends.server.authorization.dseecompat;
+
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.types.IdentifiedException;
-
/**
- * The AciException class defines an exception that may be thrown
- * either during ACI syntax verification of an "aci" attribute type value
- * or during evaluation of an LDAP operation using a set of applicable
- * ACIs.
+ * The AciException class defines an exception that may be thrown either during
+ * ACI syntax verification of an "aci" attribute type value or during evaluation
+ * of an LDAP operation using a set of applicable ACIs.
*/
public class AciException extends IdentifiedException {
- /**
- * The serial version identifier required to satisfy the compiler because this
- * class extends <CODE>java.lang.Exception</CODE>, which implements the
- * <CODE>java.io.Serializable</CODE> interface. This value was generated
- * using the <CODE>serialver</CODE> command-line utility included with the
- * Java SDK.
- */
- private static final long serialVersionUID = -2763328522960628853L;
+ /**
+ * The serial version identifier required to satisfy the compiler because
+ * this class extends <CODE>java.lang.Exception</CODE>, which implements the
+ * <CODE>java.io.Serializable</CODE> interface. This value was generated
+ * using the <CODE>serialver</CODE> command-line utility included with the
+ * Java SDK.
+ */
+ private static final long serialVersionUID = -2763328522960628853L;
/**
* Constructs a new exception with <code>null</code> as its detail message.
@@ -50,28 +49,29 @@
* decode and not print duplicate messages.
*/
public AciException() {
- super();
+ super();
}
/**
* Creates a new ACI exception with the provided message.
*
- * @param message The message to use for this ACI exception.
+ * @param message
+ * The message to use for this ACI exception.
*/
public AciException(LocalizableMessage message) {
- super(message);
+ super(message);
}
/**
- * Creates a new ACI exception with the provided message and root
- * cause.
+ * Creates a new ACI exception with the provided message and root cause.
*
- * @param message The message that explains the problem that occurred.
- * @param cause The exception that was caught to trigger this
- * exception.
+ * @param message
+ * The message that explains the problem that occurred.
+ * @param cause
+ * The exception that was caught to trigger this exception.
*/
public AciException(LocalizableMessage message, Throwable cause) {
- super(message, cause);
+ super(message, cause);
}
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/package-info.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/package-info.java
new file mode 100644
index 0000000..e8181d0
--- /dev/null
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/authorization/dseecompat/package-info.java
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2008 Sun Microsystems, Inc.
+ */
+/**
+ * Contains the Directory Server Sun Java System Directory Server Enterprise
+ * Edition (dseecompat) compatability access control handler implementation.
+ */
+package org.opends.server.authorization.dseecompat;
+
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/config/package-info.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/config/package-info.java
new file mode 100644
index 0000000..533cdfa
--- /dev/null
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/config/package-info.java
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2006-2008 Sun Microsystems, Inc.
+ */
+
+/**
+ * Contains code used to interact with the Directory Server configuration. This
+ * includes various kinds of configuration attributes for different data types,
+ * as well as the primary means of exposing configuration and operations over
+ * JMX. Further, it includes the code for the default configuration handler
+ * which stores information in an LDIF file.
+ * <BR><BR>
+ * Whenever a configuration entry is modified, assuming that the result of the
+ * modification is in conformance with the server schema, then any configurable
+ * components and configuration change listeners associated with that entry will
+ * be invoked and given an opportunity to reject that update if there is a
+ * problem with it, or dynamically react to it by applying the new
+ * configuration. If a new configuration entry is added, then any configuration
+ * add listeners associated with that entry's parent will be invoked. If an
+ * existing entry is removed, then any configuration delete listeners associated
+ * with that entry's parent will be invoked.
+ */
+package org.opends.server.config;
+
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/core/DirectoryServer.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/core/DirectoryServer.java
index 002a9fa..36ef34e 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/core/DirectoryServer.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -34,7 +34,11 @@
* TODO : this is a stub, with some default implementations for some methods,
* and no implementation for others.
*/
-public class DirectoryServer {
+public final class DirectoryServer {
+
+ private DirectoryServer() {
+ // no implementation yet
+ }
/**
* Retrieves the attribute type for the provided lowercase name or OID. It
@@ -75,10 +79,20 @@
return Schema.getDefaultSchema().getAttributeType(lowerName);
}
+ /**
+ * Returns the directory of server instance.
+ *
+ * @return the instance root directory
+ */
public static String getInstanceRoot() {
throw new RuntimeException("Not implemented");
}
+ /**
+ * Returns the root directory of server.
+ *
+ * @return the server root directory
+ */
public static String getServerRoot() {
throw new RuntimeException("Not implemented");
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/core/package-info.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/core/package-info.java
new file mode 100644
index 0000000..3dc1c49
--- /dev/null
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/core/package-info.java
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2006-2008 Sun Microsystems, Inc.
+ */
+/**
+ * Contains various classes that comprise the core of the Directory Server
+ * codebase. This includes:
+ * <BR>
+ * <UL>
+ * <LI>
+ * The code that is invoked to initialize the various components of the
+ * Directory Server when it is started.
+ * </LI>
+ * <LI>
+ * The code that is invoked whenever the Directory Server is in the process
+ * of shutting down.
+ * </LI>
+ * <LI>
+ * The various types of operations that may be processed within the
+ * Directory Server.
+ * </LI>
+ * <LI>
+ * Data structures for important elements of Directory Server data,
+ * including attributes, objectclasses, DNs, entries.
+ * </LI>
+ * <LI>
+ * The implementation of the work queue and worker threads responsible for
+ * processing operations requested by clients.
+ * </LI>
+ * </UL>
+ */
+package org.opends.server.core;
+
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/AddressMask.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/AddressMask.java
index 035345f..06309d1 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/AddressMask.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/AddressMask.java
@@ -289,8 +289,8 @@
return true;
}
for (int i = 0; i < s.length; i++) {
- if (!hostName[i].equals("*")) // skip if wildcard
- {
+ // skip if wildcard
+ if (!hostName[i].equals("*")) {
if (!s[i].equalsIgnoreCase(hostName[i])) {
return false;
}
@@ -335,7 +335,7 @@
* The rule string containing all wildcards.
*/
private void processAllWilds(final String rule) {
- final String s[] = rule.split("\\.", -1);
+ final String []s = rule.split("\\.", -1);
if (s.length == IN4ADDRSZ) {
for (int i = 0; i < IN4ADDRSZ; i++) {
wildCard.set(i);
@@ -354,7 +354,7 @@
*/
private void processHost(final String rule) throws ConfigException {
// Note that '*' is valid in host rule
- final String s[] = rule.split("^[0-9a-zA-z-.*]+");
+ final String []s = rule.split("^[0-9a-zA-z-.*]+");
if (s.length > 0) {
final LocalizableMessage message = ERR_ADDRESSMASK_FORMAT_DECODE_ERROR.get();
throw new ConfigException(message);
@@ -373,7 +373,7 @@
*/
private void processHostPattern(final String rule) throws ConfigException {
// quick check for invalid chars like " "
- final String s[] = rule.split("^[0-9a-zA-z-.]+");
+ final String []s = rule.split("^[0-9a-zA-z-.]+");
if (s.length > 0) {
final LocalizableMessage message = ERR_ADDRESSMASK_FORMAT_DECODE_ERROR.get();
throw new ConfigException(message);
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/OpenDsException.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/OpenDsException.java
index 1c77ad7..e2b4779 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/OpenDsException.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/OpenDsException.java
@@ -23,101 +23,85 @@
*
* Copyright 2008 Sun Microsystems, Inc.
*/
-
package org.opends.server.types;
import org.forgerock.i18n.LocalizableMessage;
-
/**
* This class defines a base exception for OpenDS exceptions.
*/
-public abstract class OpenDsException
- extends Exception
-{
+public abstract class OpenDsException extends Exception {
- /**
- * Generated serialization ID.
- */
- private static final long serialVersionUID = 7310881401563732702L;
+ /**
+ * Generated serialization ID.
+ */
+ private static final long serialVersionUID = 7310881401563732702L;
- /** LocalizableMessage that explains the problem. */
- LocalizableMessage message;
+ /** LocalizableMessage that explains the problem. */
+ LocalizableMessage message;
- /**
- * Creates a new identified exception.
- */
- protected OpenDsException()
- {
- super();
- }
-
- /**
- * Constructs a new instance from another
- * <code>OpenDsException</code>.
- * This constructor sets the message to be that of
- * <code>cause</code>.
- *
- * @param cause exception whose message will be used for
- * this exception's message.
- */
- protected OpenDsException(OpenDsException cause) {
- this(null, cause);
- }
-
- /**
- * Creates a new identified exception with the provided information.
- *
- * @param message The message that explains the problem that
- * occurred.
- */
- protected OpenDsException(LocalizableMessage message)
- {
- this(message, null);
- }
-
-
-
- /**
- * Creates a new identified exception with the provided information.
- *
- * @param cause The underlying cause that triggered this
- * exception.
- */
- protected OpenDsException(Throwable cause)
- {
- this(null, cause);
- }
-
-
-
- /**
- * Creates a new identified exception with the provided information.
- *
- * @param message The message that explains the problem that
- * occurred.
- * @param cause The underlying cause that triggered this
- * exception.
- */
- protected OpenDsException(LocalizableMessage message, Throwable cause)
- {
- super(message != null ? message.toString() :
- cause != null ? cause.getMessage() : null, cause);
- if (message != null) {
- this.message = message;
- } else if (cause instanceof OpenDsException) {
- this.message = ((OpenDsException)cause).getMessageObject();
+ /**
+ * Creates a new identified exception.
+ */
+ protected OpenDsException() {
+ super();
}
- }
+ /**
+ * Constructs a new instance from another <code>OpenDsException</code>. This
+ * constructor sets the message to be that of <code>cause</code>.
+ *
+ * @param cause
+ * exception whose message will be used for this exception's
+ * message.
+ */
+ protected OpenDsException(OpenDsException cause) {
+ this(null, cause);
+ }
+ /**
+ * Creates a new identified exception with the provided information.
+ *
+ * @param message
+ * The message that explains the problem that occurred.
+ */
+ protected OpenDsException(LocalizableMessage message) {
+ this(message, null);
+ }
- /**
- * Returns the message that explains the problem that occurred.
- *
- * @return LocalizableMessage of the problem
- */
- public LocalizableMessage getMessageObject() {
- return this.message;
- }
+ /**
+ * Creates a new identified exception with the provided information.
+ *
+ * @param cause
+ * The underlying cause that triggered this exception.
+ */
+ protected OpenDsException(Throwable cause) {
+ this(null, cause);
+ }
+
+ /**
+ * Creates a new identified exception with the provided information.
+ *
+ * @param message
+ * The message that explains the problem that occurred.
+ * @param cause
+ * The underlying cause that triggered this exception.
+ */
+ protected OpenDsException(LocalizableMessage message, Throwable cause) {
+ super(message != null ? message.toString() : cause != null ? cause.getMessage() : null, cause);
+ if (message != null) {
+ this.message = message;
+ } else if (cause instanceof OpenDsException) {
+ this.message = ((OpenDsException) cause).getMessageObject();
+ }
+ }
+
+ /**
+ * Returns the message that explains the problem that occurred.
+ *
+ * @return LocalizableMessage of the problem
+ */
+ public LocalizableMessage getMessageObject() {
+ return this.message;
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/package-info.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/package-info.java
new file mode 100644
index 0000000..4782891
--- /dev/null
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/types/package-info.java
@@ -0,0 +1,35 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2006-2008 Sun Microsystems, Inc.
+ */
+/**
+ * Contains implementations for a number of Directory Server data
+ * types. Most, but not necessarily all, of these data types may be
+ * considered part of the public API for use when extending the
+ * Directory Server. Please refer to the official documentation for
+ * authoritative information on what classes are considered part of
+ * the public API.
+ */
+package org.opends.server.types;
+
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/util/EmbeddedUtils.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/util/EmbeddedUtils.java
index a783e8a..f78b9b9 100644
--- a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/util/EmbeddedUtils.java
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/util/EmbeddedUtils.java
@@ -101,4 +101,10 @@
public static void initializeForClientUse() {
throw new RuntimeException("not implemented");
}
+
+ private EmbeddedUtils() {
+ // no implementation required.
+ }
+
+
}
diff --git a/opendj-sdk/opendj-admin/src/main/java/org/opends/server/util/package-info.java b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/util/package-info.java
new file mode 100644
index 0000000..b0616a3
--- /dev/null
+++ b/opendj-sdk/opendj-admin/src/main/java/org/opends/server/util/package-info.java
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2006-2008 Sun Microsystems, Inc.
+ */
+/**
+ * Contains implementations for various Directory Server utility classes and
+ * methods which may be used throughout the server but do not necessarily fit in
+ * elsewhere. Notable utility classes include:
+ * <BR>
+ * <UL>
+ * <LI>
+ * StaticUtils.java -- a set of static methods that may be called to perform
+ * all kinds of useful operations on data (e.g., get a stack trace from an
+ * exception, or convert the contents of a byte array to a readable form).
+ * </LI>
+ * <LI>
+ * Base64.java -- provides a mechanism for performing base64 encoding and
+ * decoding.
+ * </LI>
+ * <LI>
+ * DynamicConstants.java -- a set of constants that are actually generated
+ * automatically at build time and reflect information about the time and
+ * conditions under which the server was built.
+ * </LI>
+ * <LI>
+ * TimeThread.java -- provides a thread that will periodically retrieve
+ * the current time and format it in several common methods in an attempt to
+ * minimize the need to have multiple calls to
+ * <CODE>System.currentTimeMillis()</CODE> or <CODE>new Date()</CODE>
+ * whenever the time is needed. This thread updates internal variables
+ * several times each second, which should be sufficient for cases in which
+ * high-resolution timing is not required.
+ * </LI>
+ * </UL>
+ */
+package org.opends.server.util;
+
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/forgerock/opendj/config/ConfigurationMock.java b/opendj-sdk/opendj-admin/src/test/java/org/forgerock/opendj/config/ConfigurationMock.java
index ecaa9da..a2785ed 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/forgerock/opendj/config/ConfigurationMock.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/forgerock/opendj/config/ConfigurationMock.java
@@ -65,7 +65,7 @@
*/
public final class ConfigurationMock {
- private static final ConfigAnswer configAnswer = new ConfigAnswer();
+ private static final ConfigAnswer CONFIG_ANSWER = new ConfigAnswer();
/**
* Returns a mock for the provided configuration class.
@@ -83,7 +83,7 @@
* @return a mock
*/
public static <T extends Configuration> T mockCfg(Class<T> configClass) {
- return mock(configClass, configAnswer);
+ return mock(configClass, CONFIG_ANSWER);
}
/**
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/AbstractManagedObjectDefinitionTest.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/AbstractManagedObjectDefinitionTest.java
index e255500..322bd30 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/AbstractManagedObjectDefinitionTest.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/AbstractManagedObjectDefinitionTest.java
@@ -38,7 +38,7 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-@SuppressWarnings({"javadoc", "unchecked", "rawtypes"})
+@SuppressWarnings({ "javadoc", "unchecked", "rawtypes" })
@Test(singleThreaded = true)
public class AbstractManagedObjectDefinitionTest extends ConfigTestCase {
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DNPropertyDefinitionTest.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DNPropertyDefinitionTest.java
index a913fb0..e392edb 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DNPropertyDefinitionTest.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DNPropertyDefinitionTest.java
@@ -74,7 +74,7 @@
{ "", "cn=config" },
{ "cn=config", "cn=key manager providers, cn=config" },
{ "cn=key manager providers, cn=config", "cn=my provider, cn=key manager providers, cn=config" },
- };
+ };
}
@DataProvider(name = "illegalValues")
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DurationPropertyDefinitionTest.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DurationPropertyDefinitionTest.java
index 8ae04d7..1196100 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DurationPropertyDefinitionTest.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DurationPropertyDefinitionTest.java
@@ -57,7 +57,7 @@
@DataProvider(name = "longLimitData")
Object[][] createLongLimitData() {
return new Object[][] {
- { 1L, 1L },
+ { 1L, 1L },
};
}
@@ -69,11 +69,11 @@
@DataProvider(name = "illegalLongLimitData")
Object[][] createIllegalLongLimitData() {
return new Object[][] {
- // lower, upper, lower first
- { -1L, 0L, true },
- { 0L, -1L, false },
- { 2L, 1L, true },
- { 2L, 1L, false } };
+ // lower, upper, lower first
+ { -1L, 0L, true },
+ { 0L, -1L, false },
+ { 2L, 1L, true },
+ { 2L, 1L, false } };
}
@DataProvider(name = "stringLimitData")
@@ -208,7 +208,7 @@
{ 1024L, "1024 s" },
{ 1025L, "1025 s" },
{ 1000L * 1000L, "1000000 s" },
- };
+ };
}
@Test(dataProvider = "encodeValueData")
@@ -316,21 +316,21 @@
@DataProvider(name = "decodeValueDataIllegal")
Object[][] createDecodeValueDataIllegal() {
return new Object[][] { { "" }, { "0" }, // no unit
- { "123" }, // no unit
- { "a s" },
- { "1 x" },
- { "0.h" },
- { "0. h" },
- { "1.h" },
- { "1. h" },
- { "1.1 h" }, // too granular
- { "30 m" }, // unit too small violation
- { "60 m" }, // unit too small violation
- { "1 w" }, // unit too big violation
- { "7 w" }, // unit too big violation
- { "1 x" }, { "1 d" }, // upper limit violation
- { "2 h" }, // lower limit violation
- { "-1 h" } // unlimited violation
+ { "123" }, // no unit
+ { "a s" },
+ { "1 x" },
+ { "0.h" },
+ { "0. h" },
+ { "1.h" },
+ { "1. h" },
+ { "1.1 h" }, // too granular
+ { "30 m" }, // unit too small violation
+ { "60 m" }, // unit too small violation
+ { "1 w" }, // unit too big violation
+ { "7 w" }, // unit too big violation
+ { "1 x" }, { "1 d" }, // upper limit violation
+ { "2 h" }, // lower limit violation
+ { "-1 h" } // unlimited violation
};
}
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DurationUnitTest.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DurationUnitTest.java
index ecd9c5e..7877a11 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DurationUnitTest.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/DurationUnitTest.java
@@ -30,7 +30,8 @@
import static org.testng.Assert.*;
import org.forgerock.opendj.config.ConfigTestCase;
-import org.testng.annotations.*;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
@SuppressWarnings("javadoc")
public class DurationUnitTest extends ConfigTestCase {
@@ -38,18 +39,18 @@
@DataProvider(name = "testGetUnitData")
public Object[][] createStringToSizeLimitData() {
return new Object[][] {
- { "ms", MILLI_SECONDS },
- { "milliseconds", MILLI_SECONDS },
- { "s", SECONDS },
- { "seconds", SECONDS },
- { "m", MINUTES },
- { "minutes", MINUTES },
- { "h", HOURS },
- { "hours", HOURS },
- { "d", DAYS },
- { "days", DAYS },
- { "w", WEEKS },
- { "weeks", WEEKS } };
+ { "ms", MILLI_SECONDS },
+ { "milliseconds", MILLI_SECONDS },
+ { "s", SECONDS },
+ { "seconds", SECONDS },
+ { "m", MINUTES },
+ { "minutes", MINUTES },
+ { "h", HOURS },
+ { "hours", HOURS },
+ { "d", DAYS },
+ { "days", DAYS },
+ { "w", WEEKS },
+ { "weeks", WEEKS } };
}
@Test(dataProvider = "testGetUnitData")
@@ -65,15 +66,15 @@
@DataProvider(name = "valueToStringData")
public Object[][] createValueToStringData() {
return new Object[][] {
- { 0L, "0 ms" },
- { 1L, "1 ms" },
- { 999L, "999 ms" },
- { 1000L, "1 s" },
- { 1001L, "1 s 1 ms" },
- { 59999L, "59 s 999 ms" },
- { 60000L, "1 m" },
- { 3599999L, "59 m 59 s 999 ms" },
- { 3600000L, "1 h" } };
+ { 0L, "0 ms" },
+ { 1L, "1 ms" },
+ { 999L, "999 ms" },
+ { 1000L, "1 s" },
+ { 1001L, "1 s 1 ms" },
+ { 59999L, "59 s 999 ms" },
+ { 60000L, "1 m" },
+ { 3599999L, "59 m 59 s 999 ms" },
+ { 3600000L, "1 h" } };
}
@Test(dataProvider = "valueToStringData")
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/IntegerPropertyDefinitionTest.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/IntegerPropertyDefinitionTest.java
index 1bad73b..09de9a5 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/IntegerPropertyDefinitionTest.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/IntegerPropertyDefinitionTest.java
@@ -147,7 +147,7 @@
{ 5, 10, false, -1 },
{ 5, 10, true, 2 },
{ 5, 10, true, 11 }
- };
+ };
}
@Test(dataProvider = "illegalValidateValueData", expectedExceptions = { AssertionError.class,
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/MockLDAPProfile.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/MockLDAPProfile.java
index bc51efc..cab5070 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/MockLDAPProfile.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/MockLDAPProfile.java
@@ -25,123 +25,106 @@
*/
package org.opends.server.admin;
-
-
/**
* A mock LDAP profile wrapper for testing purposes.
*/
public final class MockLDAPProfile extends LDAPProfile.Wrapper {
- /**
- * Creates a new mock LDAP profile.
- */
- public MockLDAPProfile() {
- // No implementation required.
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getAttributeName(AbstractManagedObjectDefinition<?, ?> d,
- PropertyDefinition<?> pd) {
-
- if (d == TestParentCfgDefn.getInstance()) {
- TestParentCfgDefn td = TestParentCfgDefn.getInstance();
-
- if (pd == (PropertyDefinition<?>)td.getMandatoryBooleanPropertyPropertyDefinition()) {
- return "ds-cfg-enabled";
- } else if (pd == (PropertyDefinition<?>)td.getMandatoryClassPropertyPropertyDefinition()) {
- return "ds-cfg-java-class";
- } else if (pd == (PropertyDefinition<?>)td
- .getMandatoryReadOnlyAttributeTypePropertyPropertyDefinition()) {
- return "ds-cfg-attribute-type";
- } else if (pd == (PropertyDefinition<?>)td.getOptionalMultiValuedDNPropertyPropertyDefinition()) {
- return "ds-cfg-base-dn";
- } else {
- throw new RuntimeException("Unexpected test-parent property"
- + pd.getName());
- }
- } else if (d == TestChildCfgDefn.getInstance()) {
- TestChildCfgDefn td = TestChildCfgDefn.getInstance();
-
- if (pd == (PropertyDefinition<?>)td.getMandatoryBooleanPropertyPropertyDefinition()) {
- return "ds-cfg-enabled";
- } else if (pd == (PropertyDefinition<?>)td.getMandatoryClassPropertyPropertyDefinition()) {
- return "ds-cfg-java-class";
- } else if (pd == (PropertyDefinition<?>)td
- .getMandatoryReadOnlyAttributeTypePropertyPropertyDefinition()) {
- return "ds-cfg-attribute-type";
- } else if (pd == (PropertyDefinition<?>)td.getOptionalMultiValuedDNProperty1PropertyDefinition()) {
- return "ds-cfg-base-dn";
- } else if (pd == (PropertyDefinition<?>)td.getOptionalMultiValuedDNProperty2PropertyDefinition()) {
- return "ds-cfg-group-dn";
- } else if (pd.getName().equals("aggregation-property")) {
- return "ds-cfg-rotation-policy";
- } else {
- throw new RuntimeException("Unexpected test-child property"
- + pd.getName());
- }
+ /**
+ * Creates a new mock LDAP profile.
+ */
+ public MockLDAPProfile() {
+ // No implementation required.
}
- // Not known.
- return null;
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getAttributeName(AbstractManagedObjectDefinition<?, ?> d, PropertyDefinition<?> pd) {
+ if (d == TestParentCfgDefn.getInstance()) {
+ TestParentCfgDefn td = TestParentCfgDefn.getInstance();
+ if (pd == (PropertyDefinition<?>) td.getMandatoryBooleanPropertyPropertyDefinition()) {
+ return "ds-cfg-enabled";
+ } else if (pd == (PropertyDefinition<?>) td.getMandatoryClassPropertyPropertyDefinition()) {
+ return "ds-cfg-java-class";
+ } else if (pd == (PropertyDefinition<?>) td.getMandatoryReadOnlyAttributeTypePropertyPropertyDefinition()) {
+ return "ds-cfg-attribute-type";
+ } else if (pd == (PropertyDefinition<?>) td.getOptionalMultiValuedDNPropertyPropertyDefinition()) {
+ return "ds-cfg-base-dn";
+ } else {
+ throw new RuntimeException("Unexpected test-parent property" + pd.getName());
+ }
+ } else if (d == TestChildCfgDefn.getInstance()) {
+ TestChildCfgDefn td = TestChildCfgDefn.getInstance();
- /**
- * {@inheritDoc}
- */
- @Override
- public String getRelationChildRDNType(
- InstantiableRelationDefinition<?, ?> r) {
- if (r == TestCfg.getTestOneToManyParentRelationDefinition()
- || r == TestParentCfgDefn.getInstance()
- .getTestChildrenRelationDefinition()) {
- return "cn";
- } else {
- return null;
+ if (pd == (PropertyDefinition<?>) td.getMandatoryBooleanPropertyPropertyDefinition()) {
+ return "ds-cfg-enabled";
+ } else if (pd == (PropertyDefinition<?>) td.getMandatoryClassPropertyPropertyDefinition()) {
+ return "ds-cfg-java-class";
+ } else if (pd == (PropertyDefinition<?>) td.getMandatoryReadOnlyAttributeTypePropertyPropertyDefinition()) {
+ return "ds-cfg-attribute-type";
+ } else if (pd == (PropertyDefinition<?>) td.getOptionalMultiValuedDNProperty1PropertyDefinition()) {
+ return "ds-cfg-base-dn";
+ } else if (pd == (PropertyDefinition<?>) td.getOptionalMultiValuedDNProperty2PropertyDefinition()) {
+ return "ds-cfg-group-dn";
+ } else if (pd.getName().equals("aggregation-property")) {
+ return "ds-cfg-rotation-policy";
+ } else {
+ throw new RuntimeException("Unexpected test-child property" + pd.getName());
+ }
+ }
+
+ // Not known.
+ return null;
}
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getObjectClass(AbstractManagedObjectDefinition<?, ?> d) {
- if (d == TestParentCfgDefn.getInstance()) {
- return "ds-cfg-test-parent-dummy";
- } else if (d == TestChildCfgDefn.getInstance()) {
- return "ds-cfg-test-child-dummy";
- } else {
- // Not known.
- return null;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getRelationChildRDNType(InstantiableRelationDefinition<?, ?> r) {
+ if (r == TestCfg.getTestOneToManyParentRelationDefinition()
+ || r == TestParentCfgDefn.getInstance().getTestChildrenRelationDefinition()) {
+ return "cn";
+ } else {
+ return null;
+ }
}
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getRelationRDNSequence(RelationDefinition<?, ?> r) {
- if (r == TestCfg.getTestOneToManyParentRelationDefinition()) {
- return "cn=test parents,cn=config";
- } else if (r == TestCfg.getTestOneToZeroOrOneParentRelationDefinition()) {
- return "cn=optional test parent,cn=config";
- } else if (r == TestParentCfgDefn.getInstance()
- .getTestChildrenRelationDefinition()) {
- return "cn=test children";
- } else if (r == TestParentCfgDefn.getInstance()
- .getOptionalTestChildRelationDefinition()) {
- return "cn=optional test child";
- } else {
- return null;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getObjectClass(AbstractManagedObjectDefinition<?, ?> d) {
+ if (d == TestParentCfgDefn.getInstance()) {
+ return "ds-cfg-test-parent-dummy";
+ } else if (d == TestChildCfgDefn.getInstance()) {
+ return "ds-cfg-test-child-dummy";
+ } else {
+ // Not known.
+ return null;
+ }
}
- }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getRelationRDNSequence(RelationDefinition<?, ?> r) {
+ if (r == TestCfg.getTestOneToManyParentRelationDefinition()) {
+ return "cn=test parents,cn=config";
+ } else if (r == TestCfg.getTestOneToZeroOrOneParentRelationDefinition()) {
+ return "cn=optional test parent,cn=config";
+ } else if (r == TestParentCfgDefn.getInstance().getTestChildrenRelationDefinition()) {
+ return "cn=test children";
+ } else if (r == TestParentCfgDefn.getInstance().getOptionalTestChildRelationDefinition()) {
+ return "cn=optional test child";
+ } else {
+ return null;
+ }
+ }
}
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/SizeUnitTest.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/SizeUnitTest.java
index ef38b1f..a8ba27c 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/SizeUnitTest.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/SizeUnitTest.java
@@ -102,7 +102,7 @@
{ "1" },
{ "1x" },
{ "1.1y" }
- };
+ };
}
@@ -120,7 +120,7 @@
{ "1.0", 1000L },
{ "1000", 1000000L },
{ "1MB", 1000000L }
- };
+ };
}
@Test(dataProvider = "valuesToKiloBytes")
@@ -140,7 +140,7 @@
{ "-1b" },
{ "1x" },
{ "1.1y" }
- };
+ };
}
@Test(dataProvider = "parseValueIllegalDataKB", expectedExceptions = NumberFormatException.class)
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/TestCfg.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/TestCfg.java
index 9a834f8..ffa88b0 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/TestCfg.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/TestCfg.java
@@ -43,8 +43,10 @@
* A one-to-zero-or-one relation between the root and a test-parent
* component.
*/
+ // @Checkstyle:off
private static final OptionalRelationDefinition<TestParentCfgClient, TestParentCfg>
RD_TEST_ONE_TO_ZERO_OR_ONE_PARENT;
+ // @Checkstyle:on
// Create a one-to-many relation for test-parent components.
static {
@@ -83,7 +85,7 @@
LDAPProfile.getInstance().pushWrapper(new MockLDAPProfile());
}
- private static void initializeAndRegisterBundle(ManagedObjectDefinition<?,?> definition) throws Exception {
+ private static void initializeAndRegisterBundle(ManagedObjectDefinition<?, ?> definition) throws Exception {
definition.initialize();
String baseName = definition.getClass().getName();
ResourceBundle resourceBundle = ResourceBundle.getBundle(baseName);
@@ -117,10 +119,12 @@
* @return Returns the one-to-many relation between the root and test-parent
* components.
*/
+ // @Checkstyle:off
public static InstantiableRelationDefinition<TestParentCfgClient, TestParentCfg>
getTestOneToManyParentRelationDefinition() {
return RD_TEST_ONE_TO_MANY_PARENT;
}
+ // @Checkstyle:on
/**
* Gets the one-to-zero-or-one relation between the root and a test-parent
@@ -132,10 +136,12 @@
* @return Returns the one-to-zero-or-one relation between the root and a
* test-parent component.
*/
+ // @Checkstyle:off
public static OptionalRelationDefinition<TestParentCfgClient, TestParentCfg>
getTestOneToZeroOrOneParentRelationDefinition() {
return RD_TEST_ONE_TO_ZERO_OR_ONE_PARENT;
}
+ // @Checkstyle:on
/**
* Initializes a property definition and its default behavior.
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/TestChildCfgDefn.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/TestChildCfgDefn.java
index 7b2c3bc..ca36a77 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/TestChildCfgDefn.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/TestChildCfgDefn.java
@@ -53,8 +53,10 @@
private static final TestChildCfgDefn INSTANCE = new TestChildCfgDefn();
// The "aggregation-property" property definition.
+ // @Checkstyle:off
private static final AggregationPropertyDefinition<ConnectionHandlerCfgClient, ConnectionHandlerCfg>
PROPDEF_AGGREGATION_PROPERTY;
+ // @Checkstyle:on
// The "mandatory-boolean-property" property definition.
private static final BooleanPropertyDefinition PROPDEF_MANDATORY_BOOLEAN_PROPERTY;
@@ -199,10 +201,12 @@
*
* @return Returns the "aggregation-property" property definition.
*/
+ // @Checkstyle:off
public AggregationPropertyDefinition<ConnectionHandlerCfgClient, ConnectionHandlerCfg>
getAggregationPropertyPropertyDefinition() {
- return PROPDEF_AGGREGATION_PROPERTY;
+ return PROPDEF_AGGREGATION_PROPERTY;
}
+ // @Checkstyle:on
/**
* Get the "mandatory-boolean-property" property definition.
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/ValidateConfigDefinitionsTest.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/ValidateConfigDefinitionsTest.java
index 503fdc5..9505db3 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/ValidateConfigDefinitionsTest.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/ValidateConfigDefinitionsTest.java
@@ -64,7 +64,7 @@
Object[][] enumerateManageObjectDefns() throws Exception {
TopCfgDefn topCfgDefn = TopCfgDefn.getInstance();
List<AbstractManagedObjectDefinition<?, ?>> allCfgDefns =
- new ArrayList<AbstractManagedObjectDefinition<?, ?>>(topCfgDefn.getAllChildren());
+ new ArrayList<AbstractManagedObjectDefinition<?, ?>>(topCfgDefn.getAllChildren());
Object[][] params = new Object[allCfgDefns.size()][];
for (int i = 0; i < params.length; i++) {
@@ -76,9 +76,9 @@
// Exceptions to config objects having a different objectclass
private static final List<String> CLASS_OBJECT_CLASS_EXCEPTIONS = Arrays.asList(new String[] {
- "org.opends.server.admin.std.meta.RootCfgDefn", "org.opends.server.admin.std.meta.GlobalCfgDefn", });
+ "org.opends.server.admin.std.meta.RootCfgDefn", "org.opends.server.admin.std.meta.GlobalCfgDefn", });
- // TODO : does not work because can retrieve object class objects
+ // TODO : does not work because can't retrieve object class objects
@Test(enabled = false, dataProvider = "enumerateManageObjectDefns")
public void validateConfigObjectDefinitions(AbstractManagedObjectDefinition<?, ?> objectDef) {
String objName = objectDef.getName();
@@ -92,15 +92,14 @@
} else {
String expectedObjectClass = "ds-cfg-" + objName;
if (!ldapObjectclassName.equals(expectedObjectClass)
- && !CLASS_OBJECT_CLASS_EXCEPTIONS.contains(objectDef.getClass().getName())) {
+ && !CLASS_OBJECT_CLASS_EXCEPTIONS.contains(objectDef.getClass().getName())) {
errors.append(
- "For config object " + objName + ", the LDAP objectclass must be " + expectedObjectClass
- + " instead of " + ldapObjectclassName).append(EOL + EOL);
+ "For config object " + objName + ", the LDAP objectclass must be " + expectedObjectClass
+ + " instead of " + ldapObjectclassName).append(EOL + EOL);
}
}
- ObjectClass configObjectClass = Schema.getDefaultSchema().asNonStrictSchema().
- getObjectClass(ldapObjectclassName.toLowerCase());
- ;
+ ObjectClass configObjectClass =
+ Schema.getDefaultSchema().asNonStrictSchema().getObjectClass(ldapObjectclassName.toLowerCase());
for (PropertyDefinition<?> propDef : allPropertyDefs) {
validatePropertyDefinition(objectDef, configObjectClass, propDef, errors);
@@ -108,60 +107,60 @@
if (errors.length() > 0) {
Assert.fail("The configuration definition for " + objectDef.getName() + " has the following problems: "
- + EOL + errors.toString());
+ + EOL + errors.toString());
}
}
// Exceptions to properties ending in -class being exactly 'java-class'.
private static final List<String> CLASS_PROPERTY_EXCEPTIONS = Arrays.asList(new String[] {
// e.g. "prop-name-ending-with-class"
- });
+ });
// Exceptions to properties ending in -enabled being exactly 'enabled'.
private static final List<String> ENABLED_PROPERTY_EXCEPTIONS = Arrays.asList(new String[] {
- "index-filter-analyzer-enabled", "subordinate-indexes-enabled"
+ "index-filter-analyzer-enabled", "subordinate-indexes-enabled"
// e.g. "prop-name-ending-with-enabled"
- });
+ });
// Exceptions to properties not starting with the name of their config
// object
private static final List<String> OBJECT_PREFIX_PROPERTY_EXCEPTIONS = Arrays.asList(new String[] { "backend-id",
- "plugin-type", "replication-server-id", "network-group-id", "workflow-id", "workflow-element-id",
- "workflow-element"
+ "plugin-type", "replication-server-id", "network-group-id", "workflow-id", "workflow-element-id",
+ "workflow-element"
// e.g. "prop-name-starting-with-object-prefix"
- });
+ });
private void validatePropertyDefinition(AbstractManagedObjectDefinition<?, ?> objectDef,
- ObjectClass configObjectClass, PropertyDefinition<?> propDef, StringBuilder errors) {
+ ObjectClass configObjectClass, PropertyDefinition<?> propDef, StringBuilder errors) {
String objName = objectDef.getName();
String propName = propDef.getName();
// We want class properties to be exactly java-class
if (propName.endsWith("-class") && !propName.equals("java-class")
- && !CLASS_PROPERTY_EXCEPTIONS.contains(propName)) {
+ && !CLASS_PROPERTY_EXCEPTIONS.contains(propName)) {
errors.append("The " + propName + " property on config object " + objName
- + " should probably be java-class. If not, then add " + propName
- + " to the CLASS_PROPERTY_EXCEPTIONS array in " + ValidateConfigDefinitionsTest.class.getName()
- + " to suppress" + " this warning.");
+ + " should probably be java-class. If not, then add " + propName
+ + " to the CLASS_PROPERTY_EXCEPTIONS array in " + ValidateConfigDefinitionsTest.class.getName()
+ + " to suppress" + " this warning.");
}
// We want enabled properties to be exactly enabled
if (propName.endsWith("-enabled") && !ENABLED_PROPERTY_EXCEPTIONS.contains(propName)) {
errors.append("The " + propName + " property on config object " + objName
- + " should probably be just 'enabled'. If not, then add " + propName
- + " to the ENABLED_PROPERTY_EXCEPTIONS array in " + ValidateConfigDefinitionsTest.class.getName()
- + " to suppress" + " this warning.");
+ + " should probably be just 'enabled'. If not, then add " + propName
+ + " to the ENABLED_PROPERTY_EXCEPTIONS array in " + ValidateConfigDefinitionsTest.class.getName()
+ + " to suppress" + " this warning.");
}
// It's redundant for properties to be prefixed with the name of their
// objecty
if (propName.startsWith(objName) && !propName.equals(objName)
- && !OBJECT_PREFIX_PROPERTY_EXCEPTIONS.contains(propName)) {
+ && !OBJECT_PREFIX_PROPERTY_EXCEPTIONS.contains(propName)) {
errors.append("The " + propName + " property on config object " + objName
- + " should not be prefixed with the name of the config object because"
- + " this is redundant. If you disagree, then add " + propName
- + " to the OBJECT_PREFIX_PROPERTY_EXCEPTIONS array in "
- + ValidateConfigDefinitionsTest.class.getName() + " to suppress" + " this warning.");
+ + " should not be prefixed with the name of the config object because"
+ + " this is redundant. If you disagree, then add " + propName
+ + " to the OBJECT_PREFIX_PROPERTY_EXCEPTIONS array in "
+ + ValidateConfigDefinitionsTest.class.getName() + " to suppress" + " this warning.");
}
LDAPProfile ldapProfile = LDAPProfile.getInstance();
@@ -171,8 +170,8 @@
String expectedLdapAttr = "ds-cfg-" + propName;
if (!ldapAttrName.equals(expectedLdapAttr)) {
errors.append(
- "For the " + propName + " property on config object " + objName + ", the LDAP attribute must be "
- + expectedLdapAttr + " instead of " + ldapAttrName).append(EOL + EOL);
+ "For the " + propName + " property on config object " + objName + ", the LDAP attribute must be "
+ + expectedLdapAttr + " instead of " + ldapAttrName).append(EOL + EOL);
}
Schema schema = Schema.getDefaultSchema();
@@ -181,16 +180,16 @@
// LDAP attribute exists
if (attrType == null) {
errors.append(
- propName + " property on config object " + objName + " is declared" + " to use ldap attribute "
- + ldapAttrName + ", but this attribute is not in the schema ").append(EOL + EOL);
+ propName + " property on config object " + objName + " is declared" + " to use ldap attribute "
+ + ldapAttrName + ", but this attribute is not in the schema ").append(EOL + EOL);
} else {
// LDAP attribute is multivalued if the property is multivalued
if (propDef.hasOption(PropertyOption.MULTI_VALUED) && attrType.isSingleValue()) {
errors.append(
- propName + " property on config object " + objName + " is declared"
- + " as multi-valued, but the corresponding ldap attribute " + ldapAttrName
- + " is declared as single-valued.").append(EOL + EOL);
+ propName + " property on config object " + objName + " is declared"
+ + " as multi-valued, but the corresponding ldap attribute " + ldapAttrName
+ + " is declared as single-valued.").append(EOL + EOL);
}
if (configObjectClass != null) {
@@ -199,19 +198,19 @@
Set<AttributeType> mandatoryAttributes = configObjectClass.getRequiredAttributes();
if (mandatoryAttributes.contains(attrType) && !propDef.hasOption(PropertyOption.MANDATORY)) {
errors.append(
- propName + " property on config object " + objName + " is not declared"
- + " as mandatory even though the corresponding ldap attribute " + ldapAttrName
- + " is declared as mandatory in the schema.").append(EOL + EOL);
+ propName + " property on config object " + objName + " is not declared"
+ + " as mandatory even though the corresponding ldap attribute " + ldapAttrName
+ + " is declared as mandatory in the schema.").append(EOL + EOL);
}
Set<AttributeType> allowedAttributes = new HashSet<AttributeType>(mandatoryAttributes);
allowedAttributes.addAll(configObjectClass.getOptionalAttributes());
if (!allowedAttributes.contains(attrType)) {
errors.append(
- propName + " property on config object " + objName + " has"
- + " the corresponding ldap attribute " + ldapAttrName
- + ", but this attribute is not an allowed attribute on the configuration "
- + " object's objectclass " + configObjectClass.getNameOrOID()).append(EOL + EOL);
+ propName + " property on config object " + objName + " has"
+ + " the corresponding ldap attribute " + ldapAttrName
+ + ", but this attribute is not an allowed attribute on the configuration "
+ + " object's objectclass " + configObjectClass.getNameOrOID()).append(EOL + EOL);
}
}
}
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/client/ldap/LDAPClientTest.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/client/ldap/LDAPClientTest.java
index edf7848..2bfddf0 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/client/ldap/LDAPClientTest.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/client/ldap/LDAPClientTest.java
@@ -63,107 +63,107 @@
// Test LDIF.
private static final String[] TEST_LDIF = new String[] {
- // Base entries.
- "dn: cn=config",
- "objectclass: top",
- "objectclass: ds-cfg-branch",
- "cn: config",
- "",
- "dn: cn=test parents,cn=config",
- "objectclass: top",
- "objectclass: ds-cfg-branch",
- "cn: test-parents",
- "",
- // Parent 1 - uses default values for
- // optional-multi-valued-dn-property.
- "dn: cn=test parent 1,cn=test parents,cn=config",
- "objectclass: top",
- "objectclass: ds-cfg-test-parent-dummy",
- "cn: test parent 1",
- "ds-cfg-enabled: true",
- "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
- "ds-cfg-attribute-type: description",
- "",
- // Parent 2 - overrides default values for
- // optional-multi-valued-dn-property.
- "dn: cn=test parent 2,cn=test parents,cn=config",
- "objectclass: top",
- "objectclass: ds-cfg-test-parent-dummy",
- "cn: test parent 2",
- "ds-cfg-enabled: true",
- "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
- "ds-cfg-attribute-type: description",
- "ds-cfg-base-dn: dc=default value p2v1,dc=com",
- "ds-cfg-base-dn: dc=default value p2v2,dc=com",
- "",
- // Parent 3 - overrides default values for
- // optional-multi-valued-dn-property.
- "dn: cn=test parent 3,cn=test parents,cn=config",
- "objectclass: top",
- "objectclass: ds-cfg-test-parent-dummy",
- "cn: test parent 3",
- "ds-cfg-enabled: true",
- "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
- "ds-cfg-attribute-type: description",
- "ds-cfg-base-dn: dc=default value p3v1,dc=com",
- "ds-cfg-base-dn: dc=default value p3v2,dc=com",
- "",
- // Child base entries.
- "dn:cn=test children,cn=test parent 1,cn=test parents,cn=config",
- "objectclass: top",
- "objectclass: ds-cfg-branch",
- "cn: multiple children",
- "",
- "dn:cn=test children,cn=test parent 2,cn=test parents,cn=config",
- "objectclass: top",
- "objectclass: ds-cfg-branch",
- "cn: multiple children",
- "",
- // Child 1 inherits defaults for both
- // optional-multi-valued-dn-property1 and
- // optional-multi-valued-dn-property2.
- "dn: cn=test child 1,cn=test children,cn=test parent 1,cn=test parents,cn=config",
- "objectclass: top",
- "objectclass: ds-cfg-test-child-dummy",
- "cn: test child 1",
- "ds-cfg-enabled: true",
- "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
- "ds-cfg-attribute-type: description",
- "",
- // Child 2 inherits defaults for
- // optional-multi-valued-dn-property2.
- "dn: cn=test child 2,cn=test children,cn=test parent 1,cn=test parents,cn=config",
- "objectclass: top",
- "objectclass: ds-cfg-test-child-dummy",
- "cn: test child 2",
- "ds-cfg-enabled: true",
- "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
- "ds-cfg-attribute-type: description",
- "ds-cfg-base-dn: dc=default value c2v1,dc=com",
- "ds-cfg-base-dn: dc=default value c2v2,dc=com",
- "",
- // Child 3 overrides defaults for
- // optional-multi-valued-dn-property1 and
- // optional-multi-valued-dn-property2.
- "dn: cn=test child 3,cn=test children,cn=test parent 1,cn=test parents,cn=config",
- "objectclass: top",
- "objectclass: ds-cfg-test-child-dummy",
- "cn: test child 3",
- "ds-cfg-enabled: true",
- "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
- "ds-cfg-attribute-type: description",
- "ds-cfg-base-dn: dc=default value c3v1,dc=com",
- "ds-cfg-base-dn: dc=default value c3v2,dc=com",
- "ds-cfg-group-dn: dc=default value c3v3,dc=com",
- "ds-cfg-group-dn: dc=default value c3v4,dc=com",
- "",
- // Child 4 inherits overridden defaults for both
- // optional-multi-valued-dn-property1 and
- // optional-multi-valued-dn-property2.
- "dn: cn=test child 1,cn=test children,cn=test parent 2,cn=test parents,cn=config", "objectclass: top",
- "objectclass: ds-cfg-test-child-dummy", "cn: test child 1", "ds-cfg-enabled: true",
- "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
- "ds-cfg-attribute-type: description", "", };
+ // Base entries.
+ "dn: cn=config",
+ "objectclass: top",
+ "objectclass: ds-cfg-branch",
+ "cn: config",
+ "",
+ "dn: cn=test parents,cn=config",
+ "objectclass: top",
+ "objectclass: ds-cfg-branch",
+ "cn: test-parents",
+ "",
+ // Parent 1 - uses default values for
+ // optional-multi-valued-dn-property.
+ "dn: cn=test parent 1,cn=test parents,cn=config",
+ "objectclass: top",
+ "objectclass: ds-cfg-test-parent-dummy",
+ "cn: test parent 1",
+ "ds-cfg-enabled: true",
+ "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
+ "ds-cfg-attribute-type: description",
+ "",
+ // Parent 2 - overrides default values for
+ // optional-multi-valued-dn-property.
+ "dn: cn=test parent 2,cn=test parents,cn=config",
+ "objectclass: top",
+ "objectclass: ds-cfg-test-parent-dummy",
+ "cn: test parent 2",
+ "ds-cfg-enabled: true",
+ "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
+ "ds-cfg-attribute-type: description",
+ "ds-cfg-base-dn: dc=default value p2v1,dc=com",
+ "ds-cfg-base-dn: dc=default value p2v2,dc=com",
+ "",
+ // Parent 3 - overrides default values for
+ // optional-multi-valued-dn-property.
+ "dn: cn=test parent 3,cn=test parents,cn=config",
+ "objectclass: top",
+ "objectclass: ds-cfg-test-parent-dummy",
+ "cn: test parent 3",
+ "ds-cfg-enabled: true",
+ "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
+ "ds-cfg-attribute-type: description",
+ "ds-cfg-base-dn: dc=default value p3v1,dc=com",
+ "ds-cfg-base-dn: dc=default value p3v2,dc=com",
+ "",
+ // Child base entries.
+ "dn:cn=test children,cn=test parent 1,cn=test parents,cn=config",
+ "objectclass: top",
+ "objectclass: ds-cfg-branch",
+ "cn: multiple children",
+ "",
+ "dn:cn=test children,cn=test parent 2,cn=test parents,cn=config",
+ "objectclass: top",
+ "objectclass: ds-cfg-branch",
+ "cn: multiple children",
+ "",
+ // Child 1 inherits defaults for both
+ // optional-multi-valued-dn-property1 and
+ // optional-multi-valued-dn-property2.
+ "dn: cn=test child 1,cn=test children,cn=test parent 1,cn=test parents,cn=config",
+ "objectclass: top",
+ "objectclass: ds-cfg-test-child-dummy",
+ "cn: test child 1",
+ "ds-cfg-enabled: true",
+ "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
+ "ds-cfg-attribute-type: description",
+ "",
+ // Child 2 inherits defaults for
+ // optional-multi-valued-dn-property2.
+ "dn: cn=test child 2,cn=test children,cn=test parent 1,cn=test parents,cn=config",
+ "objectclass: top",
+ "objectclass: ds-cfg-test-child-dummy",
+ "cn: test child 2",
+ "ds-cfg-enabled: true",
+ "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
+ "ds-cfg-attribute-type: description",
+ "ds-cfg-base-dn: dc=default value c2v1,dc=com",
+ "ds-cfg-base-dn: dc=default value c2v2,dc=com",
+ "",
+ // Child 3 overrides defaults for
+ // optional-multi-valued-dn-property1 and
+ // optional-multi-valued-dn-property2.
+ "dn: cn=test child 3,cn=test children,cn=test parent 1,cn=test parents,cn=config",
+ "objectclass: top",
+ "objectclass: ds-cfg-test-child-dummy",
+ "cn: test child 3",
+ "ds-cfg-enabled: true",
+ "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
+ "ds-cfg-attribute-type: description",
+ "ds-cfg-base-dn: dc=default value c3v1,dc=com",
+ "ds-cfg-base-dn: dc=default value c3v2,dc=com",
+ "ds-cfg-group-dn: dc=default value c3v3,dc=com",
+ "ds-cfg-group-dn: dc=default value c3v4,dc=com",
+ "",
+ // Child 4 inherits overridden defaults for both
+ // optional-multi-valued-dn-property1 and
+ // optional-multi-valued-dn-property2.
+ "dn: cn=test child 1,cn=test children,cn=test parent 2,cn=test parents,cn=config", "objectclass: top",
+ "objectclass: ds-cfg-test-child-dummy", "cn: test child 1", "ds-cfg-enabled: true",
+ "ds-cfg-java-class: org.opends.server.extensions.UserDefinedVirtualAttributeProvider",
+ "ds-cfg-attribute-type: description", "", };
/**
* Provide valid naming exception to client API exception mappings.
@@ -178,7 +178,7 @@
{ ResultCode.UNAVAILABLE , ErrorResultException.class, ResultCode.UNAVAILABLE },
{ ResultCode.ENTRY_ALREADY_EXISTS, ManagedObjectAlreadyExistsException.class, null },
{ ResultCode.INSUFFICIENT_ACCESS_RIGHTS, ErrorResultException.class,
- ResultCode.INSUFFICIENT_ACCESS_RIGHTS },
+ ResultCode.INSUFFICIENT_ACCESS_RIGHTS },
{ ResultCode.UNWILLING_TO_PERFORM, OperationRejectedException.class, null }
};
}
@@ -196,9 +196,9 @@
{ ResultCode.UNAVAILABLE, ErrorResultException.class, ResultCode.UNAVAILABLE },
{ ResultCode.NO_SUCH_OBJECT, ManagedObjectNotFoundException.class, null },
{ ResultCode.INSUFFICIENT_ACCESS_RIGHTS, ErrorResultException.class,
- ResultCode.INSUFFICIENT_ACCESS_RIGHTS },
+ ResultCode.INSUFFICIENT_ACCESS_RIGHTS },
{ ResultCode.UNWILLING_TO_PERFORM, ErrorResultException.class,
- ResultCode.UNWILLING_TO_PERFORM }
+ ResultCode.UNWILLING_TO_PERFORM }
};
}
@@ -268,8 +268,7 @@
if (expectedExceptionClass.equals(ErrorResultException.class)) {
assertThat(e).isInstanceOf(ErrorResultException.class);
assertThat(((ErrorResultException) e).getResult().getResultCode()).isEqualTo(expectedCode);
- }
- else {
+ } else {
assertThat(e).isInstanceOf(expectedExceptionClass);
}
}
@@ -378,8 +377,7 @@
if (expectedExceptionClass.equals(ErrorResultException.class)) {
assertThat(e).isInstanceOf(ErrorResultException.class);
assertThat(((ErrorResultException) e).getResult().getResultCode()).isEqualTo(expectedCode);
- }
- else {
+ } else {
assertThat(e).isInstanceOf(expectedExceptionClass);
}
}
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/client/ldap/MockLDAPConnection.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/client/ldap/MockLDAPConnection.java
index 1631554..4e95cad 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/client/ldap/MockLDAPConnection.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/client/ldap/MockLDAPConnection.java
@@ -241,7 +241,8 @@
}
@Override
- public <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException {
+ public <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+ throws DecodeException {
throw new RuntimeException("not implemented");
}
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/AdminTestCaseUtils.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/AdminTestCaseUtils.java
index c404ab0..51031c1 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/AdminTestCaseUtils.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/AdminTestCaseUtils.java
@@ -87,12 +87,13 @@
}
}
- // Construct a dummy path.
- private synchronized static <C extends ConfigurationClient, S extends Configuration> ManagedObjectPath<C, S> getPath(
- AbstractManagedObjectDefinition<C, S> d) {
+ /** Construct a dummy path. */
+ // @Checkstyle:off
+ private synchronized static <C extends ConfigurationClient, S extends Configuration> ManagedObjectPath<C, S>
+ getPath(AbstractManagedObjectDefinition<C, S> d) {
+ // @Checkstyle:on
if (!isProfileRegistered) {
LDAPProfile.Wrapper profile = new LDAPProfile.Wrapper() {
-
@Override
public String getRelationRDNSequence(RelationDefinition<?, ?> r) {
if (r.getName().equals(DUMMY_TEST_RELATION)) {
@@ -103,15 +104,12 @@
}
};
-
LDAPProfile.getInstance().pushWrapper(profile);
isProfileRegistered = true;
}
-
- SingletonRelationDefinition.Builder<C, S> builder = new SingletonRelationDefinition.Builder<C, S>(
- RootCfgDefn.getInstance(), DUMMY_TEST_RELATION, d);
+ SingletonRelationDefinition.Builder<C, S> builder =
+ new SingletonRelationDefinition.Builder<C, S>(RootCfgDefn.getInstance(), DUMMY_TEST_RELATION, d);
ManagedObjectPath<?, ?> root = ManagedObjectPath.emptyPath();
return root.child(builder.getInstance());
-
}
}
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/AggregationServerTest.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/AggregationServerTest.java
index 01b6379..9de3b74 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/AggregationServerTest.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/AggregationServerTest.java
@@ -219,6 +219,7 @@
"ds-cfg-enabled: true",
"ds-cfg-listen-address: 0.0.0.0", "ds-cfg-listen-port: 389");
+ // @Checkstyle:off
/**
* The default test child configuration "aggregation-property" property
* definition.
@@ -235,6 +236,7 @@
/** An aggregation where the target must be enabled. */
private AggregationPropertyDefinition<ConnectionHandlerCfgClient, ConnectionHandlerCfg>
aggregationPropertyDefinitionTargetMustBeEnabled = null;
+ // @Checkstyle:on
@BeforeClass
public void setUp() throws Exception {
@@ -510,8 +512,10 @@
TestParentCfg parentCfg = getParentCfg(entryName(TEST_PARENT_1), context);
parentCfg.addTestChildDeleteListener(deleteListener);
- ArgumentCaptor<ConfigDeleteListener> registeredListener = ArgumentCaptor.forClass(ConfigDeleteListener.class);
- verify(configRepository).registerDeleteListener(eq(TEST_BASE_CHILD.getName()), registeredListener.capture());
+ ArgumentCaptor<ConfigDeleteListener> registeredListener =
+ ArgumentCaptor.forClass(ConfigDeleteListener.class);
+ verify(configRepository).registerDeleteListener(eq(TEST_BASE_CHILD.getName()),
+ registeredListener.capture());
// Now simulate the delete ofthe referenced connection handler.
assertThat(registeredListener.getValue().
@@ -545,13 +549,14 @@
TestChildCfg testChildCfg = parentCfg.getTestChild(entryName(TEST_CHILD_7));
testChildCfg.addChangeListener(changeListener);
- ArgumentCaptor<ConfigChangeListener> registeredListener = ArgumentCaptor.forClass(ConfigChangeListener.class);
+ ArgumentCaptor<ConfigChangeListener> registeredListener =
+ ArgumentCaptor.forClass(ConfigChangeListener.class);
verify(configRepository).registerChangeListener(eq(TEST_CHILD_7.getName()), registeredListener.capture());
// Now simulate the disabling ofthe referenced connection handler.
assertThat(registeredListener.getValue().
- configChangeIsAcceptable(TEST_CONNECTION_HANDLER_ENTRY_DISABLED, new LocalizableMessageBuilder())).
- isFalse();
+ configChangeIsAcceptable(TEST_CONNECTION_HANDLER_ENTRY_DISABLED, new LocalizableMessageBuilder())).
+ isFalse();
} finally {
putBackDefaultAggregationDefinitionFromTargetEnabled();
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/DNBuilderTest.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/DNBuilderTest.java
index 38ab541..6798427 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/DNBuilderTest.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/DNBuilderTest.java
@@ -58,9 +58,10 @@
@Test
public void createWithInstantiableRelationDefinition() throws Exception {
- ManagedObjectPath<?,?> parentPath = ManagedObjectPath.emptyPath().
- child(TestCfg.getTestOneToManyParentRelationDefinition(), "test-parent-1");
- ManagedObjectPath<?,?> childPath = parentPath.child(TestParentCfgDefn.getInstance().getTestChildrenRelationDefinition(), "test-child-1");
+ ManagedObjectPath<?, ?> parentPath = ManagedObjectPath.emptyPath().
+ child(TestCfg.getTestOneToManyParentRelationDefinition(), "test-parent-1");
+ ManagedObjectPath<?, ?> childPath = parentPath.child(TestParentCfgDefn.getInstance().
+ getTestChildrenRelationDefinition(), "test-child-1");
assertEquals(
DNBuilder.create(childPath),
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/DefaultBehaviorTest.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/DefaultBehaviorTest.java
index 87cef93..f9d5214 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/DefaultBehaviorTest.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/DefaultBehaviorTest.java
@@ -252,7 +252,7 @@
{ TEST_PARENT_2, TEST_CHILD_BASE_2, TEST_CHILD_4,
Arrays.asList("dc=default value p2v1,dc=com", "dc=default value p2v2,dc=com"),
Arrays.asList("dc=default value p2v1,dc=com", "dc=default value p2v2,dc=com") }
- };
+ };
}
/**
diff --git a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/ListenerTest.java b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/ListenerTest.java
index 8051357..9174888 100644
--- a/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/ListenerTest.java
+++ b/opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/server/ListenerTest.java
@@ -48,7 +48,7 @@
import org.testng.annotations.Test;
-@SuppressWarnings({"javadoc", "rawtypes", "unchecked"})
+@SuppressWarnings({ "javadoc", "rawtypes", "unchecked" })
public class ListenerTest extends AdminTestCase {
private static final DN ROOT_CONFIG_DN = DN.valueOf("cn=config");
@@ -87,7 +87,7 @@
/** Register a listener for test parent entry and return the actual registered listener */
private ConfigAddListener registerAddListenerForTestParent(ConfigurationRepository configRepository,
ServerManagedObject<RootCfg> root, ConfigurationAddListener<TestParentCfg> parentListener)
- throws Exception {
+ throws Exception {
root.registerAddListener(TestCfg.getTestOneToManyParentRelationDefinition(), parentListener);
ArgumentCaptor<ConfigAddListener> registered = ArgumentCaptor.forClass(ConfigAddListener.class);
@@ -98,7 +98,7 @@
/** Register a listener for test parent entry in delayed scenario and return the actual registered listener */
private DelayedConfigAddListener registerAddListenerForTestParentDelayed(ConfigurationRepository configRepository,
ServerManagedObject<RootCfg> root, ConfigurationAddListener<TestParentCfg> parentListener)
- throws Exception {
+ throws Exception {
root.registerAddListener(TestCfg.getTestOneToManyParentRelationDefinition(), parentListener);
ArgumentCaptor<DelayedConfigAddListener> registered = ArgumentCaptor.forClass(DelayedConfigAddListener.class);
@@ -204,7 +204,7 @@
// check that actual listener is the one provided to the root
ConfigurationDeleteListener actualListener =
((ServerManagedObjectDeleteListenerAdaptor)
- ((ConfigDeleteListenerAdaptor)argument.getValue().getDelayedDeleteListener()).
+ ((ConfigDeleteListenerAdaptor) argument.getValue().getDelayedDeleteListener()).
getServerManagedObjectDeleteListener()).getConfigurationDeleteListener();
assertThat(actualListener).isEqualTo(parentListener);
}
@@ -273,4 +273,4 @@
verify(configRepository).deregisterAddListener(eq(ROOT_CONFIG_DN), same(registeredListener));
}
-}
\ No newline at end of file
+}
--
Gitblit v1.10.0