From c2be303d8b7d9d643164fd84e07ccbc1a810c699 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 19 Mar 2013 13:27:00 +0000
Subject: [PATCH] OPENDJ-808 Implement a simple commons REST based HTTP connection handler

---
 opendj-sdk/opends/src/server/org/opends/server/extensions/StartTLSExtendedOperation.java |    2 +-
 opendj-sdk/opends/src/server/org/opends/server/extensions/TLSCapableConnection.java      |   10 +++++-----
 opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java  |   15 +++------------
 3 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/StartTLSExtendedOperation.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/StartTLSExtendedOperation.java
index f4d031d..5246495 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/StartTLSExtendedOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/StartTLSExtendedOperation.java
@@ -153,7 +153,7 @@
     }
 
     MessageBuilder unavailableReason = new MessageBuilder();
-    if (! tlsCapableConnection.isStartTLSAvailable(unavailableReason))
+    if (! tlsCapableConnection.prepareTLS(unavailableReason))
     {
       operation.setResultCode(ResultCode.UNAVAILABLE);
       operation.setErrorMessage(unavailableReason);
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/TLSCapableConnection.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/TLSCapableConnection.java
index 4606e6c..d08c907 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/TLSCapableConnection.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/TLSCapableConnection.java
@@ -40,10 +40,10 @@
 public interface TLSCapableConnection
 {
   /**
-   * Indicates whether TLS protection is actually available for the underlying
-   * client connection.  If there is any reason that TLS protection cannot be
-   * enabled on this client connection, then it should be appended to the
-   * provided buffer.
+   * Prepares this connection for using TLS and returns whether TLS protection
+   * is actually available for the underlying client connection. If there is any
+   * reason that TLS protection cannot be enabled on this client connection,
+   * then it should be appended to the provided buffer.
    *
    * @param  unavailableReason  The buffer used to hold the reason that TLS is
    *                            not available on the underlying client
@@ -52,6 +52,6 @@
    * @return  <CODE>true</CODE> if TLS is available on the underlying client
    *          connection, or <CODE>false</CODE> if it is not.
    */
-  public boolean isStartTLSAvailable(MessageBuilder unavailableReason);
+  public boolean prepareTLS(MessageBuilder unavailableReason);
 }
 
diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
index 3f6f0be..9f74bf3 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -2496,20 +2496,11 @@
 
 
   /**
-   * Indicates whether TLS protection is actually available for the
-   * underlying client connection. If there is any reason that TLS
-   * protection cannot be enabled on this client connection, then it
-   * should be appended to the provided buffer.
-   *
-   * @param unavailableReason
-   *          The buffer used to hold the reason that TLS is not
-   *          available on the underlying client connection.
-   * @return <CODE>true</CODE> if TLS is available on the underlying
-   *         client connection, or <CODE>false</CODE> if it is not.
+   * {@inheritDoc}
    */
-  public boolean isStartTLSAvailable(MessageBuilder unavailableReason)
+  public boolean prepareTLS(MessageBuilder unavailableReason)
   {
-    if (isSecure() && activeProvider.getName().equals("TLS"))
+    if (isSecure() && "TLS".equals(activeProvider.getName()))
     {
       unavailableReason.append(ERR_LDAP_TLS_EXISTING_SECURITY_PROVIDER
           .get(activeProvider.getName()));

--
Gitblit v1.10.0