You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2009/06/14 09:14:55 UTC
svn commit: r784515 - in
/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api:
./ messages/
Author: kayyagari
Date: Sun Jun 14 07:14:54 2009
New Revision: 784515
URL: http://svn.apache.org/viewvc?rev=784515&view=rev
Log:
o removed interfaces which have only one implementation class
o renamed the XXXImpl classes to XXX
o updated the dependent classes accordingly
Removed:
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbandonRequestImpl.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindRequestImpl.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponseImpl.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/IntermediateResponseImpl.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/LdapResultImpl.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/ReferralImpl.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/UnbindRequestImpl.java
Modified:
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbandonRequest.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindRequest.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponse.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/IntermediateResponse.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/LdapResult.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/ModifyRequest.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Referral.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/SearchResultReferenceImpl.java
directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/UnbindRequest.java
Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java?rev=784515&r1=784514&r2=784515&view=diff
==============================================================================
--- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java (original)
+++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java Sun Jun 14 07:14:54 2009
@@ -53,24 +53,18 @@
import org.apache.directory.shared.ldap.client.api.listeners.OperationResponseListener;
import org.apache.directory.shared.ldap.client.api.listeners.SearchListener;
import org.apache.directory.shared.ldap.client.api.messages.AbandonRequest;
-import org.apache.directory.shared.ldap.client.api.messages.AbandonRequestImpl;
import org.apache.directory.shared.ldap.client.api.messages.AddResponse;
import org.apache.directory.shared.ldap.client.api.messages.BindRequest;
-import org.apache.directory.shared.ldap.client.api.messages.BindRequestImpl;
import org.apache.directory.shared.ldap.client.api.messages.BindResponse;
-import org.apache.directory.shared.ldap.client.api.messages.BindResponseImpl;
import org.apache.directory.shared.ldap.client.api.messages.DeleteRequest;
import org.apache.directory.shared.ldap.client.api.messages.DeleteResponse;
import org.apache.directory.shared.ldap.client.api.messages.IntermediateResponse;
-import org.apache.directory.shared.ldap.client.api.messages.IntermediateResponseImpl;
import org.apache.directory.shared.ldap.client.api.messages.LdapResult;
-import org.apache.directory.shared.ldap.client.api.messages.LdapResultImpl;
import org.apache.directory.shared.ldap.client.api.messages.ModifyDnRequest;
import org.apache.directory.shared.ldap.client.api.messages.ModifyDnResponse;
import org.apache.directory.shared.ldap.client.api.messages.ModifyRequest;
import org.apache.directory.shared.ldap.client.api.messages.ModifyResponse;
import org.apache.directory.shared.ldap.client.api.messages.Referral;
-import org.apache.directory.shared.ldap.client.api.messages.ReferralImpl;
import org.apache.directory.shared.ldap.client.api.messages.SearchRequest;
import org.apache.directory.shared.ldap.client.api.messages.SearchRequestImpl;
import org.apache.directory.shared.ldap.client.api.messages.SearchResponse;
@@ -361,7 +355,7 @@
*/
private BindResponse convert( BindResponseCodec bindResponseCodec )
{
- BindResponse bindResponse = new BindResponseImpl();
+ BindResponse bindResponse = new BindResponse();
bindResponse.setMessageId( bindResponseCodec.getMessageId() );
bindResponse.setServerSaslCreds( bindResponseCodec.getServerSaslCreds() );
@@ -376,7 +370,7 @@
*/
private IntermediateResponse convert( IntermediateResponseCodec intermediateResponseCodec )
{
- IntermediateResponse intermediateResponse = new IntermediateResponseImpl();
+ IntermediateResponse intermediateResponse = new IntermediateResponse();
intermediateResponse.setMessageId( intermediateResponseCodec.getMessageId() );
intermediateResponse.setResponseName( intermediateResponseCodec.getResponseName() );
@@ -391,13 +385,13 @@
*/
private LdapResult convert( LdapResultCodec ldapResultCodec )
{
- LdapResult ldapResult = new LdapResultImpl();
+ LdapResult ldapResult = new LdapResult();
ldapResult.setErrorMessage( ldapResultCodec.getErrorMessage() );
ldapResult.setMatchedDn( ldapResultCodec.getMatchedDN() );
// Loop on the referrals
- Referral referral = new ReferralImpl();
+ Referral referral = new Referral();
if (ldapResultCodec.getReferrals() != null )
{
@@ -452,7 +446,7 @@
searchResultReference.setMessageId( searchEntryReferenceCodec.getMessageId() );
// Loop on the referrals
- Referral referral = new ReferralImpl();
+ Referral referral = new Referral();
if (searchEntryReferenceCodec.getSearchResultReferences() != null )
{
@@ -790,7 +784,7 @@
*/
public void abandon( int messageId ) throws LdapException
{
- AbandonRequest abandonRequest = new AbandonRequestImpl();
+ AbandonRequest abandonRequest = new AbandonRequest();
abandonRequest.setAbandonedMessageId( messageId );
abandonInternal( abandonRequest );
@@ -895,7 +889,7 @@
LOG.debug( "Bind request : {}", name );
// Create the BindRequest
- BindRequest bindRequest = new BindRequestImpl();
+ BindRequest bindRequest = new BindRequest();
bindRequest.setName( name );
bindRequest.setCredentials( credentials );
Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbandonRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbandonRequest.java?rev=784515&r1=784514&r2=784515&view=diff
==============================================================================
--- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbandonRequest.java (original)
+++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbandonRequest.java Sun Jun 14 07:14:54 2009
@@ -20,25 +20,71 @@
package org.apache.directory.shared.ldap.client.api.messages;
/**
- * Abandon protocol operation request. It abandons the given message.
+ * Abandon protocol operation request message. It abandons the given message.
+ *
+ * Its syntax is :
+ * AbandonRequest ::= [APPLICATION 16] MessageID
+ *
+ * MessageID ::= INTEGER (0 .. maxInt)
+ *
+ * maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface AbandonRequest extends Request
+public class AbandonRequest extends AbstractRequest
{
+ /** The abandoned message ID */
+ private int abandonedMessageId;
+
+
+ /**
+ *
+ * Creates a new instance of AbandonRequestImpl.
+ */
+ public AbandonRequest()
+ {
+ super();
+ }
+
+
/**
* Get the abandoned message ID
*
* @return Returns the abandoned MessageId.
*/
- int getAbandonedMessageId();
+ public int getAbandonedMessageId()
+ {
+ return abandonedMessageId;
+ }
+
-
/**
* Set the abandoned message ID
*
* @param abandonedMessageId The abandoned messageID to set.
- * @return The object itself, to allow chaining
*/
- AbandonRequest setAbandonedMessageId( int abandonedMessageId );
+ public AbandonRequest setAbandonedMessageId( int abandonedMessageId )
+ {
+ this.abandonedMessageId = abandonedMessageId;
+
+ return this;
+ }
+
+
+ /**
+ * Return a String representing an AbandonRequest
+ *
+ * @return A String representing the AbandonRequest
+ */
+ public String toString()
+ {
+
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( super.toString() );
+ sb.append( " Abandon Request :\n" );
+ sb.append( " Message Id : " ).append( abandonedMessageId ).append( '\n' );
+
+ return sb.toString();
+ }
}
Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindRequest.java?rev=784515&r1=784514&r2=784515&view=diff
==============================================================================
--- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindRequest.java (original)
+++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindRequest.java Sun Jun 14 07:14:54 2009
@@ -19,39 +19,59 @@
*/
package org.apache.directory.shared.ldap.client.api.messages;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
/**
+ *
* Bind protocol operation request which authenticates and begins a client
* session.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
*/
-public interface BindRequest extends AbandonableRequest, RequestWithResponse
+public class BindRequest extends AbstractRequest
{
/**
- * Checks to see if the authentication mechanism is simple and not SASL
- * based.
- *
- * @return true if the mechanism is simple false if it is SASL based.
+ * Distinguished name identifying the name of the authenticating subject -
+ * defaults to the empty string
*/
- boolean isSimple();
+ private String name;
+
+ /** The passwords, keys or tickets used to verify user identity */
+ private byte[] credentials;
+
+ /** The mechanism used to decode user identity */
+ private String saslMechanism;
+
+ /** Simple vs. SASL authentication mode flag */
+ private boolean isSimple = true;
+
+ /** Returns the protocol version */
+ private int version = 3;
/**
- * Sets the authentication mechanism to SASL
- * @return The object itself, to allow chaining
- */
- BindRequest setSasl();
-
-
+ * Creates a new instance of BindRequest.
+ */
+ public BindRequest()
+ {
+ super();
+ }
+
+
/**
* Gets the simple credentials associated with a simple authentication
* attempt or null if this request uses SASL authentication mechanisms.
*
* @return null if the mechanism is SASL or the credentials if it is simple.
*/
- byte[] getCredentials();
-
+ public byte[] getCredentials()
+ {
+ return credentials;
+ }
+
/**
* Sets the simple credentials associated with a simple authentication
* attempt ignored if this request uses SASL authentication mechanisms.
@@ -59,9 +79,14 @@
* @param credentials the credentials if authentication is simple, null otherwise
* @return The object itself, to allow chaining
*/
- BindRequest setCredentials( byte[] credentials );
-
+ public BindRequest setCredentials( byte[] credentials )
+ {
+ this.credentials = credentials;
+
+ return this;
+ }
+
/**
* Sets the simple credentials associated with a simple authentication
* attempt ignored if this request uses SASL authentication mechanisms.
@@ -69,9 +94,14 @@
* @param credentials the credentials if authentication is simple, null otherwise
* @return The object itself, to allow chaining
*/
- BindRequest setCredentials( String credentials );
-
+ public BindRequest setCredentials( String credentials )
+ {
+ this.credentials = StringTools.getBytesUtf8( credentials );
+
+ return this;
+ }
+
/**
* Gets the distinguished name of the subject in this authentication
* request. This field may take on a null value (a zero length string) for
@@ -81,9 +111,12 @@
*
* @return the DN of the authenticating user.
*/
- String getName();
-
+ public String getName()
+ {
+ return name;
+ }
+
/**
* Sets the distinguished name of the subject in this authentication
* request. This field may take on a null value (or a zero length string)
@@ -95,23 +128,41 @@
* user.
* @return The object itself, to allow chaining
*/
- BindRequest setName( String name );
-
+ public BindRequest setName( String name )
+ {
+ this.name = name;
+
+ return this;
+ }
+
/**
- * Checks to see if the Ldap v3 protocol is used. Normally this would
- * extract a version number from the bind request sent by the client
- * indicating the version of the protocol to be used in this protocol
- * session. The integer is either a 2 or a 3 at the moment. We thought it
- * was better to just check if the protocol used is 3 or not rather than use
- * an type-safe enumeration type for a binary value. If an LDAPv4 comes out
- * then we shall convert the return type to a type safe enumeration.
+ * Gets the SASL mechanism String associated with this BindRequest if the
+ * bind operation is using SASL.
*
- * @return true if client using version 3 false if it is version 2.
+ * @return the SASL mechanism or null if the bind op is simple
*/
- boolean isVersion3();
+ public String getSaslMechanism()
+ {
+ return saslMechanism;
+ }
+
+ /**
+ * Sets the SASL mechanism String associated with this BindRequest if the
+ * bind operation is using SASL.
+ *
+ * @param saslMechanism the SASL mechanism
+ * @return The object itself, to allow chaining
+ */
+ public BindRequest setSaslMechanism( String saslMechanism )
+ {
+ this.saslMechanism = saslMechanism;
+
+ return this;
+ }
+
/**
* Gets the Ldap protocol version used. Normally this would
* extract a version number from the bind request sent by the client
@@ -123,9 +174,12 @@
*
* @return 3 for LdapV3, 2 for LDAPV2
*/
- int getVersion();
-
+ public int getVersion()
+ {
+ return version;
+ }
+
/**
* Sets whether or not the LDAP v3 or v2 protocol is used. Normally this
* would extract a version number from the bind request sent by the client
@@ -138,24 +192,88 @@
* @param version The version. Should be 3 or 2
* @return The object itself, to allow chaining
*/
- BindRequest setVersion( int version );
-
+ public BindRequest setVersion( int version )
+ {
+ this.version = version;
+
+ return this;
+ }
+
/**
- * Gets the SASL mechanism String associated with this BindRequest if the
- * bind operation is using SASL.
+ * Checks to see if the authentication mechanism is simple and not SASL
+ * based.
*
- * @return the SASL mechanism or null if the bind op is simple
+ * @return true if the mechanism is simple false if it is SASL based.
*/
- String getSaslMechanism();
-
+ public boolean isSimple()
+ {
+ return isSimple;
+ }
+
/**
- * Sets the SASL mechanism String associated with this BindRequest if the
- * bind operation is using SASL.
+ * Checks to see if the Ldap v3 protocol is used. Normally this would
+ * extract a version number from the bind request sent by the client
+ * indicating the version of the protocol to be used in this protocol
+ * session. The integer is either a 2 or a 3 at the moment. We thought it
+ * was better to just check if the protocol used is 3 or not rather than use
+ * an type-safe enumeration type for a binary value. If an LDAPv4 comes out
+ * then we shall convert the return type to a type safe enumeration.
*
- * @param saslMechanism the SASL mechanism
+ * @return true if client using version 3 false if it is version 2.
+ */
+ public boolean isVersion3()
+ {
+ return version == 3;
+ }
+
+
+ /**
+ * Sets the authentication mechanism to SASL
* @return The object itself, to allow chaining
*/
- BindRequest setSaslMechanism( String saslMechanism );
+ public BindRequest setSasl()
+ {
+ isSimple = false;
+
+ return this;
+ }
+
+
+ /**
+ * Get a String representation of a BindRequest
+ *
+ * @return A BindRequest String
+ */
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( super.toString() );
+ sb.append( " BindRequest\n" );
+ sb.append( " Version : '" ).append( version ).append( "'\n" );
+
+ if ( ( null == name ) || StringTools.isEmpty( name.toString() ) )
+ {
+ sb.append( " Name : anonymous\n" );
+ }
+ else
+ {
+ sb.append( " Name : '" ).append( name ).append( "'\n" );
+
+ if ( isSimple )
+ {
+ sb.append( " Simple authentication : '" ).append( StringTools.utf8ToString( credentials ) ).append( "'\n" );
+ }
+ else
+ {
+ sb.append( " Sasl authentication : \n" );
+ sb.append( " mechanism : '" ).append( saslMechanism ).append( "'\n" );
+ sb.append( " credentials : '" ).append( StringTools.utf8ToString( credentials ) ).append( "'\n" );
+ }
+ }
+
+ return sb.toString();
+ }
}
Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponse.java?rev=784515&r1=784514&r2=784515&view=diff
==============================================================================
--- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponse.java (original)
+++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponse.java Sun Jun 14 07:14:54 2009
@@ -19,17 +19,32 @@
*/
package org.apache.directory.shared.ldap.client.api.messages;
+import org.apache.directory.shared.ldap.util.StringTools;
+
/**
* Bind protocol response message used to confirm the results of a bind request
* message. BindResponse consists simply of an indication from the server of the
* status of the client's request for authentication.
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: 760724 $
+ * @version $Rev$, $Date$
*/
-public interface BindResponse extends ResponseWithResult
+public class BindResponse extends AbstractResponseWithResult
{
+ /** optional property holding SASL authentication response parameters */
+ private byte[] credentials;
+
+
+ /**
+ * Creates a new instance of BindResponseImpl.
+ */
+ public BindResponse()
+ {
+ super();
+ }
+
+
/**
* Gets the optional property holding SASL authentication response parameters
* that are SASL mechanism specific. Will return null if the authentication
@@ -37,11 +52,40 @@
*
* @return the sasl mech. specific credentials or null of auth. is simple
*/
- byte[] getServerSaslCreds();
-
+ public byte[] getServerSaslCreds()
+ {
+ return credentials;
+ }
+
/**
* {@inheritDoc}
*/
- void setServerSaslCreds( byte[] credentials );
+ public void setServerSaslCreds( byte[] credentials )
+ {
+ this.credentials = credentials;
+ }
+
+
+ /**
+ * Get a String representation of a BindResponse
+ *
+ * @return A BindResponse String
+ */
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( super.toString() );
+ sb.append( " BindResponse\n" );
+
+ if ( credentials != null )
+ {
+ sb.append( " Server sasl credentials : '" ).
+ append( StringTools.utf8ToString( credentials ) ).
+ append( "'\n" );
+ }
+
+ return sb.toString();
+ }
}
Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/IntermediateResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/IntermediateResponse.java?rev=784515&r1=784514&r2=784515&view=diff
==============================================================================
--- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/IntermediateResponse.java (original)
+++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/IntermediateResponse.java Sun Jun 14 07:14:54 2009
@@ -21,18 +21,36 @@
/**
- * An interface for Intermediate responses.
+ * An class Intermediate responses.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface IntermediateResponse extends Message
+public class IntermediateResponse extends AbstractMessage
{
+ /** The Response OID */
+ private String responseName;
+
+ /** The response value */
+ private byte[] responseValue;
+
+ /**
+ * Creates a new instance of IntermediateResponseImpl.
+ */
+ public IntermediateResponse()
+ {
+ super();
+ }
+
+
/**
* Get the original response OID.
*
* @return The response OID
*/
- String getResponseName();
+ public String getResponseName()
+ {
+ return responseName;
+ }
/**
@@ -40,7 +58,10 @@
*
* @param responseName The response OID
*/
- void setResponseName( String responseName );
+ public void setResponseName( String responseName )
+ {
+ this.responseName = responseName;
+ }
/**
@@ -48,13 +69,19 @@
*
* @return The response value
*/
- byte[] getResponseValue();
-
+ public byte[] getResponseValue()
+ {
+ return responseValue;
+ }
+
/**
* Sets the response's value
*
* @param responseValue The associated response's value
*/
- void setResponseValue( byte[] responseValue );
+ public void setResponseValue( byte[] responseValue )
+ {
+ this.responseValue = responseValue;
+ }
}
Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/LdapResult.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/LdapResult.java?rev=784515&r1=784514&r2=784515&view=diff
==============================================================================
--- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/LdapResult.java (original)
+++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/LdapResult.java Sun Jun 14 07:14:54 2009
@@ -22,7 +22,6 @@
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-
/**
* LDAPv3 result structure embedded into Responses. See section 4.1.10 in <a
* href="">RFC 2251</a> for a description of the LDAPResult ASN.1 structure,
@@ -37,29 +36,45 @@
* </pre>
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Revision: 437007 $
+ * @version $Revision: 760984 $
*/
-public interface LdapResult
+public class LdapResult
{
+ /** Lowest matched entry Dn - defaults to empty string */
+ private String matchedDn;
+
+ /** Referral associated with this LdapResult if the errorCode is REFERRAL */
+ private Referral referral;
+
+ /** Decriptive error message - defaults to empty string */
+ private String errorMessage;
+
+ /** Resultant operation error code - defaults to SUCCESS */
+ private ResultCodeEnum resultCode = ResultCodeEnum.SUCCESS;
+
+
/**
- * Gets the result code enumeration associated with the response.
- * Corresponds to the <b> resultCode </b> field within the LDAPResult ASN.1
- * structure.
+ * Gets the descriptive error message associated with the error code. May be
+ * null for SUCCESS, COMPARETRUE, COMPAREFALSE and REFERRAL operations.
*
- * @return the result code enum value.
+ * @return the descriptive error message.
*/
- ResultCodeEnum getResultCode();
+ public String getErrorMessage()
+ {
+ return errorMessage;
+ }
/**
- * Sets the result code enumeration associated with the response.
- * Corresponds to the <b> resultCode </b> field within the LDAPResult ASN.1
- * structure.
+ * Sets the descriptive error message associated with the error code. May be
+ * null for SUCCESS, COMPARETRUE, and COMPAREFALSE operations.
*
- * @param resultCode
- * the result code enum value.
+ * @param errorMessage the descriptive error message.
*/
- void setResultCode( ResultCodeEnum resultCode );
+ public void setErrorMessage( String errorMessage )
+ {
+ this.errorMessage = errorMessage;
+ }
/**
@@ -75,7 +90,10 @@
*
* @return the Dn of the lowest matched entry.
*/
- String getMatchedDn();
+ public String getMatchedDn()
+ {
+ return matchedDn;
+ }
/**
@@ -84,44 +102,60 @@
* @see #getMatchedDn()
* @param dn the Dn of the lowest matched entry.
*/
- void setMatchedDn( String dn );
+ public void setMatchedDn( String matchedDn )
+ {
+ this.matchedDn = matchedDn;
+ }
/**
- * Gets the descriptive error message associated with the error code. May be
- * null for SUCCESS, COMPARETRUE, COMPAREFALSE and REFERRAL operations.
+ * Gets the result code enumeration associated with the response.
+ * Corresponds to the <b> resultCode </b> field within the LDAPResult ASN.1
+ * structure.
*
- * @return the descriptive error message.
+ * @return the result code enum value.
*/
- String getErrorMessage();
+ public ResultCodeEnum getResultCode()
+ {
+ return resultCode;
+ }
/**
- * Sets the descriptive error message associated with the error code. May be
- * null for SUCCESS, COMPARETRUE, and COMPAREFALSE operations.
+ * Sets the result code enumeration associated with the response.
+ * Corresponds to the <b> resultCode </b> field within the LDAPResult ASN.1
+ * structure.
*
- * @param errorMessage
- * the descriptive error message.
+ * @param resultCode the result code enum value.
*/
- void setErrorMessage( String errorMessage );
+ public void setResultCode( ResultCodeEnum resultCode )
+ {
+ this.resultCode = resultCode;
+ }
/**
- * Gets whether or not this result represents a Referral. For referrals the
- * error code is set to REFERRAL and the referral property is not null.
+ * Gets the Referral associated with this LdapResult if the resultCode
+ * property is set to the REFERRAL ResultCodeEnum.
*
- * @return true if this result represents a referral.
+ * @return the referral on REFERRAL errors, null on all others.
*/
- boolean isReferral();
+ public Referral getReferral()
+ {
+ return referral;
+ }
/**
- * Gets the Referral associated with this LdapResult if the resultCode
- * property is set to the REFERRAL ResultCodeEnum.
+ * Gets whether or not this result represents a Referral. For referrals the
+ * error code is set to REFERRAL and the referral property is not null.
*
- * @return the referral on REFERRAL errors, null on all others.
+ * @return true if this result represents a referral.
*/
- Referral getReferral();
+ public boolean isReferral()
+ {
+ return referral != null;
+ }
/**
@@ -132,5 +166,8 @@
*
* @param referral optional referral on REFERRAL errors.
*/
- void setReferral( Referral referral );
+ public void setReferral( Referral referral )
+ {
+ this.referral = referral;
+ }
}
Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/ModifyRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/ModifyRequest.java?rev=784515&r1=784514&r2=784515&view=diff
==============================================================================
--- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/ModifyRequest.java (original)
+++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/ModifyRequest.java Sun Jun 14 07:14:54 2009
@@ -22,7 +22,6 @@
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Referral.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Referral.java?rev=784515&r1=784514&r2=784515&view=diff
==============================================================================
--- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Referral.java (original)
+++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Referral.java Sun Jun 14 07:14:54 2009
@@ -20,9 +20,14 @@
package org.apache.directory.shared.ldap.client.api.messages;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
+import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
import org.apache.directory.shared.ldap.util.LdapURL;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -88,14 +93,35 @@
* remove LdapUrl objects instead of strings or provide both string and
* LdapUrl add/remove methods.
*/
-public interface Referral
+public class Referral
{
+ /** The logger */
+ static final Logger LOG = LoggerFactory.getLogger( Referral.class );
+
+ /** The list of LDAPUrls */
+ private List<LdapURL> referrals;
+
/**
* Gets an unmodifiable set of alternative referral urls.
*
* @return the alternative url objects.
*/
- Collection<String> getLdapUrls();
+ public Collection<String> getLdapUrls()
+ {
+ if ( referrals == null )
+ {
+ return new ArrayList<String>();
+ }
+
+ List<String> urls = new ArrayList<String>( referrals.size() );
+
+ for ( LdapURL referral:referrals )
+ {
+ urls.add( referral.toString() );
+ }
+
+ return urls;
+ }
/**
@@ -103,7 +129,32 @@
*
* @param urls the LDAPv3 URLs to add
*/
- void addLdapUrls( String... urls );
+ public void addLdapUrls( String... urls )
+ {
+ if ( ( urls == null ) || ( urls.length == 0 ) )
+ {
+ return;
+ }
+
+ if ( referrals == null )
+ {
+ referrals = new ArrayList<LdapURL>( urls.length );
+ }
+
+ for ( String url:urls )
+ {
+ try
+ {
+ LdapURL ldapUrl = new LdapURL( url );
+
+ referrals.add( ldapUrl );
+ }
+ catch ( LdapURLEncodingException luee )
+ {
+ LOG.warn( "The given URL '{}' is invalid", url );
+ }
+ }
+ }
/**
@@ -111,7 +162,23 @@
*
* @param urls the LDAPv3 URLs to add
*/
- void addLdapUrls( LdapURL... urls );
+ public void addLdapUrls( LdapURL... urls )
+ {
+ if ( ( urls == null ) || ( urls.length == 0 ) )
+ {
+ return;
+ }
+
+ if ( referrals == null )
+ {
+ referrals = new ArrayList<LdapURL>( urls.length );
+ }
+
+ for ( LdapURL url:urls )
+ {
+ referrals.add( url );
+ }
+ }
/**
@@ -119,7 +186,32 @@
*
* @param urls the LDAPv3 URLs to remove
*/
- void removeLdapUrl( String... urls );
+ public void removeLdapUrl( String... urls )
+ {
+ if ( ( urls == null ) || ( urls.length == 0 ) )
+ {
+ return;
+ }
+
+ if ( ( referrals == null ) || ( referrals.size() == 0 ) )
+ {
+ return;
+ }
+
+ for ( String url:urls )
+ {
+ try
+ {
+ LdapURL ldapUrl = new LdapURL( url );
+
+ referrals.remove( ldapUrl );
+ }
+ catch ( LdapURLEncodingException luee )
+ {
+ LOG.warn( "The given URL '{}' is invalid", url );
+ }
+ }
+ }
/**
@@ -127,5 +219,21 @@
*
* @param urls the LDAPv3 URLs to remove
*/
- void removeLdapUrl( LdapURL... urls );
+ public void removeLdapUrl( LdapURL... urls )
+ {
+ if ( ( urls == null ) || ( urls.length == 0 ) )
+ {
+ return;
+ }
+
+ if ( ( referrals == null ) || ( referrals.size() == 0 ) )
+ {
+ return;
+ }
+
+ for ( LdapURL url:urls )
+ {
+ referrals.remove( url );
+ }
+ }
}
Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/SearchResultReferenceImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/SearchResultReferenceImpl.java?rev=784515&r1=784514&r2=784515&view=diff
==============================================================================
--- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/SearchResultReferenceImpl.java (original)
+++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/SearchResultReferenceImpl.java Sun Jun 14 07:14:54 2009
@@ -69,7 +69,7 @@
{
if ( referral == null )
{
- referral = new ReferralImpl();
+ referral = new Referral();
}
referral.addLdapUrls( urls );
@@ -83,7 +83,7 @@
{
if ( referral == null )
{
- referral = new ReferralImpl();
+ referral = new Referral();
}
referral.addLdapUrls( urls );
@@ -97,7 +97,7 @@
{
if ( referral == null )
{
- referral = new ReferralImpl();
+ referral = new Referral();
}
referral.removeLdapUrl( urls );
@@ -111,7 +111,7 @@
{
if ( referral == null )
{
- referral = new ReferralImpl();
+ referral = new Referral();
}
referral.removeLdapUrl( urls );
Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/UnbindRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/UnbindRequest.java?rev=784515&r1=784514&r2=784515&view=diff
==============================================================================
--- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/UnbindRequest.java (original)
+++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/UnbindRequest.java Sun Jun 14 07:14:54 2009
@@ -25,6 +25,30 @@
*
* @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
*/
-public interface UnbindRequest extends Request
+public class UnbindRequest extends AbstractRequest
{
+ /**
+ *
+ * Creates a new instance of UnbindRequest.
+ */
+ public UnbindRequest()
+ {
+ super();
+ }
+
+
+ /**
+ * Get a String representation of a UnBindRequest
+ *
+ * @return A UnBindRequest String
+ */
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( super.toString() );
+ sb.append( " UnBind Request\n" );
+
+ return sb.toString();
+ }
}