From e3b8d5e3dbf22f89d86c11def28c466ab45909e3 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 15 May 2012 16:14:54 +0000
Subject: [PATCH] Fix OPENDJ-497: Add support for user defined parsing: AttributeParser.as() and AttributeParser.asSetOf()
---
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java | 4
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java | 2
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java | 2
opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Collections2.java | 2
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java | 4
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java | 4
opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterators.java | 2
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Functions.java | 45 ++++----
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Function.java | 9 +
opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterables.java | 2
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeParser.java | 140 +++++++++++++++++++--------
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RootDSE.java | 39 +++----
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java | 1
13 files changed, 163 insertions(+), 93 deletions(-)
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Collections2.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Collections2.java
index 0c3774e..b6c8899 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Collections2.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Collections2.java
@@ -32,6 +32,8 @@
import java.util.List;
import java.util.ListIterator;
+import org.forgerock.opendj.ldap.Function;
+
/**
* Additional {@code Collection} based utility methods.
*/
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterables.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterables.java
index a02151b..c5102b9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterables.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterables.java
@@ -28,6 +28,8 @@
import java.util.Iterator;
+import org.forgerock.opendj.ldap.Function;
+
/**
* Utility methods for manipulating {@link Iterable}s.
*/
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterators.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterators.java
index d36925f..957f384 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterators.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterators.java
@@ -29,6 +29,8 @@
import java.util.Iterator;
import java.util.NoSuchElementException;
+import org.forgerock.opendj.ldap.Function;
+
/**
* Utility methods for manipulating {@link Iterator}s.
*/
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeParser.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeParser.java
index 6606072..81088d0 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeParser.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeParser.java
@@ -37,9 +37,6 @@
import org.forgerock.opendj.ldap.schema.Schema;
-import com.forgerock.opendj.util.Function;
-import com.forgerock.opendj.util.Functions;
-
/**
* A fluent API for parsing attributes as different types of object. An
* attribute parser is obtained from an entry using the method
@@ -98,6 +95,42 @@
}
/**
+ * Returns the first value decoded as a {@code T} using the provided
+ * {@link Function}, or {@code null} if the attribute does not contain any
+ * values.
+ *
+ * @param <T>
+ * The type of the value to be decoded.
+ * @param f
+ * The function which should be used to decode the value.
+ * @return The first value decoded as a {@code T}.
+ */
+ public <T> T as(final Function<ByteString, ? extends T, Void> f) {
+ return as(f, null);
+ }
+
+ /**
+ * Returns the first value decoded as a {@code T} using the provided
+ * {@link Function}, or {@code defaultValue} if the attribute does not
+ * contain any values.
+ *
+ * @param <T>
+ * The type of the value to be decoded.
+ * @param f
+ * The function which should be used to decode the value.
+ * @param defaultValue
+ * The default value to return if the attribute is empty.
+ * @return The first value decoded as a {@code T}.
+ */
+ public <T> T as(final Function<ByteString, ? extends T, Void> f, final T defaultValue) {
+ if (!isEmpty(attribute)) {
+ return f.apply(attribute.firstValue(), null);
+ } else {
+ return defaultValue;
+ }
+ }
+
+ /**
* Returns the first value decoded as an {@code AttributeDescription} using
* the schema associated with this parser, or {@code null} if the attribute
* does not contain any values.
@@ -118,7 +151,7 @@
* @return The first value decoded as an {@code AttributeDescription}.
*/
public AttributeDescription asAttributeDescription(final AttributeDescription defaultValue) {
- return parseSingleValue(Functions.valueToAttributeDescription(getSchema()), defaultValue);
+ return as(Functions.byteStringToAttributeDescription(getSchema()), defaultValue);
}
/**
@@ -153,7 +186,7 @@
* @return The first value decoded as an {@code Boolean}.
*/
public boolean asBoolean(final boolean defaultValue) {
- return parseSingleValue(Functions.valueToBoolean(), defaultValue);
+ return as(Functions.byteStringToBoolean(), defaultValue);
}
/**
@@ -175,7 +208,7 @@
* @return The first value.
*/
public ByteString asByteString(final ByteString defaultValue) {
- return parseSingleValue(Functions.<ByteString> identityFunction(), defaultValue);
+ return as(Functions.<ByteString> identityFunction(), defaultValue);
}
/**
@@ -199,7 +232,7 @@
* @return The first value decoded as a {@code DN}.
*/
public DN asDN(final DN defaultValue) {
- return parseSingleValue(Functions.valueToDN(getSchema()), defaultValue);
+ return as(Functions.byteStringToDN(getSchema()), defaultValue);
}
/**
@@ -236,7 +269,7 @@
* @return The first value decoded as an {@code GeneralizedTime}.
*/
public GeneralizedTime asGeneralizedTime(final GeneralizedTime defaultValue) {
- return parseSingleValue(Functions.valueToGeneralizedTime(), defaultValue);
+ return as(Functions.byteStringToGeneralizedTime(), defaultValue);
}
/**
@@ -258,7 +291,7 @@
* @return The first value decoded as an {@code Integer}.
*/
public int asInteger(final int defaultValue) {
- return parseSingleValue(Functions.valueToInteger(), defaultValue);
+ return as(Functions.byteStringToInteger(), defaultValue);
}
/**
@@ -280,7 +313,53 @@
* @return The first value decoded as a {@code Long}.
*/
public long asLong(final long defaultValue) {
- return parseSingleValue(Functions.valueToLong(), defaultValue);
+ return as(Functions.byteStringToLong(), defaultValue);
+ }
+
+ /**
+ * Returns the values decoded as a set of {@code T}s using the provided
+ * {@link Function}, or {@code defaultValues} if the attribute does not
+ * contain any values.
+ *
+ * @param <T>
+ * The type of the values to be decoded.
+ * @param f
+ * The function which should be used to decode values.
+ * @param defaultValues
+ * The default values to return if the attribute is empty.
+ * @return The values decoded as a set of {@code T}s.
+ */
+ public <T> Set<T> asSetOf(final Function<ByteString, ? extends T, Void> f,
+ final Collection<? extends T> defaultValues) {
+ if (!isEmpty(attribute)) {
+ final LinkedHashSet<T> result = new LinkedHashSet<T>(attribute.size());
+ for (final ByteString b : attribute) {
+ result.add(f.apply(b, null));
+ }
+ return result;
+ } else if (defaultValues != null) {
+ return new LinkedHashSet<T>(defaultValues);
+ } else {
+ return new LinkedHashSet<T>(0);
+ }
+ }
+
+ /**
+ * Returns the values decoded as a set of {@code T}s using the provided
+ * {@link Function}, or {@code defaultValues} if the attribute does not
+ * contain any values.
+ *
+ * @param <T>
+ * The type of the values to be decoded.
+ * @param f
+ * The function which should be used to decode values.
+ * @param defaultValues
+ * The default values to return if the attribute is empty.
+ * @return The values decoded as a set of {@code T}s.
+ */
+ public <T> Set<T> asSetOf(final Function<ByteString, ? extends T, Void> f,
+ final T... defaultValues) {
+ return asSetOf(f, Arrays.asList(defaultValues));
}
/**
@@ -319,7 +398,7 @@
*/
public Set<AttributeDescription> asSetOfAttributeDescription(
final Collection<AttributeDescription> defaultValues) {
- return parseMultipleValues(Functions.valueToAttributeDescription(), defaultValues);
+ return asSetOf(Functions.byteStringToAttributeDescription(), defaultValues);
}
/**
@@ -357,7 +436,7 @@
* @return The values decoded as a set of {@code Boolean}s.
*/
public Set<Boolean> asSetOfBoolean(final Collection<Boolean> defaultValues) {
- return parseMultipleValues(Functions.valueToBoolean(), defaultValues);
+ return asSetOf(Functions.byteStringToBoolean(), defaultValues);
}
/**
@@ -381,7 +460,7 @@
* @return The values contained in the attribute.
*/
public Set<ByteString> asSetOfByteString(final Collection<ByteString> defaultValues) {
- return parseMultipleValues(Functions.<ByteString> identityFunction(), defaultValues);
+ return asSetOf(Functions.<ByteString> identityFunction(), defaultValues);
}
/**
@@ -405,7 +484,7 @@
* @return The values decoded as a set of {@code DN}s.
*/
public Set<DN> asSetOfDN(final Collection<DN> defaultValues) {
- return parseMultipleValues(Functions.valueToDN(), defaultValues);
+ return asSetOf(Functions.byteStringToDN(), defaultValues);
}
/**
@@ -446,7 +525,7 @@
*/
public Set<GeneralizedTime> asSetOfGeneralizedTime(
final Collection<GeneralizedTime> defaultValues) {
- return parseMultipleValues(Functions.valueToGeneralizedTime(), defaultValues);
+ return asSetOf(Functions.byteStringToGeneralizedTime(), defaultValues);
}
/**
@@ -471,7 +550,7 @@
* @return The values decoded as a set of {@code Integer}s.
*/
public Set<Integer> asSetOfInteger(final Collection<Integer> defaultValues) {
- return parseMultipleValues(Functions.valueToInteger(), defaultValues);
+ return asSetOf(Functions.byteStringToInteger(), defaultValues);
}
/**
@@ -495,7 +574,7 @@
* @return The values decoded as a set of {@code Long}s.
*/
public Set<Long> asSetOfLong(final Collection<Long> defaultValues) {
- return parseMultipleValues(Functions.valueToLong(), defaultValues);
+ return asSetOf(Functions.byteStringToLong(), defaultValues);
}
/**
@@ -519,7 +598,7 @@
* @return The values decoded as a set of {@code String}s.
*/
public Set<String> asSetOfString(final Collection<String> defaultValues) {
- return parseMultipleValues(Functions.valueToString(), defaultValues);
+ return asSetOf(Functions.byteStringToString(), defaultValues);
}
/**
@@ -553,7 +632,7 @@
* @return The first value decoded as a {@code String}.
*/
public String asString(final String defaultValue) {
- return parseSingleValue(Functions.valueToString(), defaultValue);
+ return as(Functions.byteStringToString(), defaultValue);
}
/**
@@ -594,27 +673,4 @@
private Schema getSchema() {
return schema == null ? Schema.getDefaultSchema() : schema;
}
-
- private <T> Set<T> parseMultipleValues(final Function<ByteString, T, ?> f,
- final Collection<? extends T> defaultValues) {
- if (!isEmpty(attribute)) {
- final LinkedHashSet<T> result = new LinkedHashSet<T>(attribute.size());
- for (final ByteString b : attribute) {
- result.add(f.apply(b, null));
- }
- return result;
- } else if (defaultValues != null) {
- return new LinkedHashSet<T>(defaultValues);
- } else {
- return new LinkedHashSet<T>(0);
- }
- }
-
- private <T> T parseSingleValue(final Function<ByteString, T, ?> f, final T defaultValue) {
- if (!isEmpty(attribute)) {
- return f.apply(attribute.firstValue(), null);
- } else {
- return defaultValue;
- }
- }
}
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java
index afa54b4..1a6b6bf 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java
@@ -45,7 +45,6 @@
import org.forgerock.opendj.ldap.schema.SchemaValidationPolicy;
import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException;
-import com.forgerock.opendj.util.Function;
import com.forgerock.opendj.util.Iterables;
import com.forgerock.opendj.util.Validator;
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Function.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Function.java
similarity index 84%
rename from opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Function.java
rename to opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Function.java
index 363b984..fc30ceb 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Function.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Function.java
@@ -22,13 +22,18 @@
*
*
* Copyright 2009 Sun Microsystems, Inc.
+ * Portions copyright 2012 ForgeRock AS.
*/
-package com.forgerock.opendj.util;
+package org.forgerock.opendj.ldap;
/**
* Functions transform input values of type {@code M} to output values of type
* {@code N}.
+ * <p>
+ * A {@code Function} can be passed to an {@link AttributeParser} in order to
+ * facilitate parsing of attributes. Common implementations can be found in the
+ * {@link Functions} class.
*
* @param <M>
* The type of input values transformed by this function.
@@ -38,6 +43,8 @@
* The type of the additional parameter to this function's
* {@code apply} method. Use {@link java.lang.Void} for functions
* that do not need an additional parameter.
+ * @see Functions
+ * @see AttributeParser
*/
public interface Function<M, N, P> {
/**
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Functions.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Functions.java
similarity index 93%
rename from opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Functions.java
rename to opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Functions.java
index 87302c0..408e18a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Functions.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Functions.java
@@ -25,7 +25,7 @@
* Portions copyright 2012 ForgeRock AS.
*/
-package com.forgerock.opendj.util;
+package org.forgerock.opendj.ldap;
import static org.forgerock.opendj.ldap.CoreMessages.FUNCTIONS_TO_INTEGER_FAIL;
import static org.forgerock.opendj.ldap.CoreMessages.FUNCTIONS_TO_LONG_FAIL;
@@ -33,14 +33,17 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.AttributeDescription;
-import org.forgerock.opendj.ldap.ByteString;
-import org.forgerock.opendj.ldap.DN;
-import org.forgerock.opendj.ldap.GeneralizedTime;
import org.forgerock.opendj.ldap.schema.Schema;
+import com.forgerock.opendj.util.StaticUtils;
+
/**
- * Common {@link Function} implementations.
+ * Common {@link Function} implementations which may be used when parsing
+ * attributes.
+ *
+ * @see Entry#parseAttribute
+ * @see Attribute#parse
+ * @see AttributeParser
*/
public final class Functions {
@@ -156,22 +159,22 @@
};
private static final Function<ByteString, AttributeDescription, Schema> BYTESTRING_TO_ATTRIBUTE_DESCRIPTION =
- composeSecondP(valueToString(), STRING_TO_ATTRIBUTE_DESCRIPTION);
+ composeSecondP(byteStringToString(), STRING_TO_ATTRIBUTE_DESCRIPTION);
private static final Function<ByteString, Boolean, Void> BYTESTRING_TO_BOOLEAN = compose(
- valueToString(), STRING_TO_BOOLEAN);
+ byteStringToString(), STRING_TO_BOOLEAN);
private static final Function<ByteString, DN, Schema> BYTESTRING_TO_DN = composeSecondP(
- valueToString(), STRING_TO_DN);
+ byteStringToString(), STRING_TO_DN);
private static final Function<ByteString, GeneralizedTime, Void> BYTESTRING_TO_GENERALIZED_TIME =
- compose(valueToString(), STRING_TO_GENERALIZED_TIME);
+ compose(byteStringToString(), STRING_TO_GENERALIZED_TIME);
private static final Function<ByteString, Integer, Void> BYTESTRING_TO_INTEGER = compose(
- valueToString(), STRING_TO_INTEGER);
+ byteStringToString(), STRING_TO_INTEGER);
private static final Function<ByteString, Long, Void> BYTESTRING_TO_LONG = compose(
- valueToString(), STRING_TO_LONG);
+ byteStringToString(), STRING_TO_LONG);
/**
* Returns the composition of two functions. The result of the first
@@ -422,7 +425,7 @@
*
* @return A function which parses {@code AttributeDescription}s.
*/
- public static Function<ByteString, AttributeDescription, Void> valueToAttributeDescription() {
+ public static Function<ByteString, AttributeDescription, Void> byteStringToAttributeDescription() {
return fixedFunction(BYTESTRING_TO_ATTRIBUTE_DESCRIPTION, Schema.getDefaultSchema());
}
@@ -435,7 +438,7 @@
* The schema to use for decoding attribute descriptions.
* @return A function which parses {@code AttributeDescription}s.
*/
- public static Function<ByteString, AttributeDescription, Void> valueToAttributeDescription(
+ public static Function<ByteString, AttributeDescription, Void> byteStringToAttributeDescription(
final Schema schema) {
return fixedFunction(BYTESTRING_TO_ATTRIBUTE_DESCRIPTION, schema);
}
@@ -448,7 +451,7 @@
*
* @return A function which parses {@code Boolean} values.
*/
- public static Function<ByteString, Boolean, Void> valueToBoolean() {
+ public static Function<ByteString, Boolean, Void> byteStringToBoolean() {
return BYTESTRING_TO_BOOLEAN;
}
@@ -459,7 +462,7 @@
*
* @return A function which parses {@code DN}s.
*/
- public static Function<ByteString, DN, Void> valueToDN() {
+ public static Function<ByteString, DN, Void> byteStringToDN() {
return fixedFunction(BYTESTRING_TO_DN, Schema.getDefaultSchema());
}
@@ -472,7 +475,7 @@
* The schema to use for decoding DNs.
* @return A function which parses {@code DN}s.
*/
- public static Function<ByteString, DN, Void> valueToDN(final Schema schema) {
+ public static Function<ByteString, DN, Void> byteStringToDN(final Schema schema) {
return fixedFunction(BYTESTRING_TO_DN, schema);
}
@@ -482,7 +485,7 @@
*
* @return A function which parses generalized time strings.
*/
- public static Function<ByteString, GeneralizedTime, Void> valueToGeneralizedTime() {
+ public static Function<ByteString, GeneralizedTime, Void> byteStringToGeneralizedTime() {
return BYTESTRING_TO_GENERALIZED_TIME;
}
@@ -492,7 +495,7 @@
*
* @return A function which parses {@code Integer} string values.
*/
- public static Function<ByteString, Integer, Void> valueToInteger() {
+ public static Function<ByteString, Integer, Void> byteStringToInteger() {
return BYTESTRING_TO_INTEGER;
}
@@ -502,7 +505,7 @@
*
* @return A function which parses {@code Long} string values.
*/
- public static Function<ByteString, Long, Void> valueToLong() {
+ public static Function<ByteString, Long, Void> byteStringToLong() {
return BYTESTRING_TO_LONG;
}
@@ -513,7 +516,7 @@
* @return A function which parses the string representation of a
* {@code ByteString} as a UTF-8 encoded {@code String}.
*/
- public static Function<ByteString, String, Void> valueToString() {
+ public static Function<ByteString, String, Void> byteStringToString() {
return BYTESTRING_TO_STRING;
}
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RootDSE.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RootDSE.java
index 2ca5f81..a66fc1e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RootDSE.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RootDSE.java
@@ -36,8 +36,6 @@
import org.forgerock.opendj.ldap.schema.CoreSchema;
import com.forgerock.opendj.util.Collections2;
-import com.forgerock.opendj.util.Function;
-import com.forgerock.opendj.util.Functions;
import com.forgerock.opendj.util.FutureResultTransformer;
import com.forgerock.opendj.util.Validator;
@@ -116,13 +114,13 @@
.create(CoreSchema.getVendorNameAttributeType());
private static final SearchRequest SEARCH_REQUEST = Requests.newSearchRequest(DN.rootDN(),
- SearchScope.BASE_OBJECT, Filter.objectClassPresent(), ATTR_ALT_SERVER
- .toString(), ATTR_NAMING_CONTEXTS.toString(),
- ATTR_SUPPORTED_CONTROL.toString(), ATTR_SUPPORTED_EXTENSION.toString(),
- ATTR_SUPPORTED_FEATURE.toString(), ATTR_SUPPORTED_LDAP_VERSION.toString(),
- ATTR_SUPPORTED_SASL_MECHANISMS.toString(), ATTR_VENDOR_NAME.toString(),
- ATTR_VENDOR_VERSION.toString(), ATTR_SUPPORTED_AUTH_PASSWORD_SCHEMES.toString(),
- ATTR_SUBSCHEMA_SUBENTRY.toString(), "*");
+ SearchScope.BASE_OBJECT, Filter.objectClassPresent(), ATTR_ALT_SERVER.toString(),
+ ATTR_NAMING_CONTEXTS.toString(), ATTR_SUPPORTED_CONTROL.toString(),
+ ATTR_SUPPORTED_EXTENSION.toString(), ATTR_SUPPORTED_FEATURE.toString(),
+ ATTR_SUPPORTED_LDAP_VERSION.toString(), ATTR_SUPPORTED_SASL_MECHANISMS.toString(),
+ ATTR_VENDOR_NAME.toString(), ATTR_VENDOR_VERSION.toString(),
+ ATTR_SUPPORTED_AUTH_PASSWORD_SCHEMES.toString(), ATTR_SUBSCHEMA_SUBENTRY.toString(),
+ "*");
/**
* Asynchronously reads the Root DSE from the Directory Server using the
@@ -236,7 +234,7 @@
* Directory Access Protocol (LDAP): Uniform Resource Locator </a>
*/
public Collection<String> getAlternativeServers() {
- return getMultiValuedAttribute(ATTR_ALT_SERVER, Functions.valueToString());
+ return getMultiValuedAttribute(ATTR_ALT_SERVER, Functions.byteStringToString());
}
/**
@@ -261,7 +259,7 @@
* the naming contexts, which may be empty.
*/
public Collection<DN> getNamingContexts() {
- return getMultiValuedAttribute(ATTR_NAMING_CONTEXTS, Functions.valueToDN());
+ return getMultiValuedAttribute(ATTR_NAMING_CONTEXTS, Functions.byteStringToDN());
}
/**
@@ -275,7 +273,7 @@
* the Root DSE, or {@code null} if the DN is not provided.
*/
public DN getSubschemaSubentry() {
- return getSingleValuedAttribute(ATTR_SUBSCHEMA_SUBENTRY, Functions.valueToDN());
+ return getSingleValuedAttribute(ATTR_SUBSCHEMA_SUBENTRY, Functions.byteStringToDN());
}
/**
@@ -292,7 +290,7 @@
*/
public Collection<String> getSupportedAuthenticationPasswordSchemes() {
return getMultiValuedAttribute(ATTR_SUPPORTED_AUTH_PASSWORD_SCHEMES, Functions
- .valueToString());
+ .byteStringToString());
}
/**
@@ -307,7 +305,7 @@
* request controls, which may be empty.
*/
public Collection<String> getSupportedControls() {
- return getMultiValuedAttribute(ATTR_SUPPORTED_CONTROL, Functions.valueToString());
+ return getMultiValuedAttribute(ATTR_SUPPORTED_CONTROL, Functions.byteStringToString());
}
/**
@@ -328,7 +326,7 @@
* extended operations, which may be empty.
*/
public Collection<String> getSupportedExtendedOperations() {
- return getMultiValuedAttribute(ATTR_SUPPORTED_EXTENSION, Functions.valueToString());
+ return getMultiValuedAttribute(ATTR_SUPPORTED_EXTENSION, Functions.byteStringToString());
}
/**
@@ -342,7 +340,7 @@
* elective features, which may be empty.
*/
public Collection<String> getSupportedFeatures() {
- return getMultiValuedAttribute(ATTR_SUPPORTED_FEATURE, Functions.valueToString());
+ return getMultiValuedAttribute(ATTR_SUPPORTED_FEATURE, Functions.byteStringToString());
}
/**
@@ -352,7 +350,7 @@
* @return An unmodifiable list of the versions.
*/
public Collection<Integer> getSupportedLDAPVersions() {
- return getMultiValuedAttribute(ATTR_SUPPORTED_LDAP_VERSION, Functions.valueToInteger());
+ return getMultiValuedAttribute(ATTR_SUPPORTED_LDAP_VERSION, Functions.byteStringToInteger());
}
/**
@@ -371,7 +369,8 @@
* Authentication and Security Layer (SASL) </a>
*/
public Collection<String> getSupportedSASLMechanisms() {
- return getMultiValuedAttribute(ATTR_SUPPORTED_SASL_MECHANISMS, Functions.valueToString());
+ return getMultiValuedAttribute(ATTR_SUPPORTED_SASL_MECHANISMS, Functions
+ .byteStringToString());
}
/**
@@ -384,7 +383,7 @@
* Vendor Information in the LDAP Root DSE </a>
*/
public String getVendorName() {
- return getSingleValuedAttribute(ATTR_VENDOR_NAME, Functions.valueToString());
+ return getSingleValuedAttribute(ATTR_VENDOR_NAME, Functions.byteStringToString());
}
/**
@@ -403,7 +402,7 @@
* Vendor Information in the LDAP Root DSE </a>
*/
public String getVendorVersion() {
- return getSingleValuedAttribute(ATTR_VENDOR_VERSION, Functions.valueToString());
+ return getSingleValuedAttribute(ATTR_VENDOR_VERSION, Functions.byteStringToString());
}
private <N> Collection<N> getMultiValuedAttribute(
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java
index db301c8..f62e14a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java
@@ -32,13 +32,13 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.Function;
+import org.forgerock.opendj.ldap.Functions;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
import org.forgerock.opendj.ldap.controls.GenericControl;
import com.forgerock.opendj.util.Collections2;
-import com.forgerock.opendj.util.Function;
-import com.forgerock.opendj.util.Functions;
import com.forgerock.opendj.util.Validator;
/**
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java
index 9f68d7a..c1436c4 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java
@@ -35,9 +35,9 @@
import org.forgerock.opendj.ldap.Attributes;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Function;
import org.forgerock.opendj.ldif.ChangeRecordVisitor;
-import com.forgerock.opendj.util.Function;
import com.forgerock.opendj.util.Iterables;
/**
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java
index 1f98801..891f9c1 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java
@@ -33,13 +33,13 @@
import org.forgerock.opendj.ldap.Attribute;
import org.forgerock.opendj.ldap.Attributes;
import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Function;
+import org.forgerock.opendj.ldap.Functions;
import org.forgerock.opendj.ldap.Modification;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldif.ChangeRecordVisitor;
import com.forgerock.opendj.util.Collections2;
-import com.forgerock.opendj.util.Function;
-import com.forgerock.opendj.util.Functions;
/**
* Unmodifiable modify request implementation.
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java
index ceb28a9..ce9f554 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java
@@ -32,13 +32,13 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.Function;
+import org.forgerock.opendj.ldap.Functions;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
import org.forgerock.opendj.ldap.controls.GenericControl;
import com.forgerock.opendj.util.Collections2;
-import com.forgerock.opendj.util.Function;
-import com.forgerock.opendj.util.Functions;
import com.forgerock.opendj.util.Validator;
/**
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java
index 5accd75..c3df90e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java
@@ -35,8 +35,8 @@
import org.forgerock.opendj.ldap.Attributes;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Function;
-import com.forgerock.opendj.util.Function;
import com.forgerock.opendj.util.Iterables;
/**
--
Gitblit v1.10.0