| | |
| | | * Abandon, Bind, Unbind, and StartTLS operations cannot be abandoned. |
| | | */ |
| | | public interface AbandonRequest extends Request { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | AbandonRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | final class AbandonRequestImpl extends AbstractRequestImpl<AbandonRequest> implements |
| | | AbandonRequest { |
| | | |
| | | private int requestID; |
| | | |
| | | /** |
| | | * Creates a new abandon request using the provided message ID. |
| | | * |
| | | * @param requestID |
| | | * The message ID of the request to be abandoned. |
| | | */ |
| | | AbandonRequestImpl(final int requestID) { |
| | | this.requestID = requestID; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new abandon request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param abandonRequest |
| | | * The abandon request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code abandonRequest} was {@code null} . |
| | | */ |
| | | AbandonRequestImpl(final AbandonRequest abandonRequest) { |
| | | super(abandonRequest); |
| | | this.requestID = abandonRequest.getRequestID(); |
| | | } |
| | | |
| | | AbandonRequestImpl(final int requestID) { |
| | | this.requestID = requestID; |
| | | } |
| | | |
| | | @Override |
| | | public int getRequestID() { |
| | | return requestID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public AbandonRequest setRequestID(final int id) { |
| | | this.requestID = id; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | abstract class AbstractBindRequest<R extends BindRequest> extends AbstractRequestImpl<R> implements |
| | | BindRequest { |
| | | |
| | | /** |
| | | * Creates a new abstract bind request. |
| | | */ |
| | | protected AbstractBindRequest() { |
| | | AbstractBindRequest() { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** |
| | | * Creates a new abstract bind request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param bindRequest |
| | | * The bind request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code bindRequest} was {@code null} . |
| | | */ |
| | | protected AbstractBindRequest(BindRequest bindRequest) { |
| | | AbstractBindRequest(final BindRequest bindRequest) { |
| | | super(bindRequest); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract String getName(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | @SuppressWarnings("unchecked") |
| | | final R getThis() { |
| | |
| | | * @throws NullPointerException |
| | | * If {@code extendedRequest} was {@code null} . |
| | | */ |
| | | protected AbstractExtendedRequest(ExtendedRequest<S> extendedRequest) { |
| | | protected AbstractExtendedRequest(final ExtendedRequest<S> extendedRequest) { |
| | | super(extendedRequest); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract String getOID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract ExtendedResultDecoder<S> getResultDecoder(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract ByteString getValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract boolean hasValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | return builder.toString(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | @SuppressWarnings("unchecked") |
| | | final R getThis() { |
| | |
| | | |
| | | private final List<Control> controls = new LinkedList<Control>(); |
| | | |
| | | /** |
| | | * Creates a new abstract request implementation. |
| | | */ |
| | | AbstractRequestImpl() { |
| | | // No implementation required. |
| | | } |
| | | |
| | | /** |
| | | * Creates a new abstract request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | AbstractRequestImpl(final Request request) { |
| | | Validator.ensureNotNull(request); |
| | | for (final Control control : request.getControls()) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final R addControl(final Control control) { |
| | | Validator.ensureNotNull(control); |
| | |
| | | return getThis(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean containsControl(final String oid) { |
| | | return getControl(controls, oid) != null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final <C extends Control> C getControl(final ControlDecoder<C> decoder, |
| | | final DecodeOptions options) throws DecodeException { |
| | |
| | | return control != null ? decoder.decodeControl(control, options) : null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final List<Control> getControls() { |
| | | return controls; |
| | |
| | | |
| | | } |
| | | |
| | | AbstractSASLBindRequest(SASLBindRequest saslBindRequest) { |
| | | AbstractSASLBindRequest(final SASLBindRequest saslBindRequest) { |
| | | super(saslBindRequest); |
| | | } |
| | | |
| | | @Override |
| | | public final byte getAuthenticationType() { |
| | | return TYPE_AUTHENTICATION_SASL; |
| | | } |
| | |
| | | abstract class AbstractUnmodifiableBindRequest<R extends BindRequest> extends |
| | | AbstractUnmodifiableRequest<R> implements BindRequest { |
| | | |
| | | AbstractUnmodifiableBindRequest(R impl) { |
| | | AbstractUnmodifiableBindRequest(final R impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | public BindClient createBindClient(String serverName) throws ErrorResultException { |
| | | @Override |
| | | public BindClient createBindClient(final String serverName) throws ErrorResultException { |
| | | return impl.createBindClient(serverName); |
| | | } |
| | | |
| | | @Override |
| | | public byte getAuthenticationType() { |
| | | return impl.getAuthenticationType(); |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return impl.getName(); |
| | | } |
| | |
| | | */ |
| | | abstract class AbstractUnmodifiableExtendedRequest<R extends ExtendedRequest<S>, S extends ExtendedResult> |
| | | extends AbstractUnmodifiableRequest<R> implements ExtendedRequest<S> { |
| | | AbstractUnmodifiableExtendedRequest(R impl) { |
| | | AbstractUnmodifiableExtendedRequest(final R impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | @Override |
| | | public final String getOID() { |
| | | return impl.getOID(); |
| | | } |
| | | |
| | | @Override |
| | | public final ExtendedResultDecoder<S> getResultDecoder() { |
| | | return impl.getResultDecoder(); |
| | | } |
| | | |
| | | @Override |
| | | public final ByteString getValue() { |
| | | return impl.getValue(); |
| | | } |
| | | |
| | | @Override |
| | | public final boolean hasValue() { |
| | | return impl.hasValue(); |
| | | } |
| | |
| | | |
| | | protected final R impl; |
| | | |
| | | /** |
| | | * Creates a new unmodifiable request implementation. |
| | | * |
| | | * @param impl |
| | | * The underlying request implementation to be made unmodifiable. |
| | | */ |
| | | AbstractUnmodifiableRequest(final R impl) { |
| | | this.impl = impl; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final R addControl(final Control control) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean containsControl(final String oid) { |
| | | return impl.containsControl(oid); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final <C extends Control> C getControl(final ControlDecoder<C> decoder, |
| | | final DecodeOptions options) throws DecodeException { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final List<Control> getControls() { |
| | | // We need to make all controls unmodifiable as well, which implies |
| | |
| | | return Collections.unmodifiableList(unmodifiableControls); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final String toString() { |
| | | return impl.toString(); |
| | |
| | | abstract class AbstractUnmodifiableSASLBindRequest<R extends SASLBindRequest> extends |
| | | AbstractUnmodifiableBindRequest<R> implements SASLBindRequest { |
| | | |
| | | AbstractUnmodifiableSASLBindRequest(R impl) { |
| | | AbstractUnmodifiableSASLBindRequest(final R impl) { |
| | | super(impl); |
| | | } |
| | | |
| | |
| | | * maintains these automatically. |
| | | */ |
| | | public interface AddRequest extends Request, ChangeRecord, Entry { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | <R, P> R accept(ChangeRecordVisitor<R, P> v, P p); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean addAttribute(Attribute attribute); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean addAttribute(Attribute attribute, Collection<? super ByteString> duplicateValues); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | AddRequest addAttribute(String attributeDescription, Object... values); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | AddRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | AddRequest clearAttributes(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean containsAttribute(Attribute attribute, Collection<? super ByteString> missingValues); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean containsAttribute(String attributeDescription, Object... values); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Iterable<Attribute> getAllAttributes(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Iterable<Attribute> getAllAttributes(String attributeDescription); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Attribute getAttribute(AttributeDescription attributeDescription); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Attribute getAttribute(String attributeDescription); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | int getAttributeCount(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | DN getName(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean removeAttribute(Attribute attribute, Collection<? super ByteString> missingValues); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean removeAttribute(AttributeDescription attributeDescription); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | AddRequest removeAttribute(String attributeDescription, Object... values); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean replaceAttribute(Attribute attribute); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | AddRequest replaceAttribute(String attributeDescription, Object... values); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | AddRequest setName(DN dn); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | AddRequest setName(String dn); |
| | | |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.requests; |
| | |
| | | * Add request implementation. |
| | | */ |
| | | final class AddRequestImpl extends AbstractRequestImpl<AddRequest> implements AddRequest { |
| | | |
| | | private final Entry entry; |
| | | |
| | | /** |
| | | * Creates a new add request backed by the provided entry. Modifications |
| | | * made to {@code entry} will be reflected in the returned add request. The |
| | | * returned add request supports updates to its list of controls, as well as |
| | | * updates to the name and attributes if the underlying entry allows. |
| | | * |
| | | * @param entry |
| | | * The entry to be added. |
| | | * @throws NullPointerException |
| | | * If {@code entry} was {@code null} . |
| | | */ |
| | | AddRequestImpl(final Entry entry) { |
| | | this.entry = entry; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new add request that is an exact copy of the provided request. |
| | | * |
| | | * @param addRequest |
| | | * The add request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code addRequest} was {@code null} . |
| | | */ |
| | | AddRequestImpl(final AddRequest addRequest) { |
| | | super(addRequest); |
| | | this.entry = LinkedHashMapEntry.deepCopyOfEntry(addRequest); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | AddRequestImpl(final Entry entry) { |
| | | this.entry = entry; |
| | | } |
| | | |
| | | @Override |
| | | public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p) { |
| | | return v.visitChangeRecord(p, this); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean addAttribute(final Attribute attribute) { |
| | | return entry.addAttribute(attribute); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean addAttribute(final Attribute attribute, |
| | | final Collection<? super ByteString> duplicateValues) { |
| | | return entry.addAttribute(attribute, duplicateValues); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public AddRequest addAttribute(final String attributeDescription, final Object... values) { |
| | | entry.addAttribute(attributeDescription, values); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public AddRequest clearAttributes() { |
| | | entry.clearAttributes(); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean containsAttribute(final Attribute attribute, |
| | | final Collection<? super ByteString> missingValues) { |
| | | return entry.containsAttribute(attribute, missingValues); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean containsAttribute(final String attributeDescription, final Object... values) { |
| | | return entry.containsAttribute(attributeDescription, values); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean equals(final Object object) { |
| | | return entry.equals(object); |
| | | } |
| | | |
| | | @Override |
| | | public Iterable<Attribute> getAllAttributes() { |
| | | return entry.getAllAttributes(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Iterable<Attribute> getAllAttributes(final AttributeDescription attributeDescription) { |
| | | return entry.getAllAttributes(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Iterable<Attribute> getAllAttributes(final String attributeDescription) { |
| | | return entry.getAllAttributes(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Attribute getAttribute(final AttributeDescription attributeDescription) { |
| | | return entry.getAttribute(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Attribute getAttribute(final String attributeDescription) { |
| | | return entry.getAttribute(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int getAttributeCount() { |
| | | return entry.getAttributeCount(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getName() { |
| | | return entry.getName(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int hashCode() { |
| | | return entry.hashCode(); |
| | | } |
| | | |
| | | @Override |
| | | public AttributeParser parseAttribute(final AttributeDescription attributeDescription) { |
| | | return entry.parseAttribute(attributeDescription); |
| | | } |
| | | |
| | | @Override |
| | | public AttributeParser parseAttribute(final String attributeDescription) { |
| | | return entry.parseAttribute(attributeDescription); |
| | | } |
| | | |
| | | @Override |
| | | public boolean removeAttribute(final Attribute attribute, |
| | | final Collection<? super ByteString> missingValues) { |
| | | return entry.removeAttribute(attribute, missingValues); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean removeAttribute(final AttributeDescription attributeDescription) { |
| | | return entry.removeAttribute(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public AddRequest removeAttribute(final String attributeDescription, final Object... values) { |
| | | entry.removeAttribute(attributeDescription, values); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean replaceAttribute(final Attribute attribute) { |
| | | return entry.replaceAttribute(attribute); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public AddRequest replaceAttribute(final String attributeDescription, final Object... values) { |
| | | entry.replaceAttribute(attributeDescription, values); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public AddRequest setName(final DN dn) { |
| | | entry.setName(dn); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public AddRequest setName(final String dn) { |
| | | entry.setName(dn); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | return builder.toString(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | AddRequest getThis() { |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int hashCode() { |
| | | return entry.hashCode(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public AttributeParser parseAttribute(AttributeDescription attributeDescription) { |
| | | return entry.parseAttribute(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public AttributeParser parseAttribute(String attributeDescription) { |
| | | return entry.parseAttribute(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean equals(final Object object) { |
| | | return entry.equals(object); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | public static final String SASL_MECHANISM_NAME = "ANONYMOUS"; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | AnonymousSASLBindRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindClient createBindClient(String serverName) throws ErrorResultException; |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The authentication mechanism identifier. |
| | | */ |
| | | @Override |
| | | byte getAuthenticationType(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | * @return The name of the Directory object that the client wishes to bind |
| | | * as. |
| | | */ |
| | | @Override |
| | | String getName(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getSASLMechanism(); |
| | | |
| | | /** |
| | |
| | | |
| | | private String traceString; |
| | | |
| | | AnonymousSASLBindRequestImpl(final String traceString) { |
| | | Validator.ensureNotNull(traceString); |
| | | this.traceString = traceString; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new anonymous SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param anonymousSASLBindRequest |
| | | * The anonymous SASL bind request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code anonymousSASLBindRequest} was {@code null} . |
| | | */ |
| | | AnonymousSASLBindRequestImpl(final AnonymousSASLBindRequest anonymousSASLBindRequest) { |
| | | super(anonymousSASLBindRequest); |
| | | this.traceString = anonymousSASLBindRequest.getTraceString(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | AnonymousSASLBindRequestImpl(final String traceString) { |
| | | Validator.ensureNotNull(traceString); |
| | | this.traceString = traceString; |
| | | } |
| | | |
| | | @Override |
| | | public BindClient createBindClient(final String serverName) { |
| | | return new Client(this, serverName); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getSASLMechanism() { |
| | | return SASL_MECHANISM_NAME; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getTraceString() { |
| | | return traceString; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public AnonymousSASLBindRequest setTraceString(final String traceString) { |
| | | Validator.ensureNotNull(traceString); |
| | | this.traceString = traceString; |
| | |
| | | class BindClientImpl implements BindClient, ConnectionSecurityLayer { |
| | | private final GenericBindRequest nextBindRequest; |
| | | |
| | | /** |
| | | * Creates a new abstract bind client. The next bind request will be a copy |
| | | * of the provided initial bind request which should be updated in |
| | | * subsequent bind requests forming part of this authentication. |
| | | * |
| | | * @param initialBindRequest |
| | | * The initial bind request. |
| | | */ |
| | | BindClientImpl(final BindRequest initialBindRequest) { |
| | | this.nextBindRequest = |
| | | new GenericBindRequestImpl(initialBindRequest.getName(), initialBindRequest |
| | |
| | | /** |
| | | * Default implementation does nothing. |
| | | */ |
| | | @Override |
| | | public void dispose() { |
| | | // Do nothing. |
| | | } |
| | |
| | | /** |
| | | * Default implementation does nothing and always returns {@code true}. |
| | | */ |
| | | @Override |
| | | public boolean evaluateResult(final BindResult result) throws ErrorResultException { |
| | | return true; |
| | | } |
| | |
| | | /** |
| | | * Default implementation always returns {@code null}. |
| | | */ |
| | | @Override |
| | | public ConnectionSecurityLayer getConnectionSecurityLayer() { |
| | | return null; |
| | | } |
| | |
| | | /** |
| | | * Returns the next bind request. |
| | | */ |
| | | @Override |
| | | public final GenericBindRequest nextBindRequest() { |
| | | return nextBindRequest; |
| | | } |
| | |
| | | /** |
| | | * Default implementation just returns the copy of the bytes. |
| | | */ |
| | | @Override |
| | | public byte[] unwrap(final byte[] incoming, final int offset, final int len) |
| | | throws ErrorResultException { |
| | | final byte[] copy = new byte[len]; |
| | |
| | | /** |
| | | * Default implementation just returns the copy of the bytes. |
| | | */ |
| | | @Override |
| | | public byte[] wrap(final byte[] outgoing, final int offset, final int len) |
| | | throws ErrorResultException { |
| | | final byte[] copy = new byte[len]; |
| | |
| | | * "authenticate" operation. |
| | | */ |
| | | public interface BindRequest extends Request { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | BindRequest addControl(Control control); |
| | | |
| | | /** |
| | |
| | | */ |
| | | byte getAuthenticationType(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static final String SASL_MECHANISM_NAME = "CRAM-MD5"; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | CRAMMD5SASLBindRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindClient createBindClient(String serverName) throws ErrorResultException; |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The authentication mechanism identifier. |
| | | */ |
| | | @Override |
| | | byte getAuthenticationType(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | * @return The name of the Directory object that the client wishes to bind |
| | | * as. |
| | | */ |
| | | @Override |
| | | String getName(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | byte[] getPassword(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getSASLMechanism(); |
| | | |
| | | /** |
| | |
| | | final class CRAMMD5SASLBindRequestImpl extends AbstractSASLBindRequest<CRAMMD5SASLBindRequest> |
| | | implements CRAMMD5SASLBindRequest { |
| | | private final static class Client extends SASLBindClientImpl { |
| | | private final SaslClient saslClient; |
| | | private final String authenticationID; |
| | | private final ByteString password; |
| | | private final SaslClient saslClient; |
| | | |
| | | private Client(final CRAMMD5SASLBindRequestImpl initialBindRequest, final String serverName) |
| | | throws ErrorResultException { |
| | |
| | | } |
| | | |
| | | private String authenticationID; |
| | | |
| | | private byte[] password; |
| | | |
| | | CRAMMD5SASLBindRequestImpl(final CRAMMD5SASLBindRequest cramMD5SASLBindRequest) { |
| | | super(cramMD5SASLBindRequest); |
| | | this.authenticationID = cramMD5SASLBindRequest.getAuthenticationID(); |
| | | this.password = copyOfBytes(cramMD5SASLBindRequest.getPassword()); |
| | | } |
| | | |
| | | CRAMMD5SASLBindRequestImpl(final String authenticationID, final byte[] password) { |
| | | Validator.ensureNotNull(authenticationID, password); |
| | | this.authenticationID = authenticationID; |
| | | this.password = password; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new CRAM MD5 SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param cramMD5SASLBindRequest |
| | | * The CRAM MD5 SASL bind request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code cramMD5SASLBindRequest} was {@code null} . |
| | | */ |
| | | CRAMMD5SASLBindRequestImpl(final CRAMMD5SASLBindRequest cramMD5SASLBindRequest) { |
| | | super(cramMD5SASLBindRequest); |
| | | this.authenticationID = cramMD5SASLBindRequest.getAuthenticationID(); |
| | | this.password = copyOfBytes(cramMD5SASLBindRequest.getPassword()); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public BindClient createBindClient(final String serverName) throws ErrorResultException { |
| | | return new Client(this, serverName); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getAuthenticationID() { |
| | | return authenticationID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public byte[] getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getSASLMechanism() { |
| | | return SASL_MECHANISM_NAME; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public CRAMMD5SASLBindRequest setAuthenticationID(final String authenticationID) { |
| | | Validator.ensureNotNull(authenticationID); |
| | | this.authenticationID = authenticationID; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public CRAMMD5SASLBindRequest setPassword(final byte[] password) { |
| | | Validator.ensureNotNull(password); |
| | | this.password = password; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public CRAMMD5SASLBindRequest setPassword(final char[] password) { |
| | | Validator.ensureNotNull(password); |
| | | this.password = StaticUtils.getBytes(password); |
| | |
| | | public interface CancelExtendedRequest extends ExtendedRequest<ExtendedResult> { |
| | | |
| | | /** |
| | | * The OID for the cancel extended operation request. |
| | | */ |
| | | public static final String OID = "1.3.6.1.1.8"; |
| | | |
| | | /** |
| | | * A decoder which can be used to decode cancel extended operation requests. |
| | | */ |
| | | public static final ExtendedRequestDecoder<CancelExtendedRequest, ExtendedResult> DECODER = |
| | | new CancelExtendedRequestImpl.RequestDecoder(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | * The OID for the cancel extended operation request. |
| | | */ |
| | | public static final String OID = "1.3.6.1.1.8"; |
| | | |
| | | @Override |
| | | CancelExtendedRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getOID(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | int getRequestID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ExtendedResultDecoder<ExtendedResult> getResultDecoder(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ByteString getValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean hasValue(); |
| | | |
| | | /** |
| | |
| | | CancelExtendedRequest { |
| | | static final class RequestDecoder implements |
| | | ExtendedRequestDecoder<CancelExtendedRequest, ExtendedResult> { |
| | | @Override |
| | | public CancelExtendedRequest decodeExtendedRequest(final ExtendedRequest<?> request, |
| | | final DecodeOptions options) throws DecodeException { |
| | | final ByteString requestValue = request.getValue(); |
| | |
| | | } |
| | | |
| | | private static final class ResultDecoder extends AbstractExtendedResultDecoder<ExtendedResult> { |
| | | public ExtendedResult newExtendedErrorResult(final ResultCode resultCode, |
| | | final String matchedDN, final String diagnosticMessage) { |
| | | return Responses.newGenericExtendedResult(resultCode).setMatchedDN(matchedDN) |
| | | .setDiagnosticMessage(diagnosticMessage); |
| | | } |
| | | |
| | | @Override |
| | | public ExtendedResult decodeExtendedResult(final ExtendedResult result, |
| | | final DecodeOptions options) throws DecodeException { |
| | | // TODO: Should we check to make sure OID and value is null? |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | private int requestID; |
| | | @Override |
| | | public ExtendedResult newExtendedErrorResult(final ResultCode resultCode, |
| | | final String matchedDN, final String diagnosticMessage) { |
| | | return Responses.newGenericExtendedResult(resultCode).setMatchedDN(matchedDN) |
| | | .setDiagnosticMessage(diagnosticMessage); |
| | | } |
| | | } |
| | | |
| | | // No need to expose this. |
| | | private static final ExtendedResultDecoder<ExtendedResult> RESULT_DECODER = new ResultDecoder(); |
| | | |
| | | private int requestID; |
| | | |
| | | CancelExtendedRequestImpl(final CancelExtendedRequest cancelExtendedRequest) { |
| | | super(cancelExtendedRequest); |
| | | this.requestID = cancelExtendedRequest.getRequestID(); |
| | | } |
| | | |
| | | // Instantiation via factory. |
| | | CancelExtendedRequestImpl(final int requestID) { |
| | | this.requestID = requestID; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new cancel extended request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param cancelExtendedRequest |
| | | * The cancel extended request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code cancelExtendedRequest} was {@code null} . |
| | | */ |
| | | CancelExtendedRequestImpl(final CancelExtendedRequest cancelExtendedRequest) { |
| | | super(cancelExtendedRequest); |
| | | this.requestID = cancelExtendedRequest.getRequestID(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int getRequestID() { |
| | | return requestID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int getRequestID() { |
| | | return requestID; |
| | | } |
| | | |
| | | @Override |
| | | public ExtendedResultDecoder<ExtendedResult> getResultDecoder() { |
| | | return RESULT_DECODER; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(6); |
| | |
| | | return buffer.toByteString(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public CancelExtendedRequest setRequestID(final int id) { |
| | | this.requestID = id; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * </pre> |
| | | */ |
| | | public interface CompareRequest extends Request { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | CompareRequest addControl(Control control); |
| | | |
| | | /** |
| | |
| | | */ |
| | | AttributeDescription getAttributeDescription(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | final class CompareRequestImpl extends AbstractRequestImpl<CompareRequest> implements |
| | | CompareRequest { |
| | | |
| | | private AttributeDescription attributeDescription; |
| | | |
| | | private ByteString assertionValue; |
| | | |
| | | private AttributeDescription attributeDescription; |
| | | private DN name; |
| | | |
| | | /** |
| | | * Creates a new compare request using the provided distinguished name, |
| | | * attribute name, and assertion value. |
| | | * |
| | | * @param name |
| | | * The distinguished name of the entry to be compared. |
| | | * @param attributeDescription |
| | | * The name of the attribute to be compared. |
| | | * @param assertionValue |
| | | * The assertion value to be compared. |
| | | * @throws NullPointerException |
| | | * If {@code name}, {@code attributeDescription}, or |
| | | * {@code assertionValue} was {@code null}. |
| | | */ |
| | | CompareRequestImpl(final DN name, final AttributeDescription attributeDescription, |
| | | final ByteString assertionValue) { |
| | | this.name = name; |
| | | this.attributeDescription = attributeDescription; |
| | | this.assertionValue = assertionValue; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new compare request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param compareRequest |
| | | * The compare request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code compareRequest} was {@code null} . |
| | | */ |
| | | CompareRequestImpl(final CompareRequest compareRequest) { |
| | | super(compareRequest); |
| | | this.name = compareRequest.getName(); |
| | |
| | | this.assertionValue = compareRequest.getAssertionValue(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | CompareRequestImpl(final DN name, final AttributeDescription attributeDescription, |
| | | final ByteString assertionValue) { |
| | | this.name = name; |
| | | this.attributeDescription = attributeDescription; |
| | | this.assertionValue = assertionValue; |
| | | } |
| | | |
| | | @Override |
| | | public ByteString getAssertionValue() { |
| | | return assertionValue; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getAssertionValueAsString() { |
| | | return assertionValue.toString(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public AttributeDescription getAttributeDescription() { |
| | | return attributeDescription; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getName() { |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public CompareRequest setAssertionValue(final Object value) { |
| | | Validator.ensureNotNull(value); |
| | | this.assertionValue = ByteString.valueOf(value); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public CompareRequest setAttributeDescription(final AttributeDescription attributeDescription) { |
| | | Validator.ensureNotNull(attributeDescription); |
| | | this.attributeDescription = attributeDescription; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public CompareRequest setAttributeDescription(final String attributeDescription) { |
| | | Validator.ensureNotNull(attributeDescription); |
| | | this.attributeDescription = AttributeDescription.valueOf(attributeDescription); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public CompareRequest setName(final DN dn) { |
| | | Validator.ensureNotNull(dn); |
| | | this.name = dn; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public CompareRequest setName(final String dn) { |
| | | Validator.ensureNotNull(dn); |
| | | this.name = DN.valueOf(dn); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * </pre> |
| | | */ |
| | | public interface DeleteRequest extends Request, ChangeRecord { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | <R, P> R accept(ChangeRecordVisitor<R, P> v, P p); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | DeleteRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The distinguished name of the entry. |
| | | */ |
| | | @Override |
| | | DN getName(); |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.requests; |
| | |
| | | final class DeleteRequestImpl extends AbstractRequestImpl<DeleteRequest> implements DeleteRequest { |
| | | private DN name; |
| | | |
| | | /** |
| | | * Creates a new delete request using the provided distinguished name. |
| | | * |
| | | * @param name |
| | | * The distinguished name of the entry to be deleted. |
| | | * @throws NullPointerException |
| | | * If {@code name} was {@code null}. |
| | | */ |
| | | DeleteRequestImpl(final DN name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new delete request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param deleteRequest |
| | | * The add request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code addRequest} was {@code null} . |
| | | */ |
| | | DeleteRequestImpl(final DeleteRequest deleteRequest) { |
| | | super(deleteRequest); |
| | | this.name = deleteRequest.getName(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | DeleteRequestImpl(final DN name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | @Override |
| | | public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p) { |
| | | return v.visitChangeRecord(p, this); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getName() { |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DeleteRequest setName(final DN dn) { |
| | | Validator.ensureNotNull(dn); |
| | | this.name = dn; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DeleteRequest setName(final String dn) { |
| | | Validator.ensureNotNull(dn); |
| | | this.name = DN.valueOf(dn); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | public interface DigestMD5SASLBindRequest extends SASLBindRequest { |
| | | |
| | | /** |
| | | * The name of the SASL mechanism based on DIGEST-MD5 authentication. |
| | | * Indicates that the client will accept connection encryption using the |
| | | * high strength triple-DES cipher. |
| | | */ |
| | | public static final String SASL_MECHANISM_NAME = "DIGEST-MD5"; |
| | | public static final String CIPHER_3DES = "3des"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * medium strength DES cipher. |
| | | */ |
| | | public static final String CIPHER_DES = "des"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * strongest supported cipher, as long as the cipher is considered to be |
| | | * high strength. |
| | | */ |
| | | public static final String CIPHER_HIGH = "high"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * strongest supported cipher, even if the strongest cipher is considered to |
| | | * be medium or low strength. |
| | | */ |
| | | public static final String CIPHER_LOW = "low"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * strongest supported cipher, as long as the cipher is considered to be |
| | | * high or medium strength. |
| | | */ |
| | | public static final String CIPHER_MEDIUM = "medium"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * high strength 128-bit RC4 cipher. |
| | | */ |
| | | public static final String CIPHER_RC4_128 = "rc4"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the low |
| | | * strength 40-bit RC4 cipher. |
| | | */ |
| | | public static final String CIPHER_RC4_40 = "rc4-40"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * medium strength 56-bit RC4 cipher. |
| | | */ |
| | | public static final String CIPHER_RC4_56 = "rc4-56"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication only. More |
| | |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication with connection |
| | | * integrity protection and encryption. |
| | | */ |
| | | public static final String QOP_AUTH_CONF = "auth-conf"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication with connection |
| | | * integrity protection. More specifically, the underlying connection will |
| | | * not be encrypted, unless previously established using SSL/TLS. |
| | | */ |
| | | public static final String QOP_AUTH_INT = "auth-int"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication with connection |
| | | * integrity protection and encryption. |
| | | * The name of the SASL mechanism based on DIGEST-MD5 authentication. |
| | | */ |
| | | public static final String QOP_AUTH_CONF = "auth-conf"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * high strength triple-DES cipher. |
| | | */ |
| | | public static final String CIPHER_3DES = "3des"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * high strength 128-bit RC4 cipher. |
| | | */ |
| | | public static final String CIPHER_RC4_128 = "rc4"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * medium strength DES cipher. |
| | | */ |
| | | public static final String CIPHER_DES = "des"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * medium strength 56-bit RC4 cipher. |
| | | */ |
| | | public static final String CIPHER_RC4_56 = "rc4-56"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the low |
| | | * strength 40-bit RC4 cipher. |
| | | */ |
| | | public static final String CIPHER_RC4_40 = "rc4-40"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * strongest supported cipher, as long as the cipher is considered to be |
| | | * high strength. |
| | | */ |
| | | public static final String CIPHER_HIGH = "high"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * strongest supported cipher, as long as the cipher is considered to be |
| | | * high or medium strength. |
| | | */ |
| | | public static final String CIPHER_MEDIUM = "medium"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * strongest supported cipher, even if the strongest cipher is considered to |
| | | * be medium or low strength. |
| | | */ |
| | | public static final String CIPHER_LOW = "low"; |
| | | public static final String SASL_MECHANISM_NAME = "DIGEST-MD5"; |
| | | |
| | | /** |
| | | * Adds the provided additional authentication parameter to the list of |
| | |
| | | */ |
| | | DigestMD5SASLBindRequest addAdditionalAuthParam(String name, String value); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | DigestMD5SASLBindRequest addControl(Control control); |
| | | |
| | |
| | | */ |
| | | DigestMD5SASLBindRequest addQOP(String... qopValues); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindClient createBindClient(String serverName) throws ErrorResultException; |
| | | |
| | |
| | | */ |
| | | String getCipher(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | |
| | | */ |
| | | String getRealm(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getSASLMechanism(); |
| | | |
| | |
| | | final class DigestMD5SASLBindRequestImpl extends AbstractSASLBindRequest<DigestMD5SASLBindRequest> |
| | | implements DigestMD5SASLBindRequest { |
| | | private final static class Client extends SASLBindClientImpl { |
| | | private final SaslClient saslClient; |
| | | private final String authenticationID; |
| | | private final ByteString password; |
| | | private final String realm; |
| | | private final SaslClient saslClient; |
| | | |
| | | private Client(final DigestMD5SASLBindRequestImpl initialBindRequest, |
| | | final String serverName) throws ErrorResultException { |
| | |
| | | } else if (cipher.equalsIgnoreCase(CIPHER_HIGH)) { |
| | | props.put(Sasl.STRENGTH, "high"); |
| | | } else { |
| | | // Default strength allows all ciphers, so specifying a |
| | | // single cipher |
| | | // cannot be incompatible with the strength. |
| | | /* |
| | | * Default strength allows all ciphers, so specifying a |
| | | * single cipher cannot be incompatible with the strength. |
| | | */ |
| | | props.put("com.sun.security.sasl.digest.cipher", cipher); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | private final Map<String, String> additionalAuthParams = new LinkedHashMap<String, String>(); |
| | | private final List<String> qopValues = new LinkedList<String>(); |
| | | private String cipher = null; |
| | | |
| | | // Don't use primitives for these so that we can distinguish between default |
| | | // settings (null) and values set by the caller. |
| | | private Boolean serverAuth = null; |
| | | private Integer maxReceiveBufferSize = null; |
| | | private Integer maxSendBufferSize = null; |
| | | |
| | | private String authenticationID; |
| | | private String authorizationID = null; |
| | | |
| | | private String cipher = null; |
| | | private Integer maxReceiveBufferSize = null; |
| | | private Integer maxSendBufferSize = null; |
| | | private byte[] password; |
| | | private final List<String> qopValues = new LinkedList<String>(); |
| | | private String realm = null; |
| | | |
| | | DigestMD5SASLBindRequestImpl(final String authenticationID, final byte[] password) { |
| | | Validator.ensureNotNull(authenticationID, password); |
| | | this.authenticationID = authenticationID; |
| | | this.password = password; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new digest MD5 SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param digestMD5SASLBindRequest |
| | | * The digest MD5 SASL bind request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code digestMD5SASLBindRequest} was {@code null} . |
| | | /* |
| | | * Don't use primitives for these so that we can distinguish between default |
| | | * settings (null) and values set by the caller. |
| | | */ |
| | | private Boolean serverAuth = null; |
| | | |
| | | DigestMD5SASLBindRequestImpl(final DigestMD5SASLBindRequest digestMD5SASLBindRequest) { |
| | | super(digestMD5SASLBindRequest); |
| | | this.additionalAuthParams.putAll(digestMD5SASLBindRequest.getAdditionalAuthParams()); |
| | |
| | | this.realm = digestMD5SASLBindRequest.getRealm(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | DigestMD5SASLBindRequestImpl(final String authenticationID, final byte[] password) { |
| | | Validator.ensureNotNull(authenticationID, password); |
| | | this.authenticationID = authenticationID; |
| | | this.password = password; |
| | | } |
| | | |
| | | @Override |
| | | public DigestMD5SASLBindRequest addAdditionalAuthParam(final String name, final String value) { |
| | | Validator.ensureNotNull(name, value); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DigestMD5SASLBindRequest addQOP(final String... qopValues) { |
| | | for (final String qopValue : qopValues) { |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public BindClient createBindClient(final String serverName) throws ErrorResultException { |
| | | return new Client(this, serverName); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Map<String, String> getAdditionalAuthParams() { |
| | | return additionalAuthParams; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getAuthenticationID() { |
| | | return authenticationID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getAuthorizationID() { |
| | | return authorizationID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getCipher() { |
| | | return cipher; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int getMaxReceiveBufferSize() { |
| | | return maxReceiveBufferSize == null ? 65536 : maxReceiveBufferSize; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int getMaxSendBufferSize() { |
| | | return maxSendBufferSize == null ? 65536 : maxSendBufferSize; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public byte[] getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public List<String> getQOPs() { |
| | | return qopValues; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getRealm() { |
| | | return realm; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getSASLMechanism() { |
| | | return SASL_MECHANISM_NAME; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isServerAuth() { |
| | | return serverAuth == null ? false : serverAuth; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DigestMD5SASLBindRequest setAuthenticationID(final String authenticationID) { |
| | | Validator.ensureNotNull(authenticationID); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DigestMD5SASLBindRequest setAuthorizationID(final String authorizationID) { |
| | | this.authorizationID = authorizationID; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DigestMD5SASLBindRequest setCipher(final String cipher) { |
| | | this.cipher = cipher; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DigestMD5SASLBindRequest setMaxReceiveBufferSize(final int size) { |
| | | maxReceiveBufferSize = size; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DigestMD5SASLBindRequest setMaxSendBufferSize(final int size) { |
| | | maxSendBufferSize = size; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DigestMD5SASLBindRequest setPassword(final byte[] password) { |
| | | Validator.ensureNotNull(password); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DigestMD5SASLBindRequest setPassword(final char[] password) { |
| | | Validator.ensureNotNull(password); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DigestMD5SASLBindRequest setRealm(final String realm) { |
| | | this.realm = realm; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DigestMD5SASLBindRequest setServerAuth(final boolean serverAuth) { |
| | | this.serverAuth = serverAuth; |
| | |
| | | * services not already available in the protocol; for example, to implement an |
| | | * operation which installs transport layer security (see |
| | | * {@link StartTLSExtendedRequest}). |
| | | * |
| | | * <p> |
| | | * To determine whether a directory server supports a given extension, read the |
| | | * list of supported extensions from the root DSE to get a collection of |
| | |
| | | * The type of result. |
| | | */ |
| | | public interface ExtendedRequest<S extends ExtendedResult> extends Request { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | ExtendedRequest<S> addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static final String SASL_MECHANISM_NAME = "EXTERNAL"; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ExternalSASLBindRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindClient createBindClient(String serverName) throws ErrorResultException; |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The authentication mechanism identifier. |
| | | */ |
| | | @Override |
| | | byte getAuthenticationType(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | String getAuthorizationID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | * @return The name of the Directory object that the client wishes to bind |
| | | * as. |
| | | */ |
| | | @Override |
| | | String getName(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getSASLMechanism(); |
| | | |
| | | /** |
| | |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** |
| | | * Creates a new external SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param externalSASLBindRequest |
| | | * The external SASL bind request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code externalSASLBindRequest} was {@code null} . |
| | | */ |
| | | ExternalSASLBindRequestImpl(final ExternalSASLBindRequest externalSASLBindRequest) { |
| | | super(externalSASLBindRequest); |
| | | this.authorizationID = externalSASLBindRequest.getAuthorizationID(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public BindClient createBindClient(final String serverName) throws ErrorResultException { |
| | | return new Client(this, serverName); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getAuthorizationID() { |
| | | return authorizationID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getSASLMechanism() { |
| | | return SASL_MECHANISM_NAME; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ExternalSASLBindRequest setAuthorizationID(final String authorizationID) { |
| | | this.authorizationID = authorizationID; |
| | | return this; |
| | |
| | | public interface GSSAPISASLBindRequest extends SASLBindRequest { |
| | | |
| | | /** |
| | | * The name of the SASL mechanism based on GSS-API authentication. |
| | | */ |
| | | public static final String SASL_MECHANISM_NAME = "GSSAPI"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication only. More |
| | | * specifically, the underlying connection will not be protected using |
| | | * integrity protection or encryption, unless previously established using |
| | |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication with connection |
| | | * integrity protection and encryption. |
| | | */ |
| | | public static final String QOP_AUTH_CONF = "auth-conf"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication with connection |
| | | * integrity protection. More specifically, the underlying connection will |
| | | * not be encrypted, unless previously established using SSL/TLS. |
| | | */ |
| | | public static final String QOP_AUTH_INT = "auth-int"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication with connection |
| | | * integrity protection and encryption. |
| | | * The name of the SASL mechanism based on GSS-API authentication. |
| | | */ |
| | | public static final String QOP_AUTH_CONF = "auth-conf"; |
| | | public static final String SASL_MECHANISM_NAME = "GSSAPI"; |
| | | |
| | | /** |
| | | * Adds the provided additional authentication parameter to the list of |
| | |
| | | */ |
| | | GSSAPISASLBindRequest addAdditionalAuthParam(String name, String value); |
| | | |
| | | /** |
| | | * Returns a map containing the provided additional authentication |
| | | * parameters to be passed to the underlying mechanism implementation. This |
| | | * method is provided in order to allow for future extensions. |
| | | * |
| | | * @return A map containing the provided additional authentication |
| | | * parameters to be passed to the underlying mechanism |
| | | * implementation. |
| | | */ |
| | | Map<String, String> getAdditionalAuthParams(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | GSSAPISASLBindRequest addControl(Control control); |
| | | |
| | |
| | | */ |
| | | GSSAPISASLBindRequest addQOP(String... qopValues); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindClient createBindClient(String serverName) throws ErrorResultException; |
| | | |
| | | /** |
| | | * Returns a map containing the provided additional authentication |
| | | * parameters to be passed to the underlying mechanism implementation. This |
| | | * method is provided in order to allow for future extensions. |
| | | * |
| | | * @return A map containing the provided additional authentication |
| | | * parameters to be passed to the underlying mechanism |
| | | * implementation. |
| | | */ |
| | | Map<String, String> getAdditionalAuthParams(); |
| | | |
| | | /** |
| | | * Returns the authentication ID of the user, which should be the user's |
| | | * Kerberos principal. The authentication ID usually has the form "dn:" |
| | | * immediately followed by the distinguished name of the user, or "u:" |
| | |
| | | */ |
| | | String getAuthorizationID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | |
| | | */ |
| | | String getRealm(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getSASLMechanism(); |
| | | |
| | |
| | | return subject; |
| | | } |
| | | |
| | | private final SaslClient saslClient; |
| | | private final String authorizationID; |
| | | private final Subject subject; |
| | | |
| | | private BindResult lastResult; |
| | | |
| | | private final PrivilegedExceptionAction<Boolean> evaluateAction = |
| | | new PrivilegedExceptionAction<Boolean>() { |
| | | @Override |
| | |
| | | } |
| | | } |
| | | }; |
| | | private BindResult lastResult; |
| | | |
| | | private final SaslClient saslClient; |
| | | |
| | | private final Subject subject; |
| | | |
| | | private Client(final GSSAPISASLBindRequestImpl initialBindRequest, final String serverName) |
| | | throws ErrorResultException { |
| | |
| | | Subject.doAs(subject, new PrivilegedExceptionAction<SaslClient>() { |
| | | @Override |
| | | public SaslClient run() throws ErrorResultException { |
| | | // Create property map containing all the |
| | | // parameters. |
| | | /* |
| | | * Create property map containing all the |
| | | * parameters. |
| | | */ |
| | | final Map<String, String> props = new HashMap<String, String>(); |
| | | |
| | | final List<String> qopValues = initialBindRequest.getQOPs(); |
| | |
| | | |
| | | } |
| | | |
| | | // If null then authenticationID and password must be present. |
| | | private Subject subject = null; |
| | | private final Map<String, String> additionalAuthParams = new LinkedHashMap<String, String>(); |
| | | |
| | | // Ignored if subject is non-null. |
| | | private String authenticationID = null; |
| | | private byte[] password = null; |
| | | private String realm = null; |
| | | |
| | | private String kdcAddress = null; |
| | | |
| | | // Optional authorization ID. |
| | | private String authorizationID = null; |
| | | private String kdcAddress = null; |
| | | |
| | | private final Map<String, String> additionalAuthParams = new LinkedHashMap<String, String>(); |
| | | private Integer maxReceiveBufferSize = null; |
| | | |
| | | private Integer maxSendBufferSize = null; |
| | | |
| | | private byte[] password = null; |
| | | private final List<String> qopValues = new LinkedList<String>(); |
| | | |
| | | private String realm = null; |
| | | // Don't use primitives for these so that we can distinguish between default |
| | | // settings (null) and values set by the caller. |
| | | private Boolean serverAuth = null; |
| | | private Integer maxReceiveBufferSize = null; |
| | | private Integer maxSendBufferSize = null; |
| | | // If null then authenticationID and password must be present. |
| | | private Subject subject = null; |
| | | |
| | | GSSAPISASLBindRequestImpl(final String authenticationID, final byte[] password) { |
| | | Validator.ensureNotNull(authenticationID, password); |
| | | this.authenticationID = authenticationID; |
| | | this.password = password; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new GSSAPI SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param gssapiSASLBindRequest |
| | | * The GSSAPI SASL bind request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code gssAPISASLBindRequest} was {@code null}. |
| | | */ |
| | | GSSAPISASLBindRequestImpl(final GSSAPISASLBindRequest gssapiSASLBindRequest) { |
| | | super(gssapiSASLBindRequest); |
| | | this.subject = gssapiSASLBindRequest.getSubject(); |
| | |
| | | this.maxSendBufferSize = gssapiSASLBindRequest.getMaxSendBufferSize(); |
| | | } |
| | | |
| | | GSSAPISASLBindRequestImpl(final String authenticationID, final byte[] password) { |
| | | Validator.ensureNotNull(authenticationID, password); |
| | | this.authenticationID = authenticationID; |
| | | this.password = password; |
| | | } |
| | | |
| | | GSSAPISASLBindRequestImpl(final Subject subject) { |
| | | Validator.ensureNotNull(subject); |
| | | this.subject = subject; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GSSAPISASLBindRequest addAdditionalAuthParam(final String name, final String value) { |
| | | Validator.ensureNotNull(name, value); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GSSAPISASLBindRequest addQOP(final String... qopValues) { |
| | | for (final String qopValue : qopValues) { |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public BindClient createBindClient(final String serverName) throws ErrorResultException { |
| | | return new Client(this, serverName); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Map<String, String> getAdditionalAuthParams() { |
| | | return additionalAuthParams; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getAuthenticationID() { |
| | | return authenticationID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getAuthorizationID() { |
| | | return authorizationID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getKDCAddress() { |
| | | return kdcAddress; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int getMaxReceiveBufferSize() { |
| | | return maxReceiveBufferSize == null ? 65536 : maxReceiveBufferSize; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int getMaxSendBufferSize() { |
| | | return maxSendBufferSize == null ? 65536 : maxSendBufferSize; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public byte[] getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public List<String> getQOPs() { |
| | | return qopValues; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getRealm() { |
| | | return realm; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getSASLMechanism() { |
| | | return SASL_MECHANISM_NAME; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Subject getSubject() { |
| | | return subject; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isServerAuth() { |
| | | return serverAuth == null ? false : serverAuth; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GSSAPISASLBindRequest setAuthenticationID(final String authenticationID) { |
| | | Validator.ensureNotNull(authenticationID); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GSSAPISASLBindRequest setAuthorizationID(final String authorizationID) { |
| | | this.authorizationID = authorizationID; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GSSAPISASLBindRequest setKDCAddress(final String address) { |
| | | this.kdcAddress = address; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GSSAPISASLBindRequest setMaxReceiveBufferSize(final int size) { |
| | | maxReceiveBufferSize = size; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GSSAPISASLBindRequest setMaxSendBufferSize(final int size) { |
| | | maxSendBufferSize = size; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GSSAPISASLBindRequest setPassword(final byte[] password) { |
| | | Validator.ensureNotNull(password); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GSSAPISASLBindRequest setPassword(final char[] password) { |
| | | Validator.ensureNotNull(password); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GSSAPISASLBindRequest setRealm(final String realm) { |
| | | this.realm = realm; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GSSAPISASLBindRequest setServerAuth(final boolean serverAuth) { |
| | | this.serverAuth = serverAuth; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GSSAPISASLBindRequest setSubject(final Subject subject) { |
| | | this.subject = subject; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * {@link ResultCode#AUTH_METHOD_NOT_SUPPORTED}. |
| | | */ |
| | | public interface GenericBindRequest extends BindRequest { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | GenericBindRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindClient createBindClient(String serverName) throws ErrorResultException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | byte getAuthenticationType(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | byte[] getAuthenticationValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getName(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | final class GenericBindRequestImpl extends AbstractBindRequest<GenericBindRequest> implements |
| | | GenericBindRequest { |
| | | private byte authenticationType; |
| | | |
| | | private byte[] authenticationValue; |
| | | |
| | | private final BindClient bindClient; |
| | | |
| | | private String name; |
| | | |
| | | private byte[] authenticationValue; |
| | | |
| | | private byte authenticationType; |
| | | |
| | | /** |
| | | * Creates a new generic bind request using a generic bind client. |
| | | */ |
| | | GenericBindRequestImpl(final String name, final byte authenticationType, |
| | | final byte[] authenticationValue) { |
| | | this.name = name; |
| | | this.authenticationType = authenticationType; |
| | | this.authenticationValue = authenticationValue; |
| | | this.bindClient = null; // Create a new bind client each time. |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic bind request using the provided bind client. |
| | | * <p> |
| | | * This is intended for use by other bind client implementations in this |
| | | * package. |
| | | */ |
| | | GenericBindRequestImpl(final String name, final byte authenticationType, |
| | | final byte[] authenticationValue, final BindClient bindClient) { |
| | | this.name = name; |
| | | this.authenticationType = authenticationType; |
| | | this.authenticationValue = authenticationValue; |
| | | this.bindClient = bindClient; // Always return same bind client. |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic bind request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param genericBindRequest |
| | | * The generic bind request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code genericBindRequest} was {@code null} . |
| | | */ |
| | | GenericBindRequestImpl(final GenericBindRequest genericBindRequest) { |
| | | super(genericBindRequest); |
| | | this.name = genericBindRequest.getName(); |
| | |
| | | this.bindClient = null; // Create a new bind client each time. |
| | | } |
| | | |
| | | GenericBindRequestImpl(final String name, final byte authenticationType, |
| | | final byte[] authenticationValue) { |
| | | this.name = name; |
| | | this.authenticationType = authenticationType; |
| | | this.authenticationValue = authenticationValue; |
| | | this.bindClient = null; // Create a new bind client each time. |
| | | } |
| | | |
| | | GenericBindRequestImpl(final String name, final byte authenticationType, |
| | | final byte[] authenticationValue, final BindClient bindClient) { |
| | | this.name = name; |
| | | this.authenticationType = authenticationType; |
| | | this.authenticationValue = authenticationValue; |
| | | this.bindClient = bindClient; // Always return same bind client. |
| | | } |
| | | |
| | | @Override |
| | | public BindClient createBindClient(final String serverName) throws ErrorResultException { |
| | | if (bindClient == null) { |
| | | return new BindClientImpl(this).setNextAuthenticationValue(authenticationValue); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public byte getAuthenticationType() { |
| | | return authenticationType; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public byte[] getAuthenticationValue() { |
| | | return authenticationValue; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GenericBindRequest setAuthenticationType(final byte type) { |
| | | this.authenticationType = type; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GenericBindRequest setAuthenticationValue(final byte[] bytes) { |
| | | Validator.ensureNotNull(bytes); |
| | | this.authenticationValue = bytes; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GenericBindRequest setName(final String name) { |
| | | Validator.ensureNotNull(name); |
| | | this.name = name; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | public static final ExtendedRequestDecoder<GenericExtendedRequest, GenericExtendedResult> DECODER = |
| | | new GenericExtendedRequestImpl.RequestDecoder(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | GenericExtendedRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getOID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ExtendedResultDecoder<GenericExtendedResult> getResultDecoder(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ByteString getValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean hasValue(); |
| | | |
| | | /** |
| | |
| | | |
| | | static final class RequestDecoder implements |
| | | ExtendedRequestDecoder<GenericExtendedRequest, GenericExtendedResult> { |
| | | @Override |
| | | public GenericExtendedRequest decodeExtendedRequest(final ExtendedRequest<?> request, |
| | | final DecodeOptions options) throws DecodeException { |
| | | if (request instanceof GenericExtendedRequest) { |
| | |
| | | private static final class GenericExtendedResultDecoder extends |
| | | AbstractExtendedResultDecoder<GenericExtendedResult> { |
| | | |
| | | public GenericExtendedResult newExtendedErrorResult(final ResultCode resultCode, |
| | | final String matchedDN, final String diagnosticMessage) { |
| | | return Responses.newGenericExtendedResult(resultCode).setMatchedDN(matchedDN) |
| | | .setDiagnosticMessage(diagnosticMessage); |
| | | } |
| | | |
| | | @Override |
| | | public GenericExtendedResult decodeExtendedResult(final ExtendedResult result, |
| | | final DecodeOptions options) throws DecodeException { |
| | | if (result instanceof GenericExtendedResult) { |
| | |
| | | return newResult; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public GenericExtendedResult newExtendedErrorResult(final ResultCode resultCode, |
| | | final String matchedDN, final String diagnosticMessage) { |
| | | return Responses.newGenericExtendedResult(resultCode).setMatchedDN(matchedDN) |
| | | .setDiagnosticMessage(diagnosticMessage); |
| | | } |
| | | } |
| | | |
| | | private static final GenericExtendedResultDecoder RESULT_DECODER = |
| | | new GenericExtendedResultDecoder(); |
| | | |
| | | private ByteString requestValue = null; |
| | | private String requestName; |
| | | private ByteString requestValue = null; |
| | | |
| | | /** |
| | | * Creates a new generic extended request using the provided name. |
| | | * |
| | | * @param requestName |
| | | * The dotted-decimal representation of the unique OID |
| | | * corresponding to this extended request. |
| | | * @throws NullPointerException |
| | | * If {@code requestName} was {@code null}. |
| | | */ |
| | | GenericExtendedRequestImpl(final String requestName) { |
| | | this.requestName = requestName; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic extended request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param genericExtendedRequest |
| | | * The generic extended request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code extendedRequest} was {@code null} . |
| | | */ |
| | | protected GenericExtendedRequestImpl(GenericExtendedRequest genericExtendedRequest) { |
| | | GenericExtendedRequestImpl(final GenericExtendedRequest genericExtendedRequest) { |
| | | super(genericExtendedRequest); |
| | | this.requestName = genericExtendedRequest.getOID(); |
| | | this.requestValue = genericExtendedRequest.getValue(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | GenericExtendedRequestImpl(final String requestName) { |
| | | this.requestName = requestName; |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return requestName; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ExtendedResultDecoder<GenericExtendedResult> getResultDecoder() { |
| | | return RESULT_DECODER; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return requestValue; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return requestValue != null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GenericExtendedRequest setOID(final String oid) { |
| | | Validator.ensureNotNull(oid); |
| | | this.requestName = oid; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GenericExtendedRequest setValue(final Object value) { |
| | | this.requestValue = value != null ? ByteString.valueOf(value) : null; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * to a new location in the Directory. |
| | | */ |
| | | public interface ModifyDNRequest extends Request, ChangeRecord { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | <R, P> R accept(ChangeRecordVisitor<R, P> v, P p); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ModifyDNRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The distinguished name of the entry. |
| | | */ |
| | | @Override |
| | | DN getName(); |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.requests; |
| | |
| | | */ |
| | | final class ModifyDNRequestImpl extends AbstractRequestImpl<ModifyDNRequest> implements |
| | | ModifyDNRequest { |
| | | private boolean deleteOldRDN = false; |
| | | private DN name; |
| | | |
| | | private RDN newRDN; |
| | | private DN newSuperior = null; |
| | | |
| | | private RDN newRDN; |
| | | |
| | | private boolean deleteOldRDN = false; |
| | | |
| | | /** |
| | | * Creates a new modify DN request using the provided distinguished name and |
| | | * new RDN. |
| | | * |
| | | * @param name |
| | | * The distinguished name of the entry to be renamed. |
| | | * @param newRDN |
| | | * The new RDN of the entry. |
| | | * @throws NullPointerException |
| | | * If {@code name} or {@code newRDN} was {@code null}. |
| | | */ |
| | | ModifyDNRequestImpl(final DN name, final RDN newRDN) { |
| | | this.name = name; |
| | | this.newRDN = newRDN; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new modify DN request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param modifyDNRequest |
| | | * The modify DN request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code modifyDNRequest} was {@code null} . |
| | | */ |
| | | ModifyDNRequestImpl(final ModifyDNRequest modifyDNRequest) { |
| | | super(modifyDNRequest); |
| | | this.name = modifyDNRequest.getName(); |
| | |
| | | this.deleteOldRDN = modifyDNRequest.isDeleteOldRDN(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p) { |
| | | return v.visitChangeRecord(p, this); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getName() { |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public RDN getNewRDN() { |
| | | return newRDN; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getNewSuperior() { |
| | | return newSuperior; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isDeleteOldRDN() { |
| | | return deleteOldRDN; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ModifyDNRequestImpl setDeleteOldRDN(final boolean deleteOldRDN) { |
| | | this.deleteOldRDN = deleteOldRDN; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ModifyDNRequest setName(final DN dn) { |
| | | Validator.ensureNotNull(dn); |
| | | this.name = dn; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ModifyDNRequest setName(final String dn) { |
| | | Validator.ensureNotNull(dn); |
| | | this.name = DN.valueOf(dn); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ModifyDNRequest setNewRDN(final RDN rdn) { |
| | | Validator.ensureNotNull(rdn); |
| | | this.newRDN = rdn; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ModifyDNRequest setNewRDN(final String rdn) { |
| | | Validator.ensureNotNull(rdn); |
| | | this.newRDN = RDN.valueOf(rdn); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ModifyDNRequest setNewSuperior(final DN dn) { |
| | | this.newSuperior = dn; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ModifyDNRequest setNewSuperior(final String dn) { |
| | | this.newSuperior = (dn != null) ? DN.valueOf(dn) : null; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * </pre> |
| | | */ |
| | | public interface ModifyRequest extends Request, ChangeRecord { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | <R, P> R accept(ChangeRecordVisitor<R, P> v, P p); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ModifyRequest addControl(Control control); |
| | | |
| | | /** |
| | |
| | | ModifyRequest addModification(ModificationType type, String attributeDescription, |
| | | Object... values); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The distinguished name of the entry to be modified. |
| | | */ |
| | | @Override |
| | | DN getName(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | final class ModifyRequestImpl extends AbstractRequestImpl<ModifyRequest> implements ModifyRequest { |
| | | private final List<Modification> changes = new LinkedList<Modification>(); |
| | | |
| | | private DN name; |
| | | |
| | | /** |
| | | * Creates a new modify request using the provided distinguished name. |
| | | * |
| | | * @param name |
| | | * The distinguished name of the entry to be modified. |
| | | * @throws NullPointerException |
| | | * If {@code name} was {@code null}. |
| | | */ |
| | | ModifyRequestImpl(final DN name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new modify request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param modifyRequest |
| | | * The modify request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code modifyRequest} was {@code null} . |
| | | */ |
| | | ModifyRequestImpl(final ModifyRequest modifyRequest) { |
| | | super(modifyRequest); |
| | | this.name = modifyRequest.getName(); |
| | | |
| | | // Deep copy. |
| | | for (Modification modification : modifyRequest.getModifications()) { |
| | | ModificationType type = modification.getModificationType(); |
| | | Attribute attribute = new LinkedAttribute(modification.getAttribute()); |
| | | Modification copy = new Modification(type, attribute); |
| | | for (final Modification modification : modifyRequest.getModifications()) { |
| | | final ModificationType type = modification.getModificationType(); |
| | | final Attribute attribute = new LinkedAttribute(modification.getAttribute()); |
| | | final Modification copy = new Modification(type, attribute); |
| | | this.changes.add(copy); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p) { |
| | | return v.visitChangeRecord(p, this); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ModifyRequest addModification(final Modification change) { |
| | | Validator.ensureNotNull(change); |
| | | changes.add(change); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ModifyRequest addModification(final ModificationType type, |
| | | final String attributeDescription, final Object... values) { |
| | | Validator.ensureNotNull(type, attributeDescription, values); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public List<Modification> getModifications() { |
| | | return changes; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getName() { |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ModifyRequest setName(final DN dn) { |
| | | Validator.ensureNotNull(dn); |
| | | this.name = dn; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ModifyRequest setName(final String dn) { |
| | | Validator.ensureNotNull(dn); |
| | | this.name = DN.valueOf(dn); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | ExtendedRequest<PasswordModifyExtendedResult> { |
| | | |
| | | /** |
| | | * The OID for the password modify extended operation request. |
| | | */ |
| | | public static final String OID = "1.3.6.1.4.1.4203.1.11.1"; |
| | | |
| | | /** |
| | | * A decoder which can be used to decode password modify extended operation |
| | | * requests. |
| | | */ |
| | |
| | | new PasswordModifyExtendedRequestImpl.RequestDecoder(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | * The OID for the password modify extended operation request. |
| | | */ |
| | | public static final String OID = "1.3.6.1.4.1.4203.1.11.1"; |
| | | |
| | | @Override |
| | | PasswordModifyExtendedRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | byte[] getNewPassword(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getOID(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | byte[] getOldPassword(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ExtendedResultDecoder<PasswordModifyExtendedResult> getResultDecoder(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | String getUserIdentityAsString(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ByteString getValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean hasValue(); |
| | | |
| | | /** |
| | |
| | | implements PasswordModifyExtendedRequest { |
| | | static final class RequestDecoder implements |
| | | ExtendedRequestDecoder<PasswordModifyExtendedRequest, PasswordModifyExtendedResult> { |
| | | @Override |
| | | public PasswordModifyExtendedRequest decodeExtendedRequest( |
| | | final ExtendedRequest<?> request, final DecodeOptions options) |
| | | throws DecodeException { |
| | |
| | | |
| | | private static final class ResultDecoder extends |
| | | AbstractExtendedResultDecoder<PasswordModifyExtendedResult> { |
| | | public PasswordModifyExtendedResult newExtendedErrorResult(final ResultCode resultCode, |
| | | final String matchedDN, final String diagnosticMessage) { |
| | | return Responses.newPasswordModifyExtendedResult(resultCode).setMatchedDN(matchedDN) |
| | | .setDiagnosticMessage(diagnosticMessage); |
| | | } |
| | | |
| | | @Override |
| | | public PasswordModifyExtendedResult decodeExtendedResult(final ExtendedResult result, |
| | | final DecodeOptions options) throws DecodeException { |
| | | if (result instanceof PasswordModifyExtendedResult) { |
| | |
| | | return newResult; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public PasswordModifyExtendedResult newExtendedErrorResult(final ResultCode resultCode, |
| | | final String matchedDN, final String diagnosticMessage) { |
| | | return Responses.newPasswordModifyExtendedResult(resultCode).setMatchedDN(matchedDN) |
| | | .setDiagnosticMessage(diagnosticMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The ASN.1 element type that will be used to encode the userIdentity |
| | | * component in a password modify extended request. |
| | | */ |
| | | private static final byte TYPE_PASSWORD_MODIFY_USER_ID = (byte) 0x80; |
| | | private static final ExtendedResultDecoder<PasswordModifyExtendedResult> RESULT_DECODER = |
| | | new ResultDecoder(); |
| | | |
| | | /** |
| | | * The ASN.1 element type that will be used to encode the oldPasswd |
| | | * component in a password modify extended request. |
| | | * The ASN.1 element type that will be used to encode the genPasswd |
| | | * component in a password modify extended response. |
| | | */ |
| | | private static final byte TYPE_PASSWORD_MODIFY_OLD_PASSWORD = (byte) 0x81; |
| | | private static final byte TYPE_PASSWORD_MODIFY_GENERATED_PASSWORD = (byte) 0x80; |
| | | |
| | | /** |
| | | * The ASN.1 element type that will be used to encode the newPasswd |
| | |
| | | private static final byte TYPE_PASSWORD_MODIFY_NEW_PASSWORD = (byte) 0x82; |
| | | |
| | | /** |
| | | * The ASN.1 element type that will be used to encode the genPasswd |
| | | * component in a password modify extended response. |
| | | * The ASN.1 element type that will be used to encode the oldPasswd |
| | | * component in a password modify extended request. |
| | | */ |
| | | private static final byte TYPE_PASSWORD_MODIFY_GENERATED_PASSWORD = (byte) 0x80; |
| | | private static final byte TYPE_PASSWORD_MODIFY_OLD_PASSWORD = (byte) 0x81; |
| | | |
| | | /** |
| | | * The ASN.1 element type that will be used to encode the userIdentity |
| | | * component in a password modify extended request. |
| | | */ |
| | | private static final byte TYPE_PASSWORD_MODIFY_USER_ID = (byte) 0x80; |
| | | private byte[] newPassword = null; |
| | | private byte[] oldPassword = null; |
| | | |
| | | private ByteString userIdentity = null; |
| | | private byte[] oldPassword = null; |
| | | private byte[] newPassword = null; |
| | | |
| | | private static final ExtendedResultDecoder<PasswordModifyExtendedResult> RESULT_DECODER = |
| | | new ResultDecoder(); |
| | | |
| | | // Instantiation via factory. |
| | | PasswordModifyExtendedRequestImpl() { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Creates a new password modify extended request that is an exact copy of |
| | | * the provided request. |
| | | * |
| | | * @param passwordModifyExtendedRequest |
| | | * The password modify extended request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code passwordModifyExtendedRequest} was {@code null} . |
| | | */ |
| | | PasswordModifyExtendedRequestImpl( |
| | | final PasswordModifyExtendedRequest passwordModifyExtendedRequest) { |
| | | super(passwordModifyExtendedRequest); |
| | |
| | | this.newPassword = passwordModifyExtendedRequest.getNewPassword(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public byte[] getNewPassword() { |
| | | return newPassword; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public byte[] getOldPassword() { |
| | | return oldPassword; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ExtendedResultDecoder<PasswordModifyExtendedResult> getResultDecoder() { |
| | | return RESULT_DECODER; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ByteString getUserIdentity() { |
| | | return userIdentity; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getUserIdentityAsString() { |
| | | return userIdentity != null ? userIdentity.toString() : null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | |
| | | return buffer.toByteString(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public PasswordModifyExtendedRequest setNewPassword(final byte[] newPassword) { |
| | | this.newPassword = newPassword; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public PasswordModifyExtendedRequest setNewPassword(final char[] newPassword) { |
| | | this.newPassword = (newPassword != null) ? StaticUtils.getBytes(newPassword) : null; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public PasswordModifyExtendedRequest setOldPassword(final byte[] oldPassword) { |
| | | this.oldPassword = oldPassword; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public PasswordModifyExtendedRequest setOldPassword(final char[] oldPassword) { |
| | | this.oldPassword = (oldPassword != null) ? StaticUtils.getBytes(oldPassword) : null; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public PasswordModifyExtendedRequest setUserIdentity(final Object userIdentity) { |
| | | this.userIdentity = (userIdentity != null) ? ByteString.valueOf(userIdentity) : null; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | */ |
| | | public static final String SASL_MECHANISM_NAME = "PLAIN"; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | PlainSASLBindRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindClient createBindClient(String serverName) throws ErrorResultException; |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The authentication mechanism identifier. |
| | | */ |
| | | @Override |
| | | byte getAuthenticationType(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | String getAuthorizationID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | * @return The name of the Directory object that the client wishes to bind |
| | | * as. |
| | | */ |
| | | @Override |
| | | String getName(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | byte[] getPassword(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getSASLMechanism(); |
| | | |
| | | /** |
| | |
| | | final class PlainSASLBindRequestImpl extends AbstractSASLBindRequest<PlainSASLBindRequest> |
| | | implements PlainSASLBindRequest { |
| | | private final static class Client extends SASLBindClientImpl { |
| | | private final SaslClient saslClient; |
| | | private final String authenticationID; |
| | | private final ByteString password; |
| | | private final SaslClient saslClient; |
| | | |
| | | private Client(final PlainSASLBindRequestImpl initialBindRequest, final String serverName) |
| | | throws ErrorResultException { |
| | |
| | | |
| | | private byte[] password; |
| | | |
| | | PlainSASLBindRequestImpl(final String authenticationID, final byte[] password) { |
| | | Validator.ensureNotNull(authenticationID, password); |
| | | this.authenticationID = authenticationID; |
| | | this.password = password; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new plain SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param plainSASLBindRequest |
| | | * The plain SASL bind request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code plainSASLBindRequest} was {@code null} . |
| | | */ |
| | | PlainSASLBindRequestImpl(final PlainSASLBindRequest plainSASLBindRequest) { |
| | | super(plainSASLBindRequest); |
| | | this.authenticationID = plainSASLBindRequest.getAuthenticationID(); |
| | |
| | | this.password = StaticUtils.copyOfBytes(plainSASLBindRequest.getPassword()); |
| | | } |
| | | |
| | | PlainSASLBindRequestImpl(final String authenticationID, final byte[] password) { |
| | | Validator.ensureNotNull(authenticationID, password); |
| | | this.authenticationID = authenticationID; |
| | | this.password = password; |
| | | } |
| | | |
| | | @Override |
| | | public BindClient createBindClient(final String serverName) throws ErrorResultException { |
| | | return new Client(this, serverName); |
| | | } |
| | | |
| | | @Override |
| | | public String getAuthenticationID() { |
| | | return authenticationID; |
| | | } |
| | | |
| | | @Override |
| | | public String getAuthorizationID() { |
| | | return authorizationID; |
| | | } |
| | | |
| | | @Override |
| | | public byte[] getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | @Override |
| | | public String getSASLMechanism() { |
| | | return SASL_MECHANISM_NAME; |
| | | } |
| | | |
| | | @Override |
| | | public PlainSASLBindRequest setAuthenticationID(final String authenticationID) { |
| | | Validator.ensureNotNull(authenticationID); |
| | | this.authenticationID = authenticationID; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public PlainSASLBindRequest setAuthorizationID(final String authorizationID) { |
| | | this.authorizationID = authorizationID; |
| | | return this; |
| | | } |
| | | |
| | | @Override |
| | | public PlainSASLBindRequest setPassword(final byte[] password) { |
| | | Validator.ensureNotNull(password); |
| | | this.password = password; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public PlainSASLBindRequest setPassword(final char[] password) { |
| | | Validator.ensureNotNull(password); |
| | | this.password = StaticUtils.getBytes(password); |
| | |
| | | // TODO: synchronized requests? |
| | | |
| | | /** |
| | | * Creates a new abandon request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The abandon request to be copied. |
| | | * @return The new abandon request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} |
| | | */ |
| | | public static AbandonRequest copyOfAbandonRequest(final AbandonRequest request) { |
| | | return new AbandonRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new add request that is an exact copy of the provided request. |
| | | * |
| | | * @param request |
| | | * The add request to be copied. |
| | | * @return The new add request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static AddRequest copyOfAddRequest(final AddRequest request) { |
| | | return new AddRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new anonymous SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The anonymous SASL bind request to be copied. |
| | | * @return The new anonymous SASL bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static AnonymousSASLBindRequest copyOfAnonymousSASLBindRequest( |
| | | final AnonymousSASLBindRequest request) { |
| | | return new AnonymousSASLBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new cancel extended request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The cancel extended request to be copied. |
| | | * @return The new cancel extended request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static CancelExtendedRequest copyOfCancelExtendedRequest( |
| | | final CancelExtendedRequest request) { |
| | | return new CancelExtendedRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new compare request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The compare request to be copied. |
| | | * @return The new compare request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static CompareRequest copyOfCompareRequest(final CompareRequest request) { |
| | | return new CompareRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new CRAM MD5 SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The CRAM MD5 SASL bind request to be copied. |
| | | * @return The new CRAM-MD5 SASL bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null}. |
| | | */ |
| | | public static CRAMMD5SASLBindRequest copyOfCRAMMD5SASLBindRequest( |
| | | final CRAMMD5SASLBindRequest request) { |
| | | return new CRAMMD5SASLBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new delete request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The add request to be copied. |
| | | * @return The new delete request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null}. |
| | | */ |
| | | public static DeleteRequest copyOfDeleteRequest(final DeleteRequest request) { |
| | | return new DeleteRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new digest MD5 SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The digest MD5 SASL bind request to be copied. |
| | | * @return The new DIGEST-MD5 SASL bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null}. |
| | | */ |
| | | public static DigestMD5SASLBindRequest copyOfDigestMD5SASLBindRequest( |
| | | final DigestMD5SASLBindRequest request) { |
| | | return new DigestMD5SASLBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new external SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The external SASL bind request to be copied. |
| | | * @return The new External SASL bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static ExternalSASLBindRequest copyOfExternalSASLBindRequest( |
| | | final ExternalSASLBindRequest request) { |
| | | return new ExternalSASLBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic bind request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The generic bind request to be copied. |
| | | * @return The new generic bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static GenericBindRequest copyOfGenericBindRequest(final GenericBindRequest request) { |
| | | return new GenericBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic extended request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The generic extended request to be copied. |
| | | * @return The new generic extended request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static GenericExtendedRequest copyOfGenericExtendedRequest( |
| | | final GenericExtendedRequest request) { |
| | | return new GenericExtendedRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new GSSAPI SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The GSSAPI SASL bind request to be copied. |
| | | * @return The new GSSAPI SASL bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null}. |
| | | */ |
| | | public static GSSAPISASLBindRequest copyOfGSSAPISASLBindRequest( |
| | | final GSSAPISASLBindRequest request) { |
| | | return new GSSAPISASLBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new modify DN request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The modify DN request to be copied. |
| | | * @return The new modify DN request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static ModifyDNRequest copyOfModifyDNRequest(final ModifyDNRequest request) { |
| | | return new ModifyDNRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new modify request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The modify request to be copied. |
| | | * @return The new modify request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static ModifyRequest copyOfModifyRequest(final ModifyRequest request) { |
| | | return new ModifyRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new password modify extended request that is an exact copy of |
| | | * the provided request. |
| | | * |
| | | * @param request |
| | | * The password modify extended request to be copied. |
| | | * @return The new password modify extended request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static PasswordModifyExtendedRequest copyOfPasswordModifyExtendedRequest( |
| | | final PasswordModifyExtendedRequest request) { |
| | | return new PasswordModifyExtendedRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new plain SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The plain SASL bind request to be copied. |
| | | * @return The new Plain SASL bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static PlainSASLBindRequest copyOfPlainSASLBindRequest(final PlainSASLBindRequest request) { |
| | | return new PlainSASLBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new search request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The search request to be copied. |
| | | * @return The new search request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static SearchRequest copyOfSearchRequest(final SearchRequest request) { |
| | | return new SearchRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new simple bind request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The simple bind request to be copied. |
| | | * @return The new simple bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static SimpleBindRequest copyOfSimpleBindRequest(final SimpleBindRequest request) { |
| | | return new SimpleBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new startTLS extended request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The startTLS extended request to be copied. |
| | | * @return The new start TLS extended request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static StartTLSExtendedRequest copyOfStartTLSExtendedRequest( |
| | | final StartTLSExtendedRequest request) { |
| | | return new StartTLSExtendedRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new unbind request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The unbind request to be copied. |
| | | * @return The new unbind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static UnbindRequest copyOfUnbindRequest(final UnbindRequest request) { |
| | | return new UnbindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new Who Am I extended request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The who Am I extended request to be copied. |
| | | * @return The new Who Am I extended request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static WhoAmIExtendedRequest copyOfWhoAmIExtendedRequest( |
| | | final WhoAmIExtendedRequest request) { |
| | | return new WhoAmIExtendedRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new abandon request using the provided message ID. |
| | | * |
| | | * @param requestID |
| | |
| | | * If {@code fromEntry} or {@code toEntry} were {@code null}. |
| | | * @see Entries#diffEntries(Entry, Entry) |
| | | */ |
| | | public static final ModifyRequest newModifyRequest(Entry fromEntry, Entry toEntry) { |
| | | public static final ModifyRequest newModifyRequest(final Entry fromEntry, final Entry toEntry) { |
| | | return Entries.diffEntries(fromEntry, toEntry); |
| | | } |
| | | |
| | |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static GenericExtendedRequest unmodifiableGenericExtendedRequest( |
| | | GenericExtendedRequest request) { |
| | | final GenericExtendedRequest request) { |
| | | if (request instanceof UnmodifiableGenericExtendedRequestImpl) { |
| | | return request; |
| | | } |
| | |
| | | return new UnmodifiableWhoAmIExtendedRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new abandon request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The abandon request to be copied. |
| | | * @return The new abandon request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} |
| | | */ |
| | | public static AbandonRequest copyOfAbandonRequest(final AbandonRequest request) { |
| | | return new AbandonRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new add request that is an exact copy of the provided request. |
| | | * |
| | | * @param request |
| | | * The add request to be copied. |
| | | * @return The new add request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static AddRequest copyOfAddRequest(final AddRequest request) { |
| | | return new AddRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new anonymous SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The anonymous SASL bind request to be copied. |
| | | * @return The new anonymous SASL bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static AnonymousSASLBindRequest copyOfAnonymousSASLBindRequest( |
| | | final AnonymousSASLBindRequest request) { |
| | | return new AnonymousSASLBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new cancel extended request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The cancel extended request to be copied. |
| | | * @return The new cancel extended request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static CancelExtendedRequest copyOfCancelExtendedRequest( |
| | | final CancelExtendedRequest request) { |
| | | return new CancelExtendedRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new compare request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The compare request to be copied. |
| | | * @return The new compare request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static CompareRequest copyOfCompareRequest(final CompareRequest request) { |
| | | return new CompareRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new CRAM MD5 SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The CRAM MD5 SASL bind request to be copied. |
| | | * @return The new CRAM-MD5 SASL bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null}. |
| | | */ |
| | | public static CRAMMD5SASLBindRequest copyOfCRAMMD5SASLBindRequest( |
| | | final CRAMMD5SASLBindRequest request) { |
| | | return new CRAMMD5SASLBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new delete request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The add request to be copied. |
| | | * @return The new delete request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null}. |
| | | */ |
| | | public static DeleteRequest copyOfDeleteRequest(final DeleteRequest request) { |
| | | return new DeleteRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new digest MD5 SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The digest MD5 SASL bind request to be copied. |
| | | * @return The new DIGEST-MD5 SASL bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null}. |
| | | */ |
| | | public static DigestMD5SASLBindRequest copyOfDigestMD5SASLBindRequest( |
| | | final DigestMD5SASLBindRequest request) { |
| | | return new DigestMD5SASLBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new external SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The external SASL bind request to be copied. |
| | | * @return The new External SASL bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static ExternalSASLBindRequest copyOfExternalSASLBindRequest( |
| | | final ExternalSASLBindRequest request) { |
| | | return new ExternalSASLBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic bind request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The generic bind request to be copied. |
| | | * @return The new generic bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static GenericBindRequest copyOfGenericBindRequest(final GenericBindRequest request) { |
| | | return new GenericBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic extended request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The generic extended request to be copied. |
| | | * @return The new generic extended request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static GenericExtendedRequest copyOfGenericExtendedRequest(GenericExtendedRequest request) { |
| | | return new GenericExtendedRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new GSSAPI SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The GSSAPI SASL bind request to be copied. |
| | | * @return The new GSSAPI SASL bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null}. |
| | | */ |
| | | public static GSSAPISASLBindRequest copyOfGSSAPISASLBindRequest( |
| | | final GSSAPISASLBindRequest request) { |
| | | return new GSSAPISASLBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new modify DN request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The modify DN request to be copied. |
| | | * @return The new modify DN request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static ModifyDNRequest copyOfModifyDNRequest(final ModifyDNRequest request) { |
| | | return new ModifyDNRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new modify request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The modify request to be copied. |
| | | * @return The new modify request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static ModifyRequest copyOfModifyRequest(final ModifyRequest request) { |
| | | return new ModifyRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new password modify extended request that is an exact copy of |
| | | * the provided request. |
| | | * |
| | | * @param request |
| | | * The password modify extended request to be copied. |
| | | * @return The new password modify extended request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static PasswordModifyExtendedRequest copyOfPasswordModifyExtendedRequest( |
| | | final PasswordModifyExtendedRequest request) { |
| | | return new PasswordModifyExtendedRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new plain SASL bind request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The plain SASL bind request to be copied. |
| | | * @return The new Plain SASL bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static PlainSASLBindRequest copyOfPlainSASLBindRequest(final PlainSASLBindRequest request) { |
| | | return new PlainSASLBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new search request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The search request to be copied. |
| | | * @return The new search request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static SearchRequest copyOfSearchRequest(final SearchRequest request) { |
| | | return new SearchRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new simple bind request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The simple bind request to be copied. |
| | | * @return The new simple bind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static SimpleBindRequest copyOfSimpleBindRequest(final SimpleBindRequest request) { |
| | | return new SimpleBindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new startTLS extended request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The startTLS extended request to be copied. |
| | | * @return The new start TLS extended request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static StartTLSExtendedRequest copyOfStartTLSExtendedRequest( |
| | | final StartTLSExtendedRequest request) { |
| | | return new StartTLSExtendedRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new unbind request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param request |
| | | * The unbind request to be copied. |
| | | * @return The new unbind request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static UnbindRequest copyOfUnbindRequest(final UnbindRequest request) { |
| | | return new UnbindRequestImpl(request); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new Who Am I extended request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param request |
| | | * The who Am I extended request to be copied. |
| | | * @return The new Who Am I extended request. |
| | | * @throws NullPointerException |
| | | * If {@code request} was {@code null} . |
| | | */ |
| | | public static WhoAmIExtendedRequest copyOfWhoAmIExtendedRequest( |
| | | final WhoAmIExtendedRequest request) { |
| | | return new WhoAmIExtendedRequestImpl(request); |
| | | } |
| | | |
| | | private Requests() { |
| | | // Prevent instantiation. |
| | | } |
| | |
| | | this.saslMechanism = initialBindRequest.getSASLMechanism(); |
| | | } |
| | | |
| | | @Override |
| | | public final void handle(final Callback[] callbacks) throws IOException, |
| | | UnsupportedCallbackException { |
| | | for (final Callback callback : callbacks) { |
| | |
| | | * SASL Authorization Identities (authzId) </a> |
| | | */ |
| | | public interface SASLBindRequest extends BindRequest { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | SASLBindRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindClient createBindClient(String serverName) throws ErrorResultException; |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The authentication mechanism identifier. |
| | | */ |
| | | @Override |
| | | byte getAuthenticationType(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | * @return The name of the Directory object that the client wishes to bind |
| | | * as. |
| | | */ |
| | | @Override |
| | | String getName(); |
| | | |
| | | /** |
| | |
| | | * create a new search request. |
| | | * |
| | | * <pre> |
| | | * SearchRequest request = Requests.newSearchRequest( |
| | | * "dc=example,dc=com", SearchScope.WHOLE_SUBTREE, "(sn=Jensen)", "cn"); |
| | | * SearchRequest request = Requests.newSearchRequest("dc=example,dc=com", SearchScope.WHOLE_SUBTREE, |
| | | * "(sn=Jensen)", "cn"); |
| | | * </pre> |
| | | * |
| | | * Alternatively, use the |
| | |
| | | */ |
| | | SearchRequest addAttribute(String... attributeDescriptions); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | SearchRequest addControl(Control control); |
| | | |
| | | /** |
| | |
| | | */ |
| | | List<String> getAttributes(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | * Search request implementation. |
| | | */ |
| | | final class SearchRequestImpl extends AbstractRequestImpl<SearchRequest> implements SearchRequest { |
| | | |
| | | private final List<String> attributes = new LinkedList<String>(); |
| | | |
| | | private DN name; |
| | | |
| | | private DereferenceAliasesPolicy dereferenceAliasesPolicy = DereferenceAliasesPolicy.NEVER; |
| | | |
| | | private Filter filter; |
| | | |
| | | private DN name; |
| | | private SearchScope scope; |
| | | |
| | | private int sizeLimit = 0; |
| | | |
| | | private int timeLimit = 0; |
| | | |
| | | private boolean typesOnly = false; |
| | | |
| | | /** |
| | | * Creates a new search request using the provided distinguished name, |
| | | * scope, and filter, decoded using the default schema. |
| | | * |
| | | * @param name |
| | | * The distinguished name of the base entry relative to which the |
| | | * search is to be performed. |
| | | * @param scope |
| | | * The scope of the search. |
| | | * @param filter |
| | | * The filter that defines the conditions that must be fulfilled |
| | | * in order for an entry to be returned. |
| | | * @throws NullPointerException |
| | | * If the {@code name}, {@code scope}, or {@code filter} were |
| | | * {@code null}. |
| | | */ |
| | | SearchRequestImpl(final DN name, final SearchScope scope, final Filter filter) { |
| | | this.name = name; |
| | | this.scope = scope; |
| | | this.filter = filter; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new search request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param searchRequest |
| | | * The search request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code searchRequest} was {@code null} . |
| | | */ |
| | | SearchRequestImpl(final SearchRequest searchRequest) { |
| | | super(searchRequest); |
| | | this.attributes.addAll(searchRequest.getAttributes()); |
| | |
| | | this.typesOnly = searchRequest.isTypesOnly(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchRequest addAttribute(final String... attributeDescriptions) { |
| | | for (String attributeDescription : attributeDescriptions) { |
| | | for (final String attributeDescription : attributeDescriptions) { |
| | | attributes.add(Validator.ensureNotNull(attributeDescription)); |
| | | } |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public List<String> getAttributes() { |
| | | return attributes; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DereferenceAliasesPolicy getDereferenceAliasesPolicy() { |
| | | return dereferenceAliasesPolicy; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Filter getFilter() { |
| | | return filter; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getName() { |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchScope getScope() { |
| | | return scope; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int getSizeLimit() { |
| | | return sizeLimit; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int getTimeLimit() { |
| | | return timeLimit; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isTypesOnly() { |
| | | return typesOnly; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchRequest setDereferenceAliasesPolicy(final DereferenceAliasesPolicy policy) { |
| | | Validator.ensureNotNull(policy); |
| | | |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchRequest setFilter(final Filter filter) { |
| | | Validator.ensureNotNull(filter); |
| | | |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchRequest setFilter(final String filter) { |
| | | this.filter = Filter.valueOf(filter); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchRequest setName(final DN dn) { |
| | | Validator.ensureNotNull(dn); |
| | | |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchRequest setName(final String dn) { |
| | | Validator.ensureNotNull(dn); |
| | | |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchRequest setScope(final SearchScope scope) { |
| | | Validator.ensureNotNull(scope); |
| | | |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchRequest setSizeLimit(final int limit) { |
| | | Validator.ensureTrue(limit >= 0, "negative size limit"); |
| | | |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchRequest setTimeLimit(final int limit) { |
| | | Validator.ensureTrue(limit >= 0, "negative time limit"); |
| | | |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchRequest setTypesOnly(final boolean typesOnly) { |
| | | this.typesOnly = typesOnly; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * </pre> |
| | | */ |
| | | public interface SimpleBindRequest extends BindRequest { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | SimpleBindRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindClient createBindClient(String serverName) throws ErrorResultException; |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The authentication mechanism identifier. |
| | | */ |
| | | @Override |
| | | byte getAuthenticationType(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getName(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | final class SimpleBindRequestImpl extends AbstractBindRequest<SimpleBindRequest> implements |
| | | SimpleBindRequest { |
| | | private String name = "".intern(); |
| | | private byte[] password = new byte[0]; |
| | | |
| | | private String name = "".intern(); |
| | | |
| | | /** |
| | | * Creates a new simple bind request having the provided name and password |
| | | * suitable for name/password authentication. |
| | | * |
| | | * @param name |
| | | * The name of the Directory object that the client wishes to |
| | | * bind as, which may be empty. |
| | | * @param password |
| | | * The password of the Directory object that the client wishes to |
| | | * bind as, which may be empty indicating that an unauthenticated |
| | | * bind is to be performed. |
| | | * @throws NullPointerException |
| | | * If {@code name} or {@code password} was {@code null}. |
| | | */ |
| | | SimpleBindRequestImpl(final String name, final byte[] password) { |
| | | this.name = name; |
| | | this.password = password; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new simple bind request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param simpleBindRequest |
| | | * The simple bind request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code simpleBindRequest} was {@code null} . |
| | | */ |
| | | SimpleBindRequestImpl(final SimpleBindRequest simpleBindRequest) { |
| | | super(simpleBindRequest); |
| | | this.name = simpleBindRequest.getName(); |
| | | this.password = StaticUtils.copyOfBytes(simpleBindRequest.getPassword()); |
| | | } |
| | | |
| | | SimpleBindRequestImpl(final String name, final byte[] password) { |
| | | this.name = name; |
| | | this.password = password; |
| | | } |
| | | |
| | | @Override |
| | | public BindClient createBindClient(final String serverName) throws ErrorResultException { |
| | | return new BindClientImpl(this).setNextAuthenticationValue(password); |
| | | } |
| | | |
| | | @Override |
| | | public byte getAuthenticationType() { |
| | | return TYPE_AUTHENTICATION_SIMPLE; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public byte[] getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SimpleBindRequest setName(final String name) { |
| | | Validator.ensureNotNull(name); |
| | | this.name = name; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SimpleBindRequest setPassword(final byte[] password) { |
| | | Validator.ensureNotNull(password); |
| | | this.password = password; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SimpleBindRequest setPassword(final char[] password) { |
| | | Validator.ensureNotNull(password); |
| | | this.password = StaticUtils.getBytes(password); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | public interface StartTLSExtendedRequest extends ExtendedRequest<ExtendedResult> { |
| | | |
| | | /** |
| | | * The OID for the start TLS extended operation request. |
| | | */ |
| | | public static final String OID = "1.3.6.1.4.1.1466.20037"; |
| | | |
| | | /** |
| | | * A decoder which can be used to decode start TLS extended operation |
| | | * requests. |
| | | */ |
| | |
| | | new StartTLSExtendedRequestImpl.RequestDecoder(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | * The OID for the start TLS extended operation request. |
| | | */ |
| | | public static final String OID = "1.3.6.1.4.1.1466.20037"; |
| | | |
| | | @Override |
| | | StartTLSExtendedRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | String getOID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | ExtendedResultDecoder<ExtendedResult> getResultDecoder(); |
| | | |
| | | /** |
| | | * Returns the SSLContext that should be used when installing the TLS layer. |
| | | * |
| | | * @return The SSLContext that should be used when installing the TLS layer. |
| | | */ |
| | | SSLContext getSSLContext(); |
| | | |
| | | /** |
| | | * Adds the protocol versions enabled for secure connections with the |
| | | * Directory Server. |
| | | * |
| | | * The protocols must be supported by the SSLContext specified in |
| | | * {@link #setSSLContext(SSLContext)}. Following a successful call to this |
| | | * method, only the protocols listed in the protocols parameter are enabled |
| | | * for use. |
| | | * |
| | | * @param protocols |
| | | * Names of all the protocols to enable. |
| | | * @return A reference to this LDAP connection options. |
| | | * @throws UnsupportedOperationException |
| | | * If this start TLS extended request does not permit the |
| | | * enabled protocols to be set. |
| | | */ |
| | | StartTLSExtendedRequest addEnabledProtocol(String... protocols); |
| | | |
| | | /** |
| | | * Adds the cipher suites enabled for secure connections with the Directory |
| | | * Server. |
| | | * |
| | | * The suites must be supported by the SSLContext specified in |
| | | * Server. The suites must be supported by the SSLContext specified in |
| | | * {@link #setSSLContext(SSLContext)}. Following a successful call to this |
| | | * method, only the suites listed in the protocols parameter are enabled for |
| | | * use. |
| | |
| | | StartTLSExtendedRequest addEnabledCipherSuite(String... suites); |
| | | |
| | | /** |
| | | * Returns the names of the protocol versions which are currently enabled |
| | | * for secure connections with the Directory Server. |
| | | * Adds the protocol versions enabled for secure connections with the |
| | | * Directory Server. The protocols must be supported by the SSLContext |
| | | * specified in {@link #setSSLContext(SSLContext)}. Following a successful |
| | | * call to this method, only the protocols listed in the protocols parameter |
| | | * are enabled for use. |
| | | * |
| | | * @return an array of protocols or empty set if the default protocols are |
| | | * to be used. |
| | | * @param protocols |
| | | * Names of all the protocols to enable. |
| | | * @return A reference to this LDAP connection options. |
| | | * @throws UnsupportedOperationException |
| | | * If this start TLS extended request does not permit the |
| | | * enabled protocols to be set. |
| | | */ |
| | | List<String> getEnabledProtocols(); |
| | | StartTLSExtendedRequest addEnabledProtocol(String... protocols); |
| | | |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * Returns the names of the protocol versions which are currently enabled |
| | |
| | | List<String> getEnabledCipherSuites(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | * Returns the names of the protocol versions which are currently enabled |
| | | * for secure connections with the Directory Server. |
| | | * |
| | | * @return an array of protocols or empty set if the default protocols are |
| | | * to be used. |
| | | */ |
| | | ByteString getValue(); |
| | | List<String> getEnabledProtocols(); |
| | | |
| | | @Override |
| | | String getOID(); |
| | | |
| | | @Override |
| | | ExtendedResultDecoder<ExtendedResult> getResultDecoder(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | * Returns the SSLContext that should be used when installing the TLS layer. |
| | | * |
| | | * @return The SSLContext that should be used when installing the TLS layer. |
| | | */ |
| | | SSLContext getSSLContext(); |
| | | |
| | | @Override |
| | | ByteString getValue(); |
| | | |
| | | @Override |
| | | boolean hasValue(); |
| | | |
| | | /** |
| | |
| | | static final class RequestDecoder implements |
| | | ExtendedRequestDecoder<StartTLSExtendedRequest, ExtendedResult> { |
| | | |
| | | @Override |
| | | public StartTLSExtendedRequest decodeExtendedRequest(final ExtendedRequest<?> request, |
| | | final DecodeOptions options) throws DecodeException { |
| | | // TODO: Check the OID and that the value is not present. |
| | |
| | | } |
| | | |
| | | private static final class ResultDecoder extends AbstractExtendedResultDecoder<ExtendedResult> { |
| | | public GenericExtendedResult newExtendedErrorResult(final ResultCode resultCode, |
| | | final String matchedDN, final String diagnosticMessage) { |
| | | return Responses.newGenericExtendedResult(resultCode).setMatchedDN(matchedDN) |
| | | .setDiagnosticMessage(diagnosticMessage); |
| | | } |
| | | |
| | | @Override |
| | | public ExtendedResult decodeExtendedResult(final ExtendedResult result, |
| | | final DecodeOptions options) throws DecodeException { |
| | | // TODO: Should we check oid is NOT null and matches but |
| | | // value is null? |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public GenericExtendedResult newExtendedErrorResult(final ResultCode resultCode, |
| | | final String matchedDN, final String diagnosticMessage) { |
| | | return Responses.newGenericExtendedResult(resultCode).setMatchedDN(matchedDN) |
| | | .setDiagnosticMessage(diagnosticMessage); |
| | | } |
| | | } |
| | | |
| | | private SSLContext sslContext; |
| | | // No need to expose this. |
| | | private static final ExtendedResultDecoder<ExtendedResult> RESULT_DECODER = new ResultDecoder(); |
| | | |
| | | /** |
| | | * The list of cipher suite. |
| | | */ |
| | | private List<String> enabledCipherSuites = new LinkedList<String>(); |
| | | private final List<String> enabledCipherSuites = new LinkedList<String>(); |
| | | |
| | | /** |
| | | * the list of protocols. |
| | | */ |
| | | private List<String> enabledProtocols = new LinkedList<String>(); |
| | | private final List<String> enabledProtocols = new LinkedList<String>(); |
| | | |
| | | // No need to expose this. |
| | | private static final ExtendedResultDecoder<ExtendedResult> RESULT_DECODER = new ResultDecoder(); |
| | | private SSLContext sslContext; |
| | | |
| | | StartTLSExtendedRequestImpl(final SSLContext sslContext) { |
| | | Validator.ensureNotNull(sslContext); |
| | | this.sslContext = sslContext; |
| | | } |
| | | |
| | | /** |
| | | * 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) { |
| | | super(startTLSExtendedRequest); |
| | | this.sslContext = startTLSExtendedRequest.getSSLContext(); |
| | |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ExtendedResultDecoder<ExtendedResult> getResultDecoder() { |
| | | return RESULT_DECODER; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public SSLContext getSSLContext() { |
| | | return sslContext; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public StartTLSExtendedRequest addEnabledProtocol(String... protocols) { |
| | | for (final String protocol : protocols) { |
| | | this.enabledProtocols.add(Validator.ensureNotNull(protocol)); |
| | | } |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public StartTLSExtendedRequest addEnabledCipherSuite(String... suites) { |
| | | public StartTLSExtendedRequest addEnabledCipherSuite(final String... suites) { |
| | | for (final String suite : suites) { |
| | | this.enabledCipherSuites.add(Validator.ensureNotNull(suite)); |
| | | } |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public List<String> getEnabledProtocols() { |
| | | return this.enabledProtocols; |
| | | @Override |
| | | public StartTLSExtendedRequest addEnabledProtocol(final String... protocols) { |
| | | for (final String protocol : protocols) { |
| | | this.enabledProtocols.add(Validator.ensureNotNull(protocol)); |
| | | } |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public List<String> getEnabledCipherSuites() { |
| | | return this.enabledCipherSuites; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public List<String> getEnabledProtocols() { |
| | | return this.enabledProtocols; |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | @Override |
| | | public ExtendedResultDecoder<ExtendedResult> getResultDecoder() { |
| | | return RESULT_DECODER; |
| | | } |
| | | |
| | | @Override |
| | | public SSLContext getSSLContext() { |
| | | return sslContext; |
| | | } |
| | | |
| | | @Override |
| | | public ByteString getValue() { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public StartTLSExtendedRequest setSSLContext(final SSLContext sslContext) { |
| | | Validator.ensureNotNull(sslContext); |
| | | this.sslContext = sslContext; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * The Unbind operation allows a client to terminate an LDAP session. |
| | | */ |
| | | public interface UnbindRequest extends Request { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | UnbindRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | } |
| | |
| | | */ |
| | | final class UnbindRequestImpl extends AbstractRequestImpl<UnbindRequest> implements UnbindRequest { |
| | | |
| | | /** |
| | | * Creates a new unbind request. |
| | | */ |
| | | UnbindRequestImpl() { |
| | | // Do nothing. |
| | | } |
| | | |
| | | /** |
| | | * Creates a new unbind request that is an exact copy of the provided |
| | | * request. |
| | | * |
| | | * @param unbindRequest |
| | | * The unbind request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code unbindRequest} was {@code null} . |
| | | */ |
| | | UnbindRequestImpl(final UnbindRequest unbindRequest) { |
| | | super(unbindRequest); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | */ |
| | | final class UnmodifiableAbandonRequestImpl extends AbstractUnmodifiableRequest<AbandonRequest> |
| | | implements AbandonRequest { |
| | | UnmodifiableAbandonRequestImpl(AbandonRequest request) { |
| | | UnmodifiableAbandonRequestImpl(final AbandonRequest request) { |
| | | super(request); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int getRequestID() { |
| | | return impl.getRequestID(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public AbandonRequest setRequestID(int id) { |
| | | @Override |
| | | public AbandonRequest setRequestID(final int id) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | private static final Function<Attribute, Attribute, Void> UNMODIFIABLE_ATTRIBUTE_FUNCTION = |
| | | new Function<Attribute, Attribute, Void>() { |
| | | |
| | | @Override |
| | | public Attribute apply(final Attribute value, final Void p) { |
| | | return Attributes.unmodifiableAttribute(value); |
| | | } |
| | | |
| | | }; |
| | | |
| | | UnmodifiableAddRequestImpl(AddRequest impl) { |
| | | UnmodifiableAddRequestImpl(final AddRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | public <R, P> R accept(ChangeRecordVisitor<R, P> v, P p) { |
| | | @Override |
| | | public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p) { |
| | | return v.visitChangeRecord(p, this); |
| | | } |
| | | |
| | | public boolean addAttribute(Attribute attribute) { |
| | | @Override |
| | | public boolean addAttribute(final Attribute attribute) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public boolean addAttribute(Attribute attribute, Collection<? super ByteString> duplicateValues) { |
| | | @Override |
| | | public boolean addAttribute(final Attribute attribute, |
| | | final Collection<? super ByteString> duplicateValues) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public AddRequest addAttribute(String attributeDescription, Object... values) { |
| | | @Override |
| | | public AddRequest addAttribute(final String attributeDescription, final Object... values) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public AddRequest clearAttributes() { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public boolean containsAttribute(Attribute attribute, Collection<? super ByteString> missingValues) { |
| | | @Override |
| | | public boolean containsAttribute(final Attribute attribute, |
| | | final Collection<? super ByteString> missingValues) { |
| | | return impl.containsAttribute(attribute, missingValues); |
| | | } |
| | | |
| | | public boolean containsAttribute(String attributeDescription, Object... values) { |
| | | @Override |
| | | public boolean containsAttribute(final String attributeDescription, final Object... values) { |
| | | return impl.containsAttribute(attributeDescription, values); |
| | | } |
| | | |
| | | @Override |
| | | public Iterable<Attribute> getAllAttributes() { |
| | | return Iterables.unmodifiableIterable(Iterables.transformedIterable( |
| | | impl.getAllAttributes(), UNMODIFIABLE_ATTRIBUTE_FUNCTION)); |
| | | } |
| | | |
| | | public Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription) { |
| | | @Override |
| | | public Iterable<Attribute> getAllAttributes(final AttributeDescription attributeDescription) { |
| | | return Iterables.unmodifiableIterable(Iterables.transformedIterable(impl |
| | | .getAllAttributes(attributeDescription), UNMODIFIABLE_ATTRIBUTE_FUNCTION)); |
| | | } |
| | | |
| | | public Iterable<Attribute> getAllAttributes(String attributeDescription) { |
| | | @Override |
| | | public Iterable<Attribute> getAllAttributes(final String attributeDescription) { |
| | | return Iterables.unmodifiableIterable(Iterables.transformedIterable(impl |
| | | .getAllAttributes(attributeDescription), UNMODIFIABLE_ATTRIBUTE_FUNCTION)); |
| | | } |
| | | |
| | | public Attribute getAttribute(AttributeDescription attributeDescription) { |
| | | @Override |
| | | public Attribute getAttribute(final AttributeDescription attributeDescription) { |
| | | final Attribute attribute = impl.getAttribute(attributeDescription); |
| | | if (attribute != null) { |
| | | return Attributes.unmodifiableAttribute(attribute); |
| | |
| | | } |
| | | } |
| | | |
| | | public Attribute getAttribute(String attributeDescription) { |
| | | @Override |
| | | public Attribute getAttribute(final String attributeDescription) { |
| | | final Attribute attribute = impl.getAttribute(attributeDescription); |
| | | if (attribute != null) { |
| | | return Attributes.unmodifiableAttribute(attribute); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public int getAttributeCount() { |
| | | return impl.getAttributeCount(); |
| | | } |
| | | |
| | | @Override |
| | | public DN getName() { |
| | | return impl.getName(); |
| | | } |
| | | |
| | | public AttributeParser parseAttribute(AttributeDescription attributeDescription) { |
| | | @Override |
| | | public AttributeParser parseAttribute(final AttributeDescription attributeDescription) { |
| | | return impl.parseAttribute(attributeDescription); |
| | | } |
| | | |
| | | public AttributeParser parseAttribute(String attributeDescription) { |
| | | @Override |
| | | public AttributeParser parseAttribute(final String attributeDescription) { |
| | | return impl.parseAttribute(attributeDescription); |
| | | } |
| | | |
| | | public boolean removeAttribute(Attribute attribute, Collection<? super ByteString> missingValues) { |
| | | @Override |
| | | public boolean removeAttribute(final Attribute attribute, |
| | | final Collection<? super ByteString> missingValues) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public boolean removeAttribute(AttributeDescription attributeDescription) { |
| | | @Override |
| | | public boolean removeAttribute(final AttributeDescription attributeDescription) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public AddRequest removeAttribute(String attributeDescription, Object... values) { |
| | | @Override |
| | | public AddRequest removeAttribute(final String attributeDescription, final Object... values) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public boolean replaceAttribute(Attribute attribute) { |
| | | @Override |
| | | public boolean replaceAttribute(final Attribute attribute) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public AddRequest replaceAttribute(String attributeDescription, Object... values) { |
| | | @Override |
| | | public AddRequest replaceAttribute(final String attributeDescription, final Object... values) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public AddRequest setName(DN dn) { |
| | | @Override |
| | | public AddRequest setName(final DN dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public AddRequest setName(String dn) { |
| | | @Override |
| | | public AddRequest setName(final String dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | final class UnmodifiableAnonymousSASLBindRequestImpl extends |
| | | AbstractUnmodifiableSASLBindRequest<AnonymousSASLBindRequest> implements |
| | | AnonymousSASLBindRequest { |
| | | UnmodifiableAnonymousSASLBindRequestImpl(AnonymousSASLBindRequest impl) { |
| | | UnmodifiableAnonymousSASLBindRequestImpl(final AnonymousSASLBindRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AnonymousSASLBindRequest setTraceString(String traceString) { |
| | | public AnonymousSASLBindRequest setTraceString(final String traceString) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | final class UnmodifiableCRAMMD5SASLBindRequestImpl extends |
| | | AbstractUnmodifiableSASLBindRequest<CRAMMD5SASLBindRequest> implements |
| | | CRAMMD5SASLBindRequest { |
| | | UnmodifiableCRAMMD5SASLBindRequestImpl(CRAMMD5SASLBindRequest impl) { |
| | | UnmodifiableCRAMMD5SASLBindRequestImpl(final CRAMMD5SASLBindRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public CRAMMD5SASLBindRequest setAuthenticationID(String authenticationID) { |
| | | public CRAMMD5SASLBindRequest setAuthenticationID(final String authenticationID) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public CRAMMD5SASLBindRequest setPassword(byte[] password) { |
| | | public CRAMMD5SASLBindRequest setPassword(final byte[] password) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public CRAMMD5SASLBindRequest setPassword(char[] password) { |
| | | public CRAMMD5SASLBindRequest setPassword(final char[] password) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | final class UnmodifiableCancelExtendedRequestImpl extends |
| | | AbstractUnmodifiableExtendedRequest<CancelExtendedRequest, ExtendedResult> implements |
| | | CancelExtendedRequest { |
| | | UnmodifiableCancelExtendedRequestImpl(CancelExtendedRequest impl) { |
| | | UnmodifiableCancelExtendedRequestImpl(final CancelExtendedRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | @Override |
| | | public int getRequestID() { |
| | | return impl.getRequestID(); |
| | | } |
| | | |
| | | public CancelExtendedRequest setRequestID(int id) { |
| | | @Override |
| | | public CancelExtendedRequest setRequestID(final int id) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | final class UnmodifiableCompareRequestImpl extends AbstractUnmodifiableRequest<CompareRequest> |
| | | implements CompareRequest { |
| | | UnmodifiableCompareRequestImpl(CompareRequest impl) { |
| | | UnmodifiableCompareRequestImpl(final CompareRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString getAssertionValue() { |
| | | return impl.getAssertionValue(); |
| | | } |
| | | |
| | | @Override |
| | | public String getAssertionValueAsString() { |
| | | return impl.getAssertionValueAsString(); |
| | | } |
| | | |
| | | @Override |
| | | public AttributeDescription getAttributeDescription() { |
| | | return impl.getAttributeDescription(); |
| | | } |
| | | |
| | | @Override |
| | | public DN getName() { |
| | | return impl.getName(); |
| | | } |
| | | |
| | | public CompareRequest setAssertionValue(Object value) { |
| | | @Override |
| | | public CompareRequest setAssertionValue(final Object value) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public CompareRequest setAttributeDescription(AttributeDescription attributeDescription) { |
| | | @Override |
| | | public CompareRequest setAttributeDescription(final AttributeDescription attributeDescription) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public CompareRequest setAttributeDescription(String attributeDescription) { |
| | | @Override |
| | | public CompareRequest setAttributeDescription(final String attributeDescription) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public CompareRequest setName(DN dn) { |
| | | @Override |
| | | public CompareRequest setName(final DN dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public CompareRequest setName(String dn) { |
| | | @Override |
| | | public CompareRequest setName(final String dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | final class UnmodifiableDeleteRequestImpl extends AbstractUnmodifiableRequest<DeleteRequest> |
| | | implements DeleteRequest { |
| | | UnmodifiableDeleteRequestImpl(DeleteRequest impl) { |
| | | UnmodifiableDeleteRequestImpl(final DeleteRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | public <R, P> R accept(ChangeRecordVisitor<R, P> v, P p) { |
| | | @Override |
| | | public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p) { |
| | | return v.visitChangeRecord(p, this); |
| | | } |
| | | |
| | | @Override |
| | | public DN getName() { |
| | | return impl.getName(); |
| | | } |
| | | |
| | | public DeleteRequest setName(DN dn) { |
| | | @Override |
| | | public DeleteRequest setName(final DN dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public DeleteRequest setName(String dn) { |
| | | @Override |
| | | public DeleteRequest setName(final String dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | final class UnmodifiableDigestMD5SASLBindRequestImpl extends |
| | | AbstractUnmodifiableSASLBindRequest<DigestMD5SASLBindRequest> implements |
| | | DigestMD5SASLBindRequest { |
| | | UnmodifiableDigestMD5SASLBindRequestImpl(DigestMD5SASLBindRequest impl) { |
| | | UnmodifiableDigestMD5SASLBindRequestImpl(final DigestMD5SASLBindRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | @Override |
| | | public DigestMD5SASLBindRequest addAdditionalAuthParam(String name, String value) { |
| | | public DigestMD5SASLBindRequest addAdditionalAuthParam(final String name, final String value) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public DigestMD5SASLBindRequest addQOP(String... qopValues) { |
| | | public DigestMD5SASLBindRequest addQOP(final String... qopValues) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public DigestMD5SASLBindRequest setAuthenticationID(String authenticationID) { |
| | | public DigestMD5SASLBindRequest setAuthenticationID(final String authenticationID) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public DigestMD5SASLBindRequest setAuthorizationID(String authorizationID) { |
| | | public DigestMD5SASLBindRequest setAuthorizationID(final String authorizationID) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public DigestMD5SASLBindRequest setCipher(String cipher) { |
| | | public DigestMD5SASLBindRequest setCipher(final String cipher) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public DigestMD5SASLBindRequest setMaxReceiveBufferSize(int size) { |
| | | public DigestMD5SASLBindRequest setMaxReceiveBufferSize(final int size) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public DigestMD5SASLBindRequest setMaxSendBufferSize(int size) { |
| | | public DigestMD5SASLBindRequest setMaxSendBufferSize(final int size) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public DigestMD5SASLBindRequest setPassword(byte[] password) { |
| | | public DigestMD5SASLBindRequest setPassword(final byte[] password) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public DigestMD5SASLBindRequest setPassword(char[] password) { |
| | | public DigestMD5SASLBindRequest setPassword(final char[] password) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public DigestMD5SASLBindRequest setRealm(String realm) { |
| | | public DigestMD5SASLBindRequest setRealm(final String realm) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public DigestMD5SASLBindRequest setServerAuth(boolean serverAuth) { |
| | | public DigestMD5SASLBindRequest setServerAuth(final boolean serverAuth) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | final class UnmodifiableExternalSASLBindRequestImpl extends |
| | | AbstractUnmodifiableSASLBindRequest<ExternalSASLBindRequest> implements |
| | | ExternalSASLBindRequest { |
| | | UnmodifiableExternalSASLBindRequestImpl(ExternalSASLBindRequest impl) { |
| | | UnmodifiableExternalSASLBindRequestImpl(final ExternalSASLBindRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ExternalSASLBindRequest setAuthorizationID(String authorizationID) { |
| | | public ExternalSASLBindRequest setAuthorizationID(final String authorizationID) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | final class UnmodifiableGSSAPISASLBindRequestImpl extends |
| | | AbstractUnmodifiableSASLBindRequest<GSSAPISASLBindRequest> implements GSSAPISASLBindRequest { |
| | | UnmodifiableGSSAPISASLBindRequestImpl(GSSAPISASLBindRequest impl) { |
| | | UnmodifiableGSSAPISASLBindRequestImpl(final GSSAPISASLBindRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest addAdditionalAuthParam(String name, String value) { |
| | | public GSSAPISASLBindRequest addAdditionalAuthParam(final String name, final String value) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest addQOP(final String... qopValues) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest addQOP(String... qopValues) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public String getAuthenticationID() { |
| | | return impl.getAuthenticationID(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest setAuthenticationID(String authenticationID) { |
| | | public GSSAPISASLBindRequest setAuthenticationID(final String authenticationID) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest setAuthorizationID(String authorizationID) { |
| | | public GSSAPISASLBindRequest setAuthorizationID(final String authorizationID) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest setKDCAddress(String address) { |
| | | public GSSAPISASLBindRequest setKDCAddress(final String address) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest setMaxReceiveBufferSize(int size) { |
| | | public GSSAPISASLBindRequest setMaxReceiveBufferSize(final int size) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest setMaxSendBufferSize(int size) { |
| | | public GSSAPISASLBindRequest setMaxSendBufferSize(final int size) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest setPassword(byte[] password) { |
| | | public GSSAPISASLBindRequest setPassword(final byte[] password) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest setPassword(char[] password) { |
| | | public GSSAPISASLBindRequest setPassword(final char[] password) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest setRealm(String realm) { |
| | | public GSSAPISASLBindRequest setRealm(final String realm) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest setServerAuth(boolean serverAuth) { |
| | | public GSSAPISASLBindRequest setServerAuth(final boolean serverAuth) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public GSSAPISASLBindRequest setSubject(Subject subject) { |
| | | public GSSAPISASLBindRequest setSubject(final Subject subject) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | final class UnmodifiableGenericBindRequestImpl extends |
| | | AbstractUnmodifiableBindRequest<GenericBindRequest> implements GenericBindRequest { |
| | | UnmodifiableGenericBindRequestImpl(GenericBindRequest impl) { |
| | | UnmodifiableGenericBindRequestImpl(final GenericBindRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | @Override |
| | | public byte[] getAuthenticationValue() { |
| | | // Defensive copy. |
| | | return StaticUtils.copyOfBytes(impl.getAuthenticationValue()); |
| | | } |
| | | |
| | | public GenericBindRequest setAuthenticationType(byte type) { |
| | | @Override |
| | | public GenericBindRequest setAuthenticationType(final byte type) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public GenericBindRequest setAuthenticationValue(byte[] bytes) { |
| | | @Override |
| | | public GenericBindRequest setAuthenticationValue(final byte[] bytes) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public GenericBindRequest setName(String name) { |
| | | @Override |
| | | public GenericBindRequest setName(final String name) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | final class UnmodifiableGenericExtendedRequestImpl extends |
| | | AbstractUnmodifiableExtendedRequest<GenericExtendedRequest, GenericExtendedResult> |
| | | implements GenericExtendedRequest { |
| | | UnmodifiableGenericExtendedRequestImpl(GenericExtendedRequest impl) { |
| | | UnmodifiableGenericExtendedRequestImpl(final GenericExtendedRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | public GenericExtendedRequest setOID(String oid) { |
| | | @Override |
| | | public GenericExtendedRequest setOID(final String oid) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public GenericExtendedRequest setValue(Object value) { |
| | | @Override |
| | | public GenericExtendedRequest setValue(final Object value) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | final class UnmodifiableModifyDNRequestImpl extends AbstractUnmodifiableRequest<ModifyDNRequest> |
| | | implements ModifyDNRequest { |
| | | UnmodifiableModifyDNRequestImpl(ModifyDNRequest impl) { |
| | | UnmodifiableModifyDNRequestImpl(final ModifyDNRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | public <R, P> R accept(ChangeRecordVisitor<R, P> v, P p) { |
| | | @Override |
| | | public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p) { |
| | | return v.visitChangeRecord(p, this); |
| | | } |
| | | |
| | | @Override |
| | | public DN getName() { |
| | | return impl.getName(); |
| | | } |
| | | |
| | | @Override |
| | | public RDN getNewRDN() { |
| | | return impl.getNewRDN(); |
| | | } |
| | | |
| | | @Override |
| | | public DN getNewSuperior() { |
| | | return impl.getNewSuperior(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isDeleteOldRDN() { |
| | | return impl.isDeleteOldRDN(); |
| | | } |
| | | |
| | | public ModifyDNRequest setDeleteOldRDN(boolean deleteOldRDN) { |
| | | @Override |
| | | public ModifyDNRequest setDeleteOldRDN(final boolean deleteOldRDN) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public ModifyDNRequest setName(DN dn) { |
| | | @Override |
| | | public ModifyDNRequest setName(final DN dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public ModifyDNRequest setName(String dn) { |
| | | @Override |
| | | public ModifyDNRequest setName(final String dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public ModifyDNRequest setNewRDN(RDN rdn) { |
| | | @Override |
| | | public ModifyDNRequest setNewRDN(final RDN rdn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public ModifyDNRequest setNewRDN(String rdn) { |
| | | @Override |
| | | public ModifyDNRequest setNewRDN(final String rdn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public ModifyDNRequest setNewSuperior(DN dn) { |
| | | @Override |
| | | public ModifyDNRequest setNewSuperior(final DN dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public ModifyDNRequest setNewSuperior(String dn) { |
| | | @Override |
| | | public ModifyDNRequest setNewSuperior(final String dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | final class UnmodifiableModifyRequestImpl extends AbstractUnmodifiableRequest<ModifyRequest> |
| | | implements ModifyRequest { |
| | | UnmodifiableModifyRequestImpl(ModifyRequest impl) { |
| | | UnmodifiableModifyRequestImpl(final ModifyRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | public <R, P> R accept(ChangeRecordVisitor<R, P> v, P p) { |
| | | @Override |
| | | public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p) { |
| | | return v.visitChangeRecord(p, this); |
| | | } |
| | | |
| | | public ModifyRequest addModification(Modification modification) { |
| | | @Override |
| | | public ModifyRequest addModification(final Modification modification) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public ModifyRequest addModification(ModificationType type, String attributeDescription, |
| | | Object... values) { |
| | | @Override |
| | | public ModifyRequest addModification(final ModificationType type, |
| | | final String attributeDescription, final Object... values) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Modification> getModifications() { |
| | | // We need to make all attributes unmodifiable as well. |
| | | Function<Modification, Modification, Void> function = |
| | | final Function<Modification, Modification, Void> function = |
| | | new Function<Modification, Modification, Void>() { |
| | | |
| | | public Modification apply(Modification value, Void p) { |
| | | ModificationType type = value.getModificationType(); |
| | | Attribute attribute = |
| | | @Override |
| | | public Modification apply(final Modification value, final Void p) { |
| | | final ModificationType type = value.getModificationType(); |
| | | final Attribute attribute = |
| | | Attributes.unmodifiableAttribute(value.getAttribute()); |
| | | return new Modification(type, attribute); |
| | | } |
| | | |
| | | }; |
| | | |
| | | List<Modification> unmodifiableModifications = |
| | | final List<Modification> unmodifiableModifications = |
| | | Collections2.transformedList(impl.getModifications(), function, Functions |
| | | .<Modification> identityFunction()); |
| | | return Collections.unmodifiableList(unmodifiableModifications); |
| | | } |
| | | |
| | | @Override |
| | | public DN getName() { |
| | | return impl.getName(); |
| | | } |
| | | |
| | | public ModifyRequest setName(DN dn) { |
| | | @Override |
| | | public ModifyRequest setName(final DN dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public ModifyRequest setName(String dn) { |
| | | @Override |
| | | public ModifyRequest setName(final String dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | extends |
| | | AbstractUnmodifiableExtendedRequest<PasswordModifyExtendedRequest, PasswordModifyExtendedResult> |
| | | implements PasswordModifyExtendedRequest { |
| | | UnmodifiablePasswordModifyExtendedRequestImpl(PasswordModifyExtendedRequest impl) { |
| | | UnmodifiablePasswordModifyExtendedRequestImpl(final PasswordModifyExtendedRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | @Override |
| | | public byte[] getNewPassword() { |
| | | // Defensive copy. |
| | | return StaticUtils.copyOfBytes(impl.getNewPassword()); |
| | | } |
| | | |
| | | @Override |
| | | public byte[] getOldPassword() { |
| | | // Defensive copy. |
| | | return StaticUtils.copyOfBytes(impl.getOldPassword()); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString getUserIdentity() { |
| | | return impl.getUserIdentity(); |
| | | } |
| | | |
| | | @Override |
| | | public String getUserIdentityAsString() { |
| | | return impl.getUserIdentityAsString(); |
| | | } |
| | | |
| | | public PasswordModifyExtendedRequest setNewPassword(byte[] newPassword) { |
| | | @Override |
| | | public PasswordModifyExtendedRequest setNewPassword(final byte[] newPassword) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public PasswordModifyExtendedRequest setNewPassword(char[] newPassword) { |
| | | @Override |
| | | public PasswordModifyExtendedRequest setNewPassword(final char[] newPassword) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public PasswordModifyExtendedRequest setOldPassword(byte[] oldPassword) { |
| | | @Override |
| | | public PasswordModifyExtendedRequest setOldPassword(final byte[] oldPassword) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public PasswordModifyExtendedRequest setOldPassword(char[] oldPassword) { |
| | | @Override |
| | | public PasswordModifyExtendedRequest setOldPassword(final char[] oldPassword) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public PasswordModifyExtendedRequest setUserIdentity(Object userIdentity) { |
| | | @Override |
| | | public PasswordModifyExtendedRequest setUserIdentity(final Object userIdentity) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | final class UnmodifiablePlainSASLBindRequestImpl extends |
| | | AbstractUnmodifiableSASLBindRequest<PlainSASLBindRequest> implements PlainSASLBindRequest { |
| | | UnmodifiablePlainSASLBindRequestImpl(PlainSASLBindRequest impl) { |
| | | UnmodifiablePlainSASLBindRequestImpl(final PlainSASLBindRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PlainSASLBindRequest setAuthenticationID(String authenticationID) { |
| | | public PlainSASLBindRequest setAuthenticationID(final String authenticationID) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public PlainSASLBindRequest setAuthorizationID(String authorizationID) { |
| | | public PlainSASLBindRequest setAuthorizationID(final String authorizationID) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public PlainSASLBindRequest setPassword(byte[] password) { |
| | | public PlainSASLBindRequest setPassword(final byte[] password) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public PlainSASLBindRequest setPassword(char[] password) { |
| | | public PlainSASLBindRequest setPassword(final char[] password) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | final class UnmodifiableSearchRequestImpl extends AbstractUnmodifiableRequest<SearchRequest> |
| | | implements SearchRequest { |
| | | UnmodifiableSearchRequestImpl(SearchRequest impl) { |
| | | UnmodifiableSearchRequestImpl(final SearchRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | public SearchRequest addAttribute(String... attributeDescriptions) { |
| | | @Override |
| | | public SearchRequest addAttribute(final String... attributeDescriptions) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getAttributes() { |
| | | return Collections.unmodifiableList(impl.getAttributes()); |
| | | } |
| | | |
| | | @Override |
| | | public DereferenceAliasesPolicy getDereferenceAliasesPolicy() { |
| | | return impl.getDereferenceAliasesPolicy(); |
| | | } |
| | | |
| | | @Override |
| | | public Filter getFilter() { |
| | | return impl.getFilter(); |
| | | } |
| | | |
| | | @Override |
| | | public DN getName() { |
| | | return impl.getName(); |
| | | } |
| | | |
| | | @Override |
| | | public SearchScope getScope() { |
| | | return impl.getScope(); |
| | | } |
| | | |
| | | @Override |
| | | public int getSizeLimit() { |
| | | return impl.getSizeLimit(); |
| | | } |
| | | |
| | | @Override |
| | | public int getTimeLimit() { |
| | | return impl.getTimeLimit(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isTypesOnly() { |
| | | return impl.isTypesOnly(); |
| | | } |
| | | |
| | | public SearchRequest setDereferenceAliasesPolicy(DereferenceAliasesPolicy policy) { |
| | | @Override |
| | | public SearchRequest setDereferenceAliasesPolicy(final DereferenceAliasesPolicy policy) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchRequest setFilter(Filter filter) { |
| | | @Override |
| | | public SearchRequest setFilter(final Filter filter) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchRequest setFilter(String filter) { |
| | | @Override |
| | | public SearchRequest setFilter(final String filter) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchRequest setName(DN dn) { |
| | | @Override |
| | | public SearchRequest setName(final DN dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchRequest setName(String dn) { |
| | | @Override |
| | | public SearchRequest setName(final String dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchRequest setScope(SearchScope scope) { |
| | | @Override |
| | | public SearchRequest setScope(final SearchScope scope) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchRequest setSizeLimit(int limit) { |
| | | @Override |
| | | public SearchRequest setSizeLimit(final int limit) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchRequest setTimeLimit(int limit) { |
| | | @Override |
| | | public SearchRequest setTimeLimit(final int limit) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchRequest setTypesOnly(boolean typesOnly) { |
| | | @Override |
| | | public SearchRequest setTypesOnly(final boolean typesOnly) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | final class UnmodifiableSimpleBindRequestImpl extends |
| | | AbstractUnmodifiableBindRequest<SimpleBindRequest> implements SimpleBindRequest { |
| | | UnmodifiableSimpleBindRequestImpl(SimpleBindRequest impl) { |
| | | UnmodifiableSimpleBindRequestImpl(final SimpleBindRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | @Override |
| | | public byte[] getPassword() { |
| | | // Defensive copy. |
| | | return StaticUtils.copyOfBytes(impl.getPassword()); |
| | | } |
| | | |
| | | public SimpleBindRequest setName(String name) { |
| | | @Override |
| | | public SimpleBindRequest setName(final String name) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SimpleBindRequest setPassword(byte[] password) { |
| | | @Override |
| | | public SimpleBindRequest setPassword(final byte[] password) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SimpleBindRequest setPassword(char[] password) { |
| | | @Override |
| | | public SimpleBindRequest setPassword(final char[] password) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | final class UnmodifiableStartTLSExtendedRequestImpl extends |
| | | AbstractUnmodifiableExtendedRequest<StartTLSExtendedRequest, ExtendedResult> implements |
| | | StartTLSExtendedRequest { |
| | | UnmodifiableStartTLSExtendedRequestImpl(StartTLSExtendedRequest impl) { |
| | | UnmodifiableStartTLSExtendedRequestImpl(final StartTLSExtendedRequest impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | public SSLContext getSSLContext() { |
| | | return impl.getSSLContext(); |
| | | } |
| | | |
| | | public StartTLSExtendedRequest addEnabledProtocol(String... protocols) { |
| | | @Override |
| | | public StartTLSExtendedRequest addEnabledCipherSuite(final String... suites) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public StartTLSExtendedRequest addEnabledCipherSuite(String... suites) { |
| | | @Override |
| | | public StartTLSExtendedRequest addEnabledProtocol(final String... protocols) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public List<String> getEnabledProtocols() { |
| | | return Collections.unmodifiableList(impl.getEnabledProtocols()); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getEnabledCipherSuites() { |
| | | return Collections.unmodifiableList(impl.getEnabledCipherSuites()); |
| | | } |
| | | |
| | | public StartTLSExtendedRequest setSSLContext(SSLContext sslContext) { |
| | | @Override |
| | | public List<String> getEnabledProtocols() { |
| | | return Collections.unmodifiableList(impl.getEnabledProtocols()); |
| | | } |
| | | |
| | | @Override |
| | | public SSLContext getSSLContext() { |
| | | return impl.getSSLContext(); |
| | | } |
| | | |
| | | @Override |
| | | public StartTLSExtendedRequest setSSLContext(final SSLContext sslContext) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | final class UnmodifiableUnbindRequestImpl extends AbstractUnmodifiableRequest<UnbindRequest> |
| | | implements UnbindRequest { |
| | | UnmodifiableUnbindRequestImpl(UnbindRequest impl) { |
| | | UnmodifiableUnbindRequestImpl(final UnbindRequest impl) { |
| | | super(impl); |
| | | } |
| | | } |
| | |
| | | final class UnmodifiableWhoAmIExtendedRequestImpl extends |
| | | AbstractUnmodifiableExtendedRequest<WhoAmIExtendedRequest, WhoAmIExtendedResult> implements |
| | | WhoAmIExtendedRequest { |
| | | UnmodifiableWhoAmIExtendedRequestImpl(WhoAmIExtendedRequest impl) { |
| | | UnmodifiableWhoAmIExtendedRequestImpl(final WhoAmIExtendedRequest impl) { |
| | | super(impl); |
| | | } |
| | | } |
| | |
| | | public interface WhoAmIExtendedRequest extends ExtendedRequest<WhoAmIExtendedResult> { |
| | | |
| | | /** |
| | | * The OID for the who am I extended operation request. |
| | | */ |
| | | public static final String OID = "1.3.6.1.4.1.4203.1.11.3"; |
| | | |
| | | /** |
| | | * A decoder which can be used to decode who am I extended operation |
| | | * requests. |
| | | */ |
| | |
| | | new WhoAmIExtendedRequestImpl.RequestDecoder(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | * The OID for the who am I extended operation request. |
| | | */ |
| | | public static final String OID = "1.3.6.1.4.1.4203.1.11.3"; |
| | | |
| | | @Override |
| | | WhoAmIExtendedRequest addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getOID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ExtendedResultDecoder<WhoAmIExtendedResult> getResultDecoder(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ByteString getValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean hasValue(); |
| | | } |
| | |
| | | static final class RequestDecoder implements |
| | | ExtendedRequestDecoder<WhoAmIExtendedRequest, WhoAmIExtendedResult> { |
| | | |
| | | @Override |
| | | public WhoAmIExtendedRequest decodeExtendedRequest(final ExtendedRequest<?> request, |
| | | final DecodeOptions options) throws DecodeException { |
| | | // TODO: Check the OID and that the value is not present. |
| | |
| | | |
| | | private static final class ResultDecoder extends |
| | | AbstractExtendedResultDecoder<WhoAmIExtendedResult> { |
| | | public WhoAmIExtendedResult newExtendedErrorResult(final ResultCode resultCode, |
| | | final String matchedDN, final String diagnosticMessage) { |
| | | return Responses.newWhoAmIExtendedResult(resultCode).setMatchedDN(matchedDN) |
| | | .setDiagnosticMessage(diagnosticMessage); |
| | | } |
| | | |
| | | @Override |
| | | public WhoAmIExtendedResult decodeExtendedResult(final ExtendedResult result, |
| | | final DecodeOptions options) throws DecodeException { |
| | | if (result instanceof WhoAmIExtendedResult) { |
| | |
| | | return newResult; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public WhoAmIExtendedResult newExtendedErrorResult(final ResultCode resultCode, |
| | | final String matchedDN, final String diagnosticMessage) { |
| | | return Responses.newWhoAmIExtendedResult(resultCode).setMatchedDN(matchedDN) |
| | | .setDiagnosticMessage(diagnosticMessage); |
| | | } |
| | | } |
| | | |
| | | // No need to expose this. |
| | |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** |
| | | * Creates a new Who Am I extended request that is an exact copy of the |
| | | * provided request. |
| | | * |
| | | * @param whoAmIExtendedRequest |
| | | * The who Am I extended request to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code whoAmIExtendedRequest} was {@code null} . |
| | | */ |
| | | WhoAmIExtendedRequestImpl(final WhoAmIExtendedRequest whoAmIExtendedRequest) { |
| | | super(whoAmIExtendedRequest); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ExtendedResultDecoder<WhoAmIExtendedResult> getResultDecoder() { |
| | | return RESULT_DECODER; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | AbstractResultImpl<S> implements ExtendedResult { |
| | | |
| | | /** |
| | | * Creates a new extended result that is an exact copy of the provided |
| | | * result. |
| | | * |
| | | * @param extendedResult |
| | | * The extended result to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code extendedResult} was {@code null} . |
| | | */ |
| | | protected AbstractExtendedResult(final ExtendedResult extendedResult) { |
| | | super(extendedResult); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new extended result using the provided result code. |
| | | * |
| | | * @param resultCode |
| | |
| | | super(resultCode); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new extended result that is an exact copy of the provided |
| | | * result. |
| | | * |
| | | * @param extendedResult |
| | | * The extended result to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code extendedResult} was {@code null} . |
| | | */ |
| | | protected AbstractExtendedResult(ExtendedResult extendedResult) { |
| | | super(extendedResult); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract String getOID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract ByteString getValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract boolean hasValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | return builder.toString(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | @SuppressWarnings("unchecked") |
| | | final S getThis() { |
| | |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public S adaptDecodeException(final DecodeException exception) { |
| | | final S adaptedResult = |
| | |
| | | return adaptedResult; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public <R extends ExtendedResult> ResultHandler<S> adaptExtendedResultHandler( |
| | | final ExtendedRequest<R> request, final ResultHandler<? super R> resultHandler, |
| | |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract S decodeExtendedResult(ExtendedResult result, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract S newExtendedErrorResult(ResultCode resultCode, String matchedDN, |
| | | String diagnosticMessage); |
| | |
| | | * @throws NullPointerException |
| | | * If {@code intermediateResponse} was {@code null} . |
| | | */ |
| | | protected AbstractIntermediateResponse(IntermediateResponse intermediateResponse) { |
| | | protected AbstractIntermediateResponse(final IntermediateResponse intermediateResponse) { |
| | | super(intermediateResponse); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract String getOID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract ByteString getValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public abstract boolean hasValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | return builder.toString(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | @SuppressWarnings("unchecked") |
| | | final S getThis() { |
| | |
| | | |
| | | private final List<Control> controls = new LinkedList<Control>(); |
| | | |
| | | /** |
| | | * Creates a new modifiable response implementation. |
| | | */ |
| | | AbstractResponseImpl() { |
| | | // No implementation required. |
| | | } |
| | | |
| | | /** |
| | | * Creates a new abstract response that is an exact copy of the provided |
| | | * response. |
| | | * |
| | | * @param response |
| | | * The response to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code response} was {@code null} . |
| | | */ |
| | | AbstractResponseImpl(final Response response) { |
| | | Validator.ensureNotNull(response); |
| | | for (final Control control : response.getControls()) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final S addControl(final Control control) { |
| | | Validator.ensureNotNull(control); |
| | |
| | | return getThis(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean containsControl(final String oid) { |
| | | return getControl(controls, oid) != null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final <C extends Control> C getControl(final ControlDecoder<C> decoder, |
| | | final DecodeOptions options) throws DecodeException { |
| | |
| | | return control != null ? decoder.decodeControl(control, options) : null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final List<Control> getControls() { |
| | | return controls; |
| | |
| | | Result { |
| | | // For local errors caused by internal exceptions. |
| | | private Throwable cause = null; |
| | | |
| | | private String diagnosticMessage = ""; |
| | | |
| | | private String matchedDN = ""; |
| | | |
| | | private final List<String> referralURIs = new LinkedList<String>(); |
| | | |
| | | private ResultCode resultCode; |
| | | |
| | | /** |
| | | * Creates a new modifiable result implementation using the provided result |
| | | * code. |
| | | * |
| | | * @param resultCode |
| | | * The result code. |
| | | * @throws NullPointerException |
| | | * If {@code resultCode} was {@code null}. |
| | | */ |
| | | AbstractResultImpl(final ResultCode resultCode) { |
| | | this.resultCode = resultCode; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new modifiable result that is an exact copy of the provided |
| | | * result. |
| | | * |
| | | * @param result |
| | | * The result to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | AbstractResultImpl(Result result) { |
| | | AbstractResultImpl(final Result result) { |
| | | super(result); |
| | | this.cause = result.getCause(); |
| | | this.diagnosticMessage = result.getDiagnosticMessage(); |
| | |
| | | this.resultCode = result.getResultCode(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | AbstractResultImpl(final ResultCode resultCode) { |
| | | this.resultCode = resultCode; |
| | | } |
| | | |
| | | @Override |
| | | public final S addReferralURI(final String uri) { |
| | | Validator.ensureNotNull(uri); |
| | | |
| | |
| | | return getThis(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final Throwable getCause() { |
| | | return cause; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final String getDiagnosticMessage() { |
| | | return diagnosticMessage; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final String getMatchedDN() { |
| | | return matchedDN; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final List<String> getReferralURIs() { |
| | | return referralURIs; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final ResultCode getResultCode() { |
| | | return resultCode; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final boolean isReferral() { |
| | | final ResultCode code = getResultCode(); |
| | | return code.equals(ResultCode.REFERRAL); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final boolean isSuccess() { |
| | | final ResultCode code = getResultCode(); |
| | | return !code.isExceptional(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final S setCause(final Throwable cause) { |
| | | this.cause = cause; |
| | | return getThis(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final S setDiagnosticMessage(final String message) { |
| | | if (message == null) { |
| | | this.diagnosticMessage = ""; |
| | |
| | | return getThis(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final S setMatchedDN(final String dn) { |
| | | if (dn == null) { |
| | | this.matchedDN = ""; |
| | |
| | | return getThis(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final S setResultCode(final ResultCode resultCode) { |
| | | Validator.ensureNotNull(resultCode); |
| | | |
| | |
| | | */ |
| | | abstract class AbstractUnmodifiableExtendedResultImpl<S extends ExtendedResult> extends |
| | | AbstractUnmodifiableResultImpl<S> implements ExtendedResult { |
| | | protected AbstractUnmodifiableExtendedResultImpl(S impl) { |
| | | AbstractUnmodifiableExtendedResultImpl(final S impl) { |
| | | super(impl); |
| | | } |
| | | |
| | |
| | | */ |
| | | abstract class AbstractUnmodifiableIntermediateResponseImpl<S extends IntermediateResponse> extends |
| | | AbstractUnmodifiableResponseImpl<S> implements IntermediateResponse { |
| | | protected AbstractUnmodifiableIntermediateResponseImpl(S impl) { |
| | | AbstractUnmodifiableIntermediateResponseImpl(final S impl) { |
| | | super(impl); |
| | | } |
| | | |
| | |
| | | |
| | | protected final S impl; |
| | | |
| | | /** |
| | | * Creates a new unmodifiable response implementation. |
| | | * |
| | | * @param impl |
| | | * The underlying response implementation to be made |
| | | * unmodifiable. |
| | | */ |
| | | AbstractUnmodifiableResponseImpl(final S impl) { |
| | | Validator.ensureNotNull(impl); |
| | | this.impl = impl; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final S addControl(final Control control) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean containsControl(final String oid) { |
| | | return impl.containsControl(oid); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final <C extends Control> C getControl(final ControlDecoder<C> decoder, |
| | | final DecodeOptions options) throws DecodeException { |
| | |
| | | // Got a match. Return a defensive copy only if necessary. |
| | | final C decodedControl = decoder.decodeControl(control, options); |
| | | if (decodedControl != control) { |
| | | // This was not the original control so return it |
| | | // immediately. |
| | | /* |
| | | * This was not the original control so return it immediately. |
| | | */ |
| | | return decodedControl; |
| | | } else if (decodedControl instanceof GenericControl) { |
| | | // Generic controls are immutable, so return it immediately. |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final List<Control> getControls() { |
| | | // We need to make all controls unmodifiable as well, which implies |
| | | // making |
| | | // defensive copies where necessary. |
| | | /* |
| | | * We need to make all controls unmodifiable as well, which implies |
| | | * making defensive copies where necessary. |
| | | */ |
| | | final Function<Control, Control, Void> function = new Function<Control, Control, Void>() { |
| | | |
| | | @Override |
| | |
| | | return Collections.unmodifiableList(unmodifiableControls); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final String toString() { |
| | | return impl.toString(); |
| | |
| | | abstract class AbstractUnmodifiableResultImpl<S extends Result> extends |
| | | AbstractUnmodifiableResponseImpl<S> implements Result { |
| | | |
| | | /** |
| | | * Creates a new unmodifiable result implementation. |
| | | * |
| | | * @param impl |
| | | * The underlying result implementation to be made unmodifiable. |
| | | */ |
| | | AbstractUnmodifiableResultImpl(final S impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | @Override |
| | | public final S addReferralURI(final String uri) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public final Throwable getCause() { |
| | | return impl.getCause(); |
| | | } |
| | | |
| | | @Override |
| | | public final String getDiagnosticMessage() { |
| | | return impl.getDiagnosticMessage(); |
| | | } |
| | | |
| | | @Override |
| | | public final String getMatchedDN() { |
| | | return impl.getMatchedDN(); |
| | | } |
| | | |
| | | @Override |
| | | public final List<String> getReferralURIs() { |
| | | return Collections.unmodifiableList(impl.getReferralURIs()); |
| | | } |
| | | |
| | | @Override |
| | | public final ResultCode getResultCode() { |
| | | return impl.getResultCode(); |
| | | } |
| | | |
| | | @Override |
| | | public final boolean isReferral() { |
| | | return impl.isReferral(); |
| | | } |
| | | |
| | | @Override |
| | | public final boolean isSuccess() { |
| | | return impl.isSuccess(); |
| | | } |
| | | |
| | | @Override |
| | | public final S setCause(final Throwable cause) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public final S setDiagnosticMessage(final String message) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public final S setMatchedDN(final String dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public final S setResultCode(final ResultCode resultCode) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | |
| | | * the {@link #isSASLBindInProgress} method. |
| | | */ |
| | | public interface BindResult extends Result { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | BindResult addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindResult addReferralURI(String uri); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Throwable getCause(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getDiagnosticMessage(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getMatchedDN(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<String> getReferralURIs(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ResultCode getResultCode(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | ByteString getServerSASLCredentials(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean isReferral(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | boolean isSASLBindInProgress(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean isSuccess(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindResult setCause(Throwable cause); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindResult setDiagnosticMessage(String message); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindResult setMatchedDN(String dn); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | BindResult setResultCode(ResultCode resultCode); |
| | | |
| | | /** |
| | |
| | | final class BindResultImpl extends AbstractResultImpl<BindResult> implements BindResult { |
| | | private ByteString credentials = null; |
| | | |
| | | /** |
| | | * Creates a new bind result using the provided result code. |
| | | * |
| | | * @param resultCode |
| | | * The result code. |
| | | * @throws NullPointerException |
| | | * If {@code resultCode} was {@code null}. |
| | | */ |
| | | BindResultImpl(final ResultCode resultCode) { |
| | | super(resultCode); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new bind result that is an exact copy of the provided result. |
| | | * |
| | | * @param bindResult |
| | | * The bind result to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code bindResult} was {@code null} . |
| | | */ |
| | | BindResultImpl(final BindResult bindResult) { |
| | | super(bindResult); |
| | | this.credentials = bindResult.getServerSASLCredentials(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | BindResultImpl(final ResultCode resultCode) { |
| | | super(resultCode); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString getServerSASLCredentials() { |
| | | return credentials; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isSASLBindInProgress() { |
| | | final ResultCode code = getResultCode(); |
| | | return code.equals(ResultCode.SASL_BIND_IN_PROGRESS); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public BindResult setServerSASLCredentials(final ByteString credentials) { |
| | | this.credentials = credentials; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * </pre> |
| | | */ |
| | | public interface CompareResult extends Result { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | CompareResult addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | CompareResult addReferralURI(String uri); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Throwable getCause(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getDiagnosticMessage(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getMatchedDN(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<String> getReferralURIs(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ResultCode getResultCode(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean isReferral(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean isSuccess(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | boolean matched(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | CompareResult setCause(Throwable cause); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | CompareResult setDiagnosticMessage(String message); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | CompareResult setMatchedDN(String dn); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | CompareResult setResultCode(ResultCode resultCode); |
| | | |
| | | } |
| | |
| | | */ |
| | | final class CompareResultImpl extends AbstractResultImpl<CompareResult> implements CompareResult { |
| | | |
| | | /** |
| | | * Creates a new compare result using the provided result code. |
| | | * |
| | | * @param resultCode |
| | | * The result code. |
| | | * @throws NullPointerException |
| | | * If {@code resultCode} was {@code null}. |
| | | */ |
| | | CompareResultImpl(final ResultCode resultCode) { |
| | | super(resultCode); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new compare result that is an exact copy of the provided |
| | | * result. |
| | | * |
| | | * @param compareResult |
| | | * The compare result to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code compareResult} was {@code null} . |
| | | */ |
| | | CompareResultImpl(final CompareResult compareResult) { |
| | | super(compareResult); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | CompareResultImpl(final ResultCode resultCode) { |
| | | super(resultCode); |
| | | } |
| | | |
| | | @Override |
| | | public boolean matched() { |
| | | final ResultCode code = getResultCode(); |
| | | return code.equals(ResultCode.COMPARE_TRUE); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * {@link #getOID} and {@link #getValue} methods respectively. |
| | | */ |
| | | public interface ExtendedResult extends Result { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | ExtendedResult addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ExtendedResult addReferralURI(String uri); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Throwable getCause(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getDiagnosticMessage(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getMatchedDN(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | String getOID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<String> getReferralURIs(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ResultCode getResultCode(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | boolean hasValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean isReferral(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean isSuccess(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ExtendedResult setCause(Throwable cause); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ExtendedResult setDiagnosticMessage(String message); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ExtendedResult setMatchedDN(String dn); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ExtendedResult setResultCode(ResultCode resultCode); |
| | | } |
| | |
| | | * operation. |
| | | */ |
| | | public interface GenericExtendedResult extends ExtendedResult { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | GenericExtendedResult addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | GenericExtendedResult addReferralURI(String uri); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Throwable getCause(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getDiagnosticMessage(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getMatchedDN(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getOID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<String> getReferralURIs(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ResultCode getResultCode(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ByteString getValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean hasValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean isReferral(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean isSuccess(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | GenericExtendedResult setCause(Throwable cause); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | GenericExtendedResult setDiagnosticMessage(String message); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | GenericExtendedResult setMatchedDN(String dn); |
| | | |
| | | /** |
| | |
| | | */ |
| | | GenericExtendedResult setOID(String oid); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | GenericExtendedResult setResultCode(ResultCode resultCode); |
| | | |
| | | /** |
| | |
| | | private String responseName = null; |
| | | private ByteString responseValue = null; |
| | | |
| | | /** |
| | | * Creates a new generic extended result using the provided result code. |
| | | * |
| | | * @param resultCode |
| | | * The result code. |
| | | * @throws NullPointerException |
| | | * If {@code resultCode} was {@code null}. |
| | | */ |
| | | GenericExtendedResultImpl(final ResultCode resultCode) { |
| | | super(resultCode); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic extended result that is an exact copy of the |
| | | * provided result. |
| | | * |
| | | * @param genericExtendedResult |
| | | * The generic extended result to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code genericExtendedResult} was {@code null} . |
| | | */ |
| | | GenericExtendedResultImpl(final GenericExtendedResult genericExtendedResult) { |
| | | super(genericExtendedResult); |
| | | this.responseName = genericExtendedResult.getOID(); |
| | | this.responseValue = genericExtendedResult.getValue(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | GenericExtendedResultImpl(final ResultCode resultCode) { |
| | | super(resultCode); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return responseName; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return responseValue; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return responseValue != null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GenericExtendedResult setOID(final String oid) { |
| | | this.responseName = oid; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GenericExtendedResult setValue(final Object value) { |
| | | this.responseValue = value != null ? ByteString.valueOf(value) : null; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * unrecognized or unsupported Intermediate responses to the client. |
| | | */ |
| | | public interface GenericIntermediateResponse extends IntermediateResponse { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | GenericIntermediateResponse addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getOID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ByteString getValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean hasValue(); |
| | | |
| | | /** |
| | |
| | | private String responseName = null; |
| | | private ByteString responseValue = null; |
| | | |
| | | /** |
| | | * Creates a new generic intermediate response with no name or value. |
| | | */ |
| | | GenericIntermediateResponseImpl() { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic intermediate response that is an exact copy of the |
| | | * provided result. |
| | | * |
| | | * @param genericIntermediateResponse |
| | | * The generic intermediate response to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code genericExtendedResult} was {@code null} . |
| | | */ |
| | | GenericIntermediateResponseImpl(final GenericIntermediateResponse genericIntermediateResponse) { |
| | | super(genericIntermediateResponse); |
| | | this.responseName = genericIntermediateResponse.getOID(); |
| | | this.responseValue = genericIntermediateResponse.getValue(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getOID() { |
| | | return responseName; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return responseValue; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return responseValue != null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GenericIntermediateResponse setOID(final String oid) { |
| | | this.responseName = oid; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public GenericIntermediateResponse setValue(final Object value) { |
| | | this.responseValue = value != null ? ByteString.valueOf(value) : null; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * Directory Access Protocol (LDAP) Intermediate Response Message</a> |
| | | */ |
| | | public interface IntermediateResponse extends Response { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | IntermediateResponse addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | public interface PasswordModifyExtendedResult extends ExtendedResult { |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | PasswordModifyExtendedResult addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | PasswordModifyExtendedResult addReferralURI(String uri); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Throwable getCause(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getDiagnosticMessage(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | byte[] getGeneratedPassword(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getMatchedDN(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getOID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<String> getReferralURIs(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ResultCode getResultCode(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ByteString getValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean hasValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean isReferral(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean isSuccess(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | PasswordModifyExtendedResult setCause(Throwable cause); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | PasswordModifyExtendedResult setDiagnosticMessage(String message); |
| | | |
| | | /** |
| | |
| | | */ |
| | | PasswordModifyExtendedResult setGeneratedPassword(char[] password); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | PasswordModifyExtendedResult setMatchedDN(String dn); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | PasswordModifyExtendedResult setResultCode(ResultCode resultCode); |
| | | |
| | | } |
| | |
| | | final class PasswordModifyExtendedResultImpl extends |
| | | AbstractExtendedResult<PasswordModifyExtendedResult> implements |
| | | PasswordModifyExtendedResult { |
| | | private byte[] password; |
| | | |
| | | /** |
| | | * The ASN.1 element type that will be used to encode the genPasswd |
| | | * component in a password modify extended response. |
| | | */ |
| | | private static final byte TYPE_PASSWORD_MODIFY_GENERATED_PASSWORD = (byte) 0x80; |
| | | |
| | | // Instantiation via factory. |
| | | PasswordModifyExtendedResultImpl(final ResultCode resultCode) { |
| | | super(resultCode); |
| | | } |
| | | private byte[] password; |
| | | |
| | | /** |
| | | * Creates a new password modify extended result that is an exact copy of |
| | | * the provided result. |
| | | * |
| | | * @param passwordModifyExtendedResult |
| | | * The password modify extended result to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code passwordModifyExtendedResult} was {@code null} . |
| | | */ |
| | | PasswordModifyExtendedResultImpl(final PasswordModifyExtendedResult passwordModifyExtendedResult) { |
| | | super(passwordModifyExtendedResult); |
| | | this.password = passwordModifyExtendedResult.getGeneratedPassword(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | // Instantiation via factory. |
| | | PasswordModifyExtendedResultImpl(final ResultCode resultCode) { |
| | | super(resultCode); |
| | | } |
| | | |
| | | @Override |
| | | public byte[] getGeneratedPassword() { |
| | | return password; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getOID() { |
| | | // No response name defined. |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | if (password != null) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return password != null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public PasswordModifyExtendedResult setGeneratedPassword(final byte[] password) { |
| | | this.password = password; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public PasswordModifyExtendedResult setGeneratedPassword(final char[] password) { |
| | | this.password = (password != null) ? StaticUtils.getBytes(password) : null; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | // TODO: synchronized requests? |
| | | |
| | | /** |
| | | * Creates a new bind result that is an exact copy of the provided result. |
| | | * |
| | | * @param result |
| | | * The bind result to be copied. |
| | | * @return The new bind result. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | public static BindResult copyOfBindResult(final BindResult result) { |
| | | return new BindResultImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new compare result that is an exact copy of the provided |
| | | * result. |
| | | * |
| | | * @param result |
| | | * The compare result to be copied. |
| | | * @return The new compare result. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | public static CompareResult copyOfCompareResult(final CompareResult result) { |
| | | return new CompareResultImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic extended result that is an exact copy of the |
| | | * provided result. |
| | | * |
| | | * @param result |
| | | * The generic extended result to be copied. |
| | | * @return The new generic extended result. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | public static GenericExtendedResult copyOfGenericExtendedResult( |
| | | final GenericExtendedResult result) { |
| | | return new GenericExtendedResultImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic intermediate response that is an exact copy of the |
| | | * provided response. |
| | | * |
| | | * @param result |
| | | * The generic intermediate response to be copied. |
| | | * @return The new generic intermediate response. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | public static GenericIntermediateResponse copyOfGenericIntermediateResponse( |
| | | final GenericIntermediateResponse result) { |
| | | return new GenericIntermediateResponseImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new password modify extended result that is an exact copy of |
| | | * the provided result. |
| | | * |
| | | * @param result |
| | | * The password modify extended result to be copied. |
| | | * @return The new password modify extended result. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | public static PasswordModifyExtendedResult copyOfPasswordModifyExtendedResult( |
| | | final PasswordModifyExtendedResult result) { |
| | | return new PasswordModifyExtendedResultImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new result that is an exact copy of the provided result. |
| | | * |
| | | * @param result |
| | | * The result to be copied. |
| | | * @return The new result. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | public static Result copyOfResult(final Result result) { |
| | | return new ResultImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new search result entry that is an exact copy of the provided |
| | | * result. |
| | | * |
| | | * @param entry |
| | | * The search result entry to be copied. |
| | | * @return The new search result entry. |
| | | * @throws NullPointerException |
| | | * If {@code entry} was {@code null}. |
| | | */ |
| | | public static SearchResultEntry copyOfSearchResultEntry(final SearchResultEntry entry) { |
| | | return new SearchResultEntryImpl(entry); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new search result reference that is an exact copy of the |
| | | * provided result. |
| | | * |
| | | * @param reference |
| | | * The search result reference to be copied. |
| | | * @return The new search result reference. |
| | | * @throws NullPointerException |
| | | * If {@code reference} was {@code null}. |
| | | */ |
| | | public static SearchResultReference copyOfSearchResultReference( |
| | | final SearchResultReference reference) { |
| | | return new SearchResultReferenceImpl(reference); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new who am I extended result that is an exact copy of the |
| | | * provided result. |
| | | * |
| | | * @param result |
| | | * The who am I result to be copied. |
| | | * @return The new who am I extended result. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null} . |
| | | */ |
| | | public static WhoAmIExtendedResult copyOfWhoAmIExtendedResult(final WhoAmIExtendedResult result) { |
| | | return new WhoAmIExtendedResultImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new bind result using the provided result code. |
| | | * |
| | | * @param resultCode |
| | |
| | | return new UnmodifiableWhoAmIExtendedResultImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new bind result that is an exact copy of the provided result. |
| | | * |
| | | * @param result |
| | | * The bind result to be copied. |
| | | * @return The new bind result. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | public static BindResult copyOfBindResult(final BindResult result) { |
| | | return new BindResultImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new compare result that is an exact copy of the provided |
| | | * result. |
| | | * |
| | | * @param result |
| | | * The compare result to be copied. |
| | | * @return The new compare result. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | public static CompareResult copyOfCompareResult(final CompareResult result) { |
| | | return new CompareResultImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic extended result that is an exact copy of the |
| | | * provided result. |
| | | * |
| | | * @param result |
| | | * The generic extended result to be copied. |
| | | * @return The new generic extended result. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | public static GenericExtendedResult copyOfGenericExtendedResult( |
| | | final GenericExtendedResult result) { |
| | | return new GenericExtendedResultImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new generic intermediate response that is an exact copy of the |
| | | * provided response. |
| | | * |
| | | * @param result |
| | | * The generic intermediate response to be copied. |
| | | * @return The new generic intermediate response. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | public static GenericIntermediateResponse copyOfGenericIntermediateResponse( |
| | | final GenericIntermediateResponse result) { |
| | | return new GenericIntermediateResponseImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new password modify extended result that is an exact copy of |
| | | * the provided result. |
| | | * |
| | | * @param result |
| | | * The password modify extended result to be copied. |
| | | * @return The new password modify extended result. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | public static PasswordModifyExtendedResult copyOfPasswordModifyExtendedResult( |
| | | final PasswordModifyExtendedResult result) { |
| | | return new PasswordModifyExtendedResultImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new result that is an exact copy of the provided result. |
| | | * |
| | | * @param result |
| | | * The result to be copied. |
| | | * @return The new result. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null}. |
| | | */ |
| | | public static Result copyOfResult(final Result result) { |
| | | return new ResultImpl(result); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new search result entry that is an exact copy of the provided |
| | | * result. |
| | | * |
| | | * @param entry |
| | | * The search result entry to be copied. |
| | | * @return The new search result entry. |
| | | * @throws NullPointerException |
| | | * If {@code entry} was {@code null}. |
| | | */ |
| | | public static SearchResultEntry copyOfSearchResultEntry(final SearchResultEntry entry) { |
| | | return new SearchResultEntryImpl(entry); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new search result reference that is an exact copy of the |
| | | * provided result. |
| | | * |
| | | * @param reference |
| | | * The search result reference to be copied. |
| | | * @return The new search result reference. |
| | | * @throws NullPointerException |
| | | * If {@code reference} was {@code null}. |
| | | */ |
| | | public static SearchResultReference copyOfSearchResultReference( |
| | | final SearchResultReference reference) { |
| | | return new SearchResultReferenceImpl(reference); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new who am I extended result that is an exact copy of the |
| | | * provided result. |
| | | * |
| | | * @param result |
| | | * The who am I result to be copied. |
| | | * @return The new who am I extended result. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null} . |
| | | */ |
| | | public static WhoAmIExtendedResult copyOfWhoAmIExtendedResult(final WhoAmIExtendedResult result) { |
| | | return new WhoAmIExtendedResultImpl(result); |
| | | } |
| | | |
| | | // Private constructor. |
| | | private Responses() { |
| | | // Prevent instantiation. |
| | |
| | | * </ul> |
| | | */ |
| | | public interface Result extends Response { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | Result addControl(Control control); |
| | | |
| | | /** |
| | |
| | | */ |
| | | Throwable getCause(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | final class ResultImpl extends AbstractResultImpl<Result> implements Result { |
| | | |
| | | /** |
| | | * Creates a new generic result using the provided result code. |
| | | * |
| | | * @param resultCode |
| | | * The result code. |
| | | * @throws NullPointerException |
| | | * If {@code resultCode} was {@code null}. |
| | | */ |
| | | ResultImpl(final ResultCode resultCode) { |
| | | super(resultCode); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new result that is an exact copy of the provided result. |
| | | * |
| | | * @param result |
| | | * The result to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code result} was {@code null} . |
| | | */ |
| | | ResultImpl(final Result result) { |
| | | super(result); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | ResultImpl(final ResultCode resultCode) { |
| | | super(resultCode); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * the return of values, or other reasons. |
| | | */ |
| | | public interface SearchResultEntry extends Response, Entry { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | boolean addAttribute(Attribute attribute); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean addAttribute(Attribute attribute, Collection<? super ByteString> duplicateValues); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | SearchResultEntry addAttribute(String attributeDescription, Object... values); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | SearchResultEntry addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | SearchResultEntry clearAttributes(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean containsAttribute(Attribute attribute, Collection<? super ByteString> missingValues); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean containsAttribute(String attributeDescription, Object... values); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Iterable<Attribute> getAllAttributes(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Iterable<Attribute> getAllAttributes(String attributeDescription); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Attribute getAttribute(AttributeDescription attributeDescription); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Attribute getAttribute(String attributeDescription); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | int getAttributeCount(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | DN getName(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean removeAttribute(Attribute attribute, Collection<? super ByteString> missingValues); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean removeAttribute(AttributeDescription attributeDescription); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | SearchResultEntry removeAttribute(String attributeDescription, Object... values); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean replaceAttribute(Attribute attribute); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | SearchResultEntry replaceAttribute(String attributeDescription, Object... values); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | SearchResultEntry setName(DN dn); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | SearchResultEntry setName(String dn); |
| | | |
| | | } |
| | |
| | | |
| | | private final Entry entry; |
| | | |
| | | /** |
| | | * Creates a new search result entry backed by the provided entry. |
| | | * Modifications made to {@code entry} will be reflected in the returned |
| | | * search result entry. The returned search result entry supports updates to |
| | | * its list of controls, as well as updates to the name and attributes if |
| | | * the underlying entry allows. |
| | | * |
| | | * @param entry |
| | | * The entry. |
| | | * @throws NullPointerException |
| | | * If {@code entry} was {@code null} . |
| | | */ |
| | | SearchResultEntryImpl(final Entry entry) { |
| | | this.entry = entry; |
| | | } |
| | | |
| | | /** |
| | | * Creates a new search result entry that is an exact copy of the provided |
| | | * result. |
| | | * |
| | | * @param searchResultEntry |
| | | * The search result entry to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code searchResultEntry} was {@code null} . |
| | | */ |
| | | SearchResultEntryImpl(final SearchResultEntry searchResultEntry) { |
| | | super(searchResultEntry); |
| | | this.entry = LinkedHashMapEntry.deepCopyOfEntry(searchResultEntry); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean addAttribute(final Attribute attribute) { |
| | | return entry.addAttribute(attribute); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean addAttribute(final Attribute attribute, |
| | | final Collection<? super ByteString> duplicateValues) { |
| | | return entry.addAttribute(attribute, duplicateValues); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchResultEntry addAttribute(final String attributeDescription, final Object... values) { |
| | | entry.addAttribute(attributeDescription, values); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchResultEntry clearAttributes() { |
| | | entry.clearAttributes(); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean containsAttribute(final Attribute attribute, |
| | | final Collection<? super ByteString> missingValues) { |
| | | return entry.containsAttribute(attribute, missingValues); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean containsAttribute(final String attributeDescription, final Object... values) { |
| | | return entry.containsAttribute(attributeDescription, values); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean equals(final Object object) { |
| | | return entry.equals(object); |
| | | } |
| | | |
| | | @Override |
| | | public Iterable<Attribute> getAllAttributes() { |
| | | return entry.getAllAttributes(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Iterable<Attribute> getAllAttributes(final AttributeDescription attributeDescription) { |
| | | return entry.getAllAttributes(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Iterable<Attribute> getAllAttributes(final String attributeDescription) { |
| | | return entry.getAllAttributes(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Attribute getAttribute(final AttributeDescription attributeDescription) { |
| | | return entry.getAttribute(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Attribute getAttribute(final String attributeDescription) { |
| | | return entry.getAttribute(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int getAttributeCount() { |
| | | return entry.getAttributeCount(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getName() { |
| | | return entry.getName(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public AttributeParser parseAttribute(AttributeDescription attributeDescription) { |
| | | @Override |
| | | public int hashCode() { |
| | | return entry.hashCode(); |
| | | } |
| | | |
| | | @Override |
| | | public AttributeParser parseAttribute(final AttributeDescription attributeDescription) { |
| | | return entry.parseAttribute(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public AttributeParser parseAttribute(String attributeDescription) { |
| | | @Override |
| | | public AttributeParser parseAttribute(final String attributeDescription) { |
| | | return entry.parseAttribute(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean removeAttribute(final Attribute attribute, |
| | | final Collection<? super ByteString> missingValues) { |
| | | return entry.removeAttribute(attribute, missingValues); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean removeAttribute(final AttributeDescription attributeDescription) { |
| | | return entry.removeAttribute(attributeDescription); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchResultEntry removeAttribute(final String attributeDescription, |
| | | final Object... values) { |
| | | entry.removeAttribute(attributeDescription, values); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean replaceAttribute(final Attribute attribute) { |
| | | return entry.replaceAttribute(attribute); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchResultEntry replaceAttribute(final String attributeDescription, |
| | | final Object... values) { |
| | | entry.replaceAttribute(attributeDescription, values); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchResultEntry setName(final DN dn) { |
| | | entry.setName(dn); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public SearchResultEntry setName(final String dn) { |
| | | entry.setName(dn); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int hashCode() { |
| | | return entry.hashCode(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean equals(final Object object) { |
| | | return entry.equals(object); |
| | | } |
| | | |
| | | } |
| | |
| | | * operation. |
| | | */ |
| | | public interface SearchResultReference extends Response { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | |
| | | @Override |
| | | SearchResultReference addControl(Control control); |
| | | |
| | | /** |
| | |
| | | */ |
| | | SearchResultReference addURI(String uri); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | |
| | | |
| | | private final List<String> uris = new LinkedList<String>(); |
| | | |
| | | /** |
| | | * Creates a new search result reference using the provided continuation |
| | | * reference URI. |
| | | * |
| | | * @param uri |
| | | * The first continuation reference URI to be added to this |
| | | * search result reference. |
| | | * @throws NullPointerException |
| | | * If {@code uri} was {@code null}. |
| | | */ |
| | | SearchResultReferenceImpl(final String uri) { |
| | | addURI(uri); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new search result reference that is an exact copy of the |
| | | * provided result. |
| | | * |
| | | * @param searchResultReference |
| | | * The search result reference to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code searchResultReference} was {@code null} . |
| | | */ |
| | | SearchResultReferenceImpl(final SearchResultReference searchResultReference) { |
| | | super(searchResultReference); |
| | | this.uris.addAll(searchResultReference.getURIs()); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | SearchResultReferenceImpl(final String uri) { |
| | | addURI(uri); |
| | | } |
| | | |
| | | @Override |
| | | public SearchResultReference addURI(final String uri) { |
| | | Validator.ensureNotNull(uri); |
| | | uris.add(uri); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public List<String> getURIs() { |
| | | return uris; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | */ |
| | | class UnmodifiableBindResultImpl extends AbstractUnmodifiableResultImpl<BindResult> implements |
| | | BindResult { |
| | | public UnmodifiableBindResultImpl(BindResult impl) { |
| | | UnmodifiableBindResultImpl(final BindResult impl) { |
| | | super(impl); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public BindResult setServerSASLCredentials(ByteString credentials) { |
| | | public BindResult setServerSASLCredentials(final ByteString credentials) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | class UnmodifiableCompareResultImpl extends AbstractUnmodifiableResultImpl<CompareResult> implements |
| | | CompareResult { |
| | | UnmodifiableCompareResultImpl(CompareResult impl) { |
| | | UnmodifiableCompareResultImpl(final CompareResult impl) { |
| | | super(impl); |
| | | } |
| | | |
| | |
| | | class UnmodifiableGenericExtendedResultImpl extends |
| | | AbstractUnmodifiableExtendedResultImpl<GenericExtendedResult> implements ExtendedResult, |
| | | GenericExtendedResult { |
| | | UnmodifiableGenericExtendedResultImpl(GenericExtendedResult impl) { |
| | | UnmodifiableGenericExtendedResultImpl(final GenericExtendedResult impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | @Override |
| | | public GenericExtendedResult setOID(String oid) { |
| | | public GenericExtendedResult setOID(final String oid) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public GenericExtendedResult setValue(Object value) { |
| | | public GenericExtendedResult setValue(final Object value) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | class UnmodifiableGenericIntermediateResponseImpl extends |
| | | AbstractUnmodifiableIntermediateResponseImpl<GenericIntermediateResponse> implements |
| | | GenericIntermediateResponse { |
| | | UnmodifiableGenericIntermediateResponseImpl(GenericIntermediateResponse impl) { |
| | | UnmodifiableGenericIntermediateResponseImpl(final GenericIntermediateResponse impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | @Override |
| | | public GenericIntermediateResponse setOID(String oid) { |
| | | public GenericIntermediateResponse setOID(final String oid) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public GenericIntermediateResponse setValue(Object value) { |
| | | public GenericIntermediateResponse setValue(final Object value) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | class UnmodifiablePasswordModifyExtendedResultImpl extends |
| | | AbstractUnmodifiableExtendedResultImpl<PasswordModifyExtendedResult> implements |
| | | PasswordModifyExtendedResult { |
| | | UnmodifiablePasswordModifyExtendedResultImpl(PasswordModifyExtendedResult impl) { |
| | | UnmodifiablePasswordModifyExtendedResultImpl(final PasswordModifyExtendedResult impl) { |
| | | super(impl); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PasswordModifyExtendedResult setGeneratedPassword(byte[] password) { |
| | | public PasswordModifyExtendedResult setGeneratedPassword(final byte[] password) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public PasswordModifyExtendedResult setGeneratedPassword(char[] password) { |
| | | public PasswordModifyExtendedResult setGeneratedPassword(final char[] password) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | * A unmodifiable generic result indicates the final status of an operation. |
| | | */ |
| | | class UnmodifiableResultImpl extends AbstractUnmodifiableResultImpl<Result> implements Result { |
| | | UnmodifiableResultImpl(Result impl) { |
| | | UnmodifiableResultImpl(final Result impl) { |
| | | super(impl); |
| | | } |
| | | } |
| | |
| | | private static final Function<Attribute, Attribute, Void> UNMODIFIABLE_ATTRIBUTE_FUNCTION = |
| | | new Function<Attribute, Attribute, Void>() { |
| | | |
| | | @Override |
| | | public Attribute apply(final Attribute value, final Void p) { |
| | | return Attributes.unmodifiableAttribute(value); |
| | | } |
| | | |
| | | }; |
| | | |
| | | UnmodifiableSearchResultEntryImpl(SearchResultEntry impl) { |
| | | UnmodifiableSearchResultEntryImpl(final SearchResultEntry impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | public boolean addAttribute(Attribute attribute) { |
| | | @Override |
| | | public boolean addAttribute(final Attribute attribute) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public boolean addAttribute(Attribute attribute, Collection<? super ByteString> duplicateValues) { |
| | | @Override |
| | | public boolean addAttribute(final Attribute attribute, |
| | | final Collection<? super ByteString> duplicateValues) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchResultEntry addAttribute(String attributeDescription, Object... values) { |
| | | @Override |
| | | public SearchResultEntry addAttribute(final String attributeDescription, final Object... values) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public SearchResultEntry clearAttributes() { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public boolean containsAttribute(Attribute attribute, |
| | | Collection<? super ByteString> missingValues) { |
| | | @Override |
| | | public boolean containsAttribute(final Attribute attribute, |
| | | final Collection<? super ByteString> missingValues) { |
| | | return impl.containsAttribute(attribute, missingValues); |
| | | } |
| | | |
| | | public boolean containsAttribute(String attributeDescription, Object... values) { |
| | | @Override |
| | | public boolean containsAttribute(final String attributeDescription, final Object... values) { |
| | | return impl.containsAttribute(attributeDescription, values); |
| | | } |
| | | |
| | | @Override |
| | | public Iterable<Attribute> getAllAttributes() { |
| | | return Iterables.unmodifiableIterable(Iterables.transformedIterable( |
| | | impl.getAllAttributes(), UNMODIFIABLE_ATTRIBUTE_FUNCTION)); |
| | | } |
| | | |
| | | public Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription) { |
| | | @Override |
| | | public Iterable<Attribute> getAllAttributes(final AttributeDescription attributeDescription) { |
| | | return Iterables.unmodifiableIterable(Iterables.transformedIterable(impl |
| | | .getAllAttributes(attributeDescription), UNMODIFIABLE_ATTRIBUTE_FUNCTION)); |
| | | } |
| | | |
| | | public Iterable<Attribute> getAllAttributes(String attributeDescription) { |
| | | @Override |
| | | public Iterable<Attribute> getAllAttributes(final String attributeDescription) { |
| | | return Iterables.unmodifiableIterable(Iterables.transformedIterable(impl |
| | | .getAllAttributes(attributeDescription), UNMODIFIABLE_ATTRIBUTE_FUNCTION)); |
| | | } |
| | | |
| | | public Attribute getAttribute(AttributeDescription attributeDescription) { |
| | | @Override |
| | | public Attribute getAttribute(final AttributeDescription attributeDescription) { |
| | | final Attribute attribute = impl.getAttribute(attributeDescription); |
| | | if (attribute != null) { |
| | | return Attributes.unmodifiableAttribute(attribute); |
| | |
| | | } |
| | | } |
| | | |
| | | public Attribute getAttribute(String attributeDescription) { |
| | | @Override |
| | | public Attribute getAttribute(final String attributeDescription) { |
| | | final Attribute attribute = impl.getAttribute(attributeDescription); |
| | | if (attribute != null) { |
| | | return Attributes.unmodifiableAttribute(attribute); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public int getAttributeCount() { |
| | | return impl.getAttributeCount(); |
| | | } |
| | | |
| | | @Override |
| | | public DN getName() { |
| | | return impl.getName(); |
| | | } |
| | | |
| | | public AttributeParser parseAttribute(AttributeDescription attributeDescription) { |
| | | @Override |
| | | public AttributeParser parseAttribute(final AttributeDescription attributeDescription) { |
| | | return impl.parseAttribute(attributeDescription); |
| | | } |
| | | |
| | | public AttributeParser parseAttribute(String attributeDescription) { |
| | | @Override |
| | | public AttributeParser parseAttribute(final String attributeDescription) { |
| | | return impl.parseAttribute(attributeDescription); |
| | | } |
| | | |
| | | public boolean removeAttribute(Attribute attribute, Collection<? super ByteString> missingValues) { |
| | | @Override |
| | | public boolean removeAttribute(final Attribute attribute, |
| | | final Collection<? super ByteString> missingValues) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public boolean removeAttribute(AttributeDescription attributeDescription) { |
| | | @Override |
| | | public boolean removeAttribute(final AttributeDescription attributeDescription) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchResultEntry removeAttribute(String attributeDescription, Object... values) { |
| | | @Override |
| | | public SearchResultEntry removeAttribute(final String attributeDescription, |
| | | final Object... values) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public boolean replaceAttribute(Attribute attribute) { |
| | | @Override |
| | | public boolean replaceAttribute(final Attribute attribute) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchResultEntry replaceAttribute(String attributeDescription, Object... values) { |
| | | @Override |
| | | public SearchResultEntry replaceAttribute(final String attributeDescription, |
| | | final Object... values) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchResultEntry setName(DN dn) { |
| | | @Override |
| | | public SearchResultEntry setName(final DN dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | public SearchResultEntry setName(String dn) { |
| | | @Override |
| | | public SearchResultEntry setName(final String dn) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | class UnmodifiableSearchResultReferenceImpl extends |
| | | AbstractUnmodifiableResponseImpl<SearchResultReference> implements SearchResultReference { |
| | | UnmodifiableSearchResultReferenceImpl(SearchResultReference impl) { |
| | | UnmodifiableSearchResultReferenceImpl(final SearchResultReference impl) { |
| | | super(impl); |
| | | } |
| | | |
| | | @Override |
| | | public SearchResultReference addURI(String uri) { |
| | | public SearchResultReference addURI(final String uri) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | |
| | | class UnmodifiableWhoAmIExtendedResultImpl extends |
| | | AbstractUnmodifiableExtendedResultImpl<WhoAmIExtendedResult> implements |
| | | WhoAmIExtendedResult { |
| | | UnmodifiableWhoAmIExtendedResultImpl(WhoAmIExtendedResult impl) { |
| | | UnmodifiableWhoAmIExtendedResultImpl(final WhoAmIExtendedResult impl) { |
| | | super(impl); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public WhoAmIExtendedResult setAuthorizationID(String authorizationID) { |
| | | public WhoAmIExtendedResult setAuthorizationID(final String authorizationID) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public interface WhoAmIExtendedResult extends ExtendedResult { |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | WhoAmIExtendedResult addControl(Control control); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | WhoAmIExtendedResult addReferralURI(String uri); |
| | | |
| | | /** |
| | |
| | | */ |
| | | String getAuthorizationID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | Throwable getCause(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<Control> getControls(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getDiagnosticMessage(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getMatchedDN(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | String getOID(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | List<String> getReferralURIs(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ResultCode getResultCode(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | ByteString getValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean hasValue(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean isReferral(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | boolean isSuccess(); |
| | | |
| | | /** |
| | |
| | | */ |
| | | WhoAmIExtendedResult setAuthorizationID(String authorizationID); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | WhoAmIExtendedResult setCause(Throwable cause); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | WhoAmIExtendedResult setDiagnosticMessage(String message); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | WhoAmIExtendedResult setMatchedDN(String dn); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | WhoAmIExtendedResult setResultCode(ResultCode resultCode); |
| | | |
| | | } |
| | |
| | | super(resultCode); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new who am I extended result that is an exact copy of the |
| | | * provided result. |
| | | * |
| | | * @param whoAmIExtendedResult |
| | | * The who am I extended result to be copied. |
| | | * @throws NullPointerException |
| | | * If {@code whoAmIExtendedResult} was {@code null} . |
| | | */ |
| | | WhoAmIExtendedResultImpl(final WhoAmIExtendedResult whoAmIExtendedResult) { |
| | | super(whoAmIExtendedResult); |
| | | this.authorizationID = whoAmIExtendedResult.getAuthorizationID(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getAuthorizationID() { |
| | | return authorizationID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String getOID() { |
| | | // No response name defined. |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return (authorizationID != null) ? ByteString.valueOf(authorizationID) : null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return (authorizationID != null); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public WhoAmIExtendedResult setAuthorizationID(final String authorizationID) { |
| | | if (authorizationID != null && authorizationID.length() != 0) { |
| | | final int colonIndex = authorizationID.indexOf(':'); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |