From 81901afc51c746c0caeea024645f11a72bb6c133 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 15 Feb 2013 23:53:33 +0000
Subject: [PATCH] OPENDJ-757: Add Rest2LDAP gateway Servlet
---
opendj-sdk/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java | 22 ++++++++++++++++++++--
opendj-sdk/opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/Example.java | 4 ++--
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/opendj-sdk/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java b/opendj-sdk/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java
index d0c11b3..cfb3b5d 100644
--- a/opendj-sdk/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java
+++ b/opendj-sdk/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java
@@ -123,6 +123,24 @@
}
/**
+ * Configures the connection factory using the provided JSON
+ * configuration. See
+ * {@link Rest2LDAP#configureConnectionFactory(JsonValue)} for a
+ * detailed specification of the JSON configuration.
+ *
+ * @param configuration
+ * The JSON configuration.
+ * @return A reference to this builder.
+ * @throws IllegalArgumentException
+ * If the configuration is invalid.
+ */
+ public Builder configureConnectionFactory(final JsonValue configuration)
+ throws IllegalArgumentException {
+ connectionFactory(Rest2LDAP.configureConnectionFactory(configuration));
+ return this;
+ }
+
+ /**
* Configures the JSON to LDAP mapping using the provided JSON
* configuration. The caller is still required to set the connection
* factory. The configuration should look like this, excluding the
@@ -196,7 +214,7 @@
return this;
}
- public Builder factory(final ConnectionFactory factory) {
+ public Builder connectionFactory(final ConnectionFactory factory) {
ensureNotNull(factory);
this.factory = factory;
return this;
@@ -452,7 +470,7 @@
* @throws IllegalArgumentException
* If the configuration is invalid.
*/
- public static ConnectionFactory connectionFactory(final JsonValue configuration)
+ public static ConnectionFactory configureConnectionFactory(final JsonValue configuration)
throws IllegalArgumentException {
// Parse pool parameters,
final int connectionPoolSize =
diff --git a/opendj-sdk/opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/Example.java b/opendj-sdk/opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/Example.java
index 96ac80c..f57639b 100644
--- a/opendj-sdk/opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/Example.java
+++ b/opendj-sdk/opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/Example.java
@@ -66,7 +66,7 @@
// Create user resource.
CollectionResourceProvider users =
- builder().factory(ldapFactory).baseDN("ou=people,dc=example,dc=com")
+ builder().connectionFactory(ldapFactory).baseDN("ou=people,dc=example,dc=com")
.attribute("schemas", constant(Arrays.asList("urn:scim:schemas:core:1.0")))
.attribute("id", simple("uid").isSingleValued().isRequired().writability(CREATE_ONLY))
.attribute("rev", simple("etag").isSingleValued().writability(READ_ONLY))
@@ -84,7 +84,7 @@
// Create group resource.
CollectionResourceProvider groups =
- builder().factory(ldapFactory).baseDN("ou=groups,dc=example,dc=com")
+ builder().connectionFactory(ldapFactory).baseDN("ou=groups,dc=example,dc=com")
.attribute("cn", simple("cn").isSingleValued())
.attribute("description", simple("description"))
.attribute("member", simple("uniquemember"))
--
Gitblit v1.10.0