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 2008/09/19 01:55:49 UTC
svn commit: r696857 - in /directory:
apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/
apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/
apacheds/trunk/core/src/main/java/org/apache/directory/serv...
Author: elecharny
Date: Thu Sep 18 16:55:47 2008
New Revision: 696857
URL: http://svn.apache.org/viewvc?rev=696857&view=rev
Log:
o Added the Paged Search Control code in shared
o Moved the controls into a specific package in shared
o Minor fixed in comments and javadoc
Added:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlCodec.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlContainer.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlDecoder.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlGrammar.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlStatesEnum.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/AbstractMutableControlImpl.java
- copied, changed from r696613, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/CascadeControl.java
- copied, changed from r696613, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/EntryChangeControl.java
- copied, changed from r696613, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/ManageDsaITControl.java
- copied, changed from r696613, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManageDsaITControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/PagedSearchControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/PersistentSearchControl.java
- copied, changed from r696613, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/PersistentSearchControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/SubentriesControl.java
- copied, changed from r696613, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SubentriesControl.java
Removed:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManageDsaITControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/PersistentSearchControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SubentriesControl.java
Modified:
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventType.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapService.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControlDecoder.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControlDecoder.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlGrammar.java
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java Thu Sep 18 16:55:47 2008
@@ -24,7 +24,8 @@
import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
-import org.apache.directory.shared.ldap.message.SubentriesControl;
+import org.apache.directory.shared.ldap.message.control.SubentriesControl;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventType.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventType.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventType.java Thu Sep 18 16:55:47 2008
@@ -21,7 +21,7 @@
import java.util.ArrayList;
-import org.apache.directory.shared.ldap.message.PersistentSearchControl;
+import org.apache.directory.shared.ldap.message.control.PersistentSearchControl;
/**
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java Thu Sep 18 16:55:47 2008
@@ -28,9 +28,9 @@
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.ManageDsaITControl;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
import org.apache.directory.shared.ldap.message.SearchRequest;
+import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Thu Sep 18 16:55:47 2008
@@ -71,11 +71,11 @@
import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.filter.PresenceNode;
-import org.apache.directory.shared.ldap.message.CascadeControl;
-import org.apache.directory.shared.ldap.message.EntryChangeControl;
-import org.apache.directory.shared.ldap.message.ManageDsaITControl;
-import org.apache.directory.shared.ldap.message.PersistentSearchControl;
-import org.apache.directory.shared.ldap.message.SubentriesControl;
+import org.apache.directory.shared.ldap.message.control.CascadeControl;
+import org.apache.directory.shared.ldap.message.control.EntryChangeControl;
+import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
+import org.apache.directory.shared.ldap.message.control.PersistentSearchControl;
+import org.apache.directory.shared.ldap.message.control.SubentriesControl;
import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Thu Sep 18 16:55:47 2008
@@ -92,8 +92,8 @@
import org.apache.directory.shared.ldap.filter.ScopeNode;
import org.apache.directory.shared.ldap.filter.SimpleNode;
import org.apache.directory.shared.ldap.filter.SubstringNode;
-import org.apache.directory.shared.ldap.message.CascadeControl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.control.CascadeControl;
import org.apache.directory.shared.ldap.name.AttributeTypeAndValue;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Thu Sep 18 16:55:47 2008
@@ -68,7 +68,7 @@
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.message.SubentriesControl;
+import org.apache.directory.shared.ldap.message.control.SubentriesControl;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapService.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapService.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapService.java Thu Sep 18 16:55:47 2008
@@ -50,18 +50,18 @@
import org.apache.directory.shared.ldap.message.AbandonRequest;
import org.apache.directory.shared.ldap.message.AddRequest;
import org.apache.directory.shared.ldap.message.BindRequest;
-import org.apache.directory.shared.ldap.message.CascadeControl;
import org.apache.directory.shared.ldap.message.CompareRequest;
import org.apache.directory.shared.ldap.message.DeleteRequest;
-import org.apache.directory.shared.ldap.message.EntryChangeControl;
import org.apache.directory.shared.ldap.message.ExtendedRequest;
-import org.apache.directory.shared.ldap.message.ManageDsaITControl;
import org.apache.directory.shared.ldap.message.ModifyDnRequest;
import org.apache.directory.shared.ldap.message.ModifyRequest;
-import org.apache.directory.shared.ldap.message.PersistentSearchControl;
import org.apache.directory.shared.ldap.message.SearchRequest;
-import org.apache.directory.shared.ldap.message.SubentriesControl;
import org.apache.directory.shared.ldap.message.UnbindRequest;
+import org.apache.directory.shared.ldap.message.control.CascadeControl;
+import org.apache.directory.shared.ldap.message.control.EntryChangeControl;
+import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
+import org.apache.directory.shared.ldap.message.control.PersistentSearchControl;
+import org.apache.directory.shared.ldap.message.control.SubentriesControl;
import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
import org.apache.mina.common.DefaultIoFilterChainBuilder;
import org.apache.mina.common.IoFilterChainBuilder;
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java Thu Sep 18 16:55:47 2008
@@ -34,11 +34,11 @@
import org.apache.directory.shared.ldap.codec.search.controls.ChangeType;
import org.apache.directory.shared.ldap.message.AbandonListener;
import org.apache.directory.shared.ldap.message.AbandonableRequest;
-import org.apache.directory.shared.ldap.message.EntryChangeControl;
-import org.apache.directory.shared.ldap.message.PersistentSearchControl;
import org.apache.directory.shared.ldap.message.SearchRequest;
import org.apache.directory.shared.ldap.message.SearchResponseEntry;
import org.apache.directory.shared.ldap.message.SearchResponseEntryImpl;
+import org.apache.directory.shared.ldap.message.control.EntryChangeControl;
+import org.apache.directory.shared.ldap.message.control.PersistentSearchControl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java Thu Sep 18 16:55:47 2008
@@ -37,7 +37,6 @@
import org.apache.directory.shared.ldap.message.CompareRequest;
import org.apache.directory.shared.ldap.message.DeleteRequest;
import org.apache.directory.shared.ldap.message.LdapResult;
-import org.apache.directory.shared.ldap.message.ManageDsaITControl;
import org.apache.directory.shared.ldap.message.ModifyDnRequest;
import org.apache.directory.shared.ldap.message.ModifyRequest;
import org.apache.directory.shared.ldap.message.Referral;
@@ -45,6 +44,7 @@
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.message.ResultResponseRequest;
import org.apache.directory.shared.ldap.message.SearchRequest;
+import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
import org.apache.directory.shared.ldap.util.LdapURL;
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Thu Sep 18 16:55:47 2008
@@ -39,8 +39,6 @@
import org.apache.directory.shared.ldap.filter.OrNode;
import org.apache.directory.shared.ldap.filter.PresenceNode;
import org.apache.directory.shared.ldap.message.LdapResult;
-import org.apache.directory.shared.ldap.message.ManageDsaITControl;
-import org.apache.directory.shared.ldap.message.PersistentSearchControl;
import org.apache.directory.shared.ldap.message.ReferralImpl;
import org.apache.directory.shared.ldap.message.Response;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -51,6 +49,8 @@
import org.apache.directory.shared.ldap.message.SearchResponseEntryImpl;
import org.apache.directory.shared.ldap.message.SearchResponseReference;
import org.apache.directory.shared.ldap.message.SearchResponseReferenceImpl;
+import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
+import org.apache.directory.shared.ldap.message.control.PersistentSearchControl;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.util.LdapURL;
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java Thu Sep 18 16:55:47 2008
@@ -52,7 +52,7 @@
import org.apache.directory.shared.ldap.codec.search.controls.ChangeType;
import org.apache.directory.shared.ldap.codec.search.controls.EntryChangeControlCodec;
import org.apache.directory.shared.ldap.codec.search.controls.EntryChangeControlDecoder;
-import org.apache.directory.shared.ldap.message.PersistentSearchControl;
+import org.apache.directory.shared.ldap.message.control.PersistentSearchControl;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -603,7 +603,7 @@
for ( int ii = 0; ii < controls.length; ii++ )
{
if ( controls[ii].getID().equals(
- org.apache.directory.shared.ldap.message.EntryChangeControl.CONTROL_OID ) )
+ org.apache.directory.shared.ldap.message.control.EntryChangeControl.CONTROL_OID ) )
{
EntryChangeControlDecoder decoder = new EntryChangeControlDecoder();
ecControl = ( EntryChangeControlCodec ) decoder.decode( controls[ii].getEncodedValue() );
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java Thu Sep 18 16:55:47 2008
@@ -48,7 +48,7 @@
import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.message.SubentriesControl;
+import org.apache.directory.shared.ldap.message.control.SubentriesControl;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.fail;
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java Thu Sep 18 16:55:47 2008
@@ -78,13 +78,11 @@
import org.apache.directory.shared.ldap.filter.PresenceNode;
import org.apache.directory.shared.ldap.filter.SubstringNode;
import org.apache.directory.shared.ldap.message.AbandonRequestImpl;
-import org.apache.directory.shared.ldap.message.AbstractMutableControlImpl;
import org.apache.directory.shared.ldap.message.AddRequestImpl;
import org.apache.directory.shared.ldap.message.AddResponseImpl;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
import org.apache.directory.shared.ldap.message.BindRequestImpl;
import org.apache.directory.shared.ldap.message.BindResponseImpl;
-import org.apache.directory.shared.ldap.message.CascadeControl;
import org.apache.directory.shared.ldap.message.CompareRequestImpl;
import org.apache.directory.shared.ldap.message.CompareResponseImpl;
import org.apache.directory.shared.ldap.message.DeleteRequestImpl;
@@ -97,15 +95,17 @@
import org.apache.directory.shared.ldap.message.ModifyDnResponseImpl;
import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
import org.apache.directory.shared.ldap.message.ModifyResponseImpl;
-import org.apache.directory.shared.ldap.message.PersistentSearchControl;
import org.apache.directory.shared.ldap.message.Referral;
import org.apache.directory.shared.ldap.message.ReferralImpl;
import org.apache.directory.shared.ldap.message.SearchRequestImpl;
import org.apache.directory.shared.ldap.message.SearchResponseDoneImpl;
import org.apache.directory.shared.ldap.message.SearchResponseEntryImpl;
import org.apache.directory.shared.ldap.message.SearchResponseReferenceImpl;
-import org.apache.directory.shared.ldap.message.SubentriesControl;
import org.apache.directory.shared.ldap.message.UnbindRequestImpl;
+import org.apache.directory.shared.ldap.message.control.AbstractMutableControlImpl;
+import org.apache.directory.shared.ldap.message.control.CascadeControl;
+import org.apache.directory.shared.ldap.message.control.PersistentSearchControl;
+import org.apache.directory.shared.ldap.message.control.SubentriesControl;
import org.apache.directory.shared.ldap.message.extended.GracefulShutdownRequest;
import org.apache.directory.shared.ldap.message.spi.Provider;
import org.apache.directory.shared.ldap.message.spi.TransformerSpi;
@@ -1298,8 +1298,10 @@
org.apache.directory.shared.ldap.codec.Control twixControl = new org.apache.directory.shared.ldap.codec.Control();
twixMessage.addControl( twixControl );
twixControl.setCriticality( control.isCritical() );
- twixControl.setControlValue( control.getEncodedValue() );
- twixControl.setEncodedValue( control.getEncodedValue() );
+
+ byte[] encodedValue = control.getEncodedValue();
+ twixControl.setControlValue( encodedValue );
+ twixControl.setEncodedValue( encodedValue );
twixControl.setControlType( control.getID() );
twixControl.setParent( twixMessage );
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControlDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControlDecoder.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControlDecoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControlDecoder.java Thu Sep 18 16:55:47 2008
@@ -23,6 +23,7 @@
import org.apache.directory.shared.asn1.Asn1Object;
import org.apache.directory.shared.asn1.codec.DecoderException;
import org.apache.directory.shared.ldap.codec.ControlDecoder;
+import org.apache.directory.shared.ldap.message.control.CascadeControl;
/**
@@ -35,12 +36,12 @@
{
public String getControlType()
{
- return org.apache.directory.shared.ldap.message.CascadeControl.CONTROL_OID;
+ return CascadeControl.CONTROL_OID;
}
public Asn1Object decode( byte[] controlBytes ) throws DecoderException
{
- return new org.apache.directory.shared.ldap.codec.controls.CascadeControlCodec();
+ return new CascadeControlCodec();
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControlDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControlDecoder.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControlDecoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControlDecoder.java Thu Sep 18 16:55:47 2008
@@ -23,7 +23,7 @@
import org.apache.directory.shared.asn1.Asn1Object;
import org.apache.directory.shared.asn1.codec.DecoderException;
import org.apache.directory.shared.ldap.codec.ControlDecoder;
-import org.apache.directory.shared.ldap.message.ManageDsaITControl;
+import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
/**
@@ -42,6 +42,6 @@
public Asn1Object decode( byte[] controlBytes ) throws DecoderException
{
- return new org.apache.directory.shared.ldap.codec.controls.ManageDsaITControlCodec();
+ return new ManageDsaITControlCodec();
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlGrammar.java?rev=696857&r1=696856&r2=696857&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlGrammar.java Thu Sep 18 16:55:47 2008
@@ -71,7 +71,7 @@
/**
- * Creates a new ModifyDNRequestGrammar object.
+ * Creates a new PSearchControlGrammar object.
*/
private PSearchControlGrammar()
{
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlCodec.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlCodec.java?rev=696857&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlCodec.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlCodec.java Thu Sep 18 16:55:47 2008
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.codec.search.controls;
+
+
+import java.nio.ByteBuffer;
+
+import org.apache.directory.shared.asn1.AbstractAsn1Object;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
+import org.apache.directory.shared.asn1.ber.tlv.Value;
+import org.apache.directory.shared.asn1.codec.EncoderException;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+/**
+ * A request/response control used to implement a simple paging of search
+ * results. This is an implementation of RFC 2696 :
+ * <a href="http://www.faqs.org/rfcs/rfc2696.html">LDAP Control Extension for Simple Paged Results Manipulation</a>
+ * <br/>
+ * <pre>
+ * This control is included in the searchRequest and searchResultDone
+ * messages as part of the controls field of the LDAPMessage, as defined
+ * in Section 4.1.12 of [LDAPv3]. The structure of this control is as
+ * follows:
+ *
+ * pagedResultsControl ::= SEQUENCE {
+ * controlType 1.2.840.113556.1.4.319,
+ * criticality BOOLEAN DEFAULT FALSE,
+ * controlValue searchControlValue
+ * }
+ *
+ * The searchControlValue is an OCTET STRING wrapping the BER-encoded
+ * version of the following SEQUENCE:
+ *
+ * realSearchControlValue ::= SEQUENCE {
+ * size INTEGER (0..maxInt),
+ * -- requested page size from client
+ * -- result set size estimate from server
+ * cookie OCTET STRING
+ * }
+ *
+ * </pre>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: $
+ */
+public class PagedSearchControlCodec extends AbstractAsn1Object
+{
+ /** The number of entries to return, or returned */
+ private int size;
+
+ /** The exchanged cookie */
+ private byte[] cookie;
+
+ /** The entry change global length */
+ private int pscSeqLength;
+
+
+ /**
+ * @see Asn1Object#Asn1Object
+ */
+ public PagedSearchControlCodec()
+ {
+ super();
+ }
+
+
+ /**
+ * Compute the PagedSearchControl length
+ *
+ * 0x30 L1
+ * |
+ * +--> 0x02 0x0(1-4) [0..2^63-1] (size)
+ * +--> 0x04 L2 (cookie)
+ */
+ public int computeLength()
+ {
+ int sizeLength = 1 + 1 + Value.getNbBytes( size );;
+
+ int cookieLength = 0;
+
+ if ( cookie != null )
+ {
+ cookieLength = 1 + TLV.getNbBytes( cookie.length ) + cookie.length;
+ }
+ else
+ {
+ cookieLength = 1 + 1;
+ }
+
+ pscSeqLength = sizeLength + cookieLength;
+
+ return 1 + TLV.getNbBytes( pscSeqLength ) + pscSeqLength;
+ }
+
+
+ /**
+ * Encodes the paged search control.
+ *
+ * @param buffer The encoded sink
+ * @return A ByteBuffer that contains the encoded PDU
+ * @throws EncoderException If anything goes wrong.
+ */
+ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+ {
+ // Allocate the bytes buffer.
+ ByteBuffer bb = ByteBuffer.allocate( computeLength() );
+ bb.put( UniversalTag.SEQUENCE_TAG );
+ bb.put( TLV.getBytes( pscSeqLength ) );
+
+ Value.encode( bb, size );
+ Value.encode( bb, cookie );
+
+ return bb;
+ }
+
+
+ /**
+ * Return a String representing this PagedSearchControl.
+ */
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( " Paged Search Control\n" );
+ sb.append( " size : '" ).append( size ).append( "'\n" );
+ sb.append( " cookie : '" ).append( StringTools.dumpBytes( cookie ) ).append( "'\n" );
+
+ return sb.toString();
+ }
+
+
+ /**
+ * @return The requested or returned number of entries
+ */
+ public int getSize()
+ {
+ return size;
+ }
+
+
+ /**
+ * Set the number of entry requested or returned
+ *
+ * @param size The number of entries
+ */
+ public void setSize( int size )
+ {
+ this.size = size;
+ }
+
+
+ /**
+ * @return The stored cookie
+ */
+ public byte[] getCookie()
+ {
+ return cookie;
+ }
+
+
+ /**
+ * Set the cookie
+ *
+ * @param cookie The cookie to store in this control
+ */
+ public void setCookie( byte[] cookie )
+ {
+ this.cookie = cookie;
+ }
+}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlContainer.java?rev=696857&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlContainer.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlContainer.java Thu Sep 18 16:55:47 2008
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.codec.search.controls;
+
+
+import org.apache.directory.shared.asn1.ber.AbstractContainer;
+
+
+/**
+ * A container for the Paged Search Control.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 664290 $, $Date: 2008-06-07 08:28:06 +0200 (Sat, 07 Jun 2008) $,
+ */
+public class PagedSearchControlContainer extends AbstractContainer
+{
+ /** PagedSearchControl */
+ private PagedSearchControlCodec control;
+
+
+ /**
+ * Creates a new PagedSearchControl container object. We will store one grammar,
+ * it's enough ...
+ */
+ public PagedSearchControlContainer()
+ {
+ super();
+ stateStack = new int[1];
+ grammar = PagedSearchControlGrammar.getInstance();
+ states = PagedSearchControlStatesEnum.getInstance();
+ }
+
+
+ /**
+ * @return Returns the paged search control.
+ */
+ public PagedSearchControlCodec getPagedSearchControl()
+ {
+
+ return control;
+ }
+
+
+ /**
+ * Set a PagedSearchControl Object into the container. It will be completed by
+ * the ldapDecoder.
+ *
+ * @param control the PagedSearchControl to set.
+ */
+ public void setPagedSearchControl( PagedSearchControlCodec control )
+ {
+ this.control = control;
+ }
+
+ /**
+ * Clean the container
+ */
+ public void clean()
+ {
+ super.clean();
+ control = null;
+ }
+}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlDecoder.java?rev=696857&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlDecoder.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlDecoder.java Thu Sep 18 16:55:47 2008
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.codec.search.controls;
+
+
+import java.nio.ByteBuffer;
+
+import org.apache.directory.shared.asn1.Asn1Object;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.ControlDecoder;
+
+
+/**
+ * A decoder for PagedSearchControls.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 664290 $, $Date: 2008-06-07 08:28:06 +0200 (Sat, 07 Jun 2008) $,
+ */
+public class PagedSearchControlDecoder extends Asn1Decoder implements ControlDecoder
+{
+ /** The paged search OID */
+ private final static String CONTROL_TYPE_OID = "1.2.840.113556.1.4.319";
+
+ /** An instance of this decoder */
+ private static final Asn1Decoder decoder = new Asn1Decoder();
+
+ /**
+ * Return the paged search OID
+ *
+ * @see org.apache.directory.shared.ldap.codec.ControlDecoder#getControlType()
+ */
+ public String getControlType()
+ {
+ return CONTROL_TYPE_OID;
+ }
+
+ /**
+ * Decode the paged search control
+ *
+ * @param controlBytes The bytes array which contains the encoded paged search
+ *
+ * @return A valid PagedSearch object
+ *
+ * @throws DecoderException If the decoding found an error
+ * @throws NamingException It will never be throw by this method
+ */
+ public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+ {
+ ByteBuffer bb = ByteBuffer.wrap( controlBytes );
+ PagedSearchControlContainer container = new PagedSearchControlContainer();
+ decoder.decode( bb, container );
+ return container.getPagedSearchControl();
+ }
+}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlGrammar.java?rev=696857&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlGrammar.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlGrammar.java Thu Sep 18 16:55:47 2008
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.codec.search.controls;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
+import org.apache.directory.shared.asn1.ber.grammar.IGrammar;
+import org.apache.directory.shared.asn1.ber.grammar.IStates;
+import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
+import org.apache.directory.shared.asn1.ber.tlv.Value;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.asn1.util.IntegerDecoder;
+import org.apache.directory.shared.asn1.util.IntegerDecoderException;
+import org.apache.directory.shared.ldap.util.StringTools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This class implements the PagedSearchControl. All the actions are declared in
+ * this class. As it is a singleton, these declaration are only done once.
+ *
+ * The decoded grammar is the following :
+ *
+ * realSearchControlValue ::= SEQUENCE {
+ * size INTEGER,
+ * cookie OCTET STRING,
+ * }
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 664290 $, $Date: 2008-06-07 08:28:06 +0200 (Sat, 07 Jun 2008) $,
+ */
+public class PagedSearchControlGrammar extends AbstractGrammar
+{
+ /** The logger */
+ static final Logger log = LoggerFactory.getLogger( PagedSearchControlGrammar.class );
+
+ /** Speedup for logs */
+ static final boolean IS_DEBUG = log.isDebugEnabled();
+
+ /** The instance of grammar. PagedSearchControlGrammar is a singleton */
+ private static IGrammar instance = new PagedSearchControlGrammar();
+
+
+ /**
+ * Creates a new PagedSearchControlGrammar object.
+ */
+ private PagedSearchControlGrammar()
+ {
+ name = PagedSearchControlGrammar.class.getName();
+ statesEnum = PagedSearchControlStatesEnum.getInstance();
+
+ // Create the transitions table
+ super.transitions = new GrammarTransition[PagedSearchControlStatesEnum.LAST_PAGED_SEARCH_STATE][256];
+
+ /**
+ * Transition from initial state to PagedSearch sequence
+ * realSearchControlValue ::= SEQUENCE OF {
+ * ...
+ *
+ * Initialize the persistence search object
+ */
+ super.transitions[IStates.INIT_GRAMMAR_STATE][UniversalTag.SEQUENCE_TAG] =
+ new GrammarTransition( IStates.INIT_GRAMMAR_STATE,
+ PagedSearchControlStatesEnum.PAGED_SEARCH_SEQUENCE_STATE,
+ UniversalTag.SEQUENCE_TAG,
+ new GrammarAction( "Init PagedSearchControl" )
+ {
+ public void action( IAsn1Container container )
+ {
+ PagedSearchControlContainer pagedSearchContainer = ( PagedSearchControlContainer ) container;
+ PagedSearchControlCodec control = new PagedSearchControlCodec();
+ pagedSearchContainer.setPagedSearchControl( control );
+ }
+ } );
+
+
+ /**
+ * Transition from PagedSearch sequence to size
+ *
+ * realSearchControlValue ::= SEQUENCE OF {
+ * size INTEGER, -- INTEGER (0..maxInt),
+ * ...
+ *
+ * Stores the size value
+ */
+ super.transitions[PagedSearchControlStatesEnum.PAGED_SEARCH_SEQUENCE_STATE][UniversalTag.INTEGER_TAG] =
+ new GrammarTransition( PagedSearchControlStatesEnum.PAGED_SEARCH_SEQUENCE_STATE,
+ PagedSearchControlStatesEnum.SIZE_STATE,
+ UniversalTag.INTEGER_TAG,
+ new GrammarAction( "Set PagedSearchControl size" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+ PagedSearchControlContainer pagedSearchContainer = ( PagedSearchControlContainer ) container;
+ Value value = pagedSearchContainer.getCurrentTLV().getValue();
+
+ try
+ {
+ // Check that the value is into the allowed interval
+ int size = IntegerDecoder.parse( value, 0, Integer.MAX_VALUE );
+
+ if ( IS_DEBUG )
+ {
+ log.debug( "size = " + size );
+ }
+
+ pagedSearchContainer.getPagedSearchControl().setSize( size );
+ }
+ catch ( IntegerDecoderException e )
+ {
+ String msg = "failed to decode the size for PagedSearchControl";
+ log.error( msg, e );
+ throw new DecoderException( msg );
+ }
+ }
+ } );
+
+ /**
+ * Transition from size to cookie
+ * realSearchControlValue ::= SEQUENCE OF {
+ * ...
+ * cookie OCTET STRING
+ * }
+ *
+ * Stores the cookie flag
+ */
+ super.transitions[PagedSearchControlStatesEnum.SIZE_STATE][UniversalTag.OCTET_STRING_TAG] =
+ new GrammarTransition( PagedSearchControlStatesEnum.SIZE_STATE,
+ PagedSearchControlStatesEnum.COOKIE_STATE, UniversalTag.OCTET_STRING_TAG,
+ new GrammarAction( "Set PagedSearchControl cookie" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+ PagedSearchControlContainer pagedSearchContainer = ( PagedSearchControlContainer ) container;
+ Value value = pagedSearchContainer.getCurrentTLV().getValue();
+
+ if ( pagedSearchContainer.getCurrentTLV().getLength() == 0 )
+ {
+ pagedSearchContainer.getPagedSearchControl().setCookie( StringTools.EMPTY_BYTES );
+ }
+ else
+ {
+ pagedSearchContainer.getPagedSearchControl().setCookie( value.getData() );
+ }
+
+ // We can have an END transition
+ pagedSearchContainer.grammarEndAllowed( true );
+ }
+ } );
+ }
+
+
+ /**
+ * This class is a singleton.
+ *
+ * @return An instance on this grammar
+ */
+ public static IGrammar getInstance()
+ {
+ return instance;
+ }
+}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlStatesEnum.java?rev=696857&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlStatesEnum.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlStatesEnum.java Thu Sep 18 16:55:47 2008
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.codec.search.controls;
+
+
+import org.apache.directory.shared.asn1.ber.grammar.IGrammar;
+import org.apache.directory.shared.asn1.ber.grammar.IStates;
+
+
+/**
+ * This class store the PagedSearchControl's grammar constants. It is also used for
+ * debugging purposes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 664290 $, $Date: 2008-06-07 08:28:06 +0200 (Sat, 07 Jun 2008) $,
+ */
+public class PagedSearchControlStatesEnum implements IStates
+{
+ // ~ Static fields/initializers
+ // -----------------------------------------------------------------
+
+ // =========================================================================
+ // Paged search control grammar states
+ // =========================================================================
+ /** Initial state */
+ public static final int START_STATE = 0;
+
+ /** Sequence Value */
+ public static final int PAGED_SEARCH_SEQUENCE_STATE = 1;
+
+ /** Size Value */
+ public static final int SIZE_STATE = 3;
+
+ /** Cookie Value */
+ public static final int COOKIE_STATE = 5;
+
+ /** terminal state */
+ public static final int LAST_PAGED_SEARCH_STATE = 8;
+
+ // =========================================================================
+ // States debug strings
+ // =========================================================================
+ /** A string representation of all the states */
+ private static String[] PagedSearchString = new String[]
+ {
+ "START_STATE",
+ "PAGED_SEARCH_SEQUENCE_VALUE",
+ "SIZE_STATE",
+ "COOKIE_STATE"
+ };
+
+ /** The instance */
+ private static PagedSearchControlStatesEnum instance = new PagedSearchControlStatesEnum();
+
+
+ // ~ Constructors
+ // -------------------------------------------------------------------------------
+
+ /**
+ * This is a private constructor. This class is a singleton
+ */
+ private PagedSearchControlStatesEnum()
+ {
+ }
+
+
+ // ~ Methods
+ // ------------------------------------------------------------------------------------
+
+ /**
+ * Get an instance of this class
+ *
+ * @return An instance on this class
+ */
+ public static IStates getInstance()
+ {
+ return instance;
+ }
+
+
+ /**
+ * Get the grammar name
+ *
+ * @param grammar The grammar code
+ * @return The grammar name
+ */
+ public String getGrammarName( int grammar )
+ {
+ return "PAGED_SEARCH_GRAMMAR";
+ }
+
+
+ /**
+ * Get the grammar name
+ *
+ * @param grammar The grammar class
+ * @return The grammar name
+ */
+ public String getGrammarName( IGrammar grammar )
+ {
+ if ( grammar instanceof PagedSearchControlGrammar )
+ {
+ return "PAGEDSEARCH_GRAMMAR";
+ }
+
+ return "UNKNOWN GRAMMAR";
+ }
+
+
+ /**
+ * Get the string representing the state
+ *
+ * @param state The state number
+ * @return The String representing the state
+ */
+ public String getState( int state )
+ {
+ return ( ( state == GRAMMAR_END ) ? "PAGED_SEARCH_END_STATE" : PagedSearchString[state] );
+ }
+}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/AbstractMutableControlImpl.java (from r696613, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/AbstractMutableControlImpl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/AbstractMutableControlImpl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java&r1=696613&r2=696857&rev=696857&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/AbstractMutableControlImpl.java Thu Sep 18 16:55:47 2008
@@ -17,7 +17,9 @@
* under the License.
*
*/
-package org.apache.directory.shared.ldap.message;
+package org.apache.directory.shared.ldap.message.control;
+
+import org.apache.directory.shared.ldap.message.MutableControl;
/**
@@ -53,7 +55,7 @@
/**
- * Sets the criticil flag which determines whether or not this control is
+ * Sets the critical flag which determines whether or not this control is
* critical for the correct operation of a request or response message. The
* default for this value should be false.
*
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/CascadeControl.java (from r696613, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/CascadeControl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/CascadeControl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java&r1=696613&r2=696857&rev=696857&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/CascadeControl.java Thu Sep 18 16:55:47 2008
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.shared.ldap.message;
+package org.apache.directory.shared.ldap.message.control;
import org.apache.directory.shared.ldap.util.StringTools;
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/EntryChangeControl.java (from r696613, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/EntryChangeControl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/EntryChangeControl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java&r1=696613&r2=696857&rev=696857&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/EntryChangeControl.java Thu Sep 18 16:55:47 2008
@@ -17,11 +17,12 @@
* under the License.
*
*/
-package org.apache.directory.shared.ldap.message;
+package org.apache.directory.shared.ldap.message.control;
import org.apache.directory.shared.asn1.codec.EncoderException;
import org.apache.directory.shared.ldap.codec.search.controls.ChangeType;
+import org.apache.directory.shared.ldap.codec.search.controls.EntryChangeControlCodec;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -82,7 +83,7 @@
public static final String CONTROL_OID = "2.16.840.1.113730.3.4.7";
- public static final long UNDEFINED_CHANGE_NUMBER = org.apache.directory.shared.ldap.codec.search.controls.EntryChangeControlCodec.UNDEFINED_CHANGE_NUMBER;
+ public static final long UNDEFINED_CHANGE_NUMBER = EntryChangeControlCodec.UNDEFINED_CHANGE_NUMBER;
private ChangeType changeType = ChangeType.ADD;
@@ -137,7 +138,7 @@
public byte[] getEncodedValue()
{
// should call this codec or something
- org.apache.directory.shared.ldap.codec.search.controls.EntryChangeControlCodec ecc = new org.apache.directory.shared.ldap.codec.search.controls.EntryChangeControlCodec();
+ EntryChangeControlCodec ecc = new EntryChangeControlCodec();
ecc.setChangeNumber( changeNumber );
ecc.setChangeType( changeType );
ecc.setPreviousDn( previousDn );
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/ManageDsaITControl.java (from r696613, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManageDsaITControl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/ManageDsaITControl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/ManageDsaITControl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManageDsaITControl.java&r1=696613&r2=696857&rev=696857&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManageDsaITControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/ManageDsaITControl.java Thu Sep 18 16:55:47 2008
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.shared.ldap.message;
+package org.apache.directory.shared.ldap.message.control;
import org.apache.directory.shared.ldap.util.StringTools;
@@ -67,7 +67,7 @@
private static final long serialVersionUID = -8844249964346248321L;
/**
- * Returns an empty byte[] everytime.
+ * Returns an empty byte[] every time.
*/
public byte[] getEncodedValue()
{
@@ -76,7 +76,7 @@
/**
- * Returns an empty byte[] everytime.
+ * Returns an empty byte[] every time.
*/
public byte[] getValue()
{
@@ -85,7 +85,7 @@
/**
- * Returns "2.16.840.1.113730.3.4.2" everytime.
+ * Returns "2.16.840.1.113730.3.4.2" every time.
*/
public String getType()
{
@@ -94,7 +94,7 @@
/**
- * Returns "2.16.840.1.113730.3.4.2" everytime.
+ * Returns "2.16.840.1.113730.3.4.2" every time.
*/
public String getID()
{
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/PagedSearchControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/PagedSearchControl.java?rev=696857&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/PagedSearchControl.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/PagedSearchControl.java Thu Sep 18 16:55:47 2008
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.message.control;
+
+
+import org.apache.directory.shared.asn1.codec.EncoderException;
+import org.apache.directory.shared.ldap.codec.search.controls.PagedSearchControlCodec;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A request/response control used to implement a simple paging of search
+ * results. This is an implementation of RFC 2696 :
+ * <a href="http://www.faqs.org/rfcs/rfc2696.html">LDAP Control Extension for Simple Paged Results Manipulation</a>
+ * <br/>
+ * <pre>
+ * This control is included in the searchRequest and searchResultDone
+ * messages as part of the controls field of the LDAPMessage, as defined
+ * in Section 4.1.12 of [LDAPv3]. The structure of this control is as
+ * follows:
+ *
+ * pagedResultsControl ::= SEQUENCE {
+ * controlType 1.2.840.113556.1.4.319,
+ * criticality BOOLEAN DEFAULT FALSE,
+ * controlValue searchControlValue
+ * }
+ *
+ * The searchControlValue is an OCTET STRING wrapping the BER-encoded
+ * version of the following SEQUENCE:
+ *
+ * realSearchControlValue ::= SEQUENCE {
+ * size INTEGER (0..maxInt),
+ * -- requested page size from client
+ * -- result set size estimate from server
+ * cookie OCTET STRING
+ * }
+ *
+ * </pre>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 678621 $
+ */
+public class PagedSearchControl extends AbstractMutableControlImpl
+{
+ private static final long serialVersionUID = -2356861450876343999L;
+
+ /** This class logger */
+ private static final Logger log = LoggerFactory.getLogger( PagedSearchControl.class );
+
+ /** The Paged Search Control OID */
+ public static final String CONTROL_OID = "1.2.840.113556.1.4.319";
+
+ /** The number of entries to return, or returned */
+ private int size;
+
+ /** The exchanged cookie */
+ private byte[] cookie;
+
+ /**
+ *
+ * Creates a new instance of PagedSearchControl.
+ *
+ */
+ public PagedSearchControl()
+ {
+ super();
+ setID( CONTROL_OID );
+ }
+
+
+ /**
+ * @return The requested or returned number of entries
+ */
+ public int getSize()
+ {
+ return size;
+ }
+
+
+ /**
+ * Set the number of entry requested or returned
+ *
+ * @param size The number of entries
+ */
+ public void setSize( int size )
+ {
+ this.size = size;
+ }
+
+
+ /**
+ * @return The stored cookie
+ */
+ public byte[] getCookie()
+ {
+ return cookie;
+ }
+
+
+ /**
+ * Set the cookie
+ *
+ * @param cookie The cookie to store in this control
+ */
+ public void setCookie( byte[] cookie )
+ {
+ this.cookie = cookie;
+ }
+
+
+ /**
+ * Encode the control.
+ */
+ public byte[] getEncodedValue()
+ {
+ // should call this codec or something
+ PagedSearchControlCodec pscc = new PagedSearchControlCodec();
+ pscc.setSize( size );
+ pscc.setCookie( cookie );
+
+ try
+ {
+ return pscc.encode( null ).array();
+ }
+ catch ( EncoderException e )
+ {
+ log.error( "Failed to encode paged search control", e );
+ throw new IllegalStateException( "Failed to encode control with encoder.", e );
+ }
+ }
+}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/PersistentSearchControl.java (from r696613, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/PersistentSearchControl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/PersistentSearchControl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/PersistentSearchControl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/PersistentSearchControl.java&r1=696613&r2=696857&rev=696857&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/PersistentSearchControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/PersistentSearchControl.java Thu Sep 18 16:55:47 2008
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.shared.ldap.message;
+package org.apache.directory.shared.ldap.message.control;
import org.apache.directory.shared.asn1.codec.EncoderException;
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/SubentriesControl.java (from r696613, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SubentriesControl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/SubentriesControl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/SubentriesControl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SubentriesControl.java&r1=696613&r2=696857&rev=696857&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SubentriesControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/SubentriesControl.java Thu Sep 18 16:55:47 2008
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.shared.ldap.message;
+package org.apache.directory.shared.ldap.message.control;
import org.apache.directory.shared.asn1.codec.EncoderException;