You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/08/13 18:05:38 UTC
svn commit: r985255 - in /directory:
clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/
shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/
shared/...
Author: elecharny
Date: Fri Aug 13 16:05:37 2010
New Revision: 985255
URL: http://svn.apache.org/viewvc?rev=985255&view=rev
Log:
Removed the last message response codec : SearchResultReference.
Removed:
directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceCodec.java
Modified:
directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapProtocolEncoder.java
directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java
directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreReferenceAction.java
directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java
directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ReferralImpl.java
directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResultReferenceImpl.java
directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalLdapResult.java
directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalReferral.java
directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalSearchResultReference.java
directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java
directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/LdapResultImplTest.java
directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ReferralImplTest.java
directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImplTest.java
Modified: directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java (original)
+++ directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java Fri Aug 13 16:05:37 2010
@@ -101,7 +101,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNRequestCodec;
import org.apache.directory.shared.ldap.codec.search.Filter;
import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
-import org.apache.directory.shared.ldap.codec.search.SearchResultReferenceCodec;
import org.apache.directory.shared.ldap.codec.unbind.UnBindRequestCodec;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.cursor.Cursor;
@@ -129,8 +128,10 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.internal.InternalMessage;
import org.apache.directory.shared.ldap.message.internal.InternalModifyDnResponse;
import org.apache.directory.shared.ldap.message.internal.InternalModifyResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalReferral;
import org.apache.directory.shared.ldap.message.internal.InternalSearchResultDone;
import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultReference;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.name.RDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -505,27 +506,29 @@ public class LdapNetworkConnection exten
/**
- * Convert a SearchResultReferenceCodec to a SearchResultReference message
+ * Convert a SearchResultReference to a SearchResultReference message
*/
- private SearchResultReference convert( SearchResultReferenceCodec searchEntryReferenceCodec )
+ private SearchResultReference convert( InternalSearchResultReference internalSearchEntryReference )
{
SearchResultReference searchResultReference = new SearchResultReference();
- searchResultReference.setMessageId( searchEntryReferenceCodec.getMessageId() );
+ searchResultReference.setMessageId( internalSearchEntryReference.getMessageId() );
// Loop on the referrals
Referral referral = new Referral();
- if ( searchEntryReferenceCodec.getSearchResultReferences() != null )
+ InternalReferral internalReferral = internalSearchEntryReference.getReferral();
+
+ if ( internalReferral != null )
{
- for ( LdapURL url : searchEntryReferenceCodec.getSearchResultReferences() )
+ for ( String url : referral.getLdapUrls() )
{
referral.addLdapUrls( url );
}
}
searchResultReference.setReferral( referral );
- addControls( searchEntryReferenceCodec, searchResultReference );
+ addControls( internalSearchEntryReference, searchResultReference );
return searchResultReference;
}
@@ -1575,376 +1578,346 @@ public class LdapNetworkConnection exten
public void messageReceived( IoSession session, Object message ) throws Exception
{
// Feed the response and store it into the session
- if ( message instanceof InternalMessage )
- {
- InternalMessage response = ( InternalMessage ) message;
- LOG.debug( "-------> {} Message received <-------", response );
- int messageId = response.getMessageId();
+ InternalMessage response = ( InternalMessage ) message;
+ LOG.debug( "-------> {} Message received <-------", response );
+ int messageId = response.getMessageId();
- // this check is necessary to prevent adding an abandoned operation's
- // result(s) to corresponding queue
- ResponseFuture<? extends Response> responseFuture = peekFromFutureMap( messageId );
+ // this check is necessary to prevent adding an abandoned operation's
+ // result(s) to corresponding queue
+ ResponseFuture<? extends Response> responseFuture = peekFromFutureMap( messageId );
- if ( responseFuture == null )
- {
- LOG.info( "There is no future associated with the messageId {}, ignoring the message", messageId );
- return;
- }
+ if ( responseFuture == null )
+ {
+ LOG.info( "There is no future associated with the messageId {}, ignoring the message", messageId );
+ return;
+ }
- switch ( response.getType() )
- {
- case ADD_RESPONSE:
- // Transform the response
- AddResponse addResponse = convert( ( InternalAddResponse ) response );
+ switch ( response.getType() )
+ {
+ case ADD_RESPONSE:
+ // Transform the response
+ AddResponse addResponse = convert( ( InternalAddResponse ) response );
+
+ AddFuture addFuture = ( AddFuture ) responseFuture;
- AddFuture addFuture = ( AddFuture ) responseFuture;
+ if ( addFuture == null )
+ {
+ LOG.error( "AddFuture is null" );
+ throw new LdapException( "AddFuture is null" );
+ }
- if ( addFuture == null )
+ // remove the listener from the listener map
+ if ( LOG.isDebugEnabled() )
+ {
+ if ( addResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
{
- LOG.error( "AddFuture is null" );
- throw new LdapException( "AddFuture is null" );
+ // Everything is fine, return the response
+ LOG.debug( "Add successful : {}", addResponse );
}
-
- // remove the listener from the listener map
- if ( LOG.isDebugEnabled() )
+ else
{
- if ( addResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
- {
- // Everything is fine, return the response
- LOG.debug( "Add successful : {}", addResponse );
- }
- else
- {
- // We have had an error
- LOG.debug( "Add failed : {}", addResponse );
- }
+ // We have had an error
+ LOG.debug( "Add failed : {}", addResponse );
}
+ }
- // Store the response into the future
- addFuture.set( addResponse );
+ // Store the response into the future
+ addFuture.set( addResponse );
- // Remove the future from the map
- removeFromFutureMaps( messageId );
+ // Remove the future from the map
+ removeFromFutureMaps( messageId );
- break;
+ break;
- case BIND_RESPONSE:
- // Transform the response
- BindResponse bindResponse = convert( ( InternalBindResponse ) response );
+ case BIND_RESPONSE:
+ // Transform the response
+ BindResponse bindResponse = convert( ( InternalBindResponse ) response );
- BindFuture bindFuture = ( BindFuture ) responseFuture;
+ BindFuture bindFuture = ( BindFuture ) responseFuture;
- if ( bindFuture == null )
- {
- LOG.error( "BindFuture is null" );
- throw new LdapException( "BindFuture is null" );
- }
+ if ( bindFuture == null )
+ {
+ LOG.error( "BindFuture is null" );
+ throw new LdapException( "BindFuture is null" );
+ }
- // remove the listener from the listener map
- if ( bindResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
- {
- authenticated.set( true );
+ // remove the listener from the listener map
+ if ( bindResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
+ {
+ authenticated.set( true );
- // Everything is fine, return the response
- LOG.debug( "Bind successful : {}", bindResponse );
- }
- else
- {
- // We have had an error
- LOG.debug( "Bind failed : {}", bindResponse );
- }
+ // Everything is fine, return the response
+ LOG.debug( "Bind successful : {}", bindResponse );
+ }
+ else
+ {
+ // We have had an error
+ LOG.debug( "Bind failed : {}", bindResponse );
+ }
- // Store the response into the future
- bindFuture.set( bindResponse );
+ // Store the response into the future
+ bindFuture.set( bindResponse );
- // Remove the future from the map
- removeFromFutureMaps( messageId );
+ // Remove the future from the map
+ removeFromFutureMaps( messageId );
- break;
+ break;
- case COMPARE_RESPONSE:
- // Transform the response
- CompareResponse compareResponse = convert( ( InternalCompareResponse ) response );
+ case COMPARE_RESPONSE:
+ // Transform the response
+ CompareResponse compareResponse = convert( ( InternalCompareResponse ) response );
- CompareFuture compareFuture = ( CompareFuture ) responseFuture;
+ CompareFuture compareFuture = ( CompareFuture ) responseFuture;
- if ( compareFuture == null )
+ if ( compareFuture == null )
+ {
+ LOG.error( "CompareFuture is null" );
+ throw new LdapException( "CompareFuture is null" );
+ }
+
+ // remove the listener from the listener map
+ if ( LOG.isDebugEnabled() )
+ {
+ if ( compareResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
{
- LOG.error( "CompareFuture is null" );
- throw new LdapException( "CompareFuture is null" );
+ // Everything is fine, return the response
+ LOG.debug( "Compare successful : {}", compareResponse );
}
-
- // remove the listener from the listener map
- if ( LOG.isDebugEnabled() )
+ else
{
- if ( compareResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
- {
- // Everything is fine, return the response
- LOG.debug( "Compare successful : {}", compareResponse );
- }
- else
- {
- // We have had an error
- LOG.debug( "Compare failed : {}", compareResponse );
- }
+ // We have had an error
+ LOG.debug( "Compare failed : {}", compareResponse );
}
+ }
- // Store the response into the future
- compareFuture.set( compareResponse );
+ // Store the response into the future
+ compareFuture.set( compareResponse );
- // Remove the future from the map
- removeFromFutureMaps( messageId );
+ // Remove the future from the map
+ removeFromFutureMaps( messageId );
- break;
+ break;
- case DEL_RESPONSE:
- // Transform the response
- DeleteResponse deleteResponse = convert( ( InternalDeleteResponse ) response );
+ case DEL_RESPONSE:
+ // Transform the response
+ DeleteResponse deleteResponse = convert( ( InternalDeleteResponse ) response );
- DeleteFuture deleteFuture = ( DeleteFuture ) responseFuture;
+ DeleteFuture deleteFuture = ( DeleteFuture ) responseFuture;
- if ( deleteFuture == null )
+ if ( deleteFuture == null )
+ {
+ LOG.error( "DeleteFuture is null" );
+ throw new LdapException( "DeleteFuture is null" );
+ }
+
+ if ( LOG.isDebugEnabled() )
+ {
+ if ( deleteResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
{
- LOG.error( "DeleteFuture is null" );
- throw new LdapException( "DeleteFuture is null" );
+ // Everything is fine, return the response
+ LOG.debug( "Delete successful : {}", deleteResponse );
}
-
- if ( LOG.isDebugEnabled() )
+ else
{
- if ( deleteResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
- {
- // Everything is fine, return the response
- LOG.debug( "Delete successful : {}", deleteResponse );
- }
- else
- {
- // We have had an error
- LOG.debug( "Delete failed : {}", deleteResponse );
- }
+ // We have had an error
+ LOG.debug( "Delete failed : {}", deleteResponse );
}
+ }
- // Store the response into the future
- deleteFuture.set( deleteResponse );
+ // Store the response into the future
+ deleteFuture.set( deleteResponse );
- // Remove the future from the map
- removeFromFutureMaps( messageId );
+ // Remove the future from the map
+ removeFromFutureMaps( messageId );
- break;
+ break;
- case EXTENDED_RESPONSE:
- // Transform the response
- ExtendedResponse extendedResponse = convert( ( InternalExtendedResponse ) response );
+ case EXTENDED_RESPONSE:
+ // Transform the response
+ ExtendedResponse extendedResponse = convert( ( InternalExtendedResponse ) response );
- ExtendedFuture extendedFuture = ( ExtendedFuture ) responseFuture;
+ ExtendedFuture extendedFuture = ( ExtendedFuture ) responseFuture;
- if ( extendedFuture == null )
+ if ( extendedFuture == null )
+ {
+ LOG.error( "ExtendedFuture is null" );
+ throw new LdapException( "extendedFuture is null" );
+ }
+
+ // remove the listener from the listener map
+ if ( LOG.isDebugEnabled() )
+ {
+ if ( extendedResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
{
- LOG.error( "ExtendedFuture is null" );
- throw new LdapException( "extendedFuture is null" );
+ // Everything is fine, return the response
+ LOG.debug( "Extended successful : {}", extendedResponse );
}
-
- // remove the listener from the listener map
- if ( LOG.isDebugEnabled() )
+ else
{
- if ( extendedResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
- {
- // Everything is fine, return the response
- LOG.debug( "Extended successful : {}", extendedResponse );
- }
- else
- {
- // We have had an error
- LOG.debug( "Extended failed : {}", extendedResponse );
- }
+ // We have had an error
+ LOG.debug( "Extended failed : {}", extendedResponse );
}
+ }
- // Store the response into the future
- extendedFuture.set( extendedResponse );
+ // Store the response into the future
+ extendedFuture.set( extendedResponse );
- // Remove the future from the map
- removeFromFutureMaps( messageId );
+ // Remove the future from the map
+ removeFromFutureMaps( messageId );
- break;
+ break;
- case INTERMEDIATE_RESPONSE:
- setIntermediateResponse( ( InternalIntermediateResponse ) response, responseFuture );
+ case INTERMEDIATE_RESPONSE:
+ setIntermediateResponse( ( InternalIntermediateResponse ) response, responseFuture );
- break;
+ break;
- case MODIFY_RESPONSE:
- // Transform the response
- ModifyResponse modifyResponse = convert( ( InternalModifyResponse ) response );
+ case MODIFY_RESPONSE:
+ // Transform the response
+ ModifyResponse modifyResponse = convert( ( InternalModifyResponse ) response );
- ModifyFuture modifyFuture = ( ModifyFuture ) responseFuture;
+ ModifyFuture modifyFuture = ( ModifyFuture ) responseFuture;
+
+ if ( modifyFuture == null )
+ {
+ LOG.error( "ModifyFuture is null" );
+ throw new LdapException( "ModifyFuture is null" );
+ }
- if ( modifyFuture == null )
+ if ( LOG.isDebugEnabled() )
+ {
+ if ( modifyResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
{
- LOG.error( "ModifyFuture is null" );
- throw new LdapException( "ModifyFuture is null" );
+ // Everything is fine, return the response
+ LOG.debug( "ModifyFuture successful : {}", modifyResponse );
}
-
- if ( LOG.isDebugEnabled() )
+ else
{
- if ( modifyResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
- {
- // Everything is fine, return the response
- LOG.debug( "ModifyFuture successful : {}", modifyResponse );
- }
- else
- {
- // We have had an error
- LOG.debug( "ModifyFuture failed : {}", modifyResponse );
- }
+ // We have had an error
+ LOG.debug( "ModifyFuture failed : {}", modifyResponse );
}
+ }
- // Store the response into the future
- modifyFuture.set( modifyResponse );
+ // Store the response into the future
+ modifyFuture.set( modifyResponse );
- // Remove the future from the map
- removeFromFutureMaps( messageId );
+ // Remove the future from the map
+ removeFromFutureMaps( messageId );
- break;
+ break;
- case MODIFYDN_RESPONSE:
- // Transform the response
- ModifyDnResponse modifyDnResponse = convert( ( InternalModifyDnResponse ) response );
+ case MODIFYDN_RESPONSE:
+ // Transform the response
+ ModifyDnResponse modifyDnResponse = convert( ( InternalModifyDnResponse ) response );
- ModifyDnFuture modifyDnFuture = ( ModifyDnFuture ) responseFuture;
+ ModifyDnFuture modifyDnFuture = ( ModifyDnFuture ) responseFuture;
- if ( modifyDnFuture == null )
+ if ( modifyDnFuture == null )
+ {
+ LOG.error( "ModifyDNFuture is null" );
+ throw new LdapException( "ModifyDNFuture is null" );
+ }
+
+ if ( LOG.isDebugEnabled() )
+ {
+ if ( modifyDnResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
{
- LOG.error( "ModifyDNFuture is null" );
- throw new LdapException( "ModifyDNFuture is null" );
+ // Everything is fine, return the response
+ LOG.debug( "ModifyDN successful : {}", modifyDnResponse );
}
-
- if ( LOG.isDebugEnabled() )
+ else
{
- if ( modifyDnResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
- {
- // Everything is fine, return the response
- LOG.debug( "ModifyDN successful : {}", modifyDnResponse );
- }
- else
- {
- // We have had an error
- LOG.debug( "ModifyDN failed : {}", modifyDnResponse );
- }
+ // We have had an error
+ LOG.debug( "ModifyDN failed : {}", modifyDnResponse );
}
+ }
+
+ // Store the response into the future
+ modifyDnFuture.set( modifyDnResponse );
- // Store the response into the future
- modifyDnFuture.set( modifyDnResponse );
+ // Remove the future from the map
+ removeFromFutureMaps( messageId );
- // Remove the future from the map
- removeFromFutureMaps( messageId );
+ break;
- break;
+ case SEARCH_RESULT_DONE:
+ // Store the response into the responseQueue
+ SearchResultDone searchResultDone = convert( ( InternalSearchResultDone ) response );
- case SEARCH_RESULT_DONE:
- // Store the response into the responseQueue
- SearchResultDone searchResultDone = convert( ( InternalSearchResultDone ) response );
+ SearchFuture searchFuture = ( SearchFuture ) responseFuture;
- SearchFuture searchFuture = ( SearchFuture ) responseFuture;
+ if ( searchFuture == null )
+ {
+ LOG.error( "SearchFuture is null" );
+ throw new LdapException( "SearchFuture is null" );
+ }
- if ( searchFuture == null )
+ if ( LOG.isDebugEnabled() )
+ {
+ if ( searchResultDone.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
{
- LOG.error( "SearchFuture is null" );
- throw new LdapException( "SearchFuture is null" );
+ // Everything is fine, return the response
+ LOG.debug( "Search successful : {}", searchResultDone );
}
-
- if ( LOG.isDebugEnabled() )
+ else
{
- if ( searchResultDone.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
- {
- // Everything is fine, return the response
- LOG.debug( "Search successful : {}", searchResultDone );
- }
- else
- {
- // We have had an error
- LOG.debug( "Search failed : {}", searchResultDone );
- }
+ // We have had an error
+ LOG.debug( "Search failed : {}", searchResultDone );
}
+ }
- // Store the response into the future
- searchFuture.set( searchResultDone );
-
- // Remove the future from the map
- removeFromFutureMaps( messageId );
-
- break;
-
- case SEARCH_RESULT_ENTRY:
- // Store the response into the responseQueue
- SearchResultEntry searchResultEntry = convert( ( InternalSearchResultEntry ) response );
+ // Store the response into the future
+ searchFuture.set( searchResultDone );
- searchFuture = ( SearchFuture ) responseFuture;
+ // Remove the future from the map
+ removeFromFutureMaps( messageId );
- if ( searchFuture == null )
- {
- LOG.error( "SearchFuture is null" );
- throw new LdapException( "SearchFuture is null" );
- }
-
- if ( LOG.isDebugEnabled() )
- {
- LOG.debug( "Search entry found : {}", searchResultEntry );
- }
+ break;
- // Store the response into the future
- searchFuture.set( searchResultEntry );
+ case SEARCH_RESULT_ENTRY:
+ // Store the response into the responseQueue
+ SearchResultEntry searchResultEntry = convert( ( InternalSearchResultEntry ) response );
- break;
+ searchFuture = ( SearchFuture ) responseFuture;
- }
- }
- else
- {
- LdapMessageCodec response = ( LdapMessageCodec ) message;
- LOG.debug( "-------> {} Message received <-------", response );
- int messageId = response.getMessageId();
+ if ( searchFuture == null )
+ {
+ LOG.error( "SearchFuture is null" );
+ throw new LdapException( "SearchFuture is null" );
+ }
- // this check is necessary to prevent adding an abandoned operation's
- // result(s) to corresponding queue
- ResponseFuture<? extends Response> responseFuture = peekFromFutureMap( messageId );
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( "Search entry found : {}", searchResultEntry );
+ }
- if ( responseFuture == null )
- {
- LOG.info( "There is no future associated with the messageId {}, ignoring the message", messageId );
- return;
- }
+ // Store the response into the future
+ searchFuture.set( searchResultEntry );
- switch ( response.getMessageType() )
- {
- case SEARCH_RESULT_REFERENCE:
- // Store the response into the responseQueue
- SearchResultReferenceCodec searchResultReferenceCodec = ( SearchResultReferenceCodec ) response;
- searchResultReferenceCodec.setMessageId( messageId );
- searchResultReferenceCodec.addControls( response.getControls() );
+ break;
- SearchResultReference searchResultReference = convert( searchResultReferenceCodec );
+ case SEARCH_RESULT_REFERENCE:
+ // Store the response into the responseQueue
+ SearchResultReference searchResultReference = convert( ( InternalSearchResultReference ) response );
- SearchFuture searchFuture = ( SearchFuture ) responseFuture;
+ searchFuture = ( SearchFuture ) responseFuture;
- if ( searchFuture == null )
- {
- LOG.error( "SearchFuture is null" );
- throw new LdapException( "SearchFuture is null" );
- }
+ if ( searchFuture == null )
+ {
+ LOG.error( "SearchFuture is null" );
+ throw new LdapException( "SearchFuture is null" );
+ }
- if ( LOG.isDebugEnabled() )
- {
- LOG.debug( "Search reference found : {}", searchResultReference );
- }
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( "Search reference found : {}", searchResultReference );
+ }
- // Store the response into the future
- searchFuture.set( searchResultReference );
+ // Store the response into the future
+ searchFuture.set( searchResultReference );
- break;
+ break;
- default:
- LOG.error( "~~~~~~~~~~~~~~~~~~~~~ Unknown message type {} ~~~~~~~~~~~~~~~~~~~~~", response
- .getMessageTypeName() );
- }
}
}
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java Fri Aug 13 16:05:37 2010
@@ -31,7 +31,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.modify.ModifyRequestCodec;
import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNRequestCodec;
import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
-import org.apache.directory.shared.ldap.codec.search.SearchResultReferenceCodec;
import org.apache.directory.shared.ldap.codec.unbind.UnBindRequestCodec;
import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
@@ -49,6 +48,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.internal.InternalModifyResponse;
import org.apache.directory.shared.ldap.message.internal.InternalSearchResultDone;
import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultReference;
import org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest;
import org.apache.directory.shared.ldap.message.spi.BinaryAttributeDetector;
@@ -353,11 +353,11 @@ public class LdapMessageContainer extend
/**
- * @return Returns the SearchResultReferenceCodec stored in the container
+ * @return Returns the SearchResultReference stored in the container
*/
- public SearchResultReferenceCodec getSearchResultReference()
+ public InternalSearchResultReference getInternalSearchResultReference()
{
- return ( SearchResultReferenceCodec ) ldapMessage;
+ return ( InternalSearchResultReference ) internalMessage;
}
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java Fri Aug 13 16:05:37 2010
@@ -77,7 +77,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNRequestCodec;
import org.apache.directory.shared.ldap.codec.search.ExtensibleMatchFilter;
import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
-import org.apache.directory.shared.ldap.codec.search.SearchResultReferenceCodec;
import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
import org.apache.directory.shared.ldap.exception.LdapException;
import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
@@ -99,6 +98,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.message.SearchResultDoneImpl;
import org.apache.directory.shared.ldap.message.SearchResultEntryImpl;
+import org.apache.directory.shared.ldap.message.SearchResultReferenceImpl;
import org.apache.directory.shared.ldap.message.UnbindRequestImpl;
import org.apache.directory.shared.ldap.message.control.Control;
import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
@@ -120,6 +120,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.internal.InternalResultResponse;
import org.apache.directory.shared.ldap.message.internal.InternalSearchResultDone;
import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultReference;
import org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.name.RDN;
@@ -2775,9 +2776,9 @@ public class LdapMessageGrammar extends
LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
// Now, we can allocate the SearchResultReference Object
- SearchResultReferenceCodec searchResultReference = new SearchResultReferenceCodec();
- searchResultReference.setMessageId( ldapMessageContainer.getMessageId() );
- ldapMessageContainer.setLdapMessage( searchResultReference );
+ InternalSearchResultReference searchResultReference = new SearchResultReferenceImpl(
+ ldapMessageContainer.getMessageId() );
+ ldapMessageContainer.setInternalMessage( searchResultReference );
log.debug( "SearchResultReference response " );
}
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapProtocolEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapProtocolEncoder.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapProtocolEncoder.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapProtocolEncoder.java Fri Aug 13 16:05:37 2010
@@ -46,6 +46,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.ModifyResponseImpl;
import org.apache.directory.shared.ldap.message.SearchResultDoneImpl;
import org.apache.directory.shared.ldap.message.SearchResultEntryImpl;
+import org.apache.directory.shared.ldap.message.SearchResultReferenceImpl;
import org.apache.directory.shared.ldap.message.control.Control;
import org.apache.directory.shared.ldap.message.internal.InternalAddResponse;
import org.apache.directory.shared.ldap.message.internal.InternalBindResponse;
@@ -60,6 +61,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.internal.InternalReferral;
import org.apache.directory.shared.ldap.message.internal.InternalSearchResultDone;
import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultReference;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.util.StringTools;
import org.apache.mina.core.buffer.IoBuffer;
@@ -125,7 +127,8 @@ public class LdapProtocolEncoder extends
|| ( message instanceof InternalAddResponse ) || ( message instanceof InternalCompareResponse )
|| ( message instanceof InternalExtendedResponse ) || ( message instanceof InternalModifyResponse )
|| ( message instanceof InternalModifyDnResponse ) || ( message instanceof InternalIntermediateResponse )
- || ( message instanceof InternalSearchResultDone ) || ( message instanceof InternalSearchResultEntry ) )
+ || ( message instanceof InternalSearchResultDone ) || ( message instanceof InternalSearchResultEntry )
+ || ( message instanceof InternalSearchResultReference ) )
{
try
{
@@ -306,29 +309,12 @@ public class LdapProtocolEncoder extends
ldapResultLength += 1 + TLV.getNbBytes( errorMessageBytes.length ) + errorMessageBytes.length;
ldapResult.setErrorMessageBytes( errorMessageBytes );
- InternalReferral referral = ldapResult.getReferral();
+ int referralLength = computeReferralLength( ldapResult.getReferral() );
- if ( referral != null )
+ if ( referralLength != 0 )
{
- Collection<String> ldapUrls = referral.getLdapUrls();
-
- if ( ( ldapUrls != null ) && ( ldapUrls.size() != 0 ) )
- {
- int referralsLength = 0;
-
- // Each referral
- for ( String ldapUrl : ldapUrls )
- {
- byte[] ldapUrlBytes = StringTools.getBytesUtf8( ldapUrl );
- referralsLength += 1 + TLV.getNbBytes( ldapUrlBytes.length ) + ldapUrlBytes.length;
- referral.addLdapUrlBytes( ldapUrlBytes );
- }
-
- ldapResult.setReferralsLength( referralsLength );
-
- // The referrals
- ldapResultLength += 1 + TLV.getNbBytes( referralsLength ) + referralsLength;
- }
+ // The referrals
+ ldapResultLength += 1 + TLV.getNbBytes( referralLength ) + referralLength;
}
return ldapResultLength;
@@ -371,25 +357,37 @@ public class LdapProtocolEncoder extends
if ( referral != null )
{
- Collection<byte[]> ldapUrlsBytes = referral.getLdapUrlsBytes();
+ encodeReferral( buffer, referral );
+ }
- if ( ( ldapUrlsBytes != null ) && ( ldapUrlsBytes.size() != 0 ) )
- {
- // Encode the referrals sequence
- // The referrals length MUST have been computed before !
- buffer.put( ( byte ) LdapConstants.LDAP_RESULT_REFERRAL_SEQUENCE_TAG );
- buffer.put( TLV.getBytes( ldapResult.getReferralsLength() ) );
+ return buffer;
+ }
- // Each referral
- for ( byte[] ldapUrlBytes : ldapUrlsBytes )
- {
- // Encode the current referral
- Value.encode( buffer, ldapUrlBytes );
- }
+
+ /**
+ * Encode the Referral message to a PDU.
+ *
+ * @param buffer The buffer where to put the PDU
+ * @return The PDU.
+ */
+ private void encodeReferral( ByteBuffer buffer, InternalReferral referral ) throws EncoderException
+ {
+ Collection<byte[]> ldapUrlsBytes = referral.getLdapUrlsBytes();
+
+ if ( ( ldapUrlsBytes != null ) && ( ldapUrlsBytes.size() != 0 ) )
+ {
+ // Encode the referrals sequence
+ // The referrals length MUST have been computed before !
+ buffer.put( ( byte ) LdapConstants.LDAP_RESULT_REFERRAL_SEQUENCE_TAG );
+ buffer.put( TLV.getBytes( referral.getReferralLength() ) );
+
+ // Each referral
+ for ( byte[] ldapUrlBytes : ldapUrlsBytes )
+ {
+ // Encode the current referral
+ Value.encode( buffer, ldapUrlBytes );
}
}
-
- return buffer;
}
@@ -632,6 +630,40 @@ public class LdapProtocolEncoder extends
}
+ private int computeReferralLength( InternalReferral referral )
+ {
+ if ( referral != null )
+ {
+ Collection<String> ldapUrls = referral.getLdapUrls();
+
+ if ( ( ldapUrls != null ) && ( ldapUrls.size() != 0 ) )
+ {
+ int referralLength = 0;
+
+ // Each referral
+ for ( String ldapUrl : ldapUrls )
+ {
+ byte[] ldapUrlBytes = StringTools.getBytesUtf8( ldapUrl );
+ referralLength += 1 + TLV.getNbBytes( ldapUrlBytes.length ) + ldapUrlBytes.length;
+ referral.addLdapUrlBytes( ldapUrlBytes );
+ }
+
+ referral.setReferralLength( referralLength );
+
+ return referralLength;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+
/**
* Compute the SearchResultDone length
*
@@ -783,6 +815,48 @@ public class LdapProtocolEncoder extends
/**
+ * Compute the SearchResultReference length
+ *
+ * SearchResultReference :
+ * <pre>
+ * 0x73 L1
+ * |
+ * +--> 0x04 L2 reference
+ * +--> 0x04 L3 reference
+ * +--> ...
+ * +--> 0x04 Li reference
+ * +--> ...
+ * +--> 0x04 Ln reference
+ *
+ * L1 = n*Length(0x04) + sum(Length(Li)) + sum(Length(reference[i]))
+ *
+ * Length(SearchResultReference) = Length(0x73 + Length(L1) + L1
+ * </pre>
+ */
+ private int computeSearchResultReferenceLength( InternalSearchResultReference searchResultReference )
+ {
+ int searchResultReferenceLength = 0;
+
+ // We may have more than one reference.
+ InternalReferral referral = searchResultReference.getReferral();
+
+ int referralLength = computeReferralLength( referral );
+
+ if ( referralLength != 0 )
+ {
+ searchResultReference.setReferral( referral );
+
+ searchResultReferenceLength = referralLength;
+ }
+
+ // Store the length of the response
+ searchResultReference.setSearchResultReferenceLength( searchResultReferenceLength );
+
+ return 1 + TLV.getNbBytes( searchResultReferenceLength ) + searchResultReferenceLength;
+ }
+
+
+ /**
* Encode the AddResponse message to a PDU.
*
* @param buffer The buffer where to put the PDU
@@ -1168,6 +1242,47 @@ public class LdapProtocolEncoder extends
/**
+ * Encode the SearchResultReference message to a PDU.
+ *
+ * SearchResultReference :
+ * <pre>
+ * 0x73 LL
+ * 0x04 LL reference
+ * [0x04 LL reference]*
+ * </pre>
+ * @param buffer The buffer where to put the PDU
+ * @return The PDU.
+ */
+ protected void encodeSearchResultReference( ByteBuffer buffer, InternalSearchResultReference searchResultReference )
+ throws EncoderException
+ {
+ try
+ {
+ // The SearchResultReference Tag
+ buffer.put( LdapConstants.SEARCH_RESULT_REFERENCE_TAG );
+ buffer.put( TLV.getBytes( searchResultReference.getSearchResultReferenceLength() ) );
+
+ // The referrals, if any
+ InternalReferral referral = searchResultReference.getReferral();
+
+ if ( referral != null )
+ {
+ // Each referral
+ for ( byte[] ldapUrlBytes : referral.getLdapUrlsBytes() )
+ {
+ // Encode the current referral
+ Value.encode( buffer, ldapUrlBytes );
+ }
+ }
+ }
+ catch ( BufferOverflowException boe )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
+ }
+ }
+
+
+ /**
* Compute the protocolOp length
*/
private int computeProtocolOpLength( InternalMessage message )
@@ -1204,6 +1319,9 @@ public class LdapProtocolEncoder extends
case SEARCH_RESULT_ENTRY:
return computeSearchResultEntryLength( ( SearchResultEntryImpl ) message );
+ case SEARCH_RESULT_REFERENCE:
+ return computeSearchResultReferenceLength( ( SearchResultReferenceImpl ) message );
+
default:
return 0;
}
@@ -1252,6 +1370,11 @@ public class LdapProtocolEncoder extends
case SEARCH_RESULT_ENTRY:
encodeSearchResultEntry( bb, ( SearchResultEntryImpl ) message );
+ break;
+
+ case SEARCH_RESULT_REFERENCE:
+ encodeSearchResultReference( bb, ( SearchResultReferenceImpl ) message );
+ break;
}
}
}
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java Fri Aug 13 16:05:37 2010
@@ -21,7 +21,6 @@ package org.apache.directory.shared.ldap
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -41,9 +40,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.search.OrFilter;
import org.apache.directory.shared.ldap.codec.search.PresentFilter;
import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
-import org.apache.directory.shared.ldap.codec.search.SearchResultReferenceCodec;
import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
-import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.entry.Value;
@@ -64,19 +61,13 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.AliasDerefMode;
import org.apache.directory.shared.ldap.message.BindRequestImpl;
import org.apache.directory.shared.ldap.message.ExtendedRequestImpl;
-import org.apache.directory.shared.ldap.message.LdapResultImpl;
import org.apache.directory.shared.ldap.message.ModifyDnRequestImpl;
import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
-import org.apache.directory.shared.ldap.message.ReferralImpl;
import org.apache.directory.shared.ldap.message.SearchRequestImpl;
-import org.apache.directory.shared.ldap.message.SearchResultReferenceImpl;
import org.apache.directory.shared.ldap.message.control.Control;
import org.apache.directory.shared.ldap.message.extended.GracefulShutdownRequest;
import org.apache.directory.shared.ldap.message.internal.InternalMessage;
-import org.apache.directory.shared.ldap.message.internal.InternalReferral;
import org.apache.directory.shared.ldap.schema.SchemaManager;
-import org.apache.directory.shared.ldap.util.LdapURL;
-import org.apache.directory.shared.ldap.util.StringTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -612,53 +603,6 @@ public class LdapTransformer
/**
- * Transform a Ldapresult part of a Internal Response to a Codec LdapResult
- *
- * @param InternalLdapResult the Internal LdapResult to transform
- * @return A Codec LdapResult
- */
- private static LdapResultCodec transformLdapResult( LdapResultImpl internalLdapResult )
- {
- LdapResultCodec codecLdapResult = new LdapResultCodec();
-
- // Internal : ResultCodeEnum resultCode -> Codec : int resultCode
- codecLdapResult.setResultCode( internalLdapResult.getResultCode() );
-
- // Internal : String errorMessage -> Codec : LdapString errorMessage
- String errorMessage = internalLdapResult.getErrorMessage();
-
- codecLdapResult.setErrorMessage( StringTools.isEmpty( errorMessage ) ? "" : errorMessage );
-
- // Internal : String matchedDn -> Codec : DN matchedDN
- codecLdapResult.setMatchedDN( internalLdapResult.getMatchedDn() );
-
- // Internal : Referral referral -> Codec : ArrayList referrals
- ReferralImpl internalReferrals = ( ReferralImpl ) internalLdapResult.getReferral();
-
- if ( internalReferrals != null )
- {
- codecLdapResult.initReferrals();
-
- for ( String referral : internalReferrals.getLdapUrls() )
- {
- try
- {
- LdapURL ldapUrl = new LdapURL( referral.getBytes() );
- codecLdapResult.addReferral( ldapUrl );
- }
- catch ( LdapURLEncodingException lude )
- {
- LOG.warn( "The referral " + referral + " is invalid : " + lude.getMessage() );
- codecLdapResult.addReferral( LdapURL.EMPTY_URL );
- }
- }
- }
-
- return codecLdapResult;
- }
-
-
- /**
* Transform a Internal BindRequest to a Codec BindRequest
*
* @param internalMessage The incoming Internal BindRequest
@@ -693,46 +637,6 @@ public class LdapTransformer
/**
- * Transform a Internal SearchResponseReference to a Codec
- * SearchResultReference
- *
- * @param internalMessage The incoming Internal SearchResponseReference
- */
- private static LdapMessageCodec transformSearchResultReference( InternalMessage internalMessage )
- {
- SearchResultReferenceImpl internalSearchResponseReference = ( SearchResultReferenceImpl ) internalMessage;
- SearchResultReferenceCodec searchResultReference = new SearchResultReferenceCodec();
-
- // Internal : Referral m_referral -> Codec: ArrayList
- // searchResultReferences
- InternalReferral referrals = internalSearchResponseReference.getReferral();
-
- // Loop on all referals
- if ( referrals != null )
- {
- Collection<String> urls = referrals.getLdapUrls();
-
- if ( urls != null )
- {
- for ( String url : urls )
- {
- try
- {
- searchResultReference.addSearchResultReference( new LdapURL( url ) );
- }
- catch ( LdapURLEncodingException luee )
- {
- LOG.warn( "The LdapURL " + url + " is incorrect : " + luee.getMessage() );
- }
- }
- }
- }
-
- return searchResultReference;
- }
-
-
- /**
* Transform the internal message to a codec message.
*
* @param msg the message to transform
@@ -750,10 +654,6 @@ public class LdapTransformer
switch ( msg.getType() )
{
- case SEARCH_RESULT_REFERENCE:
- codecMessage = transformSearchResultReference( msg );
- break;
-
case BIND_REQUEST:
codecMessage = transformBindRequest( msg );
break;
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreReferenceAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreReferenceAction.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreReferenceAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreReferenceAction.java Fri Aug 13 16:05:37 2010
@@ -26,8 +26,10 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.codec.DecoderException;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.search.SearchResultReferenceCodec;
import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
+import org.apache.directory.shared.ldap.message.ReferralImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalReferral;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultReference;
import org.apache.directory.shared.ldap.util.LdapURL;
import org.apache.directory.shared.ldap.util.StringTools;
import org.slf4j.Logger;
@@ -47,11 +49,13 @@ public class StoreReferenceAction extend
/** Speedup for logs */
private static final boolean IS_DEBUG = log.isDebugEnabled();
+
public StoreReferenceAction()
{
super( "Store a reference" );
}
+
/**
* The initialization action
*/
@@ -60,30 +64,39 @@ public class StoreReferenceAction extend
LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
- SearchResultReferenceCodec searchResultReference = ldapMessageContainer.getSearchResultReference();
+ InternalSearchResultReference searchResultReference = ldapMessageContainer.getInternalSearchResultReference();
// Get the Value and store it in the BindRequest
TLV tlv = ldapMessageContainer.getCurrentTLV();
- // We have to handle the special case of a 0 length server
- // sasl credentials
+ // Get the referral, or create it if not existing
+ InternalReferral referral = searchResultReference.getReferral();
+
+ if ( referral == null )
+ {
+ referral = new ReferralImpl();
+ searchResultReference.setReferral( referral );
+ }
+
+ // We have to handle the special case of a 0 length list of referrals
LdapURL url = LdapURL.EMPTY_URL;
if ( tlv.getLength() == 0 )
{
- searchResultReference.addSearchResultReference( url );
+ referral.addLdapUrl( "" );
}
else
{
+ String urlStr = StringTools.utf8ToString( tlv.getValue().getData() );
+
try
{
- url = new LdapURL( tlv.getValue().getData() );
- searchResultReference.addSearchResultReference( url );
+ url = new LdapURL( urlStr );
+ referral.addLdapUrl( urlStr );
}
catch ( LdapURLEncodingException luee )
{
- String badUrl = StringTools.utf8ToString( tlv.getValue().getData() );
- log.error( I18n.err( I18n.ERR_04021, badUrl, luee.getMessage() ) );
+ log.error( I18n.err( I18n.ERR_04021, urlStr, luee.getMessage() ) );
throw new DecoderException( I18n.err( I18n.ERR_04016, luee.getMessage() ) );
}
}
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java Fri Aug 13 16:05:37 2010
@@ -53,32 +53,11 @@ public class LdapResultImpl implements I
/** Resultant operation error code - defaults to SUCCESS */
private ResultCodeEnum resultCode = ResultCodeEnum.SUCCESS;
- /** The length of all the referrals */
- private int referralsLength;
-
// ------------------------------------------------------------------------
// LdapResult Interface Method Implementations
// ------------------------------------------------------------------------
/**
- * {@inheritDoc}
- */
- public int getReferralsLength()
- {
- return referralsLength;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void setReferralsLength( int referralsLength )
- {
- this.referralsLength = referralsLength;
- }
-
-
- /**
* Gets the descriptive error message associated with the error code. May be
* null for SUCCESS, COMPARETRUE, COMPAREFALSE and REFERRAL operations.
*
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ReferralImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ReferralImpl.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ReferralImpl.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ReferralImpl.java Fri Aug 13 16:05:37 2010
@@ -46,10 +46,30 @@ public class ReferralImpl implements Int
/** The encoded LdapURL */
private final List<byte[]> urlsBytes = new ArrayList<byte[]>();
+ /** The length of the referral */
+ private int referralLength;
+
// ------------------------------------------------------------------------
// LdapResult Interface Method Implementations
// ------------------------------------------------------------------------
+ /**
+ * {@inheritDoc}
+ */
+ public int getReferralLength()
+ {
+ return referralLength;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setReferralLength( int referralLength )
+ {
+ this.referralLength = referralLength;
+ }
+
/**
* Gets an unmodifiable set of alternative referral urls.
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResultReferenceImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResultReferenceImpl.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResultReferenceImpl.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResultReferenceImpl.java Fri Aug 13 16:05:37 2010
@@ -37,6 +37,12 @@ public class SearchResultReferenceImpl e
/** Referral holding the reference urls */
private InternalReferral referral;
+ /** The length of the referral */
+ private int referralLength;
+
+ /** The search result reference length */
+ private int searchResultReferenceLength;
+
// ------------------------------------------------------------------------
// Constructors
@@ -73,8 +79,7 @@ public class SearchResultReferenceImpl e
/**
* Sets the sequence of LdapUrls as a Referral instance.
*
- * @param referral
- * the sequence of LdapUrls
+ * @param referral the sequence of LdapUrls
*/
public void setReferral( InternalReferral referral )
{
@@ -85,6 +90,24 @@ public class SearchResultReferenceImpl e
/**
* {@inheritDoc}
*/
+ public int getReferralLength()
+ {
+ return referralLength;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setReferralLength( int referralLength )
+ {
+ this.referralLength = referralLength;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
@Override
public int hashCode()
{
@@ -137,4 +160,22 @@ public class SearchResultReferenceImpl e
return true;
}
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getSearchResultReferenceLength()
+ {
+ return searchResultReferenceLength;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setSearchResultReferenceLength( int searchResultReferenceLength )
+ {
+ this.searchResultReferenceLength = searchResultReferenceLength;
+ }
}
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalLdapResult.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalLdapResult.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalLdapResult.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalLdapResult.java Fri Aug 13 16:05:37 2010
@@ -157,21 +157,7 @@ public interface InternalLdapResult
* will result in a true return from isReferral and the resultCode should be
* set to REFERRAL.
*
- * @param referral
- * optional referral on REFERRAL errors.
+ * @param referral optional referral on REFERRAL errors.
*/
void setReferral( InternalReferral referral );
-
-
- /**
- * @return The total length of the Referral's URL
- */
- int getReferralsLength();
-
-
- /**
- * Set the length of all the referral' URL
- * @param referralsLength The total length of the Referral
- */
- void setReferralsLength( int referralsLength );
}
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalReferral.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalReferral.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalReferral.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalReferral.java Fri Aug 13 16:05:37 2010
@@ -127,4 +127,17 @@ public interface InternalReferral
* the LDAPv3 URL to remove
*/
void removeLdapUrl( String url );
+
+
+ /**
+ * @return The total length of the Referral
+ */
+ int getReferralLength();
+
+
+ /**
+ * Set the length of the referral
+ * @param referralLength The total length of the Referral
+ */
+ void setReferralLength( int referralLength );
}
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalSearchResultReference.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalSearchResultReference.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalSearchResultReference.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalSearchResultReference.java Fri Aug 13 16:05:37 2010
@@ -20,6 +20,7 @@
package org.apache.directory.shared.ldap.message.internal;
+
import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
@@ -46,8 +47,20 @@ public interface InternalSearchResultRef
/**
* Sets the sequence of LdapUrls as a Referral instance.
*
- * @param a_referral
- * the sequence of LdapUrls
+ * @param referral the sequence of LdapUrls
+ */
+ void setReferral( InternalReferral referral );
+
+
+ /**
+ * @return The encoded SearchResultReference's length
+ */
+ int getSearchResultReferenceLength();
+
+
+ /**
+ * Stores the encoded length for the SearchResultReference's
+ * @param searchResultReferenceLength The encoded length
*/
- void setReferral( InternalReferral a_referral );
+ void setSearchResultReferenceLength( int searchResultReferenceLength );
}
Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java Fri Aug 13 16:05:37 2010
@@ -21,12 +21,13 @@ package org.apache.directory.shared.ldap
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.nio.ByteBuffer;
import java.util.HashSet;
-import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.directory.junit.tools.Concurrent;
@@ -36,9 +37,10 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.codec.DecoderException;
import org.apache.directory.shared.asn1.codec.EncoderException;
import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
+import org.apache.directory.shared.ldap.codec.LdapProtocolEncoder;
import org.apache.directory.shared.ldap.message.control.Control;
-import org.apache.directory.shared.ldap.util.LdapURL;
+import org.apache.directory.shared.ldap.message.internal.InternalReferral;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultReference;
import org.apache.directory.shared.ldap.util.StringTools;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -53,6 +55,10 @@ import org.junit.runner.RunWith;
@Concurrent()
public class SearchResultReferenceTest
{
+ /** The encoder instance */
+ LdapProtocolEncoder encoder = new LdapProtocolEncoder();
+
+
/**
* Test the decoding of a SearchResultReference
*/
@@ -82,12 +88,12 @@ public class SearchResultReferenceTest
{
0x30, ( byte ) 0x82, 0x03, ( byte ) 0xd4, // LDAPMessage
- // ::=SEQUENCE {
+ // ::=SEQUENCE {
0x02, 0x01, 0x01, // messageID MessageID
0x73, ( byte ) 0x82, 0x03, ( byte ) 0xcd, // CHOICE { ...,
- // searchResEntry
- // SearchResultEntry,
- // ...
+ // searchResEntry
+ // SearchResultEntry,
+ // ...
// SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LDAPURL
} );
@@ -96,7 +102,7 @@ public class SearchResultReferenceTest
stream.put( ( byte ) 0x04 );
stream.put( ( byte ) ldapUrls[i].getBytes().length );
- byte[] bytes = ldapUrls[i].getBytes();
+ byte[] bytes = StringTools.getBytesUtf8( ldapUrls[i] );
for ( int j = 0; j < bytes.length; j++ )
{
@@ -120,29 +126,27 @@ public class SearchResultReferenceTest
fail( de.getMessage() );
}
- SearchResultReferenceCodec searchResultReference = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchResultReference();
+ InternalSearchResultReference searchResultReference = ( ( LdapMessageContainer ) ldapMessageContainer )
+ .getInternalSearchResultReference();
assertEquals( 1, searchResultReference.getMessageId() );
Set<String> ldapUrlsSet = new HashSet<String>();
- try
- {
- for ( int i = 0; i < ldapUrls.length; i++ )
- {
- ldapUrlsSet.add( new LdapURL( ldapUrls[i].getBytes() ).toString() );
- }
- }
- catch ( LdapURLEncodingException luee )
+ for ( int i = 0; i < ldapUrls.length; i++ )
{
- fail();
+ ldapUrlsSet.add( StringTools.utf8ToString( ldapUrls[i].getBytes() ) );
}
- for ( LdapURL ldapUrl:searchResultReference.getSearchResultReferences() )
+ InternalReferral referral = searchResultReference.getReferral();
+
+ assertNotNull( referral );
+
+ for ( String ldapUrl : referral.getLdapUrls() )
{
- if ( ldapUrlsSet.contains( ldapUrl.toString() ) )
+ if ( ldapUrlsSet.contains( ldapUrl ) )
{
- ldapUrlsSet.remove( ldapUrl.toString() );
+ ldapUrlsSet.remove( ldapUrl );
}
else
{
@@ -152,13 +156,13 @@ public class SearchResultReferenceTest
assertTrue( ldapUrlsSet.size() == 0 );
- // Check the length
- assertEquals( 0x3D8, searchResultReference.computeLength() );
-
// Check the encoding
try
{
- ByteBuffer bb = searchResultReference.encode();
+ ByteBuffer bb = encoder.encodeMessage( searchResultReference );
+
+ // Check the length
+ assertEquals( 0x3D8, bb.limit() );
String encodedPdu = StringTools.dumpBytes( bb.array() );
@@ -201,12 +205,12 @@ public class SearchResultReferenceTest
{
0x30, ( byte ) 0x82, 0x03, ( byte ) 0xF1, // LDAPMessage
- // ::=SEQUENCE {
+ // ::=SEQUENCE {
0x02, 0x01, 0x01, // messageID MessageID
0x73, ( byte ) 0x82, 0x03, ( byte ) 0xcd, // CHOICE { ...,
- // searchResEntry
- // SearchResultEntry,
- // ...
+ // searchResEntry
+ // SearchResultEntry,
+ // ...
// SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LDAPURL
} );
@@ -224,7 +228,8 @@ public class SearchResultReferenceTest
}
byte[] controlBytes = new byte[]
- { ( byte ) 0xA0, 0x1B, // A control
+ { ( byte ) 0xA0,
+ 0x1B, // A control
0x30, 0x19, 0x04, 0x17, 0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 0x2E, 0x31, 0x2E, 0x31, 0x31,
0x33, 0x37, 0x33, 0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 };
@@ -241,7 +246,7 @@ public class SearchResultReferenceTest
try
{
- ((LdapMessageContainer)ldapMessageContainer).clean();
+ ( ( LdapMessageContainer ) ldapMessageContainer ).clean();
ldapDecoder.decode( stream, ldapMessageContainer );
}
catch ( DecoderException de )
@@ -249,32 +254,30 @@ public class SearchResultReferenceTest
de.printStackTrace();
fail( de.getMessage() );
}
-
+
stream.flip();
-
- SearchResultReferenceCodec searchResultReference = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchResultReference();
+
+ InternalSearchResultReference searchResultReference = ( ( LdapMessageContainer ) ldapMessageContainer )
+ .getInternalSearchResultReference();
assertEquals( 1, searchResultReference.getMessageId() );
Set<String> ldapUrlsSet = new HashSet<String>();
- try
- {
- for ( int i = 0; i < ldapUrls.length; i++ )
- {
- ldapUrlsSet.add( new LdapURL( ldapUrls[i].getBytes() ).toString() );
- }
- }
- catch ( LdapURLEncodingException luee )
+ for ( int i = 0; i < ldapUrls.length; i++ )
{
- fail();
+ ldapUrlsSet.add( StringTools.utf8ToString( ldapUrls[i].getBytes() ) );
}
- for ( LdapURL ldapUrl:searchResultReference.getSearchResultReferences() )
+ InternalReferral referral = searchResultReference.getReferral();
+
+ assertNotNull( referral );
+
+ for ( String ldapUrl : referral.getLdapUrls() )
{
- if ( ldapUrlsSet.contains( ldapUrl.toString() ) )
+ if ( ldapUrlsSet.contains( ldapUrl ) )
{
- ldapUrlsSet.remove( ldapUrl.toString() );
+ ldapUrlsSet.remove( ldapUrl );
}
else
{
@@ -285,21 +288,21 @@ public class SearchResultReferenceTest
assertTrue( ldapUrlsSet.size() == 0 );
// Check the Control
- List<Control> controls = searchResultReference.getControls();
+ Map<String, Control> controls = searchResultReference.getControls();
assertEquals( 1, controls.size() );
- Control control = searchResultReference.getControls( 0 );
+ Control control = controls.get( "2.16.840.1.113730.3.4.2" );
assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
- // Check the length
- assertEquals( 0x3F5, searchResultReference.computeLength() );
-
// Check the encoding
try
{
- ByteBuffer bb = searchResultReference.encode();
+ ByteBuffer bb = encoder.encodeMessage( searchResultReference );
+
+ // Check the length
+ assertEquals( 0x3F5, bb.limit() );
String encodedPdu = StringTools.dumpBytes( bb.array() );
@@ -329,7 +332,7 @@ public class SearchResultReferenceTest
0x30, 0x05, // LDAPMessage ::=SEQUENCE {
0x02, 0x01, 0x01, // messageID MessageID
0x73, 0x00 // CHOICE { ..., searchResEntry SearchResultEntry,
- // ...
+ // ...
// SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LDAPURL
} );
@@ -369,14 +372,14 @@ public class SearchResultReferenceTest
0x30, 0x0F, // LDAPMessage ::=SEQUENCE {
0x02, 0x01, 0x01, // messageID MessageID
0x73, 0x0A, // CHOICE { ..., searchResEntry SearchResultEntry,
- // ...
+ // ...
0x04, 0x08, 'l', 'd', 'a', 'p', ':', '/', '/', '/' // SearchResultReference
- // ::=
- // [APPLICATION
- // 19]
- // SEQUENCE
- // OF
- // LDAPURL
+ // ::=
+ // [APPLICATION
+ // 19]
+ // SEQUENCE
+ // OF
+ // LDAPURL
} );
String decodedPdu = StringTools.dumpBytes( stream.array() );
@@ -395,21 +398,27 @@ public class SearchResultReferenceTest
fail( de.getMessage() );
}
- SearchResultReferenceCodec searchResultReference = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchResultReference();
+ InternalSearchResultReference searchResultReference = ( ( LdapMessageContainer ) ldapMessageContainer )
+ .getInternalSearchResultReference();
assertEquals( 1, searchResultReference.getMessageId() );
- LdapURL ldapUrl = searchResultReference.getSearchResultReferences().get( 0 );
+ InternalReferral referral = searchResultReference.getReferral();
- assertEquals( "ldap:///", ldapUrl.toString() );
+ assertNotNull( referral );
- // Check the length
- assertEquals( 0x11, searchResultReference.computeLength() );
+ for ( String ldapUrl : referral.getLdapUrls() )
+ {
+ assertEquals( "ldap:///", ldapUrl );
+ }
// Check the encoding
try
{
- ByteBuffer bb = searchResultReference.encode();
+ ByteBuffer bb = encoder.encodeMessage( searchResultReference );
+
+ // Check the length
+ assertEquals( 0x11, bb.limit() );
String encodedPdu = StringTools.dumpBytes( bb.array() );
Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/LdapResultImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/LdapResultImplTest.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/LdapResultImplTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/LdapResultImplTest.java Fri Aug 13 16:05:37 2010
@@ -138,7 +138,7 @@ public class LdapResultImplTest
}
- public void setReferral( InternalReferral a_referral )
+ public void setReferral( InternalReferral referral )
{
}
@@ -165,13 +165,13 @@ public class LdapResultImplTest
}
- public int getReferralsLength()
+ public int getReferralLength()
{
return 0;
}
- public void setReferralsLength( int referralsLength )
+ public void setReferralLength( int referralLength )
{
}
};
Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ReferralImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ReferralImplTest.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ReferralImplTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ReferralImplTest.java Fri Aug 13 16:05:37 2010
@@ -220,6 +220,17 @@ public class ReferralImplTest
{
return null;
}
+
+
+ public int getReferralLength()
+ {
+ return 0;
+ }
+
+
+ public void setReferralLength( int referralLength )
+ {
+ }
};
ReferralImpl refs1 = new ReferralImpl();
Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImplTest.java?rev=985255&r1=985254&r2=985255&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImplTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImplTest.java Fri Aug 13 16:05:37 2010
@@ -109,7 +109,7 @@ public class SearchResponseReferenceImpl
}
- public void setReferral( InternalReferral a_referral )
+ public void setReferral( InternalReferral referral )
{
}
@@ -191,6 +191,17 @@ public class SearchResponseReferenceImpl
public void setMessageLength( int messageLength )
{
}
+
+
+ public int getSearchResultReferenceLength()
+ {
+ return 0;
+ }
+
+
+ public void setSearchResultReferenceLength( int searchResultReferenceLength )
+ {
+ }
};
SearchResultReferenceImpl resp1 = new SearchResultReferenceImpl( 5 );