From 23b59def043a8f71238ec5d73a393b32fb40f83c Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Thu, 14 Oct 2010 16:15:50 +0000
Subject: [PATCH] Commit from OpenDS, matthew_swift * add unit tests for ConnectionEventListeners.
---
sdk/src/org/opends/sdk/AuthenticatedConnectionFactory.java | 315 +--------------------------------------------------
1 files changed, 11 insertions(+), 304 deletions(-)
diff --git a/sdk/src/org/opends/sdk/AuthenticatedConnectionFactory.java b/sdk/src/org/opends/sdk/AuthenticatedConnectionFactory.java
index 425e8e0..168d660 100644
--- a/sdk/src/org/opends/sdk/AuthenticatedConnectionFactory.java
+++ b/sdk/src/org/opends/sdk/AuthenticatedConnectionFactory.java
@@ -29,12 +29,10 @@
-import java.util.Collection;
+import org.opends.sdk.requests.BindRequest;
+import org.opends.sdk.responses.BindResult;
-import org.opends.sdk.requests.*;
-import org.opends.sdk.responses.*;
-import org.opends.sdk.schema.Schema;
-
+import com.sun.opends.sdk.util.AsynchronousConnectionDecorator;
import com.sun.opends.sdk.util.FutureResultTransformer;
import com.sun.opends.sdk.util.RecursiveFutureResult;
@@ -59,58 +57,14 @@
* An authenticated asynchronous connection supports all operations except
* Bind operations.
*/
- public static final class AuthenticatedAsynchronousConnection implements
- AsynchronousConnection
+ public static final class AuthenticatedAsynchronousConnection extends
+ AsynchronousConnectionDecorator
{
- private final AsynchronousConnection connection;
-
-
-
private AuthenticatedAsynchronousConnection(
final AsynchronousConnection connection)
{
- this.connection = connection;
- }
-
-
-
- public FutureResult<Void> abandon(final AbandonRequest request)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.abandon(request);
- }
-
-
-
- public FutureResult<Result> add(final AddRequest request,
- final ResultHandler<? super Result> handler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.add(request, handler);
- }
-
-
-
- public FutureResult<Result> add(final AddRequest request,
- final ResultHandler<? super Result> resultHandler,
- final IntermediateResponseHandler intermediateResponseHandler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection
- .add(request, resultHandler, intermediateResponseHandler);
- }
-
-
-
- public void addConnectionEventListener(
- final ConnectionEventListener listener) throws IllegalStateException,
- NullPointerException
- {
- connection.addConnectionEventListener(listener);
+ super(connection);
}
@@ -129,264 +83,17 @@
+ /**
+ * Bind operations are not supported by pre-authenticated connections. This
+ * method will always throw {@code UnsupportedOperationException}.
+ */
public FutureResult<BindResult> bind(final BindRequest request,
final ResultHandler<? super BindResult> resultHandler,
final IntermediateResponseHandler intermediateResponseHandler)
throws UnsupportedOperationException, IllegalStateException,
NullPointerException
{
- return connection.bind(request, resultHandler,
- intermediateResponseHandler);
- }
-
-
-
- public void close()
- {
- connection.close();
- }
-
-
-
- public void close(final UnbindRequest request, final String reason)
- throws NullPointerException
- {
- connection.close(request, reason);
- }
-
-
-
- public FutureResult<CompareResult> compare(final CompareRequest request,
- final ResultHandler<? super CompareResult> handler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.compare(request, handler);
- }
-
-
-
- public FutureResult<CompareResult> compare(final CompareRequest request,
- final ResultHandler<? super CompareResult> resultHandler,
- final IntermediateResponseHandler intermediateResponseHandler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.compare(request, resultHandler,
- intermediateResponseHandler);
- }
-
-
-
- public FutureResult<Result> delete(final DeleteRequest request,
- final ResultHandler<? super Result> handler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.delete(request, handler);
- }
-
-
-
- public FutureResult<Result> delete(final DeleteRequest request,
- final ResultHandler<? super Result> resultHandler,
- final IntermediateResponseHandler intermediateResponseHandler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.delete(request, resultHandler,
- intermediateResponseHandler);
- }
-
-
-
- public <R extends ExtendedResult> FutureResult<R> extendedRequest(
- final ExtendedRequest<R> request, final ResultHandler<? super R> handler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.extendedRequest(request, handler);
- }
-
-
-
- public <R extends ExtendedResult> FutureResult<R> extendedRequest(
- final ExtendedRequest<R> request,
- final ResultHandler<? super R> resultHandler,
- final IntermediateResponseHandler intermediateResponseHandler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.extendedRequest(request, resultHandler,
- intermediateResponseHandler);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public Connection getSynchronousConnection()
- {
- return new SynchronousConnection(this);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isClosed()
- {
- return connection.isClosed();
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isValid()
- {
- return connection.isValid();
- }
-
-
-
- public FutureResult<Result> modify(final ModifyRequest request,
- final ResultHandler<? super Result> handler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.modify(request, handler);
- }
-
-
-
- public FutureResult<Result> modify(final ModifyRequest request,
- final ResultHandler<? super Result> resultHandler,
- final IntermediateResponseHandler intermediateResponseHandler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.modify(request, resultHandler,
- intermediateResponseHandler);
- }
-
-
-
- public FutureResult<Result> modifyDN(final ModifyDNRequest request,
- final ResultHandler<? super Result> handler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.modifyDN(request, handler);
- }
-
-
-
- public FutureResult<Result> modifyDN(final ModifyDNRequest request,
- final ResultHandler<? super Result> resultHandler,
- final IntermediateResponseHandler intermediateResponseHandler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.modifyDN(request, resultHandler,
- intermediateResponseHandler);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public FutureResult<SearchResultEntry> readEntry(final DN name,
- final Collection<String> attributeDescriptions,
- final ResultHandler<? super SearchResultEntry> resultHandler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.readEntry(name, attributeDescriptions, resultHandler);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public FutureResult<RootDSE> readRootDSE(
- final ResultHandler<? super RootDSE> handler)
- throws UnsupportedOperationException, IllegalStateException
- {
- return connection.readRootDSE(handler);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public FutureResult<Schema> readSchema(final DN name,
- final ResultHandler<? super Schema> handler)
- throws UnsupportedOperationException, IllegalStateException
- {
- return connection.readSchema(name, handler);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public FutureResult<Schema> readSchemaForEntry(final DN name,
- final ResultHandler<? super Schema> handler)
- throws UnsupportedOperationException, IllegalStateException
- {
- return connection.readSchemaForEntry(name, handler);
- }
-
-
-
- public void removeConnectionEventListener(
- final ConnectionEventListener listener) throws NullPointerException
- {
- connection.removeConnectionEventListener(listener);
- }
-
-
-
- public FutureResult<Result> search(final SearchRequest request,
- final SearchResultHandler handler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.search(request, handler);
- }
-
-
-
- public FutureResult<Result> search(final SearchRequest request,
- final SearchResultHandler resultHandler,
- final IntermediateResponseHandler intermediateResponseHandler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.search(request, resultHandler,
- intermediateResponseHandler);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public FutureResult<SearchResultEntry> searchSingleEntry(
- final SearchRequest request,
- final ResultHandler<? super SearchResultEntry> resultHandler)
- throws UnsupportedOperationException, IllegalStateException,
- NullPointerException
- {
- return connection.searchSingleEntry(request, resultHandler);
+ throw new UnsupportedOperationException();
}
--
Gitblit v1.10.0