From e0e6d30a905e47931a89b7e9063d752a6f28106d Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 05 Feb 2014 22:45:49 +0000
Subject: [PATCH] OPENDJ-1235: Migrate configuration framework

---
 opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java |   27 ++++++++-------------------
 1 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java b/opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java
index 236db07..7fa3165 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java
@@ -53,7 +53,6 @@
 import org.forgerock.opendj.config.ManagedObjectPath;
 import org.forgerock.opendj.config.PropertyDefinition;
 import org.forgerock.opendj.config.PropertyDefinitionVisitor;
-import org.forgerock.opendj.config.PropertyDefinitionsOptions;
 import org.forgerock.opendj.config.PropertyOption;
 import org.forgerock.opendj.config.Reference;
 import org.forgerock.opendj.config.RelationDefinition;
@@ -81,9 +80,6 @@
      * A visitor which is used to decode property LDAP values.
      */
     private static final class ValueDecoder extends PropertyDefinitionVisitor<Object, String> {
-
-        private final PropertyDefinitionsOptions options;
-
         /**
          * Decodes the provided property LDAP value.
          *
@@ -93,21 +89,19 @@
          *            The property definition.
          * @param value
          *            The LDAP string representation.
-         * @param options
-         *            Decoding options for property definitions.
          * @return Returns the decoded LDAP value.
          * @throws PropertyException
          *             If the property value could not be decoded because it was
          *             invalid.
          */
-        public static <P> P decode(PropertyDefinition<P> pd, Object value, PropertyDefinitionsOptions options) {
+        public static <P> P decode(PropertyDefinition<P> pd, Object value) {
             String s = String.valueOf(value);
-            return pd.castValue(pd.accept(new ValueDecoder(options), s));
+            return pd.castValue(pd.accept(new ValueDecoder(), s));
         }
 
         // Prevent instantiation.
-        private ValueDecoder(PropertyDefinitionsOptions options) {
-            this.options = options;
+        private ValueDecoder() {
+            // Do nothing.
         }
 
         /**
@@ -132,7 +126,7 @@
         @Override
         public <T> Object visitUnknown(PropertyDefinition<T> d, String p) {
             // By default the property definition's decoder will do.
-            return d.decodeValue(p, options);
+            return d.decodeValue(p);
         }
     }
 
@@ -152,11 +146,8 @@
      *            The LDAP connection.
      * @param profile
      *            The LDAP profile.
-     * @param propertyDefOptions
-     *            Options used to validate property definitions values
      */
-    public LDAPDriver(LDAPConnection connection, LDAPProfile profile, PropertyDefinitionsOptions propertyDefOptions) {
-        super(propertyDefOptions);
+    public LDAPDriver(LDAPConnection connection, LDAPProfile profile) {
         this.connection = connection;
         this.profile = profile;
     }
@@ -264,10 +255,9 @@
 
             // Decode the values.
             SortedSet<P> values = new TreeSet<P>(propertyDef);
-            PropertyDefinitionsOptions options = context.getPropertyDefOptions();
             if (attribute != null) {
                 for (ByteString byteValue : attribute) {
-                    P value = ValueDecoder.decode(propertyDef, byteValue, options);
+                    P value = ValueDecoder.decode(propertyDef, byteValue);
                     values.add(value);
                 }
             }
@@ -489,10 +479,9 @@
 
         // Get the property's active values.
         SortedSet<P> activeValues = new TreeSet<P>(propertyDef);
-        PropertyDefinitionsOptions options = context.getPropertyDefOptions();
         if (attribute != null) {
             for (ByteString byteValue : attribute) {
-                P value = ValueDecoder.decode(propertyDef, byteValue, options);
+                P value = ValueDecoder.decode(propertyDef, byteValue);
                 activeValues.add(value);
             }
         }

--
Gitblit v1.10.0