opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequest.java
@@ -41,20 +41,15 @@ * 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(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequestImpl.java
@@ -32,48 +32,28 @@ */ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractBindRequest.java
@@ -36,34 +36,17 @@ 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() { opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractExtendedRequest.java
@@ -61,33 +61,22 @@ * @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(); @@ -103,9 +92,6 @@ return builder.toString(); } /** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") final R getThis() { opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractRequestImpl.java
@@ -61,22 +61,10 @@ 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()) { @@ -85,9 +73,6 @@ } } /** * {@inheritDoc} */ @Override public final R addControl(final Control control) { Validator.ensureNotNull(control); @@ -95,17 +80,11 @@ 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 { @@ -114,9 +93,6 @@ return control != null ? decoder.decodeControl(control, options) : null; } /** * {@inheritDoc} */ @Override public final List<Control> getControls() { return controls; opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractSASLBindRequest.java
@@ -42,10 +42,11 @@ } AbstractSASLBindRequest(SASLBindRequest saslBindRequest) { AbstractSASLBindRequest(final SASLBindRequest saslBindRequest) { super(saslBindRequest); } @Override public final byte getAuthenticationType() { return TYPE_AUTHENTICATION_SASL; } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java
@@ -38,18 +38,21 @@ 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(); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableExtendedRequest.java
@@ -41,22 +41,26 @@ */ 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(); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java
@@ -51,35 +51,20 @@ 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 { @@ -107,9 +92,6 @@ } } /** * {@inheritDoc} */ @Override public final List<Control> getControls() { // We need to make all controls unmodifiable as well, which implies @@ -130,9 +112,6 @@ return Collections.unmodifiableList(unmodifiableControls); } /** * {@inheritDoc} */ @Override public final String toString() { return impl.toString(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableSASLBindRequest.java
@@ -36,7 +36,7 @@ abstract class AbstractUnmodifiableSASLBindRequest<R extends SASLBindRequest> extends AbstractUnmodifiableBindRequest<R> implements SASLBindRequest { AbstractUnmodifiableSASLBindRequest(R impl) { AbstractUnmodifiableSASLBindRequest(final R impl) { super(impl); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AddRequest.java
@@ -52,125 +52,78 @@ * 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); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AddRequestImpl.java
@@ -22,7 +22,7 @@ * * * Copyright 2010 Sun Microsystems, Inc. * Portions copyright 2012 ForgeRock AS. * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; @@ -42,196 +42,151 @@ * 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(); @@ -245,42 +200,9 @@ 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); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java
@@ -61,14 +61,10 @@ */ public static final String SASL_MECHANISM_NAME = "ANONYMOUS"; /** * {@inheritDoc} */ @Override AnonymousSASLBindRequest addControl(Control control); /** * {@inheritDoc} */ @Override BindClient createBindClient(String serverName) throws ErrorResultException; /** @@ -77,17 +73,14 @@ * * @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(); /** @@ -97,11 +90,10 @@ * @return The name of the Directory object that the client wishes to bind * as. */ @Override String getName(); /** * {@inheritDoc} */ @Override String getSASLMechanism(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java
@@ -46,49 +46,32 @@ 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; opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java
@@ -38,14 +38,6 @@ 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 @@ -58,6 +50,7 @@ /** * Default implementation does nothing. */ @Override public void dispose() { // Do nothing. } @@ -65,6 +58,7 @@ /** * Default implementation does nothing and always returns {@code true}. */ @Override public boolean evaluateResult(final BindResult result) throws ErrorResultException { return true; } @@ -72,6 +66,7 @@ /** * Default implementation always returns {@code null}. */ @Override public ConnectionSecurityLayer getConnectionSecurityLayer() { return null; } @@ -79,6 +74,7 @@ /** * Returns the next bind request. */ @Override public final GenericBindRequest nextBindRequest() { return nextBindRequest; } @@ -86,6 +82,7 @@ /** * 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]; @@ -96,6 +93,7 @@ /** * 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]; opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java
@@ -41,9 +41,8 @@ * "authenticate" operation. */ public interface BindRequest extends Request { /** * {@inheritDoc} */ @Override BindRequest addControl(Control control); /** @@ -70,15 +69,11 @@ */ byte getAuthenticationType(); /** * {@inheritDoc} */ @Override <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException; /** * {@inheritDoc} */ @Override List<Control> getControls(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java
@@ -62,14 +62,10 @@ */ public static final String SASL_MECHANISM_NAME = "CRAM-MD5"; /** * {@inheritDoc} */ @Override CRAMMD5SASLBindRequest addControl(Control control); /** * {@inheritDoc} */ @Override BindClient createBindClient(String serverName) throws ErrorResultException; /** @@ -88,17 +84,14 @@ * * @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(); /** @@ -108,6 +101,7 @@ * @return The name of the Directory object that the client wishes to bind * as. */ @Override String getName(); /** @@ -121,9 +115,7 @@ */ byte[] getPassword(); /** * {@inheritDoc} */ @Override String getSASLMechanism(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java
@@ -52,9 +52,9 @@ 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 { @@ -118,79 +118,55 @@ } 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); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequest.java
@@ -51,35 +51,27 @@ 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(); /** @@ -89,19 +81,13 @@ */ int getRequestID(); /** * {@inheritDoc} */ @Override ExtendedResultDecoder<ExtendedResult> getResultDecoder(); /** * {@inheritDoc} */ @Override ByteString getValue(); /** * {@inheritDoc} */ @Override boolean hasValue(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestImpl.java
@@ -56,6 +56,7 @@ 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(); @@ -85,69 +86,51 @@ } 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); @@ -165,25 +148,17 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java
@@ -63,9 +63,8 @@ * </pre> */ public interface CompareRequest extends Request { /** * {@inheritDoc} */ @Override CompareRequest addControl(Control control); /** @@ -89,15 +88,11 @@ */ AttributeDescription getAttributeDescription(); /** * {@inheritDoc} */ @Override <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException; /** * {@inheritDoc} */ @Override List<Control> getControls(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java
@@ -39,42 +39,10 @@ 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(); @@ -82,82 +50,68 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequest.java
@@ -57,25 +57,18 @@ * </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(); /** @@ -84,6 +77,7 @@ * * @return The distinguished name of the entry. */ @Override DN getName(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequestImpl.java
@@ -22,7 +22,7 @@ * * * Copyright 2010 Sun Microsystems, Inc. * Portions copyright 2012 ForgeRock AS. * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; @@ -38,67 +38,39 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java
@@ -59,9 +59,55 @@ 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 @@ -74,67 +120,21 @@ /** * 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 @@ -154,9 +154,6 @@ */ DigestMD5SASLBindRequest addAdditionalAuthParam(String name, String value); /** * {@inheritDoc} */ @Override DigestMD5SASLBindRequest addControl(Control control); @@ -182,9 +179,6 @@ */ DigestMD5SASLBindRequest addQOP(String... qopValues); /** * {@inheritDoc} */ @Override BindClient createBindClient(String serverName) throws ErrorResultException; @@ -245,16 +239,10 @@ */ String getCipher(); /** * {@inheritDoc} */ @Override <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException; /** * {@inheritDoc} */ @Override List<Control> getControls(); @@ -319,9 +307,6 @@ */ String getRealm(); /** * {@inheritDoc} */ @Override String getSASLMechanism(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java
@@ -63,10 +63,10 @@ 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 { @@ -93,9 +93,10 @@ } 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); } } @@ -220,35 +221,21 @@ } 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()); @@ -265,9 +252,12 @@ 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); @@ -275,9 +265,6 @@ return this; } /** * {@inheritDoc} */ @Override public DigestMD5SASLBindRequest addQOP(final String... qopValues) { for (final String qopValue : qopValues) { @@ -286,105 +273,66 @@ 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); @@ -392,45 +340,30 @@ 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); @@ -438,9 +371,6 @@ return this; } /** * {@inheritDoc} */ @Override public DigestMD5SASLBindRequest setPassword(final char[] password) { Validator.ensureNotNull(password); @@ -448,18 +378,12 @@ 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; opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequest.java
@@ -41,7 +41,6 @@ * 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 @@ -63,20 +62,15 @@ * 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(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java
@@ -61,14 +61,10 @@ */ public static final String SASL_MECHANISM_NAME = "EXTERNAL"; /** * {@inheritDoc} */ @Override ExternalSASLBindRequest addControl(Control control); /** * {@inheritDoc} */ @Override BindClient createBindClient(String serverName) throws ErrorResultException; /** @@ -77,6 +73,7 @@ * * @return The authentication mechanism identifier. */ @Override byte getAuthenticationType(); /** @@ -92,15 +89,11 @@ */ String getAuthorizationID(); /** * {@inheritDoc} */ @Override <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException; /** * {@inheritDoc} */ @Override List<Control> getControls(); /** @@ -110,11 +103,10 @@ * @return The name of the Directory object that the client wishes to bind * as. */ @Override String getName(); /** * {@inheritDoc} */ @Override String getSASLMechanism(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java
@@ -102,44 +102,27 @@ // 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; opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java
@@ -58,11 +58,6 @@ 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 @@ -73,16 +68,21 @@ /** * 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 @@ -102,20 +102,6 @@ */ 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); @@ -141,13 +127,21 @@ */ 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:" @@ -180,16 +174,10 @@ */ String getAuthorizationID(); /** * {@inheritDoc} */ @Override <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException; /** * {@inheritDoc} */ @Override List<Control> getControls(); @@ -269,9 +257,6 @@ */ String getRealm(); /** * {@inheritDoc} */ @Override String getSASLMechanism(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java
@@ -121,12 +121,7 @@ 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 @@ -150,6 +145,11 @@ } } }; private BindResult lastResult; private final SaslClient saslClient; private final Subject subject; private Client(final GSSAPISASLBindRequestImpl initialBindRequest, final String serverName) throws ErrorResultException { @@ -170,8 +170,10 @@ 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(); @@ -294,43 +296,28 @@ } // 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(); @@ -351,14 +338,17 @@ 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); @@ -366,9 +356,6 @@ return this; } /** * {@inheritDoc} */ @Override public GSSAPISASLBindRequest addQOP(final String... qopValues) { for (final String qopValue : qopValues) { @@ -377,113 +364,71 @@ 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); @@ -491,45 +436,30 @@ 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); @@ -537,9 +467,6 @@ return this; } /** * {@inheritDoc} */ @Override public GSSAPISASLBindRequest setPassword(final char[] password) { Validator.ensureNotNull(password); @@ -547,36 +474,24 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java
@@ -43,19 +43,14 @@ * {@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(); /** @@ -70,20 +65,14 @@ */ 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(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java
@@ -39,48 +39,14 @@ */ 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(); @@ -89,6 +55,23 @@ 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); @@ -97,57 +80,41 @@ } } /** * {@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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java
@@ -53,40 +53,26 @@ 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(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java
@@ -50,6 +50,7 @@ static final class RequestDecoder implements ExtendedRequestDecoder<GenericExtendedRequest, GenericExtendedResult> { @Override public GenericExtendedRequest decodeExtendedRequest(final ExtendedRequest<?> request, final DecodeOptions options) throws DecodeException { if (request instanceof GenericExtendedRequest) { @@ -71,12 +72,7 @@ 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) { @@ -93,94 +89,64 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequest.java
@@ -45,25 +45,18 @@ * 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(); /** @@ -73,6 +66,7 @@ * * @return The distinguished name of the entry. */ @Override DN getName(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestImpl.java
@@ -22,7 +22,7 @@ * * * Copyright 2010 Sun Microsystems, Inc. * Portions copyright 2012 ForgeRock AS. * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; @@ -38,39 +38,16 @@ */ 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(); @@ -79,104 +56,77 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java
@@ -58,14 +58,11 @@ * </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); /** @@ -110,15 +107,11 @@ 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(); /** @@ -137,6 +130,7 @@ * * @return The distinguished name of the entry to be modified. */ @Override DN getName(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequestImpl.java
@@ -44,62 +44,38 @@ */ 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); @@ -107,41 +83,30 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java
@@ -73,11 +73,6 @@ 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. */ @@ -85,19 +80,18 @@ 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(); /** @@ -109,9 +103,7 @@ */ byte[] getNewPassword(); /** * {@inheritDoc} */ @Override String getOID(); /** @@ -122,9 +114,7 @@ */ byte[] getOldPassword(); /** * {@inheritDoc} */ @Override ExtendedResultDecoder<PasswordModifyExtendedResult> getResultDecoder(); /** @@ -151,14 +141,10 @@ */ String getUserIdentityAsString(); /** * {@inheritDoc} */ @Override ByteString getValue(); /** * {@inheritDoc} */ @Override boolean hasValue(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java
@@ -58,6 +58,7 @@ implements PasswordModifyExtendedRequest { static final class RequestDecoder implements ExtendedRequestDecoder<PasswordModifyExtendedRequest, PasswordModifyExtendedResult> { @Override public PasswordModifyExtendedRequest decodeExtendedRequest( final ExtendedRequest<?> request, final DecodeOptions options) throws DecodeException { @@ -97,12 +98,7 @@ 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) { @@ -140,19 +136,23 @@ 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 @@ -161,32 +161,26 @@ 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); @@ -195,53 +189,36 @@ 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(); @@ -267,57 +244,41 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java
@@ -70,14 +70,10 @@ */ public static final String SASL_MECHANISM_NAME = "PLAIN"; /** * {@inheritDoc} */ @Override PlainSASLBindRequest addControl(Control control); /** * {@inheritDoc} */ @Override BindClient createBindClient(String serverName) throws ErrorResultException; /** @@ -96,6 +92,7 @@ * * @return The authentication mechanism identifier. */ @Override byte getAuthenticationType(); /** @@ -110,15 +107,11 @@ */ String getAuthorizationID(); /** * {@inheritDoc} */ @Override <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException; /** * {@inheritDoc} */ @Override List<Control> getControls(); /** @@ -128,6 +121,7 @@ * @return The name of the Directory object that the client wishes to bind * as. */ @Override String getName(); /** @@ -141,9 +135,7 @@ */ byte[] getPassword(); /** * {@inheritDoc} */ @Override String getSASLMechanism(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java
@@ -50,9 +50,9 @@ 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 { @@ -107,21 +107,6 @@ 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(); @@ -129,49 +114,58 @@ 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); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java
@@ -73,6 +73,309 @@ // 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 @@ -610,7 +913,7 @@ * 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); } @@ -1057,7 +1360,7 @@ * If {@code request} was {@code null} . */ public static GenericExtendedRequest unmodifiableGenericExtendedRequest( GenericExtendedRequest request) { final GenericExtendedRequest request) { if (request instanceof UnmodifiableGenericExtendedRequestImpl) { return request; } @@ -1241,308 +1544,6 @@ 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. } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindClientImpl.java
@@ -74,6 +74,7 @@ this.saslMechanism = initialBindRequest.getSASLMechanism(); } @Override public final void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (final Callback callback : callbacks) { opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java
@@ -45,14 +45,11 @@ * SASL Authorization Identities (authzId) </a> */ public interface SASLBindRequest extends BindRequest { /** * {@inheritDoc} */ @Override SASLBindRequest addControl(Control control); /** * {@inheritDoc} */ @Override BindClient createBindClient(String serverName) throws ErrorResultException; /** @@ -61,17 +58,14 @@ * * @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(); /** @@ -81,6 +75,7 @@ * @return The name of the Directory object that the client wishes to bind * as. */ @Override String getName(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java
@@ -51,8 +51,8 @@ * 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 @@ -82,9 +82,7 @@ */ SearchRequest addAttribute(String... attributeDescriptions); /** * {@inheritDoc} */ @Override SearchRequest addControl(Control control); /** @@ -97,15 +95,11 @@ */ List<String> getAttributes(); /** * {@inheritDoc} */ @Override <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException; /** * {@inheritDoc} */ @Override List<Control> getControls(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java
@@ -41,54 +41,21 @@ * 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()); @@ -101,75 +68,55 @@ 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); @@ -177,9 +124,7 @@ return this; } /** * {@inheritDoc} */ @Override public SearchRequest setFilter(final Filter filter) { Validator.ensureNotNull(filter); @@ -187,17 +132,13 @@ 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); @@ -205,9 +146,7 @@ return this; } /** * {@inheritDoc} */ @Override public SearchRequest setName(final String dn) { Validator.ensureNotNull(dn); @@ -215,9 +154,7 @@ return this; } /** * {@inheritDoc} */ @Override public SearchRequest setScope(final SearchScope scope) { Validator.ensureNotNull(scope); @@ -225,9 +162,7 @@ return this; } /** * {@inheritDoc} */ @Override public SearchRequest setSizeLimit(final int limit) { Validator.ensureTrue(limit >= 0, "negative size limit"); @@ -235,9 +170,7 @@ return this; } /** * {@inheritDoc} */ @Override public SearchRequest setTimeLimit(final int limit) { Validator.ensureTrue(limit >= 0, "negative time limit"); @@ -245,17 +178,12 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java
@@ -68,14 +68,11 @@ * </pre> */ public interface SimpleBindRequest extends BindRequest { /** * {@inheritDoc} */ @Override SimpleBindRequest addControl(Control control); /** * {@inheritDoc} */ @Override BindClient createBindClient(String serverName) throws ErrorResultException; /** @@ -84,22 +81,17 @@ * * @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(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java
@@ -40,97 +40,61 @@ */ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest.java
@@ -69,11 +69,6 @@ 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. */ @@ -81,61 +76,16 @@ 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. @@ -150,13 +100,27 @@ 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 @@ -168,13 +132,31 @@ 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(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestImpl.java
@@ -54,6 +54,7 @@ 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. @@ -66,49 +67,42 @@ } 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(); @@ -121,91 +115,64 @@ // 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequest.java
@@ -38,19 +38,14 @@ * 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(); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequestImpl.java
@@ -32,29 +32,14 @@ */ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAbandonRequestImpl.java
@@ -31,21 +31,17 @@ */ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java
@@ -48,60 +48,74 @@ 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); @@ -110,7 +124,8 @@ } } 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); @@ -119,47 +134,59 @@ } } @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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAnonymousSASLBindRequestImpl.java
@@ -33,7 +33,7 @@ final class UnmodifiableAnonymousSASLBindRequestImpl extends AbstractUnmodifiableSASLBindRequest<AnonymousSASLBindRequest> implements AnonymousSASLBindRequest { UnmodifiableAnonymousSASLBindRequestImpl(AnonymousSASLBindRequest impl) { UnmodifiableAnonymousSASLBindRequestImpl(final AnonymousSASLBindRequest impl) { super(impl); } @@ -43,7 +43,7 @@ } @Override public AnonymousSASLBindRequest setTraceString(String traceString) { public AnonymousSASLBindRequest setTraceString(final String traceString) { throw new UnsupportedOperationException(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java
@@ -35,7 +35,7 @@ final class UnmodifiableCRAMMD5SASLBindRequestImpl extends AbstractUnmodifiableSASLBindRequest<CRAMMD5SASLBindRequest> implements CRAMMD5SASLBindRequest { UnmodifiableCRAMMD5SASLBindRequestImpl(CRAMMD5SASLBindRequest impl) { UnmodifiableCRAMMD5SASLBindRequestImpl(final CRAMMD5SASLBindRequest impl) { super(impl); } @@ -51,17 +51,17 @@ } @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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCancelExtendedRequestImpl.java
@@ -35,15 +35,17 @@ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCompareRequestImpl.java
@@ -36,43 +36,52 @@ */ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDeleteRequestImpl.java
@@ -35,23 +35,27 @@ */ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java
@@ -39,17 +39,17 @@ 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(); } @@ -105,47 +105,47 @@ } @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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableExternalSASLBindRequestImpl.java
@@ -33,7 +33,7 @@ final class UnmodifiableExternalSASLBindRequestImpl extends AbstractUnmodifiableSASLBindRequest<ExternalSASLBindRequest> implements ExternalSASLBindRequest { UnmodifiableExternalSASLBindRequestImpl(ExternalSASLBindRequest impl) { UnmodifiableExternalSASLBindRequestImpl(final ExternalSASLBindRequest impl) { super(impl); } @@ -43,7 +43,7 @@ } @Override public ExternalSASLBindRequest setAuthorizationID(String authorizationID) { public ExternalSASLBindRequest setAuthorizationID(final String authorizationID) { throw new UnsupportedOperationException(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGSSAPISASLBindRequestImpl.java
@@ -40,12 +40,17 @@ */ 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(); } @@ -55,11 +60,6 @@ } @Override public GSSAPISASLBindRequest addQOP(String... qopValues) { throw new UnsupportedOperationException(); } @Override public String getAuthenticationID() { return impl.getAuthenticationID(); } @@ -111,52 +111,52 @@ } @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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericBindRequestImpl.java
@@ -34,24 +34,28 @@ */ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericExtendedRequestImpl.java
@@ -35,15 +35,17 @@ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyDNRequestImpl.java
@@ -36,55 +36,67 @@ */ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java
@@ -46,52 +46,60 @@ */ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java
@@ -38,45 +38,54 @@ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePlainSASLBindRequestImpl.java
@@ -34,7 +34,7 @@ */ final class UnmodifiablePlainSASLBindRequestImpl extends AbstractUnmodifiableSASLBindRequest<PlainSASLBindRequest> implements PlainSASLBindRequest { UnmodifiablePlainSASLBindRequestImpl(PlainSASLBindRequest impl) { UnmodifiablePlainSASLBindRequestImpl(final PlainSASLBindRequest impl) { super(impl); } @@ -55,22 +55,22 @@ } @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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java
@@ -40,79 +40,97 @@ */ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSimpleBindRequestImpl.java
@@ -34,24 +34,28 @@ */ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableStartTLSExtendedRequestImpl.java
@@ -39,31 +39,37 @@ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableUnbindRequestImpl.java
@@ -31,7 +31,7 @@ */ final class UnmodifiableUnbindRequestImpl extends AbstractUnmodifiableRequest<UnbindRequest> implements UnbindRequest { UnmodifiableUnbindRequestImpl(UnbindRequest impl) { UnmodifiableUnbindRequestImpl(final UnbindRequest impl) { super(impl); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableWhoAmIExtendedRequestImpl.java
@@ -34,7 +34,7 @@ final class UnmodifiableWhoAmIExtendedRequestImpl extends AbstractUnmodifiableExtendedRequest<WhoAmIExtendedRequest, WhoAmIExtendedResult> implements WhoAmIExtendedRequest { UnmodifiableWhoAmIExtendedRequestImpl(WhoAmIExtendedRequest impl) { UnmodifiableWhoAmIExtendedRequestImpl(final WhoAmIExtendedRequest impl) { super(impl); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequest.java
@@ -80,11 +80,6 @@ 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. */ @@ -92,38 +87,29 @@ 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(); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestImpl.java
@@ -49,6 +49,7 @@ 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. @@ -62,12 +63,7 @@ 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) { @@ -94,6 +90,13 @@ 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. @@ -105,54 +108,30 @@ // 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResult.java
@@ -43,6 +43,19 @@ 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 @@ -54,37 +67,15 @@ 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(); @@ -108,9 +99,6 @@ return builder.toString(); } /** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") final S getThis() { opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java
@@ -53,9 +53,6 @@ // Nothing to do. } /** * {@inheritDoc} */ @Override public S adaptDecodeException(final DecodeException exception) { final S adaptedResult = @@ -64,9 +61,6 @@ return adaptedResult; } /** * {@inheritDoc} */ @Override public <R extends ExtendedResult> ResultHandler<S> adaptExtendedResultHandler( final ExtendedRequest<R> request, final ResultHandler<? super R> resultHandler, @@ -98,16 +92,10 @@ }; } /** * {@inheritDoc} */ @Override public abstract S decodeExtendedResult(ExtendedResult result, DecodeOptions options) throws DecodeException; /** * {@inheritDoc} */ @Override public abstract S newExtendedErrorResult(ResultCode resultCode, String matchedDN, String diagnosticMessage); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractIntermediateResponse.java
@@ -57,28 +57,19 @@ * @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(); @@ -94,9 +85,6 @@ return builder.toString(); } /** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") final S getThis() { opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResponseImpl.java
@@ -60,22 +60,10 @@ 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()) { @@ -84,9 +72,6 @@ } } /** * {@inheritDoc} */ @Override public final S addControl(final Control control) { Validator.ensureNotNull(control); @@ -94,17 +79,11 @@ 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 { @@ -113,9 +92,6 @@ return control != null ? decoder.decodeControl(control, options) : null; } /** * {@inheritDoc} */ @Override public final List<Control> getControls() { return controls; opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResultImpl.java
@@ -44,38 +44,12 @@ 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(); @@ -84,9 +58,11 @@ this.resultCode = result.getResultCode(); } /** * {@inheritDoc} */ AbstractResultImpl(final ResultCode resultCode) { this.resultCode = resultCode; } @Override public final S addReferralURI(final String uri) { Validator.ensureNotNull(uri); @@ -94,68 +70,50 @@ 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 = ""; @@ -166,9 +124,7 @@ return getThis(); } /** * {@inheritDoc} */ @Override public final S setMatchedDN(final String dn) { if (dn == null) { this.matchedDN = ""; @@ -179,9 +135,7 @@ return getThis(); } /** * {@inheritDoc} */ @Override public final S setResultCode(final ResultCode resultCode) { Validator.ensureNotNull(resultCode); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableExtendedResultImpl.java
@@ -37,7 +37,7 @@ */ abstract class AbstractUnmodifiableExtendedResultImpl<S extends ExtendedResult> extends AbstractUnmodifiableResultImpl<S> implements ExtendedResult { protected AbstractUnmodifiableExtendedResultImpl(S impl) { AbstractUnmodifiableExtendedResultImpl(final S impl) { super(impl); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableIntermediateResponseImpl.java
@@ -37,7 +37,7 @@ */ abstract class AbstractUnmodifiableIntermediateResponseImpl<S extends IntermediateResponse> extends AbstractUnmodifiableResponseImpl<S> implements IntermediateResponse { protected AbstractUnmodifiableIntermediateResponseImpl(S impl) { AbstractUnmodifiableIntermediateResponseImpl(final S impl) { super(impl); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java
@@ -51,37 +51,21 @@ 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 { @@ -93,8 +77,9 @@ // 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. @@ -109,14 +94,12 @@ } } /** * {@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 @@ -133,9 +116,6 @@ return Collections.unmodifiableList(unmodifiableControls); } /** * {@inheritDoc} */ @Override public final String toString() { return impl.toString(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResultImpl.java
@@ -41,60 +41,66 @@ 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(); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/BindResult.java
@@ -57,50 +57,33 @@ * 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(); /** @@ -111,9 +94,7 @@ */ ByteString getServerSASLCredentials(); /** * {@inheritDoc} */ @Override boolean isReferral(); /** @@ -130,29 +111,19 @@ */ 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); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/BindResultImpl.java
@@ -36,57 +36,32 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/CompareResult.java
@@ -59,60 +59,39 @@ * </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(); /** @@ -128,24 +107,16 @@ */ 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); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/CompareResultImpl.java
@@ -34,42 +34,20 @@ */ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResult.java
@@ -43,40 +43,27 @@ * {@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(); /** @@ -87,14 +74,10 @@ */ String getOID(); /** * {@inheritDoc} */ @Override List<String> getReferralURIs(); /** * {@inheritDoc} */ @Override ResultCode getResultCode(); /** @@ -117,33 +100,21 @@ */ 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); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java
@@ -41,90 +41,57 @@ * 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); /** @@ -140,9 +107,7 @@ */ GenericExtendedResult setOID(String oid); /** * {@inheritDoc} */ @Override GenericExtendedResult setResultCode(ResultCode resultCode); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java
@@ -41,73 +41,43 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java
@@ -40,35 +40,24 @@ * 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(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java
@@ -41,71 +41,43 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/IntermediateResponse.java
@@ -51,20 +51,15 @@ * 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(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResult.java
@@ -47,35 +47,23 @@ */ 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(); /** @@ -87,54 +75,34 @@ */ 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); /** @@ -164,14 +132,10 @@ */ PasswordModifyExtendedResult setGeneratedPassword(char[] password); /** * {@inheritDoc} */ @Override PasswordModifyExtendedResult setMatchedDN(String dn); /** * {@inheritDoc} */ @Override PasswordModifyExtendedResult setResultCode(ResultCode resultCode); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java
@@ -43,52 +43,35 @@ 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) { @@ -109,33 +92,23 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java
@@ -57,6 +57,134 @@ // 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 @@ -412,134 +540,6 @@ 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. opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Result.java
@@ -58,9 +58,8 @@ * </ul> */ public interface Result extends Response { /** * {@inheritDoc} */ @Override Result addControl(Control control); /** @@ -85,15 +84,11 @@ */ Throwable getCause(); /** * {@inheritDoc} */ @Override <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException; /** * {@inheritDoc} */ @Override List<Control> getControls(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ResultImpl.java
@@ -34,33 +34,14 @@ */ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntry.java
@@ -55,120 +55,75 @@ * 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); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntryImpl.java
@@ -45,204 +45,146 @@ 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(); @@ -261,20 +203,4 @@ return this; } /** * {@inheritDoc} */ @Override public int hashCode() { return entry.hashCode(); } /** * {@inheritDoc} */ @Override public boolean equals(final Object object) { return entry.equals(object); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReference.java
@@ -39,9 +39,8 @@ * operation. */ public interface SearchResultReference extends Response { /** * {@inheritDoc} */ @Override SearchResultReference addControl(Control control); /** @@ -59,15 +58,11 @@ */ SearchResultReference addURI(String uri); /** * {@inheritDoc} */ @Override <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException; /** * {@inheritDoc} */ @Override List<Control> getControls(); /** opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReferenceImpl.java
@@ -40,53 +40,27 @@ 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(); opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableBindResultImpl.java
@@ -34,7 +34,7 @@ */ class UnmodifiableBindResultImpl extends AbstractUnmodifiableResultImpl<BindResult> implements BindResult { public UnmodifiableBindResultImpl(BindResult impl) { UnmodifiableBindResultImpl(final BindResult impl) { super(impl); } @@ -49,7 +49,7 @@ } @Override public BindResult setServerSASLCredentials(ByteString credentials) { public BindResult setServerSASLCredentials(final ByteString credentials) { throw new UnsupportedOperationException(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableCompareResultImpl.java
@@ -31,7 +31,7 @@ */ class UnmodifiableCompareResultImpl extends AbstractUnmodifiableResultImpl<CompareResult> implements CompareResult { UnmodifiableCompareResultImpl(CompareResult impl) { UnmodifiableCompareResultImpl(final CompareResult impl) { super(impl); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericExtendedResultImpl.java
@@ -33,17 +33,17 @@ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericIntermediateResponseImpl.java
@@ -33,17 +33,17 @@ 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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiablePasswordModifyExtendedResultImpl.java
@@ -33,7 +33,7 @@ class UnmodifiablePasswordModifyExtendedResultImpl extends AbstractUnmodifiableExtendedResultImpl<PasswordModifyExtendedResult> implements PasswordModifyExtendedResult { UnmodifiablePasswordModifyExtendedResultImpl(PasswordModifyExtendedResult impl) { UnmodifiablePasswordModifyExtendedResultImpl(final PasswordModifyExtendedResult impl) { super(impl); } @@ -43,12 +43,12 @@ } @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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableResultImpl.java
@@ -30,7 +30,7 @@ * 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); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java
@@ -47,57 +47,69 @@ 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); @@ -106,7 +118,8 @@ } } 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); @@ -115,47 +128,61 @@ } } @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(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultReferenceImpl.java
@@ -34,12 +34,12 @@ */ 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(); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableWhoAmIExtendedResultImpl.java
@@ -33,7 +33,7 @@ class UnmodifiableWhoAmIExtendedResultImpl extends AbstractUnmodifiableExtendedResultImpl<WhoAmIExtendedResult> implements WhoAmIExtendedResult { UnmodifiableWhoAmIExtendedResultImpl(WhoAmIExtendedResult impl) { UnmodifiableWhoAmIExtendedResultImpl(final WhoAmIExtendedResult impl) { super(impl); } @@ -43,7 +43,7 @@ } @Override public WhoAmIExtendedResult setAuthorizationID(String authorizationID) { public WhoAmIExtendedResult setAuthorizationID(final String authorizationID) { throw new UnsupportedOperationException(); } } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResult.java
@@ -73,14 +73,10 @@ */ public interface WhoAmIExtendedResult extends ExtendedResult { /** * {@inheritDoc} */ @Override WhoAmIExtendedResult addControl(Control control); /** * {@inheritDoc} */ @Override WhoAmIExtendedResult addReferralURI(String uri); /** @@ -94,65 +90,41 @@ */ 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(); /** @@ -174,24 +146,16 @@ */ 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); } opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java
@@ -48,55 +48,33 @@ 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(':'); @@ -111,9 +89,6 @@ return this; } /** * {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder();