directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r471085 - in /directory/trunks/apacheds: core/src/main/schema/apache.schema mitosis/pom.xml mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java mitosis/src/main/schema/ pom.xml
Date Sat, 04 Nov 2006 00:51:49 GMT
Author: akarasulu
Date: Fri Nov  3 16:51:48 2006
New Revision: 471085

URL: http://svn.apache.org/viewvc?view=rev&rev=471085
Log:
changes ...

 o moved mitosis schema over to apache.schema
 o cleaned up issues with replication aged data puring
   where the search on the nexus was not done with normalized
   dn base and normalized filters
 o changed the enterprise numbers that are used for the various
   replication attributes to use ApacheDS enterprise numbers
 o added commons pool jar which it seems mitosis needs but I 
   hope to remove this stuff once I get rid of the derby based
   store.


Removed:
    directory/trunks/apacheds/mitosis/src/main/schema/
Modified:
    directory/trunks/apacheds/core/src/main/schema/apache.schema
    directory/trunks/apacheds/mitosis/pom.xml
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
    directory/trunks/apacheds/pom.xml

Modified: directory/trunks/apacheds/core/src/main/schema/apache.schema
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/schema/apache.schema?view=diff&rev=471085&r1=471084&r2=471085
==============================================================================
--- directory/trunks/apacheds/core/src/main/schema/apache.schema (original)
+++ directory/trunks/apacheds/core/src/main/schema/apache.schema Fri Nov  3 16:51:48 2006
@@ -252,3 +252,39 @@
 # End of Trigger related
 # ======================
 
+# ======================
+# Mitosis Related
+# ======================
+
+attributetype ( 1.2.6.1.4.1.18060.1.1.1.3.29
+        NAME 'entryUUID'
+        DESC 'LCUP/LDUP: UUID of the entry'
+        EQUALITY octetStringMatch
+        SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64}
+        SINGLE-VALUE 
+        NO-USER-MODIFICATION 
+        USAGE directoryOperation )
+
+attributetype ( 1.2.6.1.4.1.18060.1.1.1.3.30
+        NAME 'entryCSN'
+        DESC 'LCUP/LDUP: change sequence number of the entry'
+        EQUALITY octetStringMatch
+        ORDERING octetStringOrderingMatch
+        SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64}
+        SINGLE-VALUE 
+        NO-USER-MODIFICATION 
+        USAGE directoryOperation )
+
+attributetype ( 1.2.6.1.4.1.18060.1.1.1.3.31
+        NAME 'entryDeleted'
+        DESC 'Whether or not an entry has been deleted.'
+        EQUALITY booleanMatch
+        SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
+        SINGLE-VALUE 
+        NO-USER-MODIFICATION 
+        USAGE directoryOperation )
+
+# ======================
+# End of Mitosis Related
+# ======================
+

Modified: directory/trunks/apacheds/mitosis/pom.xml
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/pom.xml?view=diff&rev=471085&r1=471084&r2=471085
==============================================================================
--- directory/trunks/apacheds/mitosis/pom.xml (original)
+++ directory/trunks/apacheds/mitosis/pom.xml Fri Nov  3 16:51:48 2006
@@ -37,6 +37,11 @@
     </dependency>
 
     <dependency>
+      <groupId>commons-pool</groupId>
+      <artifactId>commons-pool</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>

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=471085&r1=471084&r2=471085
==============================================================================
--- 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
Fri Nov  3 16:51:48 2006
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mitosis.service;
 
+
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.text.ParseException;
@@ -54,6 +55,7 @@
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.core.schema.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
@@ -68,9 +70,15 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 public class ReplicationService extends BaseInterceptor
 {
     private static final Logger log = LoggerFactory.getLogger( ReplicationService.class );
+    
+    /** TODO these OID's need to be switched from safehaus to apache enterprise numbers */
+    private static final String ENTRY_CSN_OID = "1.2.6.1.4.1.18060.1.1.1.3.30";
+    private static final String ENTRY_DELETED_OID = "1.2.6.1.4.1.18060.1.1.1.3.31";
+    
     private DirectoryServiceConfiguration directoryServiceConfiguration;
     private ReplicationConfiguration configuration;
     private PartitionNexus nexus;
@@ -78,27 +86,33 @@
     private ReplicationStore store;
     private IoAcceptor registry;
     private final ClientConnectionManager clientConnectionManager = new ClientConnectionManager(
this );
+    private AttributeTypeRegistry attrRegistry;
+    
     
     public ReplicationService()
     {
     }
     
+    
     public ReplicationConfiguration getConfiguration()
     {
         return configuration;
     }
     
+    
     public void setConfiguration( ReplicationConfiguration cfg )
     {
         cfg.validate();
         this.configuration = cfg;
     }
     
+    
     public DirectoryServiceConfiguration getFactoryConfiguration()
     {
         return directoryServiceConfiguration;
     }
 
+    
     public void init( DirectoryServiceConfiguration serviceCfg, InterceptorConfiguration
cfg ) throws NamingException
     {
         configuration.validate();
@@ -107,6 +121,7 @@
         nexus = serviceCfg.getPartitionNexus();
         store = configuration.getStore();
         operationFactory = new OperationFactory( serviceCfg, configuration );
+        attrRegistry = serviceCfg.getGlobalRegistries().getAttributeTypeRegistry();
         
         // Initialize store and service
         store.open( serviceCfg, configuration );
@@ -132,6 +147,7 @@
         purgeAgedData();
     }
 
+    
     private void startNetworking() throws Exception
     {
         registry = new SocketAcceptor();
@@ -154,12 +170,14 @@
         clientConnectionManager.start( configuration );
     }
 
+    
     public void destroy()
     {
         stopNetworking();
         store.close();
     }
 
+    
     private void stopNetworking()
     {
         // close all open connections, deactivate all filters and service registry
@@ -174,6 +192,7 @@
         registry.unbindAll();
     }
     
+
     public void purgeAgedData() throws NamingException
     {
         Attributes rootDSE = nexus.getRootDSE();
@@ -193,10 +212,8 @@
         
         try
         {
-            filter = parser.parse(
-                "(& (entryCSN=<" +
-                purgeCSN.toOctetString() +
-                ") (entryDeleted=true))" );
+            filter = parser.parse( "(& (" + ENTRY_CSN_OID +"=<" 
+                + purgeCSN.toOctetString() + ") (" + ENTRY_DELETED_OID + "=true))" );
         }
         catch( IOException e )
         {
@@ -213,16 +230,17 @@
         {
             Object value = e.next();
             // Convert attribute value to JNDI name.
-            Name contextName;
-            if( value instanceof Name )
+            LdapDN contextName;
+            if( value instanceof LdapDN )
             {
-                contextName = ( Name ) value;
+                contextName = ( LdapDN ) value;
             }
             else
             {
                 contextName = new LdapDN( String.valueOf( value ) );
             }
             
+            contextName.normalize( attrRegistry.getNormalizerMapping() );
             log.info( "Purging aged data under '" + contextName + '"');
             purgeAgedData( contextName, filter );
         }
@@ -230,15 +248,15 @@
         store.removeLogs( purgeCSN, false );
     }
     
-    private void purgeAgedData( Name contextName, ExprNode filter ) throws NamingException
+    
+    private void purgeAgedData( LdapDN contextName, ExprNode filter ) throws NamingException
     {
         SearchControls ctrl = new SearchControls();
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE ); 
         ctrl.setReturningAttributes( new String[]
         { "entryCSN", "entryDeleted" } );
-                                                
-        NamingEnumeration e = nexus.search(
-            (LdapDN)contextName,
+
+        NamingEnumeration e = nexus.search( contextName,
                 directoryServiceConfiguration.getEnvironment(),
                 filter, ctrl );
 
@@ -248,7 +266,7 @@
             while( e.hasMore() )
             {
                 SearchResult sr = ( SearchResult ) e.next();
-                Name name = new LdapDN( sr.getName() );
+                LdapDN name = new LdapDN( sr.getName() );
                 if( name.size() > contextName.size() )
                 {
                     names.add( new LdapDN( sr.getName() ) );
@@ -263,12 +281,12 @@
         Iterator it = names.iterator();
         while( it.hasNext() )
         {
-            Name name = (Name) it.next();
+            LdapDN name = ( LdapDN ) it.next();
             try
             {
-                Attributes entry = nexus.lookup( (LdapDN)name );
+                Attributes entry = nexus.lookup( ( LdapDN ) name );
                 log.info( "Purge: " + name + " (" + entry + ')' );
-                nexus.delete( (LdapDN)name );
+                nexus.delete( ( LdapDN ) name );
             }
             catch( NamingException ex )
             {
@@ -277,6 +295,7 @@
         }
     }
     
+    
     public void add( NextInterceptor nextInterceptor, LdapDN normalizedName, Attributes entry
) throws NamingException
     {
         Operation op = operationFactory.newAdd( normalizedName, entry );
@@ -397,6 +416,7 @@
         return new SearchResultFilteringEnumeration( e, searchControls, InvocationStack.getInstance().peek(),
Constants.DELETED_ENTRIES_FILTER );
     }
 
+    
     private void ensureNotDeleted( Name name, Attributes entry ) throws NamingException,
LdapNameNotFoundException
     {
         if( isDeleted( entry ) )
@@ -407,6 +427,7 @@
             throw e;
         }
     }    
+
     
     private boolean isDeleted( Attributes entry ) throws NamingException
     {
@@ -418,5 +439,4 @@
         Attribute deleted = entry.get( Constants.ENTRY_DELETED );
         return ( deleted != null && "true".equals( deleted.get().toString() ) );
     }
-
 }

Modified: directory/trunks/apacheds/pom.xml
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/pom.xml?view=diff&rev=471085&r1=471084&r2=471085
==============================================================================
--- directory/trunks/apacheds/pom.xml (original)
+++ directory/trunks/apacheds/pom.xml Fri Nov  3 16:51:48 2006
@@ -99,6 +99,11 @@
         <version>1.2.1</version>
       </dependency>
       <dependency>
+        <groupId>commons-pool</groupId>
+        <artifactId>commons-pool</artifactId>
+        <version>1.3</version>
+      </dependency>
+      <dependency>
         <groupId>commons-logging</groupId>
         <artifactId>commons-logging</artifactId>
         <version>1.0.4</version>



Mime
View raw message