From 1734229125e7bad5f85dfe11d076eeda206236a9 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Mon, 18 Oct 2010 19:41:47 +0000
Subject: [PATCH] Update from OpenDS sdk by Bo Li: Added unmodifiable and copyOf request factories. Added authrate performance utility.
---
sdk/src/org/opends/sdk/requests/StartTLSExtendedRequestImpl.java | 51 +++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/sdk/src/org/opends/sdk/requests/StartTLSExtendedRequestImpl.java b/sdk/src/org/opends/sdk/requests/StartTLSExtendedRequestImpl.java
index 513c75e..2d0c2c3 100644
--- a/sdk/src/org/opends/sdk/requests/StartTLSExtendedRequestImpl.java
+++ b/sdk/src/org/opends/sdk/requests/StartTLSExtendedRequestImpl.java
@@ -37,6 +37,7 @@
import com.sun.opends.sdk.util.Validator;
+import java.util.*;
/**
@@ -55,7 +56,8 @@
throws DecodeException
{
// TODO: Check the OID and that the value is not present.
- final StartTLSExtendedRequest newRequest = new StartTLSExtendedRequestImpl();
+ final StartTLSExtendedRequest newRequest =
+ new StartTLSExtendedRequestImpl();
for (final Control control : request.getControls())
{
newRequest.addControl(control);
@@ -95,15 +97,16 @@
/**
* The list of cipher suite
*/
- private String[] enabledCipherSuites = null;
+ private List<String> enabledCipherSuites = new LinkedList<String>();
/**
* the list of protocols
*/
- private String[] enabledProtocols = null;
+ private List<String> enabledProtocols = new LinkedList<String>();
// No need to expose this.
- private static final ExtendedResultDecoder<ExtendedResult> RESULT_DECODER = new ResultDecoder();
+ private static final ExtendedResultDecoder<ExtendedResult> RESULT_DECODER =
+ new ResultDecoder();
@@ -115,6 +118,28 @@
+ /**
+ * Creates a new startTLS extended request that is an exact copy of the
+ * provided request.
+ *
+ * @param startTLSExtendedRequest
+ * The startTLS extended request to be copied.
+ * @throws NullPointerException
+ * If {@code startTLSExtendedRequest} was {@code null} .
+ */
+ StartTLSExtendedRequestImpl(
+ final StartTLSExtendedRequest startTLSExtendedRequest)
+ throws NullPointerException
+ {
+ super(startTLSExtendedRequest);
+ this.sslContext = startTLSExtendedRequest.getSSLContext();
+ this.enabledCipherSuites.addAll(
+ startTLSExtendedRequest.getEnabledCipherSuites());
+ this.enabledProtocols.addAll(startTLSExtendedRequest.getEnabledProtocols());
+ }
+
+
+
// Prevent instantiation.
private StartTLSExtendedRequestImpl()
{
@@ -158,9 +183,12 @@
/**
* {@inheritDoc}}
*/
- public StartTLSExtendedRequest setEnabledProtocols(String[] protocols)
+ public StartTLSExtendedRequest addEnabledProtocol(String... protocols)
{
- this.enabledProtocols = protocols;
+ for (final String protocol : protocols)
+ {
+ this.enabledProtocols.add(Validator.ensureNotNull(protocol));
+ }
return this;
}
@@ -169,9 +197,12 @@
/**
* {@inheritDoc}}
*/
- public StartTLSExtendedRequest setEnabledCipherSuites(String[] suites)
+ public StartTLSExtendedRequest addEnabledCipherSuite(String... suites)
{
- this.enabledCipherSuites = suites;
+ for (final String suite : suites)
+ {
+ this.enabledCipherSuites.add(Validator.ensureNotNull(suite));
+ }
return this;
}
@@ -180,7 +211,7 @@
/**
* {@inheritDoc}}
*/
- public String[] getEnabledProtocols()
+ public List<String> getEnabledProtocols()
{
return this.enabledProtocols;
}
@@ -190,7 +221,7 @@
/**
* {@inheritDoc}}
*/
- public String[] getEnabledCipherSuites()
+ public List<String> getEnabledCipherSuites()
{
return this.enabledCipherSuites;
}
--
Gitblit v1.10.0