| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | import java.util.logging.Level; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.requests.*; |
| | | import org.forgerock.opendj.ldap.responses.*; |
| | | import org.forgerock.opendj.ldif.ConnectionEntryReader; |
| | |
| | | |
| | | @Override |
| | | public FutureResult<Void> abandonAsync(final AbandonRequest request) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().abandonAsync(request); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public Result add(final AddRequest request) throws ErrorResultException, |
| | | InterruptedException, UnsupportedOperationException, |
| | | IllegalStateException, NullPointerException |
| | | InterruptedException |
| | | { |
| | | return checkState().add(request); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public Result add(final Entry entry) throws ErrorResultException, |
| | | InterruptedException, UnsupportedOperationException, |
| | | IllegalStateException, NullPointerException |
| | | InterruptedException |
| | | { |
| | | return checkState().add(entry); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public Result add(final String... ldifLines) throws ErrorResultException, |
| | | InterruptedException, UnsupportedOperationException, |
| | | LocalizedIllegalArgumentException, IllegalStateException, |
| | | NullPointerException |
| | | InterruptedException |
| | | { |
| | | return checkState().add(ldifLines); |
| | | } |
| | |
| | | public FutureResult<Result> addAsync(final AddRequest request, |
| | | final IntermediateResponseHandler intermediateResponseHandler, |
| | | final ResultHandler<? super Result> resultHandler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().addAsync(request, intermediateResponseHandler, |
| | | resultHandler); |
| | |
| | | */ |
| | | @Override |
| | | public void addConnectionEventListener( |
| | | final ConnectionEventListener listener) throws IllegalStateException, |
| | | NullPointerException |
| | | final ConnectionEventListener listener) |
| | | { |
| | | Validator.ensureNotNull(listener); |
| | | checkState(); |
| | |
| | | |
| | | @Override |
| | | public BindResult bind(final BindRequest request) |
| | | throws ErrorResultException, InterruptedException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return checkState().bind(request); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public BindResult bind(final String name, final char[] password) |
| | | throws ErrorResultException, InterruptedException, |
| | | LocalizedIllegalArgumentException, UnsupportedOperationException, |
| | | IllegalStateException, NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return checkState().bind(name, password); |
| | | } |
| | |
| | | public FutureResult<BindResult> bindAsync(final BindRequest request, |
| | | final IntermediateResponseHandler intermediateResponseHandler, |
| | | final ResultHandler<? super BindResult> resultHandler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().bindAsync(request, intermediateResponseHandler, |
| | | resultHandler); |
| | |
| | | */ |
| | | @Override |
| | | public void close(final UnbindRequest request, final String reason) |
| | | throws NullPointerException |
| | | { |
| | | close(); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public CompareResult compare(final CompareRequest request) |
| | | throws ErrorResultException, InterruptedException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return checkState().compare(request); |
| | | } |
| | |
| | | @Override |
| | | public CompareResult compare(final String name, |
| | | final String attributeDescription, final String assertionValue) |
| | | throws ErrorResultException, InterruptedException, |
| | | LocalizedIllegalArgumentException, UnsupportedOperationException, |
| | | IllegalStateException, NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return checkState().compare(name, attributeDescription, assertionValue); |
| | | } |
| | |
| | | final CompareRequest request, |
| | | final IntermediateResponseHandler intermediateResponseHandler, |
| | | final ResultHandler<? super CompareResult> resultHandler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().compareAsync(request, intermediateResponseHandler, |
| | | resultHandler); |
| | |
| | | |
| | | @Override |
| | | public Result delete(final DeleteRequest request) |
| | | throws ErrorResultException, InterruptedException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return checkState().delete(request); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public Result delete(final String name) throws ErrorResultException, |
| | | InterruptedException, LocalizedIllegalArgumentException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | InterruptedException |
| | | { |
| | | return checkState().delete(name); |
| | | } |
| | |
| | | public FutureResult<Result> deleteAsync(final DeleteRequest request, |
| | | final IntermediateResponseHandler intermediateResponseHandler, |
| | | final ResultHandler<? super Result> resultHandler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().deleteAsync(request, intermediateResponseHandler, |
| | | resultHandler); |
| | |
| | | @Override |
| | | public <R extends ExtendedResult> R extendedRequest( |
| | | final ExtendedRequest<R> request) throws ErrorResultException, |
| | | InterruptedException, UnsupportedOperationException, |
| | | IllegalStateException, NullPointerException |
| | | InterruptedException |
| | | { |
| | | return checkState().extendedRequest(request); |
| | | } |
| | |
| | | public <R extends ExtendedResult> R extendedRequest( |
| | | final ExtendedRequest<R> request, |
| | | final IntermediateResponseHandler handler) throws ErrorResultException, |
| | | InterruptedException, UnsupportedOperationException, |
| | | IllegalStateException, NullPointerException |
| | | InterruptedException |
| | | { |
| | | return checkState().extendedRequest(request, handler); |
| | | } |
| | |
| | | @Override |
| | | public GenericExtendedResult extendedRequest(final String requestName, |
| | | final ByteString requestValue) throws ErrorResultException, |
| | | InterruptedException, UnsupportedOperationException, |
| | | IllegalStateException, NullPointerException |
| | | InterruptedException |
| | | { |
| | | return checkState().extendedRequest(requestName, requestValue); |
| | | } |
| | |
| | | final ExtendedRequest<R> request, |
| | | final IntermediateResponseHandler intermediateResponseHandler, |
| | | final ResultHandler<? super R> resultHandler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().extendedRequestAsync(request, |
| | | intermediateResponseHandler, resultHandler); |
| | |
| | | |
| | | @Override |
| | | public Result modify(final ModifyRequest request) |
| | | throws ErrorResultException, InterruptedException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return checkState().modify(request); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public Result modify(final String... ldifLines) |
| | | throws ErrorResultException, InterruptedException, |
| | | UnsupportedOperationException, LocalizedIllegalArgumentException, |
| | | IllegalStateException, NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return checkState().modify(ldifLines); |
| | | } |
| | |
| | | public FutureResult<Result> modifyAsync(final ModifyRequest request, |
| | | final IntermediateResponseHandler intermediateResponseHandler, |
| | | final ResultHandler<? super Result> resultHandler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().modifyAsync(request, intermediateResponseHandler, |
| | | resultHandler); |
| | |
| | | |
| | | @Override |
| | | public Result modifyDN(final ModifyDNRequest request) |
| | | throws ErrorResultException, InterruptedException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return checkState().modifyDN(request); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public Result modifyDN(final String name, final String newRDN) |
| | | throws ErrorResultException, LocalizedIllegalArgumentException, |
| | | InterruptedException, UnsupportedOperationException, |
| | | IllegalStateException, NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return checkState().modifyDN(name, newRDN); |
| | | } |
| | |
| | | public FutureResult<Result> modifyDNAsync(final ModifyDNRequest request, |
| | | final IntermediateResponseHandler intermediateResponseHandler, |
| | | final ResultHandler<? super Result> resultHandler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().modifyDNAsync(request, intermediateResponseHandler, |
| | | resultHandler); |
| | |
| | | @Override |
| | | public SearchResultEntry readEntry(final DN name, |
| | | final String... attributeDescriptions) throws ErrorResultException, |
| | | InterruptedException, UnsupportedOperationException, |
| | | IllegalStateException, NullPointerException |
| | | InterruptedException |
| | | { |
| | | return checkState().readEntry(name, attributeDescriptions); |
| | | } |
| | |
| | | @Override |
| | | public SearchResultEntry readEntry(final String name, |
| | | final String... attributeDescriptions) throws ErrorResultException, |
| | | InterruptedException, LocalizedIllegalArgumentException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | InterruptedException |
| | | { |
| | | return checkState().readEntry(name, attributeDescriptions); |
| | | } |
| | |
| | | public FutureResult<SearchResultEntry> readEntryAsync(final DN name, |
| | | final Collection<String> attributeDescriptions, |
| | | final ResultHandler<? super SearchResultEntry> handler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().readEntryAsync(name, attributeDescriptions, handler); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public void removeConnectionEventListener( |
| | | final ConnectionEventListener listener) throws NullPointerException |
| | | final ConnectionEventListener listener) |
| | | { |
| | | Validator.ensureNotNull(listener); |
| | | checkState(); |
| | |
| | | |
| | | @Override |
| | | public ConnectionEntryReader search(final SearchRequest request) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().search(request); |
| | | } |
| | |
| | | @Override |
| | | public Result search(final SearchRequest request, |
| | | final Collection<? super SearchResultEntry> entries) |
| | | throws ErrorResultException, InterruptedException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return checkState().search(request, entries); |
| | | } |
| | |
| | | public Result search(final SearchRequest request, |
| | | final Collection<? super SearchResultEntry> entries, |
| | | final Collection<? super SearchResultReference> references) |
| | | throws ErrorResultException, InterruptedException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return checkState().search(request, entries, references); |
| | | } |
| | |
| | | @Override |
| | | public Result search(final SearchRequest request, |
| | | final SearchResultHandler handler) throws ErrorResultException, |
| | | InterruptedException, UnsupportedOperationException, |
| | | IllegalStateException, NullPointerException |
| | | InterruptedException |
| | | { |
| | | return checkState().search(request, handler); |
| | | } |
| | |
| | | public ConnectionEntryReader search(final String baseObject, |
| | | final SearchScope scope, final String filter, |
| | | final String... attributeDescriptions) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().search(baseObject, scope, filter, |
| | | attributeDescriptions); |
| | |
| | | public FutureResult<Result> searchAsync(final SearchRequest request, |
| | | final IntermediateResponseHandler intermediateResponseHandler, |
| | | final SearchResultHandler resultHandler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().searchAsync(request, intermediateResponseHandler, |
| | | resultHandler); |
| | |
| | | |
| | | @Override |
| | | public SearchResultEntry searchSingleEntry(final SearchRequest request) |
| | | throws ErrorResultException, InterruptedException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return checkState().searchSingleEntry(request); |
| | | } |
| | |
| | | public SearchResultEntry searchSingleEntry(final String baseObject, |
| | | final SearchScope scope, final String filter, |
| | | final String... attributeDescriptions) throws ErrorResultException, |
| | | InterruptedException, LocalizedIllegalArgumentException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | InterruptedException |
| | | { |
| | | return checkState().searchSingleEntry(baseObject, scope, filter, |
| | | attributeDescriptions); |
| | |
| | | public FutureResult<SearchResultEntry> searchSingleEntryAsync( |
| | | final SearchRequest request, |
| | | final ResultHandler<? super SearchResultEntry> handler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | return checkState().searchSingleEntryAsync(request, handler); |
| | | } |