directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r369686 - in /directory/trunks: apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/ apacheds/standalone/simple/unit/src/test/java/org/apache/ldap/server/ common/ldap/src/main/java/org/apache/ldap/common/codec/ com...
Date Tue, 17 Jan 2006 05:17:53 GMT
Author: akarasulu
Date: Mon Jan 16 21:17:36 2006
New Revision: 369686

URL: http://svn.apache.org/viewcvs?rev=369686&view=rev
Log:
fixed encoding issues and started populating referrals

Modified:
    directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/AddHandler.java
    directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/CompareHandler.java
    directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/DeleteHandler.java
    directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/ModifyDnHandler.java
    directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/ModifyHandler.java
    directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/SearchHandler.java
    directory/trunks/apacheds/standalone/simple/unit/src/test/java/org/apache/ldap/server/ReferralTest.java
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapConstants.java
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/message/ReferralImpl.java

Modified: directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/AddHandler.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/AddHandler.java?rev=369686&r1=369685&r2=369686&view=diff
==============================================================================
--- directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/AddHandler.java
(original)
+++ directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/AddHandler.java
Mon Jan 16 21:17:36 2006
@@ -19,6 +19,7 @@
 
 import javax.naming.Context;
 import javax.naming.NamingException;
+import javax.naming.ReferralException;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.ldap.common.exception.LdapException;
@@ -26,6 +27,7 @@
 import org.apache.ldap.common.message.Control;
 import org.apache.ldap.common.message.LdapResult;
 import org.apache.ldap.common.message.ManageDsaITControl;
+import org.apache.ldap.common.message.ReferralImpl;
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.ldap.server.protocol.SessionRegistry;
@@ -71,6 +73,22 @@
             }
             ctx.setRequestControls( ( Control[] ) req.getControls().values().toArray( EMPTY_CONTROLS
) );
             ctx.createSubcontext( req.getEntry(), req.getAttributes() );
+        }
+        catch( ReferralException e )
+        {
+            ReferralImpl refs = new ReferralImpl();
+            result.setReferral( refs );
+            result.setResultCode( ResultCodeEnum.REFERRAL );
+            result.setErrorMessage( "Encountered referral attempting to handle add request."
);
+            /* coming up null causing a NPE */
+            // result.setMatchedDn( e.getResolvedName().toString() );
+            do
+            {
+                refs.addLdapUrl( ( String ) e.getReferralInfo() );
+            }
+            while( e.skipReferral() );
+            session.write( req.getResultResponse() );
+            return;
         }
         catch( NamingException e )
         {

Modified: directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/CompareHandler.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/CompareHandler.java?rev=369686&r1=369685&r2=369686&view=diff
==============================================================================
--- directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/CompareHandler.java
(original)
+++ directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/CompareHandler.java
Mon Jan 16 21:17:36 2006
@@ -19,6 +19,7 @@
 
 import javax.naming.Context;
 import javax.naming.NamingException;
+import javax.naming.ReferralException;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.ldap.common.exception.LdapException;
@@ -26,6 +27,7 @@
 import org.apache.ldap.common.message.Control;
 import org.apache.ldap.common.message.LdapResult;
 import org.apache.ldap.common.message.ManageDsaITControl;
+import org.apache.ldap.common.message.ReferralImpl;
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.util.ExceptionUtils;
@@ -78,6 +80,22 @@
             {
                 result.setResultCode( ResultCodeEnum.COMPAREFALSE );
             }
+        }
+        catch( ReferralException e )
+        {
+            ReferralImpl refs = new ReferralImpl();
+            result.setReferral( refs );
+            result.setResultCode( ResultCodeEnum.REFERRAL );
+            result.setErrorMessage( "Encountered referral attempting to handle compare request."
);
+            /* coming up null causing a NPE */
+            // result.setMatchedDn( e.getResolvedName().toString() );
+            do
+            {
+                refs.addLdapUrl( ( String ) e.getReferralInfo() );
+            }
+            while( e.skipReferral() );
+            session.write( req.getResultResponse() );
+            return;
         }
         catch ( Exception e )
         {

Modified: directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/DeleteHandler.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/DeleteHandler.java?rev=369686&r1=369685&r2=369686&view=diff
==============================================================================
--- directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/DeleteHandler.java
(original)
+++ directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/DeleteHandler.java
Mon Jan 16 21:17:36 2006
@@ -19,6 +19,7 @@
 
 import javax.naming.Context;
 import javax.naming.NamingException;
+import javax.naming.ReferralException;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.ldap.common.exception.LdapException;
@@ -26,6 +27,7 @@
 import org.apache.ldap.common.message.DeleteRequest;
 import org.apache.ldap.common.message.LdapResult;
 import org.apache.ldap.common.message.ManageDsaITControl;
+import org.apache.ldap.common.message.ReferralImpl;
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.ldap.server.protocol.SessionRegistry;
@@ -66,6 +68,22 @@
             }
             ctx.setRequestControls( ( Control[] ) req.getControls().values().toArray( EMPTY_CONTROLS
) );
             ctx.destroySubcontext( req.getName() );
+        }
+        catch( ReferralException e )
+        {
+            ReferralImpl refs = new ReferralImpl();
+            result.setReferral( refs );
+            result.setResultCode( ResultCodeEnum.REFERRAL );
+            result.setErrorMessage( "Encountered referral attempting to handle delete request."
);
+            /* coming up null causing a NPE */
+            // result.setMatchedDn( e.getResolvedName().toString() );
+            do
+            {
+                refs.addLdapUrl( ( String ) e.getReferralInfo() );
+            }
+            while( e.skipReferral() );
+            session.write( req.getResultResponse() );
+            return;
         }
         catch( NamingException e )
         {

Modified: directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/ModifyDnHandler.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/ModifyDnHandler.java?rev=369686&r1=369685&r2=369686&view=diff
==============================================================================
--- directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/ModifyDnHandler.java
(original)
+++ directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/ModifyDnHandler.java
Mon Jan 16 21:17:36 2006
@@ -19,6 +19,7 @@
 
 import javax.naming.Context;
 import javax.naming.NamingException;
+import javax.naming.ReferralException;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.ldap.common.exception.LdapException;
@@ -26,6 +27,7 @@
 import org.apache.ldap.common.message.LdapResult;
 import org.apache.ldap.common.message.ManageDsaITControl;
 import org.apache.ldap.common.message.ModifyDnRequest;
+import org.apache.ldap.common.message.ReferralImpl;
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.util.ExceptionUtils;
@@ -118,6 +120,22 @@
                     newDn.add( req.getNewRdn() );
                     ctx.rename( new LdapName( req.getName() ), newDn );
                 }
+            }
+            catch( ReferralException e )
+            {
+                ReferralImpl refs = new ReferralImpl();
+                result.setReferral( refs );
+                result.setResultCode( ResultCodeEnum.REFERRAL );
+                result.setErrorMessage( "Encountered referral attempting to handle modifyDn
request." );
+                /* coming up null causing a NPE */
+                // result.setMatchedDn( e.getResolvedName().toString() );
+                do
+                {
+                    refs.addLdapUrl( ( String ) e.getReferralInfo() );
+                }
+                while( e.skipReferral() );
+                session.write( req.getResultResponse() );
+                return;
             }
             catch ( NamingException e )
             {

Modified: directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/ModifyHandler.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/ModifyHandler.java?rev=369686&r1=369685&r2=369686&view=diff
==============================================================================
--- directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/ModifyHandler.java
(original)
+++ directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/ModifyHandler.java
Mon Jan 16 21:17:36 2006
@@ -19,6 +19,7 @@
 
 import javax.naming.Context;
 import javax.naming.NamingException;
+import javax.naming.ReferralException;
 import javax.naming.directory.ModificationItem;
 import javax.naming.ldap.LdapContext;
 
@@ -27,6 +28,7 @@
 import org.apache.ldap.common.message.LdapResult;
 import org.apache.ldap.common.message.ManageDsaITControl;
 import org.apache.ldap.common.message.ModifyRequest;
+import org.apache.ldap.common.message.ReferralImpl;
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.ldap.server.protocol.SessionRegistry;
@@ -69,6 +71,22 @@
             ctx.setRequestControls( ( Control[] ) req.getControls().values().toArray( EMPTY_CONTROLS
) );
             Object[] mods = req.getModificationItems().toArray( EMPTY );
             ctx.modifyAttributes( req.getName(), ( ModificationItem[] ) mods );
+        }
+        catch( ReferralException e )
+        {
+            ReferralImpl refs = new ReferralImpl();
+            result.setReferral( refs );
+            result.setResultCode( ResultCodeEnum.REFERRAL );
+            result.setErrorMessage( "Encountered referral attempting to handle modify request."
);
+            /* coming up null causing a NPE */
+            // result.setMatchedDn( e.getResolvedName().toString() );
+            do
+            {
+                refs.addLdapUrl( ( String ) e.getReferralInfo() );
+            }
+            while( e.skipReferral() );
+            session.write( req.getResultResponse() );
+            return;
         }
         catch ( NamingException e )
         {

Modified: directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/SearchHandler.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/SearchHandler.java?rev=369686&r1=369685&r2=369686&view=diff
==============================================================================
--- directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/SearchHandler.java
(original)
+++ directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/SearchHandler.java
Mon Jan 16 21:17:36 2006
@@ -24,6 +24,7 @@
 import javax.naming.Context;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
+import javax.naming.ReferralException;
 import javax.naming.directory.SearchControls;
 import javax.naming.ldap.LdapContext;
 
@@ -35,6 +36,7 @@
 import org.apache.ldap.common.message.LdapResult;
 import org.apache.ldap.common.message.ManageDsaITControl;
 import org.apache.ldap.common.message.PersistentSearchControl;
+import org.apache.ldap.common.message.ReferralImpl;
 import org.apache.ldap.common.message.Response;
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.message.ScopeEnum;
@@ -284,6 +286,23 @@
                 }
                 return;
             }
+        }
+        catch( ReferralException e )
+        {
+            LdapResult result = req.getResultResponse().getLdapResult();
+            ReferralImpl refs = new ReferralImpl();
+            result.setReferral( refs );
+            result.setResultCode( ResultCodeEnum.REFERRAL );
+            result.setErrorMessage( "Encountered referral attempting to handle add request."
);
+            /* coming up null causing a NPE */
+            // result.setMatchedDn( e.getResolvedName().toString() );
+            do
+            {
+                refs.addLdapUrl( ( String ) e.getReferralInfo() );
+            }
+            while( e.skipReferral() );
+            session.write( req.getResultResponse() );
+            return;
         }
         catch( NamingException e )
         {

Modified: directory/trunks/apacheds/standalone/simple/unit/src/test/java/org/apache/ldap/server/ReferralTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/simple/unit/src/test/java/org/apache/ldap/server/ReferralTest.java?rev=369686&r1=369685&r2=369686&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/simple/unit/src/test/java/org/apache/ldap/server/ReferralTest.java
(original)
+++ directory/trunks/apacheds/standalone/simple/unit/src/test/java/org/apache/ldap/server/ReferralTest.java
Mon Jan 16 21:17:36 2006
@@ -90,8 +90,7 @@
 
     
     /**
-     * Get's the root "ou=system" using the SUN JNDI provider on the embedded 
-     * ApacheDS instance.
+     * Get's the root "ou=system" using the SUN JNDI provider on the embedded ApacheDS instance
      */
     private LdapContext getSystemRoot() throws NamingException
     {

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapConstants.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapConstants.java?rev=369686&r1=369685&r2=369686&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapConstants.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapConstants.java
Mon Jan 16 21:17:36 2006
@@ -76,7 +76,7 @@
     public static final int SEARCH_SUBSTRINGS_FINAL_TAG         = 0x82;
     public static final int SEARCH_MATCH_VALUE_TAG              = 0x83;
     public static final int BIND_REQUEST_SASL_TAG               = 0x83;
-    public static final int LDAP_RESULT_REFERRAL_SEQUENCE_TAG   = 0x83;
+    public static final int LDAP_RESULT_REFERRAL_SEQUENCE_TAG   = 0xa3;
     public static final int DN_ATTRIBUTES_FILTER_TAG            = 0x84;
     public static final int SERVER_SASL_CREDENTIAL_TAG          = 0x87;
     public static final int PRESENT_FILTER_TAG                  = 0x87;

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/message/ReferralImpl.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/message/ReferralImpl.java?rev=369686&r1=369685&r2=369686&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/message/ReferralImpl.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/message/ReferralImpl.java
Mon Jan 16 21:17:36 2006
@@ -33,7 +33,7 @@
 {
     static final long serialVersionUID = 2638820668325359096L;
     /** Sequence of LDAPUrls composing this Referral */
-    private final HashSet urls = new HashSet();
+    private final List urls = new ArrayList();
 
 
     // ------------------------------------------------------------------------



Mime
View raw message