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/12/11 16:32:12 UTC

svn commit: r725712 [8/9] - in /directory: apacheds/trunk/ apacheds/trunk/all/ apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/ apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltr...

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java Thu Dec 11 07:32:04 2008
@@ -176,11 +176,11 @@
         {
             if ( node instanceof AndNode )
             {
-            	count = getConjunctionScan( (AndNode)node );
+                count = getConjunctionScan( (AndNode)node );
             }
             else if ( node instanceof OrNode )
             {
-            	count = getDisjunctionScan( (OrNode)node );
+                count = getDisjunctionScan( (OrNode)node );
             }
             else if ( node instanceof NotNode )
             {
@@ -196,7 +196,7 @@
             }
             else
             {
-            	throw new IllegalArgumentException( "Unrecognized branch node type" );
+                throw new IllegalArgumentException( "Unrecognized branch node type" );
             }
         }
 

Modified: directory/daemon/trunk/bootstrappers/src/main/java/org/apache/directory/daemon/InstallationLayout.java
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/bootstrappers/src/main/java/org/apache/directory/daemon/InstallationLayout.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/daemon/trunk/bootstrappers/src/main/java/org/apache/directory/daemon/InstallationLayout.java (original)
+++ directory/daemon/trunk/bootstrappers/src/main/java/org/apache/directory/daemon/InstallationLayout.java Thu Dec 11 07:32:04 2008
@@ -63,13 +63,13 @@
     private transient URL[] extensionJars = null;
 
 
-    public InstallationLayout(File baseDirectory)
+    public InstallationLayout( File baseDirectory )
     {
         this.baseDirectory = baseDirectory;
     }
 
 
-    public InstallationLayout(String baseDirectoryPath)
+    public InstallationLayout( String baseDirectoryPath )
     {
         this.baseDirectory = new File( baseDirectoryPath );
     }
@@ -95,9 +95,9 @@
 
     public File getVarDirectory()
     {
-        String varDir = System.getProperty(VAR_DIR);
+        String varDir = System.getProperty( VAR_DIR );
 
-        if ( varDir != null)
+        if ( varDir != null )
         {
             return new File( varDir );
         }
@@ -108,7 +108,7 @@
 
     public File getLogDirectory()
     {
-        String logDir = System.getProperty(LOG_DIR);
+        String logDir = System.getProperty( LOG_DIR );
 
         if ( logDir != null)
         {
@@ -121,9 +121,9 @@
 
     public File getRunDirectory()
     {
-        String runDir = System.getProperty(RUN_DIR);
+        String runDir = System.getProperty( RUN_DIR );
 
-        if ( runDir != null)
+        if ( runDir != null )
         {
             return new File( runDir );
         }
@@ -257,16 +257,27 @@
         if ( dirs == null )
         {
             dirs = new File[]
-                { this.getBaseDirectory(), this.getBinDirectory(), this.getLibDirectory(),
-                    this.getExtensionsDirectory(), this.getConfigurationDirectory(), this.getVarDirectory(),
-                    this.getLogDirectory(), this.getPartitionsDirectory(), this.getRunDirectory() };
+                { 
+                getBaseDirectory(), 
+                getBinDirectory(), 
+                getLibDirectory(),
+                getExtensionsDirectory(), 
+                getConfigurationDirectory(), 
+                getVarDirectory(),
+                getLogDirectory(), 
+                getPartitionsDirectory(), 
+                getRunDirectory() 
+                };
         }
 
         if ( files == null )
         {
-            // only these files are requred to be present
+            // only these files are required to be present
             files = new File[]
-                { this.getBootstrapper(), this.getBootstrapperConfigurationFile() };
+                { 
+                getBootstrapper(), 
+                getBootstrapperConfigurationFile() 
+                };
         }
     }
 
@@ -275,40 +286,40 @@
     {
         init();
 
-        for ( int ii = 0; ii < dirs.length; ii++ )
+        for ( File dir:dirs )
         {
-            if ( !dirs[ii].exists() )
+            if ( !dir.exists() )
             {
-                throw new IllegalStateException( dirs[ii] + " does not exist!" );
+                throw new IllegalStateException( dir + " does not exist!" );
             }
 
-            if ( dirs[ii].isFile() )
+            if ( dir.isFile() )
             {
-                throw new IllegalStateException( dirs[ii] + " is a file when it should be a directory." );
+                throw new IllegalStateException( dir + " is a file when it should be a directory." );
             }
 
-            if ( !dirs[ii].canWrite() )
+            if ( !dir.canWrite() )
             {
-                throw new IllegalStateException( dirs[ii] + " is write protected from the current user: "
+                throw new IllegalStateException( dir + " is write protected from the current user: "
                     + System.getProperty( "user.name" ) );
             }
         }
 
-        for ( int ii = 0; ii < files.length; ii++ )
+        for ( File file:files )
         {
-            if ( !files[ii].exists() )
+            if ( !file.exists() )
             {
-                throw new IllegalStateException( files[ii] + " does not exist!" );
+                throw new IllegalStateException( file + " does not exist!" );
             }
 
-            if ( files[ii].isDirectory() )
+            if ( file.isDirectory() )
             {
-                throw new IllegalStateException( files[ii] + " is a directory when it should be a file." );
+                throw new IllegalStateException( file + " is a directory when it should be a file." );
             }
 
-            if ( !dirs[ii].canRead() )
+            if ( !file.canRead() )
             {
-                throw new IllegalStateException( files[ii] + " is not readable by the current user: "
+                throw new IllegalStateException( file + " is not readable by the current user: "
                     + System.getProperty( "user.name" ) );
             }
         }

Modified: directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/archive/apacheds.bat
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/archive/apacheds.bat?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/archive/apacheds.bat (original)
+++ directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/archive/apacheds.bat Thu Dec 11 07:32:04 2008
@@ -1,18 +1,18 @@
-@echo off
-REM  Licensed to the Apache Software Foundation (ASF) under one
-REM  or more contributor license agreements.  See the NOTICE file
-REM  distributed with this work for additional information
-REM  regarding copyright ownership.  The ASF licenses this file
-REM  to you under the Apache License, Version 2.0 (the
-REM  "License"); you may not use this file except in compliance
-REM  with the License.  You may obtain a copy of the License at
-REM 
-REM    http://www.apache.org/licenses/LICENSE-2.0
-REM 
-REM  Unless required by applicable law or agreed to in writing,
-REM  software distributed under the License is distributed on an
-REM  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-REM  KIND, either express or implied.  See the License for the
-REM  specific language governing permissions and limitations
-REM  under the License.
-java -Dlog4j.configuration="file:conf/log4j.properties" -cp lib/antlr-2.7.7.jar;lib/apacheds-bootstrap-extract-1.5.5-SNAPSHOT.jar;lib/apacheds-bootstrap-partition-1.5.5-SNAPSHOT.jar;lib/apacheds-btree-base-1.5.5-SNAPSHOT.jar;lib/apacheds-core-1.5.5-SNAPSHOT.jar;lib/apacheds-core-avl-1.5.5-SNAPSHOT.jar;lib/apacheds-core-constants-1.5.5-SNAPSHOT.jar;lib/apacheds-core-cursor-1.5.5-SNAPSHOT.jar;lib/apacheds-core-entry-1.5.5-SNAPSHOT.jar;lib/apacheds-core-jndi-1.5.5-SNAPSHOT.jar;lib/apacheds-core-shared-1.5.5-SNAPSHOT.jar;lib/apacheds-jdbm-1.5.5-SNAPSHOT.jar;lib/apacheds-jdbm-store-1.5.5-SNAPSHOT.jar;lib/apacheds-kerberos-shared-1.5.5-SNAPSHOT.jar;lib/apacheds-noarch-installer-1.5.5-SNAPSHOT.jar;lib/apacheds-protocol-changepw-1.5.5-SNAPSHOT.jar;lib/apacheds-protocol-dhcp-1.5.5-SNAPSHOT.jar;lib/apacheds-protocol-dns-1.5.5-SNAPSHOT.jar;lib/apacheds-protocol-kerberos-1.5.5-SNAPSHOT.jar;lib/apacheds-protocol-ldap-1.5.5-SNAPSHOT.jar;lib/apacheds-protocol-ntp-1.5.5-SNAPSHOT.jar;lib/apa
 cheds-protocol-shared-1.5.5-SNAPSHOT.jar;lib/apacheds-schema-bootstrap-1.5.5-SNAPSHOT.jar;lib/apacheds-schema-extras-1.5.5-SNAPSHOT.jar;lib/apacheds-schema-registries-1.5.5-SNAPSHOT.jar;lib/apacheds-server-jndi-1.5.5-SNAPSHOT.jar;lib/apacheds-server-xml-1.5.5-SNAPSHOT.jar;lib/apacheds-utils-1.5.5-SNAPSHOT.jar;lib/apacheds-xbean-spring-1.5.5-SNAPSHOT.jar;lib/apacheds-xdbm-search-1.5.5-SNAPSHOT.jar;lib/apacheds-xdbm-tools-1.5.5-SNAPSHOT.jar;lib/bootstrapper.jar;lib/commons-cli-1.1.jar;lib/commons-collections-3.2.1.jar;lib/commons-daemon-1.0.1.jar;lib/commons-io-1.4.jar;lib/commons-lang-2.4.jar;lib/jcl-over-slf4j-1.4.3.jar;lib/log4j-1.2.14.jar;lib/mina-core-1.1.7.jar;lib/mina-filter-ssl-1.1.7.jar;lib/shared-asn1-0.9.14-SNAPSHOT.jar;lib/shared-asn1-codec-0.9.14-SNAPSHOT.jar;lib/shared-bouncycastle-reduced-0.9.14-SNAPSHOT.jar;lib/shared-ldap-0.9.14-SNAPSHOT.jar;lib/shared-ldap-constants-0.9.14-SNAPSHOT.jar;lib/slf4j-api-1.5.2.jar;lib/slf4j-log4j12-1.5.2.jar;lib/spring-beans-2.5.5
 .jar;lib/spring-context-2.5.5.jar;lib/spring-core-2.5.5.jar;lib/xbean-spring-3.4.3.jar org.apache.directory.server.UberjarMain conf\server.xml
+@echo off
+REM  Licensed to the Apache Software Foundation (ASF) under one
+REM  or more contributor license agreements.  See the NOTICE file
+REM  distributed with this work for additional information
+REM  regarding copyright ownership.  The ASF licenses this file
+REM  to you under the Apache License, Version 2.0 (the
+REM  "License"); you may not use this file except in compliance
+REM  with the License.  You may obtain a copy of the License at
+REM 
+REM    http://www.apache.org/licenses/LICENSE-2.0
+REM 
+REM  Unless required by applicable law or agreed to in writing,
+REM  software distributed under the License is distributed on an
+REM  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+REM  KIND, either express or implied.  See the License for the
+REM  specific language governing permissions and limitations
+REM  under the License.
+java -Dlog4j.configuration="file:conf/log4j.properties" -cp lib/antlr-2.7.7.jar;lib/apacheds-bootstrap-extract-1.5.5-SNAPSHOT.jar;lib/apacheds-bootstrap-partition-1.5.5-SNAPSHOT.jar;lib/apacheds-btree-base-1.5.5-SNAPSHOT.jar;lib/apacheds-core-1.5.5-SNAPSHOT.jar;lib/apacheds-core-avl-1.5.5-SNAPSHOT.jar;lib/apacheds-core-constants-1.5.5-SNAPSHOT.jar;lib/apacheds-core-cursor-1.5.5-SNAPSHOT.jar;lib/apacheds-core-entry-1.5.5-SNAPSHOT.jar;lib/apacheds-core-jndi-1.5.5-SNAPSHOT.jar;lib/apacheds-core-shared-1.5.5-SNAPSHOT.jar;lib/apacheds-jdbm-1.5.5-SNAPSHOT.jar;lib/apacheds-jdbm-store-1.5.5-SNAPSHOT.jar;lib/apacheds-kerberos-shared-1.5.5-SNAPSHOT.jar;lib/apacheds-noarch-installer-1.5.5-SNAPSHOT.jar;lib/apacheds-protocol-changepw-1.5.5-SNAPSHOT.jar;lib/apacheds-protocol-dhcp-1.5.5-SNAPSHOT.jar;lib/apacheds-protocol-dns-1.5.5-SNAPSHOT.jar;lib/apacheds-protocol-kerberos-1.5.5-SNAPSHOT.jar;lib/apacheds-protocol-ldap-1.5.5-SNAPSHOT.jar;lib/apacheds-protocol-ntp-1.5.5-SNAPSHOT.jar;lib/apa
 cheds-protocol-shared-1.5.5-SNAPSHOT.jar;lib/apacheds-schema-bootstrap-1.5.5-SNAPSHOT.jar;lib/apacheds-schema-extras-1.5.5-SNAPSHOT.jar;lib/apacheds-schema-registries-1.5.5-SNAPSHOT.jar;lib/apacheds-server-jndi-1.5.5-SNAPSHOT.jar;lib/apacheds-server-xml-1.5.5-SNAPSHOT.jar;lib/apacheds-utils-1.5.5-SNAPSHOT.jar;lib/apacheds-xbean-spring-1.5.5-SNAPSHOT.jar;lib/apacheds-xdbm-search-1.5.5-SNAPSHOT.jar;lib/apacheds-xdbm-tools-1.5.5-SNAPSHOT.jar;lib/bootstrapper.jar;lib/commons-cli-1.1.jar;lib/commons-collections-3.2.1.jar;lib/commons-daemon-1.0.1.jar;lib/commons-io-1.4.jar;lib/commons-lang-2.4.jar;lib/jcl-over-slf4j-1.4.3.jar;lib/log4j-1.2.14.jar;lib/mina-core-2.0.0-M4-SNAPSHOT.jar;lib/shared-asn1-0.9.14-SNAPSHOT.jar;lib/shared-asn1-codec-0.9.14-SNAPSHOT.jar;lib/shared-bouncycastle-reduced-0.9.14-SNAPSHOT.jar;lib/shared-ldap-0.9.14-SNAPSHOT.jar;lib/shared-ldap-constants-0.9.14-SNAPSHOT.jar;lib/slf4j-api-1.5.2.jar;lib/slf4j-log4j12-1.5.2.jar;lib/spring-beans-2.5.5.jar;lib/spring-co
 ntext-2.5.5.jar;lib/spring-core-2.5.5.jar;lib/xbean-spring-3.4.3.jar org.apache.directory.server.UberjarMain conf\server.xml

Modified: directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/archive/apacheds.sh
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/archive/apacheds.sh?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/archive/apacheds.sh (original)
+++ directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/archive/apacheds.sh Thu Dec 11 07:32:04 2008
@@ -17,4 +17,4 @@
 #  specific language governing permissions and limitations
 #  under the License.
 #
-java -Dlog4j.configuration=file:conf/log4j.properties -cp lib/antlr-2.7.7.jar:lib/apacheds-bootstrap-extract-1.5.5-SNAPSHOT.jar:lib/apacheds-bootstrap-partition-1.5.5-SNAPSHOT.jar:lib/apacheds-btree-base-1.5.5-SNAPSHOT.jar:lib/apacheds-core-1.5.5-SNAPSHOT.jar:lib/apacheds-core-avl-1.5.5-SNAPSHOT.jar:lib/apacheds-core-constants-1.5.5-SNAPSHOT.jar:lib/apacheds-core-cursor-1.5.5-SNAPSHOT.jar:lib/apacheds-core-entry-1.5.5-SNAPSHOT.jar:lib/apacheds-core-jndi-1.5.5-SNAPSHOT.jar:lib/apacheds-core-shared-1.5.5-SNAPSHOT.jar:lib/apacheds-jdbm-1.5.5-SNAPSHOT.jar:lib/apacheds-jdbm-store-1.5.5-SNAPSHOT.jar:lib/apacheds-kerberos-shared-1.5.5-SNAPSHOT.jar:lib/apacheds-noarch-installer-1.5.5-SNAPSHOT.jar:lib/apacheds-protocol-changepw-1.5.5-SNAPSHOT.jar:lib/apacheds-protocol-dhcp-1.5.5-SNAPSHOT.jar:lib/apacheds-protocol-dns-1.5.5-SNAPSHOT.jar:lib/apacheds-protocol-kerberos-1.5.5-SNAPSHOT.jar:lib/apacheds-protocol-ldap-1.5.5-SNAPSHOT.jar:lib/apacheds-protocol-ntp-1.5.5-SNAPSHOT.jar:lib/apach
 eds-protocol-shared-1.5.5-SNAPSHOT.jar:lib/apacheds-schema-bootstrap-1.5.5-SNAPSHOT.jar:lib/apacheds-schema-extras-1.5.5-SNAPSHOT.jar:lib/apacheds-schema-registries-1.5.5-SNAPSHOT.jar:lib/apacheds-server-jndi-1.5.5-SNAPSHOT.jar:lib/apacheds-server-xml-1.5.5-SNAPSHOT.jar:lib/apacheds-utils-1.5.5-SNAPSHOT.jar:lib/apacheds-xbean-spring-1.5.5-SNAPSHOT.jar:lib/apacheds-xdbm-search-1.5.5-SNAPSHOT.jar:lib/apacheds-xdbm-tools-1.5.5-SNAPSHOT.jar:lib/bootstrapper.jar:lib/commons-cli-1.1.jar:lib/commons-collections-3.2.1.jar:lib/commons-daemon-1.0.1.jar:lib/commons-io-1.4.jar:lib/commons-lang-2.4.jar:lib/jcl-over-slf4j-1.5.2.jar:lib/log4j-1.2.14.jar:lib/mina-core-1.1.7.jar:lib/mina-filter-ssl-1.1.7.jar:lib/shared-asn1-0.9.14-SNAPSHOT.jar:lib/shared-asn1-codec-0.9.14-SNAPSHOT.jar:lib/shared-bouncycastle-reduced-0.9.14-SNAPSHOT.jar:lib/shared-ldap-0.9.14-SNAPSHOT.jar:lib/shared-ldap-constants-0.9.14-SNAPSHOT.jar:lib/slf4j-api-1.5.2.jar:lib/slf4j-log4j12-1.5.2.jar:lib/spring-beans-2.5.5.j
 ar:lib/spring-context-2.5.5.jar:lib/spring-core-2.5.5.jar:lib/xbean-spring-3.4.3.jar org.apache.directory.server.UberjarMain conf/server.xml
+java -Dlog4j.configuration=file:conf/log4j.properties -cp lib/antlr-2.7.7.jar:lib/apacheds-bootstrap-extract-1.5.5-SNAPSHOT.jar:lib/apacheds-bootstrap-partition-1.5.5-SNAPSHOT.jar:lib/apacheds-btree-base-1.5.5-SNAPSHOT.jar:lib/apacheds-core-1.5.5-SNAPSHOT.jar:lib/apacheds-core-avl-1.5.5-SNAPSHOT.jar:lib/apacheds-core-constants-1.5.5-SNAPSHOT.jar:lib/apacheds-core-cursor-1.5.5-SNAPSHOT.jar:lib/apacheds-core-entry-1.5.5-SNAPSHOT.jar:lib/apacheds-core-jndi-1.5.5-SNAPSHOT.jar:lib/apacheds-core-shared-1.5.5-SNAPSHOT.jar:lib/apacheds-jdbm-1.5.5-SNAPSHOT.jar:lib/apacheds-jdbm-store-1.5.5-SNAPSHOT.jar:lib/apacheds-kerberos-shared-1.5.5-SNAPSHOT.jar:lib/apacheds-noarch-installer-1.5.5-SNAPSHOT.jar:lib/apacheds-protocol-changepw-1.5.5-SNAPSHOT.jar:lib/apacheds-protocol-dhcp-1.5.5-SNAPSHOT.jar:lib/apacheds-protocol-dns-1.5.5-SNAPSHOT.jar:lib/apacheds-protocol-kerberos-1.5.5-SNAPSHOT.jar:lib/apacheds-protocol-ldap-1.5.5-SNAPSHOT.jar:lib/apacheds-protocol-ntp-1.5.5-SNAPSHOT.jar:lib/apach
 eds-protocol-shared-1.5.5-SNAPSHOT.jar:lib/apacheds-schema-bootstrap-1.5.5-SNAPSHOT.jar:lib/apacheds-schema-extras-1.5.5-SNAPSHOT.jar:lib/apacheds-schema-registries-1.5.5-SNAPSHOT.jar:lib/apacheds-server-jndi-1.5.5-SNAPSHOT.jar:lib/apacheds-server-xml-1.5.5-SNAPSHOT.jar:lib/apacheds-utils-1.5.5-SNAPSHOT.jar:lib/apacheds-xbean-spring-1.5.5-SNAPSHOT.jar:lib/apacheds-xdbm-search-1.5.5-SNAPSHOT.jar:lib/apacheds-xdbm-tools-1.5.5-SNAPSHOT.jar:lib/bootstrapper.jar:lib/commons-cli-1.1.jar:lib/commons-collections-3.2.1.jar:lib/commons-daemon-1.0.1.jar:lib/commons-io-1.4.jar:lib/commons-lang-2.4.jar:lib/jcl-over-slf4j-1.5.2.jar:lib/log4j-1.2.14.jar:lib/mina-core-2.0.0-M4-SNAPSHOT.jar:lib/shared-asn1-0.9.14-SNAPSHOT.jar:lib/shared-asn1-codec-0.9.14-SNAPSHOT.jar:lib/shared-bouncycastle-reduced-0.9.14-SNAPSHOT.jar:lib/shared-ldap-0.9.14-SNAPSHOT.jar:lib/shared-ldap-constants-0.9.14-SNAPSHOT.jar:lib/slf4j-api-1.5.2.jar:lib/slf4j-log4j12-1.5.2.jar:lib/spring-beans-2.5.5.jar:lib/spring-cont
 ext-2.5.5.jar:lib/spring-core-2.5.5.jar:lib/xbean-spring-3.4.3.jar org.apache.directory.server.UberjarMain conf/server.xml

Modified: directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/solarispkg/Prototype
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/solarispkg/Prototype?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/solarispkg/Prototype (original)
+++ directory/daemon/trunk/plugin/src/main/resources/org/apache/directory/daemon/installers/solarispkg/Prototype Thu Dec 11 07:32:04 2008
@@ -51,8 +51,7 @@
 f none /opt/apacheds/lib/jcl-over-slf4j-1.5.2.jar 0644 apacheds apacheds
 f none /opt/apacheds/lib/libwrapper.so 0644 apacheds apacheds
 f none /opt/apacheds/lib/log4j-1.2.14.jar 0644 apacheds apacheds
-f none /opt/apacheds/lib/mina-core-1.1.7.jar 0644 apacheds apacheds
-f none /opt/apacheds/lib/mina-filter-ssl-1.1.7.jar 0644 apacheds apacheds
+f none /opt/apacheds/lib/mina-core-2.0.0-M4-SNAPSHOT.jar 0644 apacheds apacheds
 f none /opt/apacheds/lib/shared-asn1-0.9.14-SNAPSHOT.jar 0644 apacheds apacheds
 f none /opt/apacheds/lib/shared-asn1-codec-0.9.14-SNAPSHOT.jar 0644 apacheds apacheds
 f none /opt/apacheds/lib/shared-bouncycastle-reduced-0.9.14-SNAPSHOT.jar 0644 apacheds apacheds

Modified: directory/installers/trunk/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java
URL: http://svn.apache.org/viewvc/directory/installers/trunk/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/installers/trunk/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java (original)
+++ directory/installers/trunk/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java Thu Dec 11 07:32:04 2008
@@ -27,8 +27,12 @@
 import org.apache.directory.server.configuration.ApacheDS;
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.dns.DnsServer;
+import org.apache.directory.server.kerberos.kdc.KdcServer;
 import org.apache.directory.server.ldap.LdapService;
-import org.apache.directory.server.protocol.shared.SocketAcceptor;
+import org.apache.directory.server.ntp.NtpServer;
+import org.apache.mina.transport.socket.SocketAcceptor;
+import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
 import org.apache.xbean.spring.context.FileSystemXmlApplicationContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -45,13 +49,53 @@
     private static final Logger LOG = LoggerFactory.getLogger( Service.class );
     private Thread workerThread;
     private SynchWorker worker = new SynchWorker();
+    
+    /** The LDAP server instance */ 
     private ApacheDS apacheDS;
+    
+    /** The NTP server instance */
+    private NtpServer ntpServer;
+    
+    /** The DNS server instance */
+    private DnsServer dnsServer;
+    
+    /** The Kerberos server instance */
+    private KdcServer kdcServer;
+    
     private FileSystemXmlApplicationContext factory;
 
 
     public void init( InstallationLayout install, String[] args ) throws Exception
     {
-        printBanner();
+        // Initialize the LDAP server
+        initLdap( install, args );
+        
+        // Initialize the NTP server
+        initNtp( install, args );
+        
+        // Initialize the DNS server (Not ready yet)
+        // initDns( install, args );
+        
+        // Initialize the DHCP server (Not ready yet)
+        //initDhcp( install, args );
+        
+        // Initialize the ChangePwd server (Not ready yet)
+        //initChangePwd( install, args );
+        
+        // Initialize the Kerberos server
+        initKerberos( install, args );
+    }
+    
+    
+    /**
+     * Initialize the LDAP server
+     */
+    private void initLdap( InstallationLayout install, String[] args ) throws Exception
+    {
+        System.out.println( "Starting the LDAP server" );
+        LOG.info( "Starting the LDAP server" );
+        
+        printBannerLDAP();
         long startTime = System.currentTimeMillis();
 
         if ( args.length > 0 && new File( args[0] ).exists() ) // hack that takes server.xml file argument
@@ -65,7 +109,7 @@
             LOG.info( "server: using default settings ..." );
             DirectoryService directoryService = new DefaultDirectoryService();
             directoryService.startup();
-            SocketAcceptor socketAcceptor = new SocketAcceptor( null );
+            SocketAcceptor socketAcceptor = new NioSocketAcceptor();
             LdapService ldapService = new LdapService();
             ldapService.setSocketAcceptor( socketAcceptor );
             ldapService.setDirectoryService( directoryService );
@@ -92,9 +136,120 @@
         
         if ( LOG.isInfoEnabled() )
         {
-            LOG.info( "server: started in {} milliseconds", ( System.currentTimeMillis() - startTime ) + "" );
+            LOG.info( "LDAP server: started in {} milliseconds", ( System.currentTimeMillis() - startTime ) + "" );
+        }
+
+        System.out.println( "LDAP server started" );
+    }
+
+    
+    /**
+     * Initialize the NTP server
+     */
+    private void initNtp( InstallationLayout install, String[] args ) throws Exception
+    {
+        if ( factory == null )
+        {
+            return;
+        }
+
+        try
+        {
+            ntpServer = ( NtpServer ) factory.getBean( "ntpServer" );
+        }
+        catch ( Exception e )
+        {
+            LOG.info( "Cannot find any reference to the NTP Server in the server.xml file : the server won't be started" );
+            return;
+        }
+        
+        System.out.println( "Starting the NTP server" );
+        LOG.info( "Starting the NTP server" );
+        
+        printBannerNTP();
+        long startTime = System.currentTimeMillis();
+
+        ntpServer.start();
+        System.out.println( "NTP Server started" );
+
+        if ( LOG.isInfoEnabled() )
+        {
+            LOG.info( "NTP server: started in {} milliseconds", ( System.currentTimeMillis() - startTime ) + "" );
+        }
+    }
+
+
+    /**
+     * Initialize the DNS server
+     */
+    private void initDns( InstallationLayout install, String[] args ) throws Exception
+    {
+        if ( factory == null )
+        {
+            return;
+        }
+
+        try
+        {
+            dnsServer = ( DnsServer ) factory.getBean( "dnsServer" );
+        }
+        catch ( Exception e )
+        {
+            LOG.info( "Cannot find any reference to the DNS Server in the server.xml file : the server won't be started" );
+            return;
+        }
+        
+        System.out.println( "Starting the DNS server" );
+        LOG.info( "Starting the DNS server" );
+        
+        printBannerDNS();
+        long startTime = System.currentTimeMillis();
+
+        dnsServer.start();
+        System.out.println( "DNS Server started" );
+
+        if ( LOG.isInfoEnabled() )
+        {
+            LOG.info( "DNS server: started in {} milliseconds", ( System.currentTimeMillis() - startTime ) + "" );
+        }
+    }
+
+
+    /**
+     * Initialize the KERBEROS server
+     */
+    private void initKerberos( InstallationLayout install, String[] args ) throws Exception
+    {
+        if ( factory == null )
+        {
+            return;
+        }
+
+        try
+        {
+            kdcServer = ( KdcServer ) factory.getBean( "kdcServer" );
+        }
+        catch ( Exception e )
+        {
+            LOG.info( "Cannot find any reference to the Kerberos Server in the server.xml file : the server won't be started" );
+            return;
+        }
+        
+        System.out.println( "Starting the Kerberos server" );
+        LOG.info( "Starting the Kerberos server" );
+        
+        printBannerKERBEROS();
+        long startTime = System.currentTimeMillis();
+
+        kdcServer.start();
+
+        System.out.println( "Kerberos server started" );
+        if ( LOG.isInfoEnabled() )
+        {
+            LOG.info( "Kerberos server: started in {} milliseconds", ( System.currentTimeMillis() - startTime ) + "" );
         }
     }
+    
 
     public DirectoryService getDirectoryService() {
         return apacheDS.getDirectoryService();
@@ -180,16 +335,74 @@
         }
     }
 
-    public static final String BANNER = "           _                     _          ____  ____   \n"
-        + "          / \\   _ __   __ _  ___| |__   ___|  _ \\/ ___|  \n"
-        + "         / _ \\ | '_ \\ / _` |/ __| '_ \\ / _ \\ | | \\___ \\   \n"
-        + "        / ___ \\| |_) | (_| | (__| | | |  __/ |_| |___) |  \n"
-        + "       /_/   \\_\\ .__/ \\__,_|\\___|_| |_|\\___|____/|____/   \n"
-        + "               |_|                                                               \n";
+    public static final String BANNER_LDAP = 
+          "           _                     _          ____  ____   \n"
+        + "          / \\   _ __    ___  ___| |__   ___|  _ \\/ ___|  \n"
+        + "         / _ \\ | '_ \\ / _` |/ __| '_ \\ / _ \\ | | \\___ \\  \n"
+        + "        / ___ \\| |_) | (_| | (__| | | |  __/ |_| |___) | \n"
+        + "       /_/   \\_\\ .__/ \\__,_|\\___|_| |_|\\___|____/|____/  \n"
+        + "               |_|                                       \n";
+
+
+    public static final String BANNER_NTP =
+          "           _                     _          _   _ _____ _ __    \n"
+        + "          / \\   _ __    ___  ___| |__   ___| \\ | |_  __| '_ \\   \n"
+        + "         / _ \\ | '_ \\ / _` |/ __| '_ \\ / _ \\ .\\| | | | | |_) |  \n"
+        + "        / ___ \\| |_) | (_| | (__| | | |  __/ |\\  | | | | .__/   \n"
+        + "       /_/   \\_\\ .__/ \\__,_|\\___|_| |_|\\___|_| \\_| |_| |_|      \n"
+        + "               |_|                                              \n";
+
+
+    public static final String BANNER_KERBEROS = 
+          "           _                     _          _  __ ____   ___    \n"
+        + "          / \\   _ __    ___  ___| |__   ___| |/ /|  _ \\ / __|   \n"
+        + "         / _ \\ | '_ \\ / _` |/ __| '_ \\ / _ \\ ' / | | | / /      \n"
+        + "        / ___ \\| |_) | (_| | (__| | | |  __/ . \\ | |_| \\ \\__    \n"
+        + "       /_/   \\_\\ .__/ \\__,_|\\___|_| |_|\\___|_|\\_\\|____/ \\___|   \n"
+        + "               |_|                                              \n";
+
+
+    public static final String BANNER_DNS =
+          "           _                     _          ____  _   _ ____    \n"
+        + "          / \\   _ __    ___  ___| |__   ___|  _ \\| \\ | / ___|   \n"
+        + "         / _ \\ | '_ \\ / _` |/ __| '_ \\ / _ \\ | | |  \\| \\__  \\   \n"
+        + "        / ___ \\| |_) | (_| | (__| | | |  __/ |_| | . ' |___) |  \n"
+        + "       /_/   \\_\\ .__/ \\__,_|\\___|_| |_|\\___|____/|_|\\__|____/   \n"
+        + "               |_|                                              \n";
+
+
+    /**
+     * Print the LDAP banner
+     */
+    public static void printBannerLDAP()
+    {
+        System.out.println( BANNER_LDAP );
+    }
+
+
+    /**
+     * Print the NTP banner
+     */
+    public static void printBannerNTP()
+    {
+        System.out.println( BANNER_NTP );
+    }
+
+
+    /**
+     * Print the Kerberos banner
+     */
+    public static void printBannerKERBEROS()
+    {
+        System.out.println( BANNER_KERBEROS );
+    }
 
 
-    public static void printBanner()
+    /**
+     * Print the DNS banner
+     */
+    public static void printBannerDNS()
     {
-        System.out.println( BANNER );
+        System.out.println( BANNER_DNS );
     }
 }

Modified: directory/installers/trunk/pom.xml
URL: http://svn.apache.org/viewvc/directory/installers/trunk/pom.xml?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/installers/trunk/pom.xml (original)
+++ directory/installers/trunk/pom.xml Thu Dec 11 07:32:04 2008
@@ -154,13 +154,7 @@
       <dependency>
         <groupId>org.apache.mina</groupId>
         <artifactId>mina-core</artifactId>
-        <version>1.1.7</version>
-      </dependency>
-
-      <dependency>
-        <groupId>org.apache.mina</groupId>
-        <artifactId>mina-filter-ssl</artifactId>
-        <version>1.1.7</version>
+        <version>2.0.0-M4-SNAPSHOT</version>
       </dependency>
 
       <dependency>

Modified: directory/shared/trunk/asn1-codec/src/main/java/org/apache/directory/shared/asn1/codec/Asn1CodecDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1-codec/src/main/java/org/apache/directory/shared/asn1/codec/Asn1CodecDecoder.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/asn1-codec/src/main/java/org/apache/directory/shared/asn1/codec/Asn1CodecDecoder.java (original)
+++ directory/shared/trunk/asn1-codec/src/main/java/org/apache/directory/shared/asn1/codec/Asn1CodecDecoder.java Thu Dec 11 07:32:04 2008
@@ -22,8 +22,8 @@
 
 import org.apache.directory.shared.asn1.codec.stateful.DecoderCallback;
 import org.apache.directory.shared.asn1.codec.stateful.StatefulDecoder;
-import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.IoSession;
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
 import org.apache.mina.filter.codec.ProtocolDecoderAdapter;
 import org.apache.mina.filter.codec.ProtocolDecoderOutput;
 
@@ -47,7 +47,7 @@
     }
 
 
-    public void decode( IoSession session, ByteBuffer in, ProtocolDecoderOutput out ) throws DecoderException
+    public void decode( IoSession session, IoBuffer in, ProtocolDecoderOutput out ) throws DecoderException
     {
         callback.decOut = out;
         decoder.decode( in.buf() );

Modified: directory/shared/trunk/asn1-codec/src/main/java/org/apache/directory/shared/asn1/codec/Asn1CodecEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1-codec/src/main/java/org/apache/directory/shared/asn1/codec/Asn1CodecEncoder.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/asn1-codec/src/main/java/org/apache/directory/shared/asn1/codec/Asn1CodecEncoder.java (original)
+++ directory/shared/trunk/asn1-codec/src/main/java/org/apache/directory/shared/asn1/codec/Asn1CodecEncoder.java Thu Dec 11 07:32:04 2008
@@ -26,8 +26,8 @@
 
 import org.apache.directory.shared.asn1.codec.stateful.EncoderCallback;
 import org.apache.directory.shared.asn1.codec.stateful.StatefulEncoder;
-import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.IoSession;
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
 import org.apache.mina.filter.codec.ProtocolEncoder;
 import org.apache.mina.filter.codec.ProtocolEncoderOutput;
 
@@ -73,8 +73,7 @@
             if( encoded instanceof java.nio.ByteBuffer )
             {
                 java.nio.ByteBuffer buf = ( java.nio.ByteBuffer ) encoded;
-                ByteBuffer wrappedBuf = ByteBuffer.wrap( buf );
-                wrappedBuf.acquire();  // acquire once more to prvent leak
+                IoBuffer wrappedBuf = IoBuffer.wrap( buf );
                 encOut.write( wrappedBuf );
             }
             else if( encoded instanceof Object[] )

Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java Thu Dec 11 07:32:04 2008
@@ -63,6 +63,12 @@
     /** The grammar end transition flag */
     protected boolean grammarEndAllowed;
 
+    /** A counter for the decoded bytes */
+    protected int decodeBytes;
+
+    /** The maximum allowed size for a PDU. Default to MAX int value */
+    protected int maxPDUSize = Integer.MAX_VALUE;
+
     /** The incremental id used to tag TLVs */
     private int id = 0;
     
@@ -229,4 +235,52 @@
     {
         return tlv.getId();
     }
+
+
+    /**
+     * @return The number of decoded bytes for this message. This is used
+     * to control the PDU size and avoid PDU exceeding the maximum allowed
+     * size to break the server.
+     */
+    public int getDecodeBytes()
+    {
+        return decodeBytes;
+    }
+
+
+    /**
+     * Increment the decodedBytes by the latest received buffer's size.
+     * @param nb The buffer size.
+     */
+    public void incrementDecodeBytes( int nb )
+    {
+        decodeBytes += nb;
+    }
+    
+    
+    /**
+     * @return The maximum PDU size.
+     */
+    public int getMaxPDUSize()
+    {
+        return maxPDUSize;
+    }
+    
+    
+    /**
+     * Set the maximum PDU size.
+     * @param maxPDUSize The maximum PDU size (if negative or null, will be
+     * replaced by the max integer value)
+     */
+    public void setMaxPDUSize( int maxPDUSize )
+    {
+        if ( maxPDUSize > 0 )
+        {
+            this.maxPDUSize = maxPDUSize;
+        }
+        else
+        {
+            this.maxPDUSize = Integer.MAX_VALUE;
+        }
+    }
 }

Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java Thu Dec 11 07:32:04 2008
@@ -47,10 +47,10 @@
     // -----------------------------------------------------------------
 
     /** The logger */
-    private static final Logger log = LoggerFactory.getLogger( Asn1Decoder.class );
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.class );
     
     /** A speedup for logger */
-    private static final boolean IS_DEBUG = log.isDebugEnabled();
+    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
     
     /** This flag is used to indicate that there are more bytes in the stream */
     private static final boolean MORE = true;
@@ -120,7 +120,7 @@
             if ( IS_DEBUG )
             {
                 byte tag = container.getCurrentTLV().getTag();
-                log.debug( "Tag {} has been decoded", Asn1StringUtils.dumpByte( tag ) );
+                LOG.debug( "Tag {} has been decoded", Asn1StringUtils.dumpByte( tag ) );
             }
 
             return MORE;
@@ -157,7 +157,7 @@
 
         if ( IS_DEBUG ) 
         {
-            log.debug( "TLV Tree : {}", sb.toString() );
+            LOG.debug( "TLV Tree : {}", sb.toString() );
         }
     }
 
@@ -232,7 +232,7 @@
 
                 if ( expectedLength > 4 )
                 {
-                    log.error( "Overflow : can't have more than 4 bytes long length" );
+                    LOG.error( "Overflow : can't have more than 4 bytes long length" );
                     throw new DecoderException( "Overflow : can't have more than 4 bytes long length" );
                 }
 
@@ -243,7 +243,7 @@
             }
             else
             {
-                log.error( "Length reserved extension used" );
+                LOG.error( "Length reserved extension used" );
                 throw new DecoderException( "Length reserved extension used" );
             }
 
@@ -282,7 +282,7 @@
 
                 if ( IS_DEBUG )
                 {
-                    log.debug( "  current byte : {}", Asn1StringUtils.dumpByte( octet ) );
+                    LOG.debug( "  current byte : {}", Asn1StringUtils.dumpByte( octet ) );
                 }
 
                 tlv.incLengthBytesRead();
@@ -362,7 +362,7 @@
         
         if ( tlv == null )
         {
-            log.error( "The current container TLV is null." );
+            LOG.error( "The current container TLV is null." );
             throw new DecoderException( "Current TLV is null" );
         }
         
@@ -375,7 +375,7 @@
 
         if ( IS_DEBUG )
         {
-            log.debug( "Parent length : {}", getParentLength( parentTLV ) );
+            LOG.debug( "Parent length : {}", getParentLength( parentTLV ) );
         }
 
         if ( parentTLV == null )
@@ -387,7 +387,7 @@
 
             if ( IS_DEBUG )
             {
-                log.debug( "Root TLV[{}]", Integer.valueOf( length ) );
+                LOG.debug( "Root TLV[{}]", Integer.valueOf( length ) );
             }
         }
         else
@@ -401,7 +401,7 @@
             {
                 // The expected length is lower than the Value length of the
                 // current TLV. This is an error...
-                log.error( "tlv[{}, {}]", Integer.valueOf( expectedLength ), Integer.valueOf( currentLength ) );
+                LOG.error( "tlv[{}, {}]", Integer.valueOf( expectedLength ), Integer.valueOf( currentLength ) );
                 throw new DecoderException( "The current Value length is above the expected length" );
             }
 
@@ -494,7 +494,7 @@
 
         if ( IS_DEBUG )
         {
-            log.debug( "Length {} has been decoded", Integer.valueOf( length ) );
+            LOG.debug( "Length {} has been decoded", Integer.valueOf( length ) );
         }
 
         if ( length == 0 )
@@ -636,7 +636,7 @@
                 }
                 else
                 {
-                    log.error( "The PDU is decoded, but we should have had more TLVs" );
+                    LOG.error( "The PDU is decoded, but we should have had more TLVs" );
                     throw new DecoderException( "Truncated PDU. Some elements are lacking, accordingly to the grammar" );
                 }
             }
@@ -724,12 +724,23 @@
          */
 
         boolean hasRemaining = stream.hasRemaining();
+        
+        // Increment the PDU size counter.
+        container.incrementDecodeBytes( stream.remaining() );
+        
+        if ( container.getDecodeBytes() > container.getMaxPDUSize() )
+        {
+            String message = "The PDU current size (" + container.getDecodeBytes() +
+            ") exceeds the maximum allowed PDU size (" + container.getMaxPDUSize() +")";
+            LOG.error( message );
+            throw new DecoderException( message );
+        }
 
         if ( IS_DEBUG )
         {
-            log.debug( ">>>==========================================" );
-            log.debug( "--> Decoding a PDU" );
-            log.debug( ">>>------------------------------------------" );
+            LOG.debug( ">>>==========================================" );
+            LOG.debug( "--> Decoding a PDU" );
+            LOG.debug( ">>>------------------------------------------" );
         }
 
         while ( hasRemaining )
@@ -737,17 +748,17 @@
 
             if ( IS_DEBUG )
             {
-                log.debug( "--- State = {} ---", stateToString( container.getState() ) );
+                LOG.debug( "--- State = {} ---", stateToString( container.getState() ) );
 
                 if ( stream.hasRemaining() )
                 {
                     byte octet = stream.get( stream.position() );
 
-                    log.debug( "  current byte : {}", Asn1StringUtils.dumpByte( octet ) );
+                    LOG.debug( "  current byte : {}", Asn1StringUtils.dumpByte( octet ) );
                 }
                 else
                 {
-                    log.debug( "  no more byte to decode in the stream" );
+                    LOG.debug( "  no more byte to decode in the stream" );
                 }
             }
 
@@ -800,7 +811,7 @@
                 case TLVStateEnum.PDU_DECODED:
                     // We have to deal with the case where there are
                     // more bytes in the buffer, but the PDU has been decoded.
-                    log.warn( "The PDU has been fully decoded but there are still bytes in the buffer." );
+                    LOG.warn( "The PDU has been fully decoded but there are still bytes in the buffer." );
 
                     hasRemaining = false;
 
@@ -813,32 +824,32 @@
 
         if ( IS_DEBUG )
         {
-            log.debug( "<<<------------------------------------------" );
+            LOG.debug( "<<<------------------------------------------" );
 
             if ( container.getState() == TLVStateEnum.PDU_DECODED )
             {
                 if ( container.getCurrentTLV() != null )
                 {
-                    log.debug( "<-- Stop decoding : {}", container.getCurrentTLV().toString() );
+                    LOG.debug( "<-- Stop decoding : {}", container.getCurrentTLV().toString() );
                 }
                 else
                 {
-                    log.debug( "<-- Stop decoding : null current TLV" );
+                    LOG.debug( "<-- Stop decoding : null current TLV" );
                 }
             }
             else
             {
                 if ( container.getCurrentTLV() != null )
                 {
-                    log.debug( "<-- End decoding : {}", container.getCurrentTLV().toString() );
+                    LOG.debug( "<-- End decoding : {}", container.getCurrentTLV().toString() );
                 }
                 else
                 {
-                    log.debug( "<-- End decoding : null current TLV" );
+                    LOG.debug( "<-- End decoding : null current TLV" );
                 }
             }
 
-            log.debug( "<<<==========================================" );
+            LOG.debug( "<<<==========================================" );
         }
 
         return;

Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/IAsn1Container.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/IAsn1Container.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/IAsn1Container.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/IAsn1Container.java Thu Dec 11 07:32:04 2008
@@ -139,4 +139,33 @@
      * @return a unique value representing the current TLV id
      */
     int getTlvId();
+    
+    
+    /**
+     * @return The number of decoded bytes for this message. This is used
+     * to control the PDU size and avoid PDU exceeding the maximum allowed
+     * size to break the server.
+     */
+    int getDecodeBytes();
+
+    
+    /**
+     * Increment the decodedBytes by the latest received buffer's size.
+     * @param nb The buffer size.
+     */
+    void incrementDecodeBytes( int nb );
+
+
+    /**
+     * @return The maximum PDU size.
+     */
+    int getMaxPDUSize();
+    
+    
+    /**
+     * Set the maximum PDU size.
+     * @param maxPDUSize The maximum PDU size (if negative or null, will be
+     * replaced by the max integer value)
+     */
+    void setMaxPDUSize( int maxPDUSize );
 }

Modified: directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/AuthenticationLevel.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/AuthenticationLevel.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/AuthenticationLevel.java (original)
+++ directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/AuthenticationLevel.java Thu Dec 11 07:32:04 2008
@@ -28,11 +28,11 @@
  */
 public enum AuthenticationLevel
 {
-	/**
-	 * Invalid authentication type
-	 */
-	INVALID(-1, "invalid" ),
-	
+    /**
+     * Invalid authentication type
+     */
+    INVALID(-1, "invalid" ),
+    
     /**
      * No authentication (anonymous access)
      */
@@ -47,10 +47,10 @@
      * Strong authentication (bound with encrypted credentials)
      */
     STRONG( 2, "strong" ),
-	
-	/**
-	 * Unauthentication, if the BIND contains a DN but no credentials
-	 */
+    
+    /**
+     * Unauthentication, if the BIND contains a DN but no credentials
+     */
     UNAUTHENT( 3, "unauthent" );
     
     private int level;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java Thu Dec 11 07:32:04 2008
@@ -114,6 +114,7 @@
         ldapMessage = null;
         messageId = 0;
         currentControl = null;
+        decodeBytes = 0;
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java Thu Dec 11 07:32:04 2008
@@ -69,12 +69,15 @@
      * 
      * @param provider the owning provider.
      * @param binaryAttributeDetector checks for binary attributes 
+     * @param maxPDUSize the maximum size a PDU can be
      */
-    public TwixDecoder( Provider provider, BinaryAttributeDetector binaryAttributeDetector )
+    public TwixDecoder( Provider provider, BinaryAttributeDetector binaryAttributeDetector, int maxPDUSize )
     {
         this.provider = provider;
-        this.ldapMessageContainer = new LdapMessageContainer( binaryAttributeDetector );
-        this.ldapDecoder = new LdapDecoder();
+        ldapMessageContainer = new LdapMessageContainer( binaryAttributeDetector );
+        ldapDecoder = new LdapDecoder();
+        
+        ldapMessageContainer.setMaxPDUSize( maxPDUSize );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixProvider.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixProvider.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixProvider.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixProvider.java Thu Dec 11 07:32:04 2008
@@ -85,8 +85,8 @@
      * @throws org.apache.directory.shared.ldap.message.spi.ProviderException
      *             if the provider or its decoder cannot be found
      */
-    public ProviderDecoder getDecoder( BinaryAttributeDetector binaryAttributeDetector ) throws ProviderException
+    public ProviderDecoder getDecoder( BinaryAttributeDetector binaryAttributeDetector, int maxPDUSize ) throws ProviderException
     {
-        return new TwixDecoder( this, binaryAttributeDetector );
+        return new TwixDecoder( this, binaryAttributeDetector, maxPDUSize );
     }
 }

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=725712&r1=725711&r2=725712&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 Dec 11 07:32:04 2008
@@ -60,6 +60,7 @@
 import org.apache.directory.shared.ldap.codec.search.SearchResultReference;
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
 import org.apache.directory.shared.ldap.codec.search.controls.PSearchControlCodec;
+import org.apache.directory.shared.ldap.codec.search.controls.PagedSearchControlCodec;
 import org.apache.directory.shared.ldap.codec.search.controls.SubEntryControlCodec;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -105,6 +106,7 @@
 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.PagedSearchControl;
 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;
@@ -128,7 +130,7 @@
 
     /** A speedup for logger */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-    
+
 
     /**
      * Transform an AbandonRequest message from a TwixMessage to a
@@ -179,7 +181,7 @@
      * @param messageId The message Id
      * @return A Snickers BindRequestImpl
      */
-    public static  Message transformBindRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformBindRequest( LdapMessage twixMessage, int messageId )
     {
         BindRequestImpl snickersMessage = new BindRequestImpl( messageId );
         BindRequest bindRequest = twixMessage.getBindRequest();
@@ -222,7 +224,7 @@
      * @param messageId The message Id
      * @return a Snickers BindResponseImpl
      */
-    public static  Message transformBindResponse( LdapMessage twixMessage, int messageId )
+    public static Message transformBindResponse( LdapMessage twixMessage, int messageId )
     {
         BindResponseImpl snickersMessage = new BindResponseImpl( messageId );
         BindResponse bindResponse = twixMessage.getBindResponse();
@@ -242,7 +244,7 @@
      * @param twixResult the Twix LdapResult representation
      * @param snickersResult the Snickers LdapResult representation
      */
-    public static  void transformLdapResultTwixToSnickers( LdapResult twixResult, 
+    public static void transformLdapResultTwixToSnickers( LdapResult twixResult, 
         org.apache.directory.shared.ldap.message.LdapResult snickersResult )
     {
         snickersResult.setErrorMessage( twixResult.getErrorMessage() );
@@ -286,7 +288,7 @@
      * @param messageId The message Id
      * @return A Snickers CompareRequestImpl
      */
-    public static  Message transformCompareRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformCompareRequest( LdapMessage twixMessage, int messageId )
     {
         CompareRequestImpl snickersMessage = new CompareRequestImpl( messageId );
         CompareRequest compareRequest = twixMessage.getCompareRequest();
@@ -318,7 +320,7 @@
      * @param messageId The message Id
      * @return A Snickers DeleteRequestImpl
      */
-    public static  Message transformDelRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformDelRequest( LdapMessage twixMessage, int messageId )
     {
         DeleteRequestImpl snickersMessage = new DeleteRequestImpl( messageId );
         DelRequest delRequest = twixMessage.getDelRequest();
@@ -338,7 +340,7 @@
      * @param messageId The message Id
      * @return A Snickers ExtendedRequestImpl
      */
-    public static  Message transformExtendedRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformExtendedRequest( LdapMessage twixMessage, int messageId )
     {
         ExtendedRequest extendedRequest = twixMessage.getExtendedRequest();
         ExtendedRequestImpl snickersMessage;
@@ -370,7 +372,7 @@
      * @param messageId The message Id
      * @return A Snickers ModifyDNRequestImpl
      */
-    public static  Message transformModifyDNRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformModifyDNRequest( LdapMessage twixMessage, int messageId )
     {
         ModifyDnRequestImpl snickersMessage = new ModifyDnRequestImpl( messageId );
         ModifyDNRequest modifyDNRequest = twixMessage.getModifyDNRequest();
@@ -398,7 +400,7 @@
      * @param messageId The message Id
      * @return A Snickers ModifyRequestImpl
      */
-    public static  Message transformModifyRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformModifyRequest( LdapMessage twixMessage, int messageId )
     {
         ModifyRequestImpl snickersMessage = new ModifyRequestImpl( messageId );
         ModifyRequest modifyRequest = twixMessage.getModifyRequest();
@@ -426,7 +428,7 @@
      * @param twixFilter The filter to be transformed
      * @return An ExprNode
      */
-    public static  ExprNode transformFilter( Filter twixFilter )
+    public static ExprNode transformFilter( Filter twixFilter )
     {
         if ( twixFilter != null )
         {
@@ -739,7 +741,7 @@
      * @param messageId The message Id
      * @return A Snickers SearchRequestImpl
      */
-    public static  Message transformSearchRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformSearchRequest( LdapMessage twixMessage, int messageId )
     {
         SearchRequestImpl snickersMessage = new SearchRequestImpl( messageId );
         SearchRequest searchRequest = twixMessage.getSearchRequest();
@@ -813,7 +815,7 @@
      * @param messageId The message Id
      * @return A Snickers UnBindRequestImpl
      */
-    public static  Message transformUnBindRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformUnBindRequest( LdapMessage twixMessage, int messageId )
     {
         return new UnbindRequestImpl( messageId );
     }
@@ -825,7 +827,7 @@
      * @param obj the object to transform
      * @return the object transformed
      */
-    public static  Message transform( Object obj )
+    public static Message transform( Object obj )
     {
         LdapMessage twixMessage = ( LdapMessage ) obj;
         int messageId = twixMessage.getMessageId();
@@ -935,6 +937,15 @@
                     neutralSubentriesControl.setVisibility( twixSubentriesControl.isVisible() );
                     neutralSubentriesControl.setCritical( twixControl.getCriticality() );
                 }
+                else if ( twixControl.getControlValue() instanceof PagedSearchControlCodec )
+                {
+                    PagedSearchControl neutralPagedSearchControl = new PagedSearchControl();
+                    neutralControl = neutralPagedSearchControl;
+                    PagedSearchControlCodec twixPagedSearchControl = (PagedSearchControlCodec)twixControl.getControlValue();
+                    neutralPagedSearchControl.setCookie( twixPagedSearchControl.getCookie() );
+                    neutralPagedSearchControl.setSize( twixPagedSearchControl.getSize() );
+                    neutralPagedSearchControl.setCritical( twixControl.getCriticality() );
+                }
                 else if ( twixControl.getControlValue() instanceof byte[] )
                 {
                     neutralControl = new AbstractMutableControlImpl()
@@ -985,7 +996,7 @@
      * @param snickersLdapResult the Snickers LdapResult to transform
      * @return A Twix LdapResult
      */
-    public static  LdapResult transformLdapResult( LdapResultImpl snickersLdapResult )
+    public static LdapResult transformLdapResult( LdapResultImpl snickersLdapResult )
     {
         LdapResult twixLdapResult = new LdapResult();
 
@@ -1032,7 +1043,7 @@
      * @param twixMessage The Twix AddResponse to produce
      * @param snickersMessage The incoming Snickers AddResponse
      */
-    public static  void transformAddResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformAddResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         AddResponseImpl snickersAddResponse = ( AddResponseImpl ) snickersMessage;
 
@@ -1052,7 +1063,7 @@
      * @param twixMessage The Twix BindResponse to produce
      * @param snickersMessage The incoming Snickers BindResponse
      */
-    public static  void transformBindResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformBindResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         BindResponseImpl snickersBindResponse = ( BindResponseImpl ) snickersMessage;
 
@@ -1081,7 +1092,7 @@
      * @param twixMessage The Twix BindRequest to produce
      * @param snickersMessage The incoming Snickers BindRequest
      */
-    public static  void transformBindRequest( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformBindRequest( LdapMessage twixMessage, Message snickersMessage )
     {
         BindRequestImpl snickersBindRequest = ( BindRequestImpl ) snickersMessage;
 
@@ -1116,7 +1127,7 @@
      * @param twixMessage The Twix CompareResponse to produce
      * @param snickersMessage The incoming Snickers CompareResponse
      */
-    public static  void transformCompareResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformCompareResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         CompareResponseImpl snickersCompareResponse = ( CompareResponseImpl ) snickersMessage;
 
@@ -1137,7 +1148,7 @@
      * @param twixMessage The Twix DelResponse to produce
      * @param snickersMessage The incoming Snickers DelResponse
      */
-    public static  void transformDelResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformDelResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         DeleteResponseImpl snickersDelResponse = ( DeleteResponseImpl ) snickersMessage;
 
@@ -1157,7 +1168,7 @@
      * @param twixMessage The Twix ExtendedResponse to produce
      * @param snickersMessage The incoming Snickers ExtendedResponse
      */
-    public static  void transformExtendedResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformExtendedResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         ExtendedResponseImpl snickersExtendedResponse = ( ExtendedResponseImpl ) snickersMessage;
         ExtendedResponse extendedResponse = new ExtendedResponse();
@@ -1191,7 +1202,7 @@
      * @param twixMessage The Twix ModifyResponse to produce
      * @param snickersMessage The incoming Snickers ModifyResponse
      */
-    public static  void transformModifyResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformModifyResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         ModifyResponseImpl snickersModifyResponse = ( ModifyResponseImpl ) snickersMessage;
 
@@ -1211,7 +1222,7 @@
      * @param twixMessage The Twix ModifyDNResponse to produce
      * @param snickersMessage The incoming Snickers ModifyDNResponse
      */
-    public static  void transformModifyDNResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformModifyDNResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         ModifyDnResponseImpl snickersModifyDNResponse = ( ModifyDnResponseImpl ) snickersMessage;
 
@@ -1252,7 +1263,7 @@
      * @param twixMessage The Twix SearchResultEntry to produce
      * @param snickersMessage The incoming Snickers SearchResponseEntry
      */
-    public static  void transformSearchResultEntry( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformSearchResultEntry( LdapMessage twixMessage, Message snickersMessage )
     {
         SearchResponseEntryImpl snickersSearchResultResponse = ( SearchResponseEntryImpl ) snickersMessage;
         SearchResultEntry searchResultEntry = new SearchResultEntry();
@@ -1276,7 +1287,7 @@
      * @param twixMessage The Twix SearchResultReference to produce
      * @param snickersMessage The incoming Snickers SearchResponseReference
      */
-    public static  void transformSearchResultReference( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformSearchResultReference( LdapMessage twixMessage, Message snickersMessage )
     {
         SearchResponseReferenceImpl snickersSearchResponseReference = ( SearchResponseReferenceImpl ) snickersMessage;
         SearchResultReference searchResultReference = new SearchResultReference();

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java Thu Dec 11 07:32:04 2008
@@ -34,6 +34,7 @@
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.controls.ManageDsaITControlDecoder;
 import org.apache.directory.shared.ldap.codec.search.controls.PSearchControlDecoder;
+import org.apache.directory.shared.ldap.codec.search.controls.PagedSearchControlDecoder;
 import org.apache.directory.shared.ldap.codec.search.controls.SubEntryControlDecoder;
 import org.apache.directory.shared.ldap.util.StringTools;
 
@@ -73,6 +74,9 @@
 
         decoder = new SubEntryControlDecoder();
         controlDecoders.put( decoder.getControlType(), decoder );
+
+        decoder = new PagedSearchControlDecoder();
+        controlDecoders.put( decoder.getControlType(), decoder );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java Thu Dec 11 07:32:04 2008
@@ -34,7 +34,7 @@
     /**
      * Creates a NotNode using a logical NOT operator and a list of children.
      * 
-     * A Not node could contain only one child.
+     * A Not node could contain only one child
      * 
      * @param childList the child nodes under this branch node.
      */

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java Thu Dec 11 07:32:04 2008
@@ -21,24 +21,17 @@
 
 import java.io.UnsupportedEncodingException;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
-import org.apache.directory.shared.ldap.entry.client.ClientModification;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.Base64;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -528,395 +521,5 @@
         
         return new String( buffer );
     }
-    
-    
-    /**
-     * Compute a reverse LDIF of an AddRequest. It's simply a delete request
-     * of the added entry
-     *
-     * @param dn the dn of the added entry
-     * @return a reverse LDIF
-     */
-    public static LdifEntry reverseAdd( LdapDN dn )
-    {
-        LdifEntry entry = new LdifEntry();
-        entry.setChangeType( ChangeType.Delete );
-        entry.setDn( dn );
-        return entry;
-    }
-
-    
-    /**
-     * Compute a reverse LDIF of a DeleteRequest. We have to get the previous
-     * entry in order to restore it.
-     *
-     * @param dn The deleted entry DN
-     * @param deletedEntry The entry which has been deleted
-     * @return A reverse LDIF
-     */
-    public static LdifEntry reverseDel( LdapDN dn, Entry deletedEntry ) throws NamingException
-    {
-        LdifEntry entry = new LdifEntry();
-        
-        entry.setDn( dn );
-        entry.setChangeType( ChangeType.Add );
-        
-        for ( EntryAttribute attribute:deletedEntry )
-        {
-            entry.addAttribute( attribute );
-        }       
-
-        return entry;
-    }
-    
-    
-    /**
-     * Compute a reverse LDIF for a forward change which if in LDIF format
-     * would represent a moddn operation.  Hence there is no newRdn in the
-     * picture here.
-     *
-     * @param newSuperiorDn the new parent dn to be (must not be null)
-     * @param modifiedDn the dn of the entry being moved (must not be null)
-     * @return a reverse LDIF
-     * @throws NamingException if something went wrong
-     */
-    public static LdifEntry reverseModifyDn( LdapDN newSuperiorDn, LdapDN modifiedDn ) throws NamingException
-    {
-        LdifEntry entry = new LdifEntry();
-        LdapDN currentParent = null;
-        LdapDN newDn = null;
-
-        if ( newSuperiorDn == null )
-        {
-            throw new NullPointerException( "newSuperiorDn must not be null" );
-        }
-
-        if ( modifiedDn == null )
-        {
-            throw new NullPointerException( "modifiedDn must not be null" );
-        }
-
-        if ( modifiedDn.size() == 0 )
-        {
-            throw new IllegalArgumentException( "Don't think about moving the rootDSE." );
-        }
-
-        currentParent = ( LdapDN ) modifiedDn.clone();
-        currentParent.remove( currentParent.size() - 1 );
-
-        newDn = ( LdapDN ) newSuperiorDn.clone();
-        newDn.add( modifiedDn.getRdn() );
-
-        entry.setChangeType( ChangeType.ModDn );
-        entry.setDn( newDn );
-        entry.setNewSuperior( currentParent.getUpName() );
-        entry.setDeleteOldRdn( false );
-        return entry;
-    }
-
-
-    /**
-     * Revert a DN to it's previous version by removing the first RDN and adding the given RDN
-     *
-     * @param t0 The initial Attributes
-     * @param t0_dn The initial DN
-     * @param t1_rdn The new RDN
-     * @return A new LDIF entry with a reverted DN
-     * @throws NamingException If the name reverting failed
-     */
-    public static List<LdifEntry> reverseRename( Attributes t0, LdapDN t0_dn, Rdn t1_rdn ) throws NamingException
-    {
-        LdifEntry entry = new LdifEntry();
-        LdapDN parent = null;
-        LdapDN newDn = null;
-
-        if ( t1_rdn == null )
-        {
-            throw new NullPointerException( "newRdn must not be null" );
-        }
-
-        if ( t0_dn == null )
-        {
-            throw new NullPointerException( "modifiedDn must not be null" );
-        }
-
-        if ( t0_dn.size() == 0 )
-        {
-            throw new IllegalArgumentException( "Don't think about renaming the rootDSE." );
-        }
-
-        parent = ( LdapDN ) t0_dn.clone();
-        parent.remove( parent.size() - 1 );
-
-        newDn = ( LdapDN ) parent.clone();
-        newDn.add( t1_rdn );
-
-        List<LdifEntry> entries = new ArrayList<LdifEntry>(1);
-        
-        entry.setChangeType( ChangeType.ModRdn );
-        entry.setDeleteOldRdn( reverseDoDeleteOldRdn( t0, t1_rdn ) );
-        entry.setDn( newDn );
-        entry.setNewRdn( t0_dn.getRdn().getUpName() );
-        
-        entries.add( entry );
-        return entries;
-    }
-
-
-
-    /**
-     * Compute a reverse LDIF for a forward change which if in LDIF format
-     * would represent a modrdn operation.
-     *
-     * @param t0 the entry the way it was before changes were made
-     * @param t1_parentDn the new superior dn if this is a move, otherwise null
-     * @param t0_dn the dn of the entry being modified
-     * @param t1_rdn the new rdn to use
-     * @return A reverse LDIF, with potentially more than one reverse operation 
-     * @throws NamingException If something went wrong
-     */
-    public static List<LdifEntry> reverseModifyRdn( Attributes t0, LdapDN t1_parentDn, LdapDN t0_dn, Rdn t1_rdn )
-            throws NamingException
-    {
-        if ( t0_dn == null )
-        {
-            throw new NullPointerException( "t0_dn must not be null" );
-        }
-
-        if ( t0_dn.size() == 0 )
-        {
-            throw new IllegalArgumentException( "Don't think about a move op on the rootDSE." );
-        }
-
-        // if there is no new superior in the picture then this is a rename
-        // operation where the parent is retained and only the rdn is changed
-        // We still have to take care that the entry attributes are correctly
-        // restored if the new RDN has more than one AVAs
-        if ( t1_parentDn == null )
-        {
-            return reverseRename( t0, t0_dn, t1_rdn );
-        }
-
-        // if there is no rdn change then this is a raw move operation without
-        // a name change, we can delegate this to a simpler method
-        if ( t1_rdn == null )
-        {
-            List<LdifEntry> entries = new ArrayList<LdifEntry>(1);
-            LdifEntry entry = reverseModifyDn( t1_parentDn, t0_dn );
-            entries.add( entry );
-            
-            return entries;
-        }
-
-        // -------------------------------------------------------------------
-        // Below here we do a move and change the name of the rdn all in one
-        // -------------------------------------------------------------------
-
-        // the reverse LDIF we will create
-        LdifEntry reverse = new LdifEntry();
-
-        // take the dn before the forward change was applied, and get it's
-        // parent, this parent will be the newSuperiorDn to be used for the
-        // reverse LDIF.  This is the same as t0_parentDn.
-        LdapDN reverseNewSuperiorDn = ( LdapDN ) t0_dn.clone();
-        reverseNewSuperiorDn.remove( reverseNewSuperiorDn.size() - 1 );
-
-        // take the rdn before the forward change, this will be the newRdn
-        // of the reverse LDIF, this is the same as a t0_rdn.
-        Rdn reverseNewRdn = t0_dn.getRdn();
-
-        // take the newSuperiorDn of the forward operation and append to it
-        // the new rdn of the forward operation to get the new dn after the
-        // change.  This will be the dn of the reverse ldif.  And this is just
-        // the same as t1_dn.
-        LdapDN reverseDn = ( LdapDN ) t1_parentDn.clone();
-        reverseDn.add( t1_rdn );
-
-        reverse.setDn( reverseDn );
-        reverse.setNewSuperior( reverseNewSuperiorDn.getUpName() );
-        reverse.setNewRdn( reverseNewRdn.getUpName() );
-        reverse.setChangeType( ChangeType.ModRdn );
-        reverse.setDeleteOldRdn( reverseDoDeleteOldRdn( t0, t1_rdn ) );
-
-        List<LdifEntry> entries = new ArrayList<LdifEntry>(1);
-        entries.add( reverse );
-        return entries;
-    }
-
-
-    private static boolean reverseDoDeleteOldRdn( Attributes t0_entry, Rdn t1_rdn )
-    {
-        // Consider simple example changes (rename or move does not matter)
-        // -------------------------------------------------------------------
-        // Example A:  t0 (ou=foo) => t1 (ou=bar)
-        //
-        // If at t0 ou=foo contained an ou value of 'bar' then the reverse
-        // LDIF must not delete the old rdn which would be bar.  Otherwise
-        // we must delete the old rdn.
-        //
-        // Example B:  t0 (cn=foo) => t1 (ou=bar)
-        //
-        // Here it's similar to example (A) except because the rdn attribute
-        // is different which shifts basically changes how we check for the
-        // presence of the rdn.  If cn=foo at t0 contains the ou attribute
-        // with a 'bar' value then we cannot delete the oldRdn in the reverse
-        // LDAP.  The logic below expresses this.
-        //
-        // @TODO this code stinks because it does not consider whitespace and
-        // case varience which requires schema awareness.  This must change.
-
-        // look up attribute in t0 using t1's rdn attribute type
-        Attribute t0_attr = t0_entry.get( t1_rdn.getUpType() );
-
-        // if we don't have that attribute in t0 then we need to make sure the
-        // reverse LDIF deletes the t1 rdn of 'bar', if we do have that attribute
-        // then we check if the value 'bar' is in it, if not there we delete
-        // if there we do not
-        return t0_attr == null || ! t0_attr.contains( t1_rdn.getUpValue() );
-    }
-
-
-    /**
-     *
-     * Compute the reversed LDIF for a modify request. We will deal with the
-     * three kind of modifications :
-     * - add
-     * - remove
-     * - replace
-     *
-     * As the modifications should be issued in a reversed order ( ie, for
-     * the initials modifications {A, B, C}, the reversed modifications will
-     * be ordered like {C, B, A}), we will change the modifications order.
-     *
-     * @param dn the dn of the modified entry
-     * @param forwardModifications the modification items for the forward change
-     * @param modifiedEntry The modified entry. Necessary for the destructive modifications
-     * @return A reversed LDIF
-     * @throws NamingException If something went wrong
-     */
-    public static LdifEntry reverseModify( LdapDN dn, List<Modification> forwardModifications,
-                                       Entry modifiedEntry ) throws NamingException
-    {
-        // First, protect the original entry by cloning it : we will modify it
-        Entry clonedEntry = ( Entry ) modifiedEntry.clone();
-
-        LdifEntry entry = new LdifEntry();
-        entry.setChangeType( ChangeType.Modify );
-
-        entry.setDn( dn );
-
-        // As the reversed modifications should be pushed in reversed order,
-        // we create a list to temporarily store the modifications.
-        List<Modification> reverseModifications = new ArrayList<Modification>();
-
-        // Loop through all the modifications. For each modification, we will
-        // have to apply it to the modified entry in order to be able to generate
-        // the reversed modification
-        for ( Modification modification : forwardModifications )
-        {
-            switch ( modification.getOperation() )
-            {
-                case ADD_ATTRIBUTE :
-                    EntryAttribute mod = modification.getAttribute();
-
-                    EntryAttribute previous = modifiedEntry.get( mod.getId() );
-
-                    if ( mod.equals( previous ) )
-                    {
-                        continue;
-                    }
-
-                    Modification reverseModification = new ClientModification( ModificationOperation.REMOVE_ATTRIBUTE, mod );
-                    reverseModifications.add( 0, reverseModification );
-                    break;
-
-                case REMOVE_ATTRIBUTE :
-                    mod = modification.getAttribute();
-
-                    previous = modifiedEntry.get( mod.getId() );
-
-                    if ( previous == null )
-                    {
-                        // Nothing to do if the previous attribute didn't exist
-                        continue;
-                    }
-
-                    if ( mod.get() == null )
-                    {
-                        reverseModification = new ClientModification( ModificationOperation.ADD_ATTRIBUTE, previous );
-                        reverseModifications.add( 0, reverseModification );
-                        continue;
-                    }
-
-                    reverseModification = new ClientModification( ModificationOperation.ADD_ATTRIBUTE, mod );
-                    reverseModifications.add( 0, reverseModification );
-                    break;
-
-                case REPLACE_ATTRIBUTE :
-                    mod = modification.getAttribute();
-
-                    previous = modifiedEntry.get( mod.getId() );
-
-                    /*
-                     * The server accepts without complaint replace 
-                     * modifications to non-existing attributes in the 
-                     * entry.  When this occurs nothing really happens
-                     * but this method freaks out.  To prevent that we
-                     * make such no-op modifications produce the same
-                     * modification for the reverse direction which should
-                     * do nothing as well.  
-                     */
-                    if ( mod.get() == null && previous == null )
-                    {
-                        reverseModification = new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, 
-                            new DefaultClientAttribute( mod.getId() ) );
-                        reverseModifications.add( 0, reverseModification );
-                        continue;
-                    }
-                    
-                    if ( mod.get() == null )
-                    {
-                        reverseModification = new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, previous );
-                        reverseModifications.add( 0, reverseModification );
-                        continue;
-                    }
-
-                    if ( previous == null )
-                    {
-                        EntryAttribute emptyAttribute = new DefaultClientAttribute( mod.getId() );
-                        reverseModification = new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, emptyAttribute );
-                        reverseModifications.add( 0, reverseModification );
-                        continue;
-                    }
-
-                    reverseModification = new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, previous );
-                    reverseModifications.add( 0, reverseModification );
-                    break;
-                    
-                default :
-                    break; // Do nothing
-                    
-            }
-
-            AttributeUtils.applyModification( clonedEntry, modification );
-
-        }
-
-        // Special case if we don't have any reverse modifications
-        if ( reverseModifications.size() == 0 )
-        {
-            throw new IllegalArgumentException( "Could not deduce reverse modifications from provided modifications: "
-                    + forwardModifications );
-        }
-
-        // Now, push the reversed list into the entry
-        for ( Modification modification:reverseModifications )
-        {
-            entry.addModificationItem( modification );
-        }
-
-        // Return the reverted entry
-        return entry;
-    }
 }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java Thu Dec 11 07:32:04 2008
@@ -63,11 +63,25 @@
      */
     public MessageDecoder( BinaryAttributeDetector binaryAttributeDetector ) throws MessageException
     {
+        this( binaryAttributeDetector, Integer.MAX_VALUE );
+    }
+    
+    
+    /**
+     * Creates a MessageDecoder using default properties for enabling a BER
+     * library provider.
+     * 
+     * @param binaryAttributeDetector detects whether or not an attribute is binary
+     * @param maxPDUSize the maximum size a PDU can be
+     * @throws MessageException if there is a problem creating this decoder.
+     */
+    public MessageDecoder( BinaryAttributeDetector binaryAttributeDetector, int maxPDUSize ) throws MessageException
+    {
         // We need to get the encoder class name
         Hashtable<Object, Object> providerEnv = Provider.getEnvironment();
         
         this.provider = Provider.getProvider( providerEnv );
-        this.decoder = this.provider.getDecoder( binaryAttributeDetector );
+        this.decoder = this.provider.getDecoder( binaryAttributeDetector, maxPDUSize );
         this.decoder.setCallback( new DecoderCallback()
         {
             public void decodeOccurred( StatefulDecoder decoder, Object decoded )

Modified: 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=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/PagedSearchControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/PagedSearchControl.java Thu Dec 11 07:32:04 2008
@@ -116,6 +116,17 @@
 
 
     /**
+     * @return The integer value for the current cookie
+     */
+    public int getCookieValue()
+    {
+        int value = ((cookie[0]&0x00FF)<<24) + ((cookie[1]&0x00FF)<<16) + ((cookie[2]&0x00FF)<<8) + (cookie[3]&0x00FF);
+        
+        return value;
+    }
+    
+    
+    /**
      * Set the cookie
      *
      * @param cookie The cookie to store in this control

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java Thu Dec 11 07:32:04 2008
@@ -176,8 +176,10 @@
      * @return the provider's decoder.
      * @throws ProviderException if the provider or its decoder cannot be found
      * @param binaryAttributeDetector detects whether or not attributes are binary
+     * @param maxPDUSize the maximum size a PDU can be
      */
-    public abstract ProviderDecoder getDecoder( BinaryAttributeDetector binaryAttributeDetector )
+    public abstract ProviderDecoder getDecoder( BinaryAttributeDetector binaryAttributeDetector,
+        int maxPDUSize )
             throws ProviderException;
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java Thu Dec 11 07:32:04 2008
@@ -169,8 +169,8 @@
             return dateFormat.format( date );
         }
     }
-    
-    
+
+
     /**
      * 
      * @see #getGeneralizedTime()

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Position.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Position.java?rev=725712&r1=725711&r2=725712&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Position.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Position.java Thu Dec 11 07:32:04 2008
@@ -28,7 +28,7 @@
  */
 public class Position
 {
-	/** The starting position in the string */
+    /** The starting position in the string */
     public int start = 0;
     
     /** The current token length */