directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r414035 [8/8] - in /directory/trunks/apacheds: ./ core-plugin/ core-shared/ core-unit/ core-unit/src/main/java/org/apache/directory/server/core/unit/ core-unit/src/test/java/org/apache/directory/server/core/ core-unit/src/test/java/org/apac...
Date Wed, 14 Jun 2006 03:22:12 GMT
Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchResponseIterator.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchResponseIterator.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchResponseIterator.java
(original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchResponseIterator.java
Tue Jun 13 20:22:05 2006
@@ -19,6 +19,7 @@
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
+import javax.naming.InvalidNameException;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -26,6 +27,7 @@
 import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.core.jndi.ServerLdapContext;
+import org.apache.directory.server.ldap.SessionRegistry;
 import org.apache.directory.shared.ldap.codec.util.LdapURL;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -38,7 +40,9 @@
 import org.apache.directory.shared.ldap.message.SearchResponseEntryImpl;
 import org.apache.directory.shared.ldap.message.SearchResponseReference;
 import org.apache.directory.shared.ldap.message.SearchResponseReferenceImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
+import org.apache.mina.common.IoSession;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -57,6 +61,7 @@
     private final SearchRequest req;
     private final ServerLdapContext ctx;
     private final NamingEnumeration underlying;
+    private final IoSession session;
     private SearchResponseDone respDone;
     private boolean done = false;
     private Object prefetched;
@@ -70,12 +75,14 @@
      * @param req the search request to generate responses to
      * @param underlying the underlying JNDI enumeration containing SearchResults
      */
-    public SearchResponseIterator(SearchRequest req, ServerLdapContext ctx, NamingEnumeration
underlying, int scope)
+    public SearchResponseIterator( SearchRequest req, ServerLdapContext ctx, NamingEnumeration
underlying, int scope,
+        IoSession session )
     {
         this.req = req;
         this.ctx = ctx;
         this.scope = scope;
         this.underlying = underlying;
+        this.session = session;
 
         try
         {
@@ -94,7 +101,16 @@
                     SearchResponseEntry respEntry;
                     respEntry = new SearchResponseEntryImpl( req.getMessageId() );
                     respEntry.setAttributes( result.getAttributes() );
-                    respEntry.setObjectName( result.getName() );
+                    try
+                    {
+                        respEntry.setObjectName( new LdapDN( result.getName() ) );
+                    }
+                    catch ( InvalidNameException ine )
+                    {
+                        log.error( "Invalid object name : " + result.getName(), ine);
+                        throw new RuntimeException( ine );
+                    }
+                    
                     prefetched = respEntry;
                 }
                 else
@@ -130,6 +146,10 @@
                     prefetched = respRef;
                 }
             }
+            else
+            {
+                SessionRegistry.getSingleton().removeOutstandingRequest( session, req.getMessageId()
);
+            }
         }
         catch ( NamingException e )
         {
@@ -197,6 +217,7 @@
                 respDone = ( SearchResponseDone ) req.getResultResponse();
                 respDone.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
                 prefetched = null;
+                SessionRegistry.getSingleton().removeOutstandingRequest( session, req.getMessageId()
);
                 return next;
             }
         }
@@ -251,7 +272,17 @@
         {
             SearchResponseEntry respEntry = new SearchResponseEntryImpl( req.getMessageId()
);
             respEntry.setAttributes( result.getAttributes() );
-            respEntry.setObjectName( result.getName() );
+            
+            try
+            {
+                respEntry.setObjectName( new LdapDN( result.getName() ) );
+            }
+            catch ( InvalidNameException ine )
+            {
+                log.error( "Invalid object name : " + result.getName(), ine);
+                throw new RuntimeException( ine );
+            }
+            
             prefetched = respEntry;
         }
         else
@@ -367,6 +398,7 @@
     SearchResponseDone getResponse( SearchRequest req, Exception e )
     {
         String msg = "failed on search operation";
+        
         if ( log.isDebugEnabled() )
         {
             msg += ":\n" + req + ":\n" + ExceptionUtils.getStackTrace( e );
@@ -374,6 +406,7 @@
 
         SearchResponseDone resp = ( SearchResponseDone ) req.getResultResponse();
         ResultCodeEnum code = null;
+        
         if ( e instanceof LdapException )
         {
             code = ( ( LdapException ) e ).getResultCode();
@@ -389,13 +422,16 @@
         if ( e instanceof NamingException )
         {
             NamingException ne = ( NamingException ) e;
+            
             if ( ( ne.getResolvedName() != null )
                 && ( ( code == ResultCodeEnum.NOSUCHOBJECT ) || ( code == ResultCodeEnum.ALIASPROBLEM
)
                     || ( code == ResultCodeEnum.INVALIDDNSYNTAX ) || ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM
) ) )
             {
-                resp.getLdapResult().setMatchedDn( ne.getResolvedName().toString() );
+                resp.getLdapResult().setMatchedDn( (LdapDN)ne.getResolvedName() );
             }
         }
+        
+        SessionRegistry.getSingleton().removeOutstandingRequest( session, req.getMessageId()
);
         return resp;
     }
 }

Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java
(original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java
Tue Jun 13 20:22:05 2006
@@ -43,7 +43,7 @@
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.extended.LaunchDiagnosticUiRequest;
 import org.apache.directory.shared.ldap.message.extended.LaunchDiagnosticUiResponse;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.mina.common.IoSession;
 
 
@@ -89,11 +89,11 @@
             requestor.write( new LaunchDiagnosticUiResponse( req.getMessageId() ) );
 
             DirectoryPartitionNexus nexus = service.getConfiguration().getPartitionNexus();
-            Iterator list = nexus.listSuffixes( true );
+            Iterator list = nexus.listSuffixes();
             int launchedWindowCount = 0;
             while ( list.hasNext() )
             {
-                LdapName dn = new LdapName( ( String ) list.next() );
+                LdapDN dn = new LdapDN( ( String ) list.next() );
                 DirectoryPartition partition = nexus.getPartition( dn );
                 if ( partition instanceof BTreeDirectoryPartition )
                 {

Propchange: directory/trunks/apacheds/protocol-ntp/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -11,3 +11,5 @@
 .project
 *.iws
 *.ipr
+
+nbproject

Propchange: directory/trunks/apacheds/protocol-shared/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -12,3 +12,5 @@
 .classpath
 .project
 *.iml
+
+nbproject

Propchange: directory/trunks/apacheds/server-jndi/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -10,3 +10,5 @@
 .project
 *.iml
 *.log
+
+nbproject

Propchange: directory/trunks/apacheds/server-main/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -15,3 +15,5 @@
 *.ipr
 *.iws
 target
+
+nbproject

Propchange: directory/trunks/apacheds/server-sar/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -1,7 +1,11 @@
 .classpath
+*.iml
+*.iws
 target
 .wtpmodules
 .settings
 .deployables
 .cdtproject
 .project
+
+nbproject

Propchange: directory/trunks/apacheds/server-ssl/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -8,3 +8,5 @@
 *.iml
 *.ipr
 *.iws
+
+nbproject

Propchange: directory/trunks/apacheds/server-tools/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -8,3 +8,5 @@
 *.iwl
 *.iws
 *.iml
+
+nbproject

Modified: directory/trunks/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/DisconnectNotificationCommand.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/DisconnectNotificationCommand.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/DisconnectNotificationCommand.java
(original)
+++ directory/trunks/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/DisconnectNotificationCommand.java
Tue Jun 13 20:22:05 2006
@@ -19,6 +19,7 @@
 
 import java.util.Hashtable;
 
+import javax.naming.NamingException;
 import javax.naming.directory.SearchControls;
 import javax.naming.event.EventContext;
 import javax.naming.event.NamingExceptionEvent;
@@ -64,7 +65,7 @@
     }
 
 
-    public void notificationReceived( UnsolicitedNotificationEvent evt )
+    public void notificationReceived( UnsolicitedNotificationEvent evt ) 
     {
         notification = evt.getNotification();
 
@@ -77,7 +78,18 @@
         else if ( notification.getID().equals( GracefulDisconnect.EXTENSION_OID ) )
         {
             System.out.println( "Recieved GracefulDisconnect: " + GracefulDisconnect.EXTENSION_OID
);
-            GracefulDisconnect gd = new GracefulDisconnect( notification.getEncodedValue()
);
+            GracefulDisconnect gd = null;
+            
+            try
+            {
+                gd = new GracefulDisconnect( notification.getEncodedValue() );
+            }
+            catch ( NamingException e )
+            {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+            
             System.out.println( "LDAP server will shutdown in " + gd.getDelay() + " seconds."
);
             System.out.println( "LDAP server will be back online in " + gd.getTimeOffline()
+ " minutes." );
 

Modified: directory/trunks/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
(original)
+++ directory/trunks/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
Tue Jun 13 20:22:05 2006
@@ -138,7 +138,7 @@
         bb.clear();
     }
 
-    private LdapMessage readResponse( ByteBuffer bb ) throws IOException, DecoderException
+    private LdapMessage readResponse( ByteBuffer bb ) throws IOException, DecoderException,
NamingException
     {
 
         LdapMessage messageResp = null;
@@ -526,7 +526,7 @@
      * 
      * @param messageId The message Id
      */
-    private void bind( int messageId ) throws InvalidNameException, EncoderException, DecoderException,
IOException
+    private void bind( int messageId ) throws NamingException, EncoderException, DecoderException,
IOException
     {
         BindRequest bindRequest = new BindRequest();
         LdapMessage message = new LdapMessage();

Propchange: directory/trunks/apacheds/server-unit/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -10,3 +10,5 @@
 *.log
 .classpath
 .project
+
+nbproject

Modified: directory/trunks/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
(original)
+++ directory/trunks/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
Tue Jun 13 20:22:05 2006
@@ -25,7 +25,6 @@
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
-import javax.naming.Name;
 import javax.naming.NamingException;
 import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapContext;
@@ -39,7 +38,7 @@
 import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
 import org.apache.directory.shared.ldap.ldif.Entry;
 import org.apache.directory.shared.ldap.ldif.LdifReader;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.mina.util.AvailablePortFinder;
 
 
@@ -188,7 +187,7 @@
             {
                 Entry entry = ( Entry) iterator.next();
 
-                Name dn = new LdapName( entry.getDn() );
+                LdapDN dn = new LdapDN( entry.getDn() );
                 dn.remove( 0 );
 
                 ctx.createSubcontext( dn, entry.getAttributes() );

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/MatchingRuleCompareTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/MatchingRuleCompareTest.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/MatchingRuleCompareTest.java
(original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/MatchingRuleCompareTest.java
Tue Jun 13 20:22:05 2006
@@ -248,7 +248,7 @@
         ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
 
         String[] values =
-            { "", memberDN, "cn=nobody", memberDN.toLowerCase(), PERSON_RDN + " , " + ctx.getNameInNamespace()
};
+            { "", memberDN, "cn=nobody", memberDN, PERSON_RDN + " , " + ctx.getNameInNamespace()
};
         boolean[] expected =
             { false, true, false, true, true };
 

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/PersistentSearchTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/PersistentSearchTest.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/PersistentSearchTest.java
(original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/PersistentSearchTest.java
Tue Jun 13 20:22:05 2006
@@ -148,8 +148,7 @@
         }
 
         assertNotNull( listener.result );
-        // darn it getting normalized name back
-        assertEquals( RDN.toLowerCase(), listener.result.getName().toLowerCase() );
+        assertEquals( RDN, listener.result.getName() );
     }
 
 
@@ -181,8 +180,7 @@
         }
 
         assertNotNull( listener.result );
-        // darn it getting normalized name back
-        assertEquals( "cn=Jack Black".toLowerCase(), listener.result.getName().toLowerCase()
);
+        assertEquals( "cn=Jack Black", listener.result.getName() );
     }
 
 
@@ -214,8 +212,7 @@
         }
 
         assertNotNull( listener.result );
-        // darn it getting normalized name back
-        assertEquals( RDN.toLowerCase(), listener.result.getName().toLowerCase() );
+        assertEquals( RDN, listener.result.getName() );
     }
 
 
@@ -247,8 +244,7 @@
         }
 
         assertNotNull( listener.result );
-        // darn it getting normalized name back
-        assertEquals( "cn=Jack Black".toLowerCase(), listener.result.getName().toLowerCase()
);
+        assertEquals( "cn=Jack Black", listener.result.getName() );
     }
 
 
@@ -283,8 +279,7 @@
         }
 
         assertNotNull( listener.result );
-        // darn it getting normalized name back
-        assertEquals( RDN.toLowerCase(), listener.result.getName().toLowerCase() );
+        assertEquals( RDN, listener.result.getName() );
         assertEquals( listener.result.control.getChangeType(), ChangeType.MODIFY );
     }
 
@@ -320,10 +315,9 @@
         }
 
         assertNotNull( listener.result );
-        // darn it getting normalized name back
-        assertEquals( "cn=Jack Black".toLowerCase(), listener.result.getName().toLowerCase()
);
+        assertEquals( "cn=Jack Black", listener.result.getName() );
         assertEquals( listener.result.control.getChangeType(), ChangeType.MODDN );
-        assertEquals( ( RDN + ",ou=system" ).toLowerCase(), listener.result.control.getPreviousDn().toLowerCase()
);
+        assertEquals( ( RDN + ",ou=system" ), listener.result.control.getPreviousDn().getUpName()
);
     }
 
 
@@ -358,8 +352,7 @@
         }
 
         assertNotNull( listener.result );
-        // darn it getting normalized name back
-        assertEquals( RDN.toLowerCase(), listener.result.getName().toLowerCase() );
+        assertEquals( RDN, listener.result.getName() );
         assertEquals( listener.result.control.getChangeType(), ChangeType.DELETE );
     }
 
@@ -395,8 +388,7 @@
         }
 
         assertNotNull( listener.result );
-        // darn it getting normalized name back
-        assertEquals( "cn=Jack Black".toLowerCase(), listener.result.getName().toLowerCase()
);
+        assertEquals( "cn=Jack Black", listener.result.getName() );
         assertEquals( listener.result.control.getChangeType(), ChangeType.ADD );
     }
 
@@ -434,8 +426,7 @@
         }
 
         assertNotNull( listener.result );
-        // darn it getting normalized name back
-        assertEquals( "cn=Jack Black".toLowerCase(), listener.result.getName().toLowerCase()
);
+        assertEquals( "cn=Jack Black", listener.result.getName() );
         assertEquals( listener.result.control.getChangeType(), ChangeType.ADD );
         listener.result = null;
         t = new Thread( listener );
@@ -469,8 +460,7 @@
         }
 
         assertNotNull( listener.result );
-        // darn it getting normalized name back
-        assertEquals( RDN.toLowerCase(), listener.result.getName().toLowerCase() );
+        assertEquals( RDN, listener.result.getName() );
         assertEquals( listener.result.control.getChangeType(), ChangeType.MODIFY );
     }
 
@@ -511,8 +501,7 @@
     //        
     //        assertEquals( 6, listener.count );
     //        assertNotNull( listener.result );
-    //        // darn it getting normalized name back
-    //        assertEquals( "cn=Jack Black".toLowerCase(), listener.result.getName().toLowerCase()
);
+    //        assertEquals( "cn=Jack Black", listener.result.getName() );
     //        assertEquals( listener.result.control.getChangeType(), ChangeType.ADD );
     //    }
 
@@ -578,8 +567,7 @@
         }
 
         assertNotNull( listener.result );
-        // darn it getting normalized name back
-        assertEquals( "cn=Jack Black".toLowerCase(), listener.result.getName().toLowerCase()
);
+        assertEquals( "cn=Jack Black", listener.result.getName() );
         assertEquals( listener.result.control.getChangeType(), ChangeType.ADD );
         listener.result = null;
         t = new Thread( listener );
@@ -614,8 +602,7 @@
         }
 
         assertNotNull( listener.result );
-        // darn it getting normalized name back
-        assertEquals( RDN.toLowerCase(), listener.result.getName().toLowerCase() );
+        assertEquals( RDN, listener.result.getName() );
         assertEquals( listener.result.control.getChangeType(), ChangeType.MODIFY );
     }
 

Modified: directory/trunks/apacheds/server-unit/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-unit/src/test/resources/log4j.properties?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/resources/log4j.properties (original)
+++ directory/trunks/apacheds/server-unit/src/test/resources/log4j.properties Tue Jun 13 20:22:05
2006
@@ -1,4 +1,4 @@
-log4j.rootCategory=ERROR, stdout
+log4j.rootCategory=OFF, stdout
 
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout



Mime
View raw message