directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r471334 - in /directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service: ClientConnectionManager.java ReplicationService.java SimpleReplicationContext.java
Date Sun, 05 Nov 2006 02:29:47 GMT
Author: akarasulu
Date: Sat Nov  4 18:29:44 2006
New Revision: 471334

URL: http://svn.apache.org/viewvc?view=rev&rev=471334
Log:
using generics where appropriate and removing the use of javax.naming.Name in favor of LdapDN:
this fixes a serious bug where intercepted methods were not being called and empty super methods
were

Modified:
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ClientConnectionManager.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/SimpleReplicationContext.java

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ClientConnectionManager.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ClientConnectionManager.java?view=diff&rev=471334&r1=471333&r2=471334
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ClientConnectionManager.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ClientConnectionManager.java
Sat Nov  4 18:29:44 2006
@@ -25,6 +25,7 @@
 import java.util.Map;
 
 import org.apache.directory.mitosis.common.Replica;
+import org.apache.directory.mitosis.common.ReplicaId;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.mitosis.service.protocol.codec.ReplicationClientProtocolCodecFactory;
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationClientProtocolHandler;
@@ -60,7 +61,7 @@
     private final ReplicationService service;
     private final IoConnector connector = new SocketConnector();
     private final IoConnectorConfig connectorConfig = new SocketConnectorConfig();
-    private final Map sessions = new HashMap();
+    private final Map<ReplicaId,Connection> sessions = new HashMap<ReplicaId,Connection>();
     private ReplicationConfiguration configuration;
     private ConnectionMonitor monitor;
 

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java?view=diff&rev=471334&r1=471333&r2=471334
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
Sat Nov  4 18:29:44 2006
@@ -28,7 +28,6 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.naming.Name;
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -246,12 +245,11 @@
     {
         SearchControls ctrl = new SearchControls();
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        ctrl.setReturningAttributes( new String[]
-            { "entryCSN", "entryDeleted" } );
+        ctrl.setReturningAttributes( new String[] { "entryCSN", "entryDeleted" } );
 
         NamingEnumeration e = nexus.search( contextName, directoryServiceConfiguration.getEnvironment(),
filter, ctrl );
 
-        List names = new ArrayList();
+        List<LdapDN> names = new ArrayList<LdapDN>();
         try
         {
             while ( e.hasMore() )
@@ -269,15 +267,15 @@
             e.close();
         }
 
-        Iterator it = names.iterator();
+        Iterator<LdapDN> it = names.iterator();
         while ( it.hasNext() )
         {
-            LdapDN name = ( LdapDN ) it.next();
+            LdapDN name = it.next();
             try
             {
-                Attributes entry = nexus.lookup( ( LdapDN ) name );
+                Attributes entry = nexus.lookup( name );
                 log.info( "Purge: " + name + " (" + entry + ')' );
-                nexus.delete( ( LdapDN ) name );
+                nexus.delete( name );
             }
             catch ( NamingException ex )
             {
@@ -338,10 +336,10 @@
     }
 
 
-    public boolean hasEntry( NextInterceptor nextInterceptor, Name name ) throws NamingException
+    public boolean hasEntry( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
     {
         // Ask others first.
-        boolean hasEntry = nextInterceptor.hasEntry( ( LdapDN ) name );
+        boolean hasEntry = nextInterceptor.hasEntry( name );
 
         // If the entry exists,
         if ( hasEntry )
@@ -349,7 +347,7 @@
             // Check DELETED attribute.
             try
             {
-                Attributes entry = nextInterceptor.lookup( ( LdapDN ) name );
+                Attributes entry = nextInterceptor.lookup( name );
                 hasEntry = !isDeleted( entry );
             }
             catch ( NameNotFoundException e )
@@ -363,15 +361,15 @@
     }
 
 
-    public Attributes lookup( NextInterceptor nextInterceptor, Name name ) throws NamingException
+    public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
     {
-        Attributes result = nextInterceptor.lookup( ( LdapDN ) name );
+        Attributes result = nextInterceptor.lookup( name );
         ensureNotDeleted( name, result );
         return result;
     }
 
 
-    public Attributes lookup( NextInterceptor nextInterceptor, Name name, String[] attrIds
) throws NamingException
+    public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds
) throws NamingException
     {
         boolean found = false;
         // Look for 'entryDeleted' attribute is in attrIds.
@@ -393,24 +391,24 @@
             attrIds = newAttrIds;
         }
 
-        Attributes result = nextInterceptor.lookup( ( LdapDN ) name, attrIds );
+        Attributes result = nextInterceptor.lookup( name, attrIds );
         ensureNotDeleted( name, result );
         return result;
     }
 
 
-    public NamingEnumeration list( NextInterceptor nextInterceptor, Name baseName ) throws
NamingException
+    public NamingEnumeration list( NextInterceptor nextInterceptor, LdapDN baseName ) throws
NamingException
     {
-        NamingEnumeration e = nextInterceptor.list( ( LdapDN ) baseName );
+        NamingEnumeration e = nextInterceptor.list( baseName );
         return new SearchResultFilteringEnumeration( e, new SearchControls(), InvocationStack.getInstance().peek(),
             Constants.DELETED_ENTRIES_FILTER );
     }
 
 
-    public NamingEnumeration search( NextInterceptor nextInterceptor, Name baseName, Map
environment, ExprNode filter,
+    public NamingEnumeration search( NextInterceptor nextInterceptor, LdapDN baseName, Map
environment, ExprNode filter,
         SearchControls searchControls ) throws NamingException
     {
-        NamingEnumeration e = nextInterceptor.search( ( LdapDN ) baseName, environment, filter,
searchControls );
+        NamingEnumeration e = nextInterceptor.search( baseName, environment, filter, searchControls
);
         if ( searchControls.getReturningAttributes() != null )
         {
             return e;
@@ -421,12 +419,12 @@
     }
 
 
-    private void ensureNotDeleted( Name name, Attributes entry ) throws NamingException,
LdapNameNotFoundException
+    private void ensureNotDeleted( LdapDN name, Attributes entry ) throws NamingException,
LdapNameNotFoundException
     {
         if ( isDeleted( entry ) )
         {
             LdapNameNotFoundException e = new LdapNameNotFoundException( "Deleted entry:
" + name );
-            e.setResolvedName( nexus.getMatchedName( ( LdapDN ) name ) );
+            e.setResolvedName( nexus.getMatchedName( name ) );
             throw e;
         }
     }
@@ -440,6 +438,6 @@
         }
 
         Attribute deleted = entry.get( Constants.ENTRY_DELETED );
-        return ( deleted != null && "true".equals( deleted.get().toString() ) );
+        return ( deleted != null && "true".equalsIgnoreCase( deleted.get().toString()
) );
     }
 }

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/SimpleReplicationContext.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/SimpleReplicationContext.java?view=diff&rev=471334&r1=471333&r2=471334
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/SimpleReplicationContext.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/SimpleReplicationContext.java
Sat Nov  4 18:29:44 2006
@@ -42,7 +42,7 @@
     private final ReplicationConfiguration configuration;
     private final DirectoryServiceConfiguration serviceConfiguration;
     private final IoSession session;
-    private final Map expirableMessages = new HashMap();
+    private final Map<Integer,ExpirationTask> expirableMessages = new HashMap<Integer,ExpirationTask>();
     private int nextSequence;
     private Replica peer;
     private State state = State.INIT;



Mime
View raw message