You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2011/01/25 05:33:19 UTC
svn commit: r1063135 - in /directory/shared/trunk/ldap/src:
main/java/org/apache/directory/shared/ldap/message/
main/java/org/apache/directory/shared/ldap/message/decorators/
main/java/org/apache/directory/shared/ldap/model/message/
test/java/org/apach...
Author: akarasulu
Date: Tue Jan 25 04:33:18 2011
New Revision: 1063135
URL: http://svn.apache.org/viewvc?rev=1063135&view=rev
Log:
Shared refactoring ...
o THIS WILL BREAK THE BUILD: shared tests will fail
o decoupled LdapResultImpl and moved it over to the model
o could not totally decouple SeachRequestImpl, remains behind for now
Added:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/LdapResultDecorator.java
- copied, changed from r1063097, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/FooDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/SearchRequestDecorator.java
- copied, changed from r1063097, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/FooDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/LdapResultImpl.java (contents, props changed)
- copied, changed from r1063063, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java
directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/LdapResultImplTest.java (contents, props changed)
- copied, changed from r1063113, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/LdapResultImplTest.java
Removed:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java
directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/LdapResultImplTest.java
Modified:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapEncoder.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/MessageDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/AbstractResultResponse.java
directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/BindResponseImplTest.java
directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/ExtendedResponseImplTest.java
directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/SearchResponseDoneImplTest.java
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapEncoder.java?rev=1063135&r1=1063134&r2=1063135&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapEncoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapEncoder.java Tue Jan 25 04:33:18 2011
@@ -232,9 +232,9 @@ public class LdapEncoder
* Length(0x01) + 1 + Length(0x04) + Length(L1) + L1 + Length(0x04) +
* Length(L2) + L2 + Length(0x83) + Length(L3) + L3
*/
- private int computeLdapResultLength( LdapResult internalLdapResult )
+ private int computeLdapResultLength( LdapResultDecorator decorator )
{
- LdapResultImpl ldapResult = ( LdapResultImpl ) internalLdapResult;
+ LdapResult ldapResult = decorator.getLdapResult();
int ldapResultLength = 0;
// The result code : always 3 bytes
@@ -250,13 +250,13 @@ public class LdapEncoder
byte[] matchedDNBytes = Strings.getBytesUtf8(Strings
.trimLeft(ldapResult.getMatchedDn().getName()));
ldapResultLength += 1 + TLV.getNbBytes( matchedDNBytes.length ) + matchedDNBytes.length;
- ldapResult.setMatchedDnBytes( matchedDNBytes );
+ decorator.setMatchedDnBytes( matchedDNBytes );
}
// The errorMessage length
byte[] errorMessageBytes = Strings.getBytesUtf8(ldapResult.getErrorMessage());
ldapResultLength += 1 + TLV.getNbBytes( errorMessageBytes.length ) + errorMessageBytes.length;
- ldapResult.setErrorMessageBytes( errorMessageBytes );
+ decorator.setErrorMessageBytes( errorMessageBytes );
int referralLength = computeReferralLength( ldapResult.getReferral() );
@@ -276,9 +276,9 @@ public class LdapEncoder
* @param buffer The buffer where to put the PDU
* @return The PDU.
*/
- private ByteBuffer encodeLdapResult( ByteBuffer buffer, LdapResult internalLdapResult ) throws EncoderException
+ private ByteBuffer encodeLdapResult( ByteBuffer buffer, LdapResultDecorator decorator ) throws EncoderException
{
- LdapResultImpl ldapResult = ( LdapResultImpl ) internalLdapResult;
+ LdapResult ldapResult = decorator.getLdapResult();
if ( buffer == null )
{
@@ -298,10 +298,10 @@ public class LdapEncoder
}
// The matchedDN
- Value.encode( buffer, ldapResult.getMatchedDnBytes() );
+ Value.encode( buffer, decorator.getMatchedDnBytes() );
// The error message
- Value.encode( buffer, ldapResult.getErrorMessageBytes() );
+ Value.encode( buffer, decorator.getErrorMessageBytes() );
// The referrals, if any
Referral referral = ldapResult.getReferral();
@@ -478,7 +478,7 @@ public class LdapEncoder
private int computeAddResponseLength( AddResponseDecorator decorator )
{
AddResponse addResponse = decorator.getAddResponse();
- int addResponseLength = computeLdapResultLength( addResponse.getLdapResult() );
+ int addResponseLength = computeLdapResultLength( new LdapResultDecorator( addResponse.getLdapResult() ) );
decorator.setAddResponseLength( addResponseLength );
@@ -572,7 +572,7 @@ public class LdapEncoder
private int computeBindResponseLength( BindResponseDecorator decorator )
{
BindResponse bindResponse = decorator.getBindResponse();
- int ldapResultLength = computeLdapResultLength( bindResponse.getLdapResult() );
+ int ldapResultLength = computeLdapResultLength( new LdapResultDecorator( bindResponse.getLdapResult() ) );
int bindResponseLength = ldapResultLength;
@@ -660,7 +660,7 @@ public class LdapEncoder
private int computeCompareResponseLength( CompareResponseDecorator decorator )
{
CompareResponse compareResponse = decorator.getCompareResponse();
- int compareResponseLength = computeLdapResultLength( compareResponse.getLdapResult() );
+ int compareResponseLength = computeLdapResultLength( new LdapResultDecorator( compareResponse.getLdapResult() ) );
decorator.setCompareResponseLength( compareResponseLength );
@@ -700,7 +700,7 @@ public class LdapEncoder
private int computeDeleteResponseLength( DeleteResponseDecorator decorator )
{
DeleteResponse deleteResponse = decorator.getDeleteResponse();
- int deleteResponseLength = computeLdapResultLength( deleteResponse.getLdapResult() );
+ int deleteResponseLength = computeLdapResultLength( new LdapResultDecorator( deleteResponse.getLdapResult() ) );
decorator.setDeleteResponseLength( deleteResponseLength );
@@ -766,7 +766,7 @@ public class LdapEncoder
private int computeExtendedResponseLength( ExtendedResponseDecorator decorator )
{
ExtendedResponse extendedResponse = decorator.getExtendedResponse();
- int ldapResultLength = computeLdapResultLength( extendedResponse.getLdapResult() );
+ int ldapResultLength = computeLdapResultLength( new LdapResultDecorator( extendedResponse.getLdapResult() ) );
int extendedResponseLength = ldapResultLength;
@@ -961,7 +961,7 @@ public class LdapEncoder
private int computeModifyResponseLength( ModifyResponseDecorator decorator )
{
ModifyResponse modifyResponse = decorator.getModifyResponse();
- int modifyResponseLength = computeLdapResultLength( modifyResponse.getLdapResult() );
+ int modifyResponseLength = computeLdapResultLength( new LdapResultDecorator( modifyResponse.getLdapResult() ) );
decorator.setModifyResponseLength( modifyResponseLength );
@@ -1028,7 +1028,8 @@ public class LdapEncoder
private int computeModifyDnResponseLength( ModifyDnResponseDecorator decorator )
{
ModifyDnResponse modifyDnResponse = decorator.getModifyDnResponse();
- int modifyDnResponseLength = computeLdapResultLength( modifyDnResponse.getLdapResult() );
+ int modifyDnResponseLength = computeLdapResultLength( new LdapResultDecorator(
+ modifyDnResponse.getLdapResult() ) );
decorator.setModifyDnResponseLength( modifyDnResponseLength );
@@ -1094,13 +1095,14 @@ public class LdapEncoder
* +--> 0x04 L4-n Attribute description
* </pre>
*/
- private int computeSearchRequestLength( SearchRequestImpl searchRequest )
+ private int computeSearchRequestLength( SearchRequestDecorator decorator )
{
+ SearchRequest searchRequest = decorator.getSearchRequest();
int searchRequestLength = 0;
// The baseObject
- searchRequestLength += 1 + TLV.getNbBytes( Dn.getNbBytes(searchRequest.getBase()) )
- + Dn.getNbBytes(searchRequest.getBase());
+ searchRequestLength += 1 + TLV.getNbBytes( Dn.getNbBytes( searchRequest.getBase() ) )
+ + Dn.getNbBytes(searchRequest.getBase() );
// The scope
searchRequestLength += 1 + 1 + 1;
@@ -1118,7 +1120,7 @@ public class LdapEncoder
searchRequestLength += 1 + 1 + 1;
// The filter
- searchRequestLength += searchRequest.getCurrentFilter().computeLength();
+ searchRequestLength += decorator.getCurrentFilter().computeLength();
// The attributes description list
int attributeDescriptionListLength = 0;
@@ -1134,11 +1136,11 @@ public class LdapEncoder
}
}
- searchRequest.setAttributeDescriptionListLength( attributeDescriptionListLength );
+ decorator.setAttributeDescriptionListLength( attributeDescriptionListLength );
searchRequestLength += 1 + TLV.getNbBytes( attributeDescriptionListLength ) + attributeDescriptionListLength;
- searchRequest.setSearchRequestLength( searchRequestLength );
+ decorator.setSearchRequestLength( searchRequestLength );
// Return the result.
return 1 + TLV.getNbBytes( searchRequestLength ) + searchRequestLength;
}
@@ -1160,7 +1162,8 @@ public class LdapEncoder
private int computeSearchResultDoneLength( SearchResultDoneDecorator decorator )
{
SearchResultDone searchResultDone = decorator.getSearchResultDone();
- int searchResultDoneLength = computeLdapResultLength( searchResultDone.getLdapResult() );
+ int searchResultDoneLength = computeLdapResultLength( new LdapResultDecorator(
+ searchResultDone.getLdapResult() ) );
decorator.setSearchResultDoneLength( searchResultDoneLength );
@@ -1483,7 +1486,7 @@ public class LdapEncoder
buffer.put( TLV.getBytes( decorator.getAddResponseLength() ) );
// The LdapResult
- encodeLdapResult( buffer, addResponse.getLdapResult() );
+ encodeLdapResult( buffer, new LdapResultDecorator( addResponse.getLdapResult() ) );
}
catch ( BufferOverflowException boe )
{
@@ -1613,7 +1616,7 @@ public class LdapEncoder
bb.put( TLV.getBytes( decorator.getBindResponseLength() ) );
// The LdapResult
- encodeLdapResult( bb, bindResponse.getLdapResult() );
+ encodeLdapResult( bb, new LdapResultDecorator( bindResponse.getLdapResult() ) );
// The serverSaslCredential, if any
byte[] serverSaslCreds = bindResponse.getServerSaslCreds();
@@ -1694,7 +1697,7 @@ public class LdapEncoder
buffer.put( TLV.getBytes( decorator.getCompareResponseLength() ) );
// The LdapResult
- encodeLdapResult( buffer, compareResponse.getLdapResult() );
+ encodeLdapResult( buffer, new LdapResultDecorator( compareResponse.getLdapResult() ) );
}
catch ( BufferOverflowException boe )
{
@@ -1745,7 +1748,7 @@ public class LdapEncoder
buffer.put( TLV.getBytes( decorator.getDeleteResponseLength() ) );
// The LdapResult
- encodeLdapResult( buffer, deleteResponse.getLdapResult() );
+ encodeLdapResult( buffer, new LdapResultDecorator( deleteResponse.getLdapResult() ) );
}
catch ( BufferOverflowException boe )
{
@@ -1831,7 +1834,7 @@ public class LdapEncoder
buffer.put( TLV.getBytes( decorator.getExtendedResponseLength() ) );
// The LdapResult
- encodeLdapResult( buffer, extendedResponse.getLdapResult() );
+ encodeLdapResult( buffer, new LdapResultDecorator( extendedResponse.getLdapResult() ) );
// The ID, if any
byte[] idBytes = decorator.getResponseNameBytes();
@@ -2043,7 +2046,7 @@ public class LdapEncoder
buffer.put( TLV.getBytes( decorator.getModifyResponseLength() ) );
// The LdapResult
- encodeLdapResult( buffer, modifyResponse.getLdapResult() );
+ encodeLdapResult( buffer, new LdapResultDecorator( modifyResponse.getLdapResult() ) );
}
catch ( BufferOverflowException boe )
{
@@ -2126,7 +2129,7 @@ public class LdapEncoder
buffer.put( TLV.getBytes( decorator.getModifyDnResponseLength() ) );
// The LdapResult
- encodeLdapResult( buffer, modifyDnResponse.getLdapResult() );
+ encodeLdapResult( buffer, new LdapResultDecorator( modifyDnResponse.getLdapResult() ) );
}
catch ( BufferOverflowException boe )
{
@@ -2156,16 +2159,17 @@ public class LdapEncoder
* @param buffer The buffer where to put the PDU
* @return The PDU.
*/
- private void encodeSearchRequest( ByteBuffer buffer, SearchRequestImpl searchRequest ) throws EncoderException
+ private void encodeSearchRequest( ByteBuffer buffer, SearchRequestDecorator decorator ) throws EncoderException
{
+ SearchRequest searchRequest = decorator.getSearchRequest();
try
{
// The SearchRequest Tag
buffer.put( LdapConstants.SEARCH_REQUEST_TAG );
- buffer.put( TLV.getBytes( searchRequest.getSearchRequestLength() ) );
+ buffer.put( TLV.getBytes( decorator.getSearchRequestLength() ) );
// The baseObject
- Value.encode( buffer, Dn.getBytes(searchRequest.getBase()) );
+ Value.encode( buffer, Dn.getBytes( searchRequest.getBase()) );
// The scope
Value.encodeEnumerated( buffer, searchRequest.getScope().getScope() );
@@ -2183,11 +2187,11 @@ public class LdapEncoder
Value.encode( buffer, searchRequest.getTypesOnly() );
// The filter
- searchRequest.getCurrentFilter().encode( buffer );
+ decorator.getCurrentFilter().encode( buffer );
// The attributeDescriptionList
buffer.put( UniversalTag.SEQUENCE.getValue() );
- buffer.put( TLV.getBytes( searchRequest.getAttributeDescriptionListLength() ) );
+ buffer.put( TLV.getBytes( decorator.getAttributeDescriptionListLength() ) );
if ( ( searchRequest.getAttributes() != null ) && ( searchRequest.getAttributes().size() != 0 ) )
{
@@ -2222,7 +2226,7 @@ public class LdapEncoder
buffer.put( TLV.getBytes( decorator.getSearchResultDoneLength() ) );
// The LdapResult
- encodeLdapResult( buffer, searchResultDone.getLdapResult() );
+ encodeLdapResult( buffer, new LdapResultDecorator( searchResultDone.getLdapResult() ) );
}
catch ( BufferOverflowException boe )
{
@@ -2444,7 +2448,7 @@ public class LdapEncoder
return computeModifyDnResponseLength( ( ModifyDnResponseDecorator ) decorator );
case SEARCH_REQUEST:
- return computeSearchRequestLength( ( SearchRequestImpl ) message );
+ return computeSearchRequestLength( ( SearchRequestDecorator ) decorator );
case SEARCH_RESULT_DONE:
return computeSearchResultDoneLength( ( SearchResultDoneDecorator ) decorator );
@@ -2535,7 +2539,7 @@ public class LdapEncoder
break;
case SEARCH_REQUEST:
- encodeSearchRequest( bb, ( SearchRequestImpl ) message );
+ encodeSearchRequest( bb, ( SearchRequestDecorator ) decorator );
break;
case SEARCH_RESULT_DONE:
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java?rev=1063135&r1=1063134&r2=1063135&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java Tue Jan 25 04:33:18 2011
@@ -113,16 +113,7 @@ public class SearchRequestImpl extends A
/** The final result containing SearchResponseDone response */
private SearchResultDone response;
- /** The searchRequest length */
- private int searchRequestLength;
- /** The attributeDescriptionList length */
- private int attributeDescriptionListLength;
-
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
/**
* Creates a SearcRequest implementing object used to search the
* DIT.
@@ -148,7 +139,7 @@ public class SearchRequestImpl extends A
/**
* Transform the Filter part of a SearchRequest to an ExprNode
*
- * @param codecFilter The filter to be transformed
+ * @param filter The filter to be transformed
* @return An ExprNode
*/
private ExprNode transform( Filter filter )
@@ -559,17 +550,6 @@ public class SearchRequestImpl extends A
/**
- * Set the current filter
- *
- * @param filter The filter to set.
- */
- public void setCurrentFilter( Filter filter )
- {
- currentFilter = filter;
- }
-
-
- /**
* {@inheritDoc}
*/
public void setFilter( String filter ) throws LdapException
@@ -588,6 +568,17 @@ public class SearchRequestImpl extends A
/**
+ * Set the current filter
+ *
+ * @param filter The filter to set.
+ */
+ public void setCurrentFilter( Filter filter )
+ {
+ currentFilter = filter;
+ }
+
+
+ /**
* Get the parent Filter, if any
*
* @return The parent filter
@@ -856,44 +847,6 @@ public class SearchRequestImpl extends A
/**
- * Stores the encoded length for the SearchRequest
- * @param searchRequestLength The encoded length
- */
- /*No qualifier*/void setSearchRequestLength( int searchRequestLength )
- {
- this.searchRequestLength = searchRequestLength;
- }
-
-
- /**
- * @return The encoded SearchRequest's length
- */
- /*No qualifier*/int getSearchRequestLength()
- {
- return searchRequestLength;
- }
-
-
- /**
- * Stores the encoded length for the list of attributes
- * @param attributeDescriptionListLength The encoded length of the attributes
- */
- /*No qualifier*/void setAttributeDescriptionListLength( int attributeDescriptionListLength )
- {
- this.attributeDescriptionListLength = attributeDescriptionListLength;
- }
-
-
- /**
- * @return The encoded SearchRequest's attributes length
- */
- /*No qualifier*/int getAttributeDescriptionListLength()
- {
- return attributeDescriptionListLength;
- }
-
-
- /**
* Set the SearchRequest PDU TLV's Id
* @param tlvId The TLV id
*/
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/LdapResultDecorator.java (from r1063097, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/FooDecorator.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/LdapResultDecorator.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/LdapResultDecorator.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/FooDecorator.java&r1=1063097&r2=1063135&rev=1063135&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/FooDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/LdapResultDecorator.java Tue Jan 25 04:33:18 2011
@@ -20,9 +20,7 @@
package org.apache.directory.shared.ldap.message.decorators;
-import org.apache.directory.shared.ldap.model.message.AddRequest;
-
-import java.util.List;
+import org.apache.directory.shared.ldap.model.message.LdapResult;
/**
@@ -30,22 +28,70 @@ import java.util.List;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class FooDecorator extends MessageDecorator
+public class LdapResultDecorator
{
+ /** The decorated LdapResult */
+ private final LdapResult decoratedLdapResult;
+
+ /** Temporary storage for message bytes */
+ private byte[] errorMessageBytes;
+
+ /** Temporary storage of the byte[] representing the matchedDN */
+ private byte[] matchedDnBytes;
+
/**
- * Makes a Foo encodable.
+ * Makes a LdapResult encodable.
*
- * @param decoratedMessage the decorated Foo
+ * @param decoratedLdapResult the decorated LdapResult
*/
- public FooDecorator( AddRequest decoratedMessage )
+ public LdapResultDecorator( LdapResult decoratedLdapResult )
+ {
+ this.decoratedLdapResult = decoratedLdapResult;
+ }
+
+
+ public LdapResult getLdapResult()
{
- super( decoratedMessage );
+ return decoratedLdapResult;
}
- public AddRequest getAddRequest()
+ /**
+ * @return The encoded Error message
+ */
+ public byte[] getErrorMessageBytes()
+ {
+ return errorMessageBytes;
+ }
+
+
+ /**
+ * Set the encoded message's bytes
+ * @param errorMessageBytes The encoded bytes
+ */
+ public void setErrorMessageBytes( byte[] errorMessageBytes )
+ {
+ this.errorMessageBytes = errorMessageBytes;
+ }
+
+
+ /**
+ * Sets the encoded value for MatchedDn
+ *
+ * @param matchedDnBytes The encoded MatchedDN
+ */
+ public void setMatchedDnBytes( byte[] matchedDnBytes )
+ {
+ this.matchedDnBytes = matchedDnBytes;
+ }
+
+
+ /**
+ * @return the encoded MatchedDN
+ */
+ public byte[] getMatchedDnBytes()
{
- return ( AddRequest ) getMessage();
+ return matchedDnBytes;
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/MessageDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/MessageDecorator.java?rev=1063135&r1=1063134&r2=1063135&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/MessageDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/MessageDecorator.java Tue Jan 25 04:33:18 2011
@@ -81,6 +81,8 @@ public class MessageDecorator
return new ModifyDnRequestDecorator( ( ModifyDnRequest ) decoratedMessage );
case MODIFYDN_RESPONSE:
return new ModifyDnResponseDecorator( ( ModifyDnResponse ) decoratedMessage );
+ case SEARCH_REQUEST:
+ return new SearchRequestDecorator( ( SearchRequest ) decoratedMessage );
case SEARCH_RESULT_DONE:
return new SearchResultDoneDecorator( ( SearchResultDone ) decoratedMessage );
case SEARCH_RESULT_ENTRY:
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/SearchRequestDecorator.java (from r1063097, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/FooDecorator.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/SearchRequestDecorator.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/SearchRequestDecorator.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/FooDecorator.java&r1=1063097&r2=1063135&rev=1063135&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/FooDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/SearchRequestDecorator.java Tue Jan 25 04:33:18 2011
@@ -20,9 +20,9 @@
package org.apache.directory.shared.ldap.message.decorators;
-import org.apache.directory.shared.ldap.model.message.AddRequest;
-
-import java.util.List;
+import org.apache.directory.shared.ldap.codec.search.Filter;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
+import org.apache.directory.shared.ldap.model.message.SearchRequest;
/**
@@ -30,22 +30,73 @@ import java.util.List;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class FooDecorator extends MessageDecorator
+public class SearchRequestDecorator extends MessageDecorator
{
+ /** The searchRequest length */
+ private int searchRequestLength;
+
+ /** The attributeDescriptionList length */
+ private int attributeDescriptionListLength;
+
/**
- * Makes a Foo encodable.
+ * Makes a SearchRequest encodable.
*
- * @param decoratedMessage the decorated Foo
+ * @param decoratedMessage the decorated SearchRequest
*/
- public FooDecorator( AddRequest decoratedMessage )
+ public SearchRequestDecorator( SearchRequest decoratedMessage )
{
super( decoratedMessage );
}
- public AddRequest getAddRequest()
+ public SearchRequest getSearchRequest()
+ {
+ return ( SearchRequest ) getMessage();
+ }
+
+
+ /**
+ * Stores the encoded length for the SearchRequest
+ * @param searchRequestLength The encoded length
+ */
+ public void setSearchRequestLength( int searchRequestLength )
+ {
+ this.searchRequestLength = searchRequestLength;
+ }
+
+
+ /**
+ * @return The encoded SearchRequest's length
+ */
+ public int getSearchRequestLength()
+ {
+ return searchRequestLength;
+ }
+
+
+ /**
+ * Stores the encoded length for the list of attributes
+ * @param attributeDescriptionListLength The encoded length of the attributes
+ */
+ public void setAttributeDescriptionListLength( int attributeDescriptionListLength )
+ {
+ this.attributeDescriptionListLength = attributeDescriptionListLength;
+ }
+
+
+ /**
+ * @return The encoded SearchRequest's attributes length
+ */
+ public int getAttributeDescriptionListLength()
+ {
+ return attributeDescriptionListLength;
+ }
+
+
+ public Filter getCurrentFilter()
{
- return ( AddRequest ) getMessage();
+ // TODO - very very bad move for now to make sure it works but need to remove Impl ref and use interface
+ return ( ( SearchRequestImpl ) getSearchRequest() ).getCurrentFilter();
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/AbstractResultResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/AbstractResultResponse.java?rev=1063135&r1=1063134&r2=1063135&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/AbstractResultResponse.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/AbstractResultResponse.java Tue Jan 25 04:33:18 2011
@@ -20,9 +20,6 @@
package org.apache.directory.shared.ldap.model.message;
-import org.apache.directory.shared.ldap.message.LdapResultImpl;
-
-
/**
* Abstract base for a ResultResponse message.
*
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/LdapResultImpl.java (from r1063063, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/LdapResultImpl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/LdapResultImpl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java&r1=1063063&r2=1063135&rev=1063135&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/LdapResultImpl.java Tue Jan 25 04:33:18 2011
@@ -18,7 +18,7 @@
*
*/
-package org.apache.directory.shared.ldap.message;
+package org.apache.directory.shared.ldap.model.message;
import org.apache.directory.shared.ldap.model.message.LdapResult;
@@ -39,18 +39,12 @@ public class LdapResultImpl implements L
/** Lowest matched entry Dn - defaults to empty string */
private Dn matchedDn;
- /** Temporary storage of the byte[] representing the matchedDN */
- private byte[] matchedDnBytes;
-
/** Referral associated with this LdapResult if the errorCode is REFERRAL */
private Referral referral;
/** Decriptive error message - defaults to empty string */
private String errorMessage;
- /** Temporary storage for message bytes */
- private byte[] errorMessageBytes;
-
/** Resultant operation error code - defaults to SUCCESS */
private ResultCodeEnum resultCode = ResultCodeEnum.SUCCESS;
@@ -58,6 +52,8 @@ public class LdapResultImpl implements L
// ------------------------------------------------------------------------
// LdapResult Interface Method Implementations
// ------------------------------------------------------------------------
+
+
/**
* Gets the descriptive error message associated with the error code. May be
* null for SUCCESS, COMPARETRUE, COMPAREFALSE and REFERRAL operations.
@@ -71,15 +67,6 @@ public class LdapResultImpl implements L
/**
- * @return The encoded Error message
- */
- /*No qualifier*/byte[] getErrorMessageBytes()
- {
- return errorMessageBytes;
- }
-
-
- /**
* Sets the descriptive error message associated with the error code. May be
* null for SUCCESS, COMPARETRUE, and COMPAREFALSE operations.
*
@@ -93,16 +80,6 @@ public class LdapResultImpl implements L
/**
- * Set the encoded message's bytes
- * @param errorMessageBytes The encoded bytes
- */
- /*No qualifier*/void setErrorMessageBytes( byte[] errorMessageBytes )
- {
- this.errorMessageBytes = errorMessageBytes;
- }
-
-
- /**
* Gets the lowest entry in the directory that was matched. For result codes
* of noSuchObject, aliasProblem, invalidDNSyntax and
* aliasDereferencingProblem, the matchedDN field is set to the name of the
@@ -122,15 +99,6 @@ public class LdapResultImpl implements L
/**
- * @return the encoded MatchedDN
- */
- /*No qualifier*/byte[] getMatchedDnBytes()
- {
- return matchedDnBytes;
- }
-
-
- /**
* Sets the lowest entry in the directory that was matched.
*
* @see #getMatchedDn()
@@ -143,17 +111,6 @@ public class LdapResultImpl implements L
/**
- * Sets the encoded value for MatchedDn
- *
- * @param matchedDnBytes The encoded MatchedDN
- */
- /*No qualifier*/void setMatchedDnBytes( byte[] matchedDnBytes )
- {
- this.matchedDnBytes = matchedDnBytes;
- }
-
-
- /**
* Gets the result code enumeration associated with the response.
* Corresponds to the <b> resultCode </b> field within the LDAPResult ASN.1
* structure.
Propchange: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/LdapResultImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/BindResponseImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/BindResponseImplTest.java?rev=1063135&r1=1063134&r2=1063135&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/BindResponseImplTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/BindResponseImplTest.java Tue Jan 25 04:33:18 2011
@@ -22,7 +22,6 @@ package org.apache.directory.shared.ldap
import org.apache.directory.junit.tools.Concurrent;
import org.apache.directory.junit.tools.ConcurrentJunitRunner;
-import org.apache.directory.shared.ldap.message.LdapResultImpl;
import org.apache.directory.shared.ldap.model.exception.LdapException;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.junit.Test;
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/ExtendedResponseImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/ExtendedResponseImplTest.java?rev=1063135&r1=1063134&r2=1063135&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/ExtendedResponseImplTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/ExtendedResponseImplTest.java Tue Jan 25 04:33:18 2011
@@ -28,7 +28,6 @@ import java.util.Map;
import org.apache.directory.junit.tools.Concurrent;
import org.apache.directory.junit.tools.ConcurrentJunitRunner;
-import org.apache.directory.shared.ldap.message.LdapResultImpl;
import org.apache.directory.shared.ldap.model.exception.LdapException;
import org.apache.directory.shared.ldap.model.exception.MessageException;
import org.apache.directory.shared.ldap.model.name.Dn;
Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/LdapResultImplTest.java (from r1063113, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/LdapResultImplTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/LdapResultImplTest.java?p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/LdapResultImplTest.java&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/LdapResultImplTest.java&r1=1063113&r2=1063135&rev=1063135&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/LdapResultImplTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/LdapResultImplTest.java Tue Jan 25 04:33:18 2011
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.shared.ldap.message;
+package org.apache.directory.shared.ldap.model.message;
import static org.junit.Assert.assertFalse;
@@ -26,10 +26,7 @@ import static org.junit.Assert.assertTru
import org.apache.directory.junit.tools.Concurrent;
import org.apache.directory.junit.tools.ConcurrentJunitRunner;
import org.apache.directory.shared.ldap.model.exception.LdapException;
-import org.apache.directory.shared.ldap.model.message.LdapResult;
-import org.apache.directory.shared.ldap.model.message.Referral;
-import org.apache.directory.shared.ldap.model.message.ReferralImpl;
-import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.model.message.*;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.junit.Test;
import org.junit.runner.RunWith;
Propchange: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/LdapResultImplTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/SearchResponseDoneImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/SearchResponseDoneImplTest.java?rev=1063135&r1=1063134&r2=1063135&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/SearchResponseDoneImplTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/SearchResponseDoneImplTest.java Tue Jan 25 04:33:18 2011
@@ -28,11 +28,8 @@ import java.util.Map;
import org.apache.directory.junit.tools.Concurrent;
import org.apache.directory.junit.tools.ConcurrentJunitRunner;
-import org.apache.directory.shared.ldap.message.LdapResultImpl;
import org.apache.directory.shared.ldap.model.exception.MessageException;
-import org.apache.directory.shared.ldap.model.message.*;
import org.apache.directory.shared.ldap.model.exception.LdapException;
-import org.apache.directory.shared.ldap.model.message.Control;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.junit.Test;
import org.junit.runner.RunWith;