From fd794cb26c7e4ce55a7230f7f0ea755c024d38c6 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Mon, 22 Oct 2012 17:14:03 +0000
Subject: [PATCH] Fix checkstyle errors.

---
 opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/EntryContainer.java |   97 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 70 insertions(+), 27 deletions(-)

diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/EntryContainer.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/EntryContainer.java
index a40b006..e318c3a 100644
--- a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/EntryContainer.java
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/EntryContainer.java
@@ -9,11 +9,10 @@
  * When distributing Covered Software, include this CDDL Header Notice in each file and include
  * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
  * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyrighted [year] [name of copyright owner]".
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * Copyright 2012 ForgeRock AS. All rights reserved.
+ * Copyright 2012 ForgeRock AS.
  */
-
 package org.forgerock.opendj.rest2ldap;
 
 import java.util.Collection;
@@ -35,7 +34,7 @@
 import org.forgerock.opendj.ldap.responses.SearchResultReference;
 
 /**
- *
+ * An entry container.
  */
 public final class EntryContainer {
     private abstract class AbstractRequestCompletionHandler<R, H extends ResultHandler<? super R>>
@@ -124,58 +123,102 @@
 
     private final ConnectionFactory factory;
 
+    /**
+     * Creates a new entry container for the provided base DN and LDAP
+     * connection factory.
+     *
+     * @param baseDN
+     *            The base DN.
+     * @param factory
+     *            The LDAP connection factory.
+     */
     public EntryContainer(final DN baseDN, final ConnectionFactory factory) {
         this.baseDN = baseDN;
         this.factory = factory;
     }
 
+    /**
+     * Returns the ETag for the provided entry.
+     *
+     * @param entry
+     *            The entry.
+     * @return The ETag.
+     */
     public String getEtagFromEntry(final Entry entry) {
         return entry.parseAttribute(ETAG_ATTRIBUTE).asString();
     }
 
+    /**
+     * Returns the resource ID for the provided entry.
+     *
+     * @param entry
+     *            The entry.
+     * @return The resource ID.
+     */
     public String getIDFromEntry(final Entry entry) {
         return entry.parseAttribute(UUID_ATTRIBUTE).asString();
     }
 
+    /**
+     * Lists the entries contained in this container.
+     *
+     * @param context
+     *            The request context.
+     * @param attributes
+     *            The list of LDAP attributes to be returned.
+     * @param handler
+     *            The search result handler.
+     */
     public void listEntries(final Context context, final Collection<String> attributes,
             final SearchResultHandler handler) {
         final String[] tmp = getSearchAttributes(attributes);
-        final ConnectionCompletionHandler<Result> outerHandler =
-                new ConnectionCompletionHandler<Result>(handler) {
+        final ConnectionCompletionHandler<Result> outerHandler = new ConnectionCompletionHandler<Result>(
+                handler) {
 
-                    @Override
-                    public void handleResult(final Connection connection) {
-                        final SearchRequestCompletionHandler innerHandler =
-                                new SearchRequestCompletionHandler(connection, handler);
-                        final SearchRequest request =
-                                Requests.newSearchRequest(baseDN, SearchScope.SINGLE_LEVEL, Filter
-                                        .objectClassPresent(), tmp);
-                        connection.searchAsync(request, null, innerHandler);
-                    }
+            @Override
+            public void handleResult(final Connection connection) {
+                final SearchRequestCompletionHandler innerHandler = new SearchRequestCompletionHandler(
+                        connection, handler);
+                final SearchRequest request = Requests.newSearchRequest(baseDN,
+                        SearchScope.SINGLE_LEVEL, Filter.objectClassPresent(), tmp);
+                connection.searchAsync(request, null, innerHandler);
+            }
 
-                };
+        };
 
         factory.getConnectionAsync(outerHandler);
     }
 
+    /**
+     * Reads the entry having the specified resource ID.
+     *
+     * @param c
+     *            The request context.
+     * @param id
+     *            The resource ID.
+     * @param attributes
+     *            The list of LDAP attributes to be returned.
+     * @param handler
+     *            The search result handler.
+     */
     public void readEntry(final Context c, final String id, final Collection<String> attributes,
             final ResultHandler<SearchResultEntry> handler) {
         final String[] tmp = getSearchAttributes(attributes);
+        // @Checkstyle:off
         final ConnectionCompletionHandler<SearchResultEntry> outerHandler =
                 new ConnectionCompletionHandler<SearchResultEntry>(handler) {
 
-                    @Override
-                    public void handleResult(final Connection connection) {
-                        final RequestCompletionHandler<SearchResultEntry> innerHandler =
-                                new RequestCompletionHandler<SearchResultEntry>(connection, handler);
-                        final SearchRequest request =
-                                Requests.newSearchRequest(baseDN, SearchScope.SINGLE_LEVEL, Filter
-                                        .equality(UUID_ATTRIBUTE, id), tmp);
-                        connection.searchSingleEntryAsync(request, innerHandler);
-                    }
+            @Override
+            public void handleResult(final Connection connection) {
+                final RequestCompletionHandler<SearchResultEntry> innerHandler =
+                        new RequestCompletionHandler<SearchResultEntry>(connection, handler);
+                final SearchRequest request = Requests.newSearchRequest(baseDN,
+                        SearchScope.SINGLE_LEVEL, Filter.equality(UUID_ATTRIBUTE, id), tmp);
+                connection.searchSingleEntryAsync(request, innerHandler);
+            }
 
-                };
-
+        };
+        // @Checkstyle:on
         factory.getConnectionAsync(outerHandler);
     }
 

--
Gitblit v1.10.0