| | |
| | | import static com.sun.opends.sdk.messages.Messages.*; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.concurrent.CancellationException; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.concurrent.TimeoutException; |
| | | |
| | |
| | | { |
| | | |
| | | private static final class SingleEntryFuture implements |
| | | ResultFuture<SearchResultEntry>, ResultHandler<Result>, |
| | | FutureResult<SearchResultEntry>, ResultHandler<Result>, |
| | | SearchResultHandler |
| | | { |
| | | private final ResultHandler<? super SearchResultEntry> handler; |
| | |
| | | |
| | | private volatile int entryCount = 0; |
| | | |
| | | private volatile ResultFuture<Result> future = null; |
| | | private volatile FutureResult<Result> future = null; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | public SearchResultEntry get() throws ErrorResultException, |
| | | CancellationException, InterruptedException |
| | | InterruptedException |
| | | { |
| | | future.get(); |
| | | return get0(); |
| | |
| | | |
| | | public SearchResultEntry get(long timeout, TimeUnit unit) |
| | | throws ErrorResultException, TimeoutException, |
| | | CancellationException, InterruptedException |
| | | InterruptedException |
| | | { |
| | | future.get(timeout, unit); |
| | | return get0(); |
| | |
| | | |
| | | |
| | | |
| | | public int getMessageID() |
| | | public int getRequestID() |
| | | { |
| | | return future.getMessageID(); |
| | | return future.getRequestID(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | private void setResultFuture(ResultFuture<Result> future) |
| | | private void setResultFuture(FutureResult<Result> future) |
| | | { |
| | | this.future = future; |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ResultFuture<SearchResultEntry> readEntry(DN name, |
| | | public FutureResult<SearchResultEntry> readEntry(DN name, |
| | | Collection<String> attributeDescriptions, |
| | | ResultHandler<? super SearchResultEntry> handler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ResultFuture<RootDSE> readRootDSE( |
| | | public FutureResult<RootDSE> readRootDSE( |
| | | ResultHandler<RootDSE> handler) |
| | | throws UnsupportedOperationException, IllegalStateException |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ResultFuture<Schema> readSchema(DN name, |
| | | public FutureResult<Schema> readSchema(DN name, |
| | | ResultHandler<Schema> handler) |
| | | throws UnsupportedOperationException, IllegalStateException |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ResultFuture<Schema> readSchemaForEntry(DN name, |
| | | public FutureResult<Schema> readSchemaForEntry(DN name, |
| | | ResultHandler<Schema> handler) |
| | | throws UnsupportedOperationException, IllegalStateException |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ResultFuture<SearchResultEntry> searchSingleEntry( |
| | | public FutureResult<SearchResultEntry> searchSingleEntry( |
| | | SearchRequest request, |
| | | ResultHandler<? super SearchResultEntry> handler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | final SingleEntryFuture innerFuture = new SingleEntryFuture(handler); |
| | | final ResultFuture<Result> future = search(request, innerFuture, |
| | | final FutureResult<Result> future = search(request, innerFuture, |
| | | innerFuture); |
| | | innerFuture.setResultFuture(future); |
| | | return innerFuture; |