From 9020a676bbe359cb158e96761ef6f1a3c32c80e5 Mon Sep 17 00:00:00 2001
From: Yannick Lecaillez <yannick.lecaillez@forgerock.com>
Date: Tue, 10 May 2016 16:42:27 +0000
Subject: [PATCH] REST2LDAP Refactoring

---
 opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/NameStrategy.java |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/NameStrategy.java b/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/NameStrategy.java
index 69e764e..ad7d817 100644
--- a/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/NameStrategy.java
+++ b/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/NameStrategy.java
@@ -11,7 +11,7 @@
  * Header, with the fields enclosed by brackets [] replaced by your own identifying
  * information: "Portions copyright [year] [name of copyright owner]".
  *
- * Copyright 2013-2015 ForgeRock AS.
+ * Copyright 2013-2016 ForgeRock AS.
  */
 
 package org.forgerock.opendj.rest2ldap;
@@ -19,6 +19,7 @@
 import java.util.Set;
 
 import org.forgerock.json.resource.ResourceException;
+import org.forgerock.opendj.ldap.Connection;
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.Entry;
 import org.forgerock.opendj.ldap.requests.SearchRequest;
@@ -40,8 +41,8 @@
      * Returns a search request which can be used to obtain the specified REST
      * resource.
      *
-     * @param requestState
-     *            The request state.
+     * @param connection
+     *            The LDAP connection to use to perform the operation.
      * @param baseDN
      *            The search base DN.
      * @param resourceId
@@ -49,40 +50,40 @@
      * @return A search request which can be used to obtain the specified REST
      *         resource.
      */
-    abstract SearchRequest createSearchRequest(RequestState requestState, DN baseDN, String resourceId);
+    abstract SearchRequest createSearchRequest(Connection connection, DN baseDN, String resourceId);
 
     /**
      * Adds the name of any LDAP attribute required by this name strategy to the
      * provided set.
      *
-     * @param requestState
-     *            The request state.
+     * @param connection
+     *            The LDAP connection to use to perform the operation.
      * @param ldapAttributes
      *            The set into which any required LDAP attribute name should be
      *            put.
      */
-    abstract void getLDAPAttributes(RequestState requestState, Set<String> ldapAttributes);
+    abstract void getLDAPAttributes(Connection connection, Set<String> ldapAttributes);
 
     /**
      * Retrieves the resource ID from the provided LDAP entry. Implementations
      * may use the entry DN as well as any attributes in order to determine the
      * resource ID.
      *
-     * @param requestState
-     *            The request state.
+     * @param connection
+     *            The LDAP connection to use to perform the operation.
      * @param entry
      *            The LDAP entry from which the resource ID should be obtained.
      * @return The resource ID.
      */
-    abstract String getResourceId(RequestState requestState, Entry entry);
+    abstract String getResourceId(Connection connection, Entry entry);
 
     /**
      * Sets the resource ID in the provided LDAP entry. Implementations are
      * responsible for setting the entry DN as well as any attributes associated
      * with the resource ID.
      *
-     * @param requestState
-     *            The request state.
+     * @param connection
+     *            The LDAP connection to use to perform the operation.
      * @param baseDN
      *            The baseDN to use when constructing the entry's DN.
      * @param resourceId
@@ -93,7 +94,7 @@
      * @throws ResourceException
      *             If the resource ID cannot be determined.
      */
-    abstract void setResourceId(RequestState requestState, DN baseDN, String resourceId, Entry entry)
+    abstract void setResourceId(Connection connection, DN baseDN, String resourceId, Entry entry)
             throws ResourceException;
 
 }

--
Gitblit v1.10.0