From db786032bf45be89c4a893281911364d158cfb6e Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Sat, 20 Oct 2012 10:10:53 +0000
Subject: [PATCH] Update to use new json-resource 2.0 APIs.

---
 opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/ConstantAttributeMapper.java |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/ConstantAttributeMapper.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/ConstantAttributeMapper.java
index 2d29263..5a2b251 100644
--- a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/ConstantAttributeMapper.java
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/ConstantAttributeMapper.java
@@ -23,12 +23,13 @@
 
 import org.forgerock.json.fluent.JsonPointer;
 import org.forgerock.json.fluent.JsonValue;
+import org.forgerock.json.resource.ResultHandler;
+import org.forgerock.json.resource.ServerContext;
 import org.forgerock.opendj.ldap.Attribute;
 import org.forgerock.opendj.ldap.Entry;
-import org.forgerock.resource.provider.Context;
 
 /**
- *
+ * An attribute mapper which maps a single JSON attribute to a fixed value.
  */
 public class ConstantAttributeMapper implements AttributeMapper {
 
@@ -36,7 +37,7 @@
     private final Object jsonAttributeValue;
 
     /**
-     * Creates a new constant attribute mapper which maps a single LDAP
+     * Creates a new constant attribute mapper which maps a single JSON
      * attribute to a fixed value.
      *
      * @param attributeName
@@ -44,7 +45,7 @@
      * @param attributeValue
      *            The value of the simple JSON attribute.
      */
-    public ConstantAttributeMapper(String attributeName, Object attributeValue) {
+    public ConstantAttributeMapper(final String attributeName, final Object attributeValue) {
         this.jsonAttributeName = attributeName;
         this.jsonAttributeValue = attributeValue;
     }
@@ -52,26 +53,27 @@
     /**
      * {@inheritDoc}
      */
-    public void getLDAPAttributes(JsonPointer jsonAttribute, Set<String> ldapAttributes) {
+    public void getLDAPAttributes(final JsonPointer jsonAttribute, final Set<String> ldapAttributes) {
         // Nothing to do.
     }
 
     /**
      * {@inheritDoc}
      */
-    public void toJson(Context c, Entry e,
-            final AttributeMapperCompletionHandler<Map<String, Object>> h) {
+    public void toJson(final ServerContext c, final Entry e,
+            final ResultHandler<Map<String, Object>> h) {
         // FIXME: how do we know if the user requested it???
-        Map<String, Object> result =
-                Collections.singletonMap(jsonAttributeName, jsonAttributeValue);
-        h.onSuccess(result);
+        final Map<String, Object> result = Collections.singletonMap(jsonAttributeName,
+                jsonAttributeValue);
+        h.handleResult(result);
 
     }
 
     /**
      * {@inheritDoc}
      */
-    public void toLDAP(Context c, JsonValue v, AttributeMapperCompletionHandler<List<Attribute>> h) {
+    public void toLDAP(final ServerContext c, final JsonValue v,
+            final ResultHandler<List<Attribute>> h) {
         // TODO Auto-generated method stub
 
     }

--
Gitblit v1.10.0