directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1214112 - in /directory/apacheds/branches/apacheds-txns: server-jndi/src/main/java/org/apache/directory/server/configuration/ service-builder/src/main/java/org/apache/directory/server/config/ service-builder/src/main/java/org/apache/direct...
Date Wed, 14 Dec 2011 08:44:47 GMT
Author: saya
Date: Wed Dec 14 08:44:46 2011
New Revision: 1214112

URL: http://svn.apache.org/viewvc?rev=1214112&view=rev
Log:
added txn manager and log manager initialization for apacheds service builder

Modified:
    directory/apacheds/branches/apacheds-txns/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
    directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
    directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
    directory/apacheds/branches/apacheds-txns/service-osgi/src/main/java/org/apache/directory/server/ApacheDsService.java
    directory/apacheds/branches/apacheds-txns/service/src/main/java/org/apache/directory/server/ApacheDsService.java

Modified: directory/apacheds/branches/apacheds-txns/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=1214112&r1=1214111&r2=1214112&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
(original)
+++ directory/apacheds/branches/apacheds-txns/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
Wed Dec 14 08:44:46 2011
@@ -495,7 +495,7 @@ public class ApacheDS
         directoryService.setSchemaManager( schemaManager );
 
         // Init the LdifPartition
-        LdifPartition ldifPartition = new LdifPartition( schemaManager );
+        LdifPartition ldifPartition = new LdifPartition( schemaManager, null, null );
         ldifPartition.setPartitionPath( new File( workingDirectory, "schema" ).toURI() );
 
         schemaPartition.setWrappedPartition( ldifPartition );

Modified: directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java?rev=1214112&r1=1214111&r2=1214112&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
(original)
+++ directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
Wed Dec 14 08:44:46 2011
@@ -66,6 +66,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.journal.DefaultJournalStore;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.integration.http.HttpServer;
 import org.apache.directory.server.integration.http.WebApp;
 import org.apache.directory.server.kerberos.kdc.KdcServer;
@@ -1130,14 +1132,14 @@ public class ServiceBuilder
      * @throws LdapInvalidDnException 
      * @throws Exception If the instance cannot be created
      */
-    public static JdbmPartition createJdbmPartition( DirectoryService directoryService, JdbmPartitionBean
jdbmPartitionBean ) throws ConfigurationException
+    public static JdbmPartition createJdbmPartition( DirectoryService directoryService, JdbmPartitionBean
jdbmPartitionBean, TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory
) throws ConfigurationException
     {
         if ( ( jdbmPartitionBean == null ) || jdbmPartitionBean.isDisabled() )
         {
             return null;
         }
         
-        JdbmPartition jdbmPartition = new JdbmPartition( directoryService.getSchemaManager()
);
+        JdbmPartition jdbmPartition = new JdbmPartition( directoryService.getSchemaManager(),
txnManagerFactory, executionManagerFactory );
         
         jdbmPartition.setCacheSize( jdbmPartitionBean.getPartitionCacheSize() );
         jdbmPartition.setId( jdbmPartitionBean.getPartitionId() );
@@ -1196,7 +1198,7 @@ public class ServiceBuilder
      * @return The instantiated Partition
      * @throws ConfigurationException If we cannot process the Partition
      */
-    public static Partition createPartition( DirectoryService directoryService, PartitionBean
partitionBean ) throws ConfigurationException
+    public static Partition createPartition( DirectoryService directoryService, PartitionBean
partitionBean, TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory
) throws ConfigurationException
     {
         if ( ( partitionBean == null ) || partitionBean.isDisabled() )
         {
@@ -1205,7 +1207,7 @@ public class ServiceBuilder
         
         if ( partitionBean instanceof JdbmPartitionBean )
         {
-            return createJdbmPartition( directoryService, (JdbmPartitionBean)partitionBean
);
+            return createJdbmPartition( directoryService, (JdbmPartitionBean)partitionBean,
txnManagerFactory, executionManagerFactory );
         }
         else
         {
@@ -1220,7 +1222,8 @@ public class ServiceBuilder
      * @return A Map of all the instantiated partitions
      * @throws ConfigurationException If we cannot process some Partition
      */
-    public static Map<String, Partition> createPartitions( DirectoryService directoryService,
List<PartitionBean> partitionBeans ) throws ConfigurationException
+    public static Map<String, Partition> createPartitions( DirectoryService directoryService,
List<PartitionBean> partitionBeans, 
+        TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory
 ) throws ConfigurationException
     {
         Map<String, Partition> partitions = new HashMap<String, Partition>( partitionBeans.size()
);
         
@@ -1231,7 +1234,7 @@ public class ServiceBuilder
                 continue;
             }
             
-            Partition partition = createPartition( directoryService, partitionBean );
+            Partition partition = createPartition( directoryService, partitionBean, txnManagerFactory,
executionManagerFactory );
             
             if ( partition != null )
             {
@@ -1251,7 +1254,7 @@ public class ServiceBuilder
      * @return An instance of DirectoryService
      * @throws Exception 
      */
-    public static DirectoryService createDirectoryService( DirectoryServiceBean directoryServiceBean,
InstanceLayout instanceLayout, SchemaManager schemaManager ) throws Exception
+    public static DirectoryService createDirectoryService( DirectoryServiceBean directoryServiceBean,
InstanceLayout instanceLayout, SchemaManager schemaManager, TxnManagerFactory txnManagerFactory,
OperationExecutionManagerFactory executionManagerFactory ) throws Exception
     {
         DirectoryService directoryService = new DefaultDirectoryService();
         
@@ -1273,7 +1276,7 @@ public class ServiceBuilder
         directoryService.setInterceptors( interceptors );
         
         // Partitions
-        Map<String, Partition> partitions = createPartitions( directoryService, directoryServiceBean.getPartitions()
);
+        Map<String, Partition> partitions = createPartitions( directoryService, directoryServiceBean.getPartitions(),
txnManagerFactory, executionManagerFactory );
 
         Partition systemPartition = partitions.remove( "system" );
 

Modified: directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java?rev=1214112&r1=1214111&r2=1214112&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
(original)
+++ directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
Wed Dec 14 08:44:46 2011
@@ -77,6 +77,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.journal.DefaultJournalStore;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.integration.http.HttpServer;
 import org.apache.directory.server.integration.http.WebApp;
 import org.apache.directory.server.kerberos.kdc.KdcServer;
@@ -1132,14 +1134,14 @@ public class ServiceBuilder
      * @throws LdapInvalidDnException
      * @throws Exception If the instance cannot be created
      */
-    public static JdbmPartition createJdbmPartition( DirectoryService directoryService, JdbmPartitionBean
jdbmPartitionBean ) throws ConfigurationException
+    public static JdbmPartition createJdbmPartition( DirectoryService directoryService, JdbmPartitionBean
jdbmPartitionBean, TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory
) throws ConfigurationException
     {
         if ( ( jdbmPartitionBean == null ) || jdbmPartitionBean.isDisabled() )
         {
             return null;
         }
         
-        JdbmPartition jdbmPartition = new JdbmPartition( directoryService.getSchemaManager()
);
+        JdbmPartition jdbmPartition = new JdbmPartition( directoryService.getSchemaManager(),
txnManagerFactory, executionManagerFactory );
         
         jdbmPartition.setCacheSize( jdbmPartitionBean.getPartitionCacheSize() );
         jdbmPartition.setId( jdbmPartitionBean.getPartitionId() );
@@ -1198,7 +1200,8 @@ public class ServiceBuilder
      * @return The instantiated Partition
      * @throws ConfigurationException If we cannot process the Partition
      */
-    public static Partition createPartition( DirectoryService directoryService, PartitionBean
partitionBean ) throws ConfigurationException
+    public static Partition createPartition( DirectoryService directoryService, PartitionBean
partitionBean, 
+        TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory
) throws ConfigurationException
     {
         if ( ( partitionBean == null ) || partitionBean.isDisabled() )
         {
@@ -1207,7 +1210,7 @@ public class ServiceBuilder
         
         if ( partitionBean instanceof JdbmPartitionBean )
         {
-            return createJdbmPartition( directoryService, (JdbmPartitionBean)partitionBean
);
+            return createJdbmPartition( directoryService, (JdbmPartitionBean)partitionBean,
txnManagerFactory, executionManagerFactory );
         }
         else
         {
@@ -1222,7 +1225,8 @@ public class ServiceBuilder
      * @return A Map of all the instantiated partitions
      * @throws ConfigurationException If we cannot process some Partition
      */
-    public static Map<String, Partition> createPartitions( DirectoryService directoryService,
List<PartitionBean> partitionBeans ) throws ConfigurationException
+    public static Map<String, Partition> createPartitions( DirectoryService directoryService,
List<PartitionBean> partitionBeans, 
+        TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory
) throws ConfigurationException
     {
         Map<String, Partition> partitions = new HashMap<String, Partition>( partitionBeans.size()
);
         
@@ -1233,7 +1237,7 @@ public class ServiceBuilder
                 continue;
             }
             
-            Partition partition = createPartition( directoryService, partitionBean );
+            Partition partition = createPartition( directoryService, partitionBean, txnManagerFactory,
executionManagerFactory );
             
             if ( partition != null )
             {
@@ -1253,9 +1257,12 @@ public class ServiceBuilder
      * @return An instance of DirectoryService
      * @throws Exception
      */
-    public static DirectoryService createDirectoryService( DirectoryServiceBean directoryServiceBean,
InstanceLayout instanceLayout, SchemaManager schemaManager ) throws Exception
+    public static DirectoryService createDirectoryService( DirectoryServiceBean directoryServiceBean,
InstanceLayout instanceLayout, SchemaManager schemaManager,
+        TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory
) throws Exception
     {
         DirectoryService directoryService = new DefaultDirectoryService();
+        ( ( DefaultDirectoryService ) directoryService ).setTxnManagerFactory( txnManagerFactory
);
+        ( ( DefaultDirectoryService ) directoryService ).setExecutionManagerFactory( executionManagerFactory
);
         
         // The schemaManager
         directoryService.setSchemaManager( schemaManager );
@@ -1275,7 +1282,7 @@ public class ServiceBuilder
         directoryService.setInterceptors( interceptors );
         
         // Partitions
-        Map<String, Partition> partitions = createPartitions( directoryService, directoryServiceBean.getPartitions()
);
+        Map<String, Partition> partitions = createPartitions( directoryService, directoryServiceBean.getPartitions(),
txnManagerFactory, executionManagerFactory );
 
         Partition systemPartition = partitions.remove( "system" );
 

Modified: directory/apacheds/branches/apacheds-txns/service-osgi/src/main/java/org/apache/directory/server/ApacheDsService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/service-osgi/src/main/java/org/apache/directory/server/ApacheDsService.java?rev=1214112&r1=1214111&r2=1214112&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/service-osgi/src/main/java/org/apache/directory/server/ApacheDsService.java
(original)
+++ directory/apacheds/branches/apacheds-txns/service-osgi/src/main/java/org/apache/directory/server/ApacheDsService.java
Wed Dec 14 08:44:46 2011
@@ -47,6 +47,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.schema.SchemaPartition;
 import org.apache.directory.server.core.partition.ldif.LdifPartition;
 import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.integration.http.HttpServer;
 import org.apache.directory.server.kerberos.kdc.KdcServer;
@@ -136,6 +138,9 @@ public class ApacheDsService
     private boolean isConfigPartitionFirstExtraction = false;
 
     private boolean isSchemaPartitionFirstExtraction = false;
+    
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
 
     /**
@@ -160,6 +165,10 @@ public class ApacheDsService
 
         LOG.info( "using partition dir {}", partitionsDir.getAbsolutePath() );
 
+        txnManagerFactory = new TxnManagerFactory( instanceLayout.getTxnLogDirectory().getPath(),

+            DirectoryService.TXN_LOG_BUFFER_SIZE, DirectoryService.TXN_LOG_FILE_SIZE );
+        executionManagerFactory = new OperationExecutionManagerFactory( txnManagerFactory
);
+        
         initSchemaManager( instanceLayout );
         initSchemaLdifPartition( instanceLayout );
         initConfigPartition( instanceLayout );
@@ -247,7 +256,7 @@ public class ApacheDsService
         File schemaPartitionDirectory = new File( instanceLayout.getPartitionsDirectory(),
"schema" );
 
         // Init the LdifPartition
-        schemaLdifPartition = new LdifPartition( schemaManager );
+        schemaLdifPartition = new LdifPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         schemaLdifPartition.setPartitionPath( schemaPartitionDirectory.toURI() );
     }
 
@@ -274,7 +283,7 @@ public class ApacheDsService
             isConfigPartitionFirstExtraction = true;
         }
 
-        configPartition = new SingleFileLdifPartition( schemaManager );
+        configPartition = new SingleFileLdifPartition( schemaManager, txnManagerFactory,
executionManagerFactory );
         configPartition.setId( "config" );
         configPartition.setPartitionPath( confFile.toURI() );
         configPartition.setSuffixDn( new Dn( schemaManager, "ou=config" ) );
@@ -292,7 +301,7 @@ public class ApacheDsService
         long startTime = System.currentTimeMillis();
 
         DirectoryService directoryService = ServiceBuilder.createDirectoryService( directoryServiceBean,
-            instanceLayout, schemaManager );
+            instanceLayout, schemaManager, txnManagerFactory, executionManagerFactory );
 
         // The schema partition
         SchemaPartition schemaPartition = new SchemaPartition( schemaManager );

Modified: directory/apacheds/branches/apacheds-txns/service/src/main/java/org/apache/directory/server/ApacheDsService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/service/src/main/java/org/apache/directory/server/ApacheDsService.java?rev=1214112&r1=1214111&r2=1214112&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/service/src/main/java/org/apache/directory/server/ApacheDsService.java
(original)
+++ directory/apacheds/branches/apacheds-txns/service/src/main/java/org/apache/directory/server/ApacheDsService.java
Wed Dec 14 08:44:46 2011
@@ -29,6 +29,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
+import javax.lang.model.element.ExecutableElement;
+
 import org.apache.directory.server.config.ConfigPartitionReader;
 import org.apache.directory.server.config.LdifConfigExtractor;
 import org.apache.directory.server.config.beans.ConfigBean;
@@ -38,6 +40,7 @@ import org.apache.directory.server.confi
 import org.apache.directory.server.config.beans.LdapServerBean;
 import org.apache.directory.server.config.beans.NtpServerBean;
 import org.apache.directory.server.config.builder.ServiceBuilder;
+import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.InstanceLayout;
@@ -47,6 +50,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.schema.SchemaPartition;
 import org.apache.directory.server.core.partition.ldif.LdifPartition;
 import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.integration.http.HttpServer;
 import org.apache.directory.server.kerberos.kdc.KdcServer;
@@ -137,6 +142,8 @@ public class ApacheDsService
 
     private boolean isSchemaPartitionFirstExtraction = false;
 
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
     /**
      * starts various services configured according to the 
@@ -160,6 +167,10 @@ public class ApacheDsService
 
         LOG.info( "using partition dir {}", partitionsDir.getAbsolutePath() );
 
+        txnManagerFactory = new TxnManagerFactory( instanceLayout.getTxnLogDirectory().getPath(),

+            DirectoryService.TXN_LOG_BUFFER_SIZE, DirectoryService.TXN_LOG_FILE_SIZE );
+        executionManagerFactory = new OperationExecutionManagerFactory( txnManagerFactory
);
+        
         initSchemaManager( instanceLayout );
         initSchemaLdifPartition( instanceLayout );
         initConfigPartition( instanceLayout );
@@ -247,7 +258,7 @@ public class ApacheDsService
         File schemaPartitionDirectory = new File( instanceLayout.getPartitionsDirectory(),
"schema" );
 
         // Init the LdifPartition
-        schemaLdifPartition = new LdifPartition( schemaManager );
+        schemaLdifPartition = new LdifPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         schemaLdifPartition.setPartitionPath( schemaPartitionDirectory.toURI() );
     }
 
@@ -274,7 +285,7 @@ public class ApacheDsService
             isConfigPartitionFirstExtraction = true;
         }
 
-        configPartition = new SingleFileLdifPartition( schemaManager );
+        configPartition = new SingleFileLdifPartition( schemaManager, txnManagerFactory,
executionManagerFactory );
         configPartition.setId( "config" );
         configPartition.setPartitionPath( confFile.toURI() );
         configPartition.setSuffixDn( new Dn( schemaManager, "ou=config" ) );
@@ -290,9 +301,9 @@ public class ApacheDsService
         LOG.info( "Initializing the DirectoryService..." );
 
         long startTime = System.currentTimeMillis();
-
+ 
         DirectoryService directoryService = ServiceBuilder.createDirectoryService( directoryServiceBean,
-            instanceLayout, schemaManager );
+            instanceLayout, schemaManager, txnManagerFactory, executionManagerFactory );
 
         // The schema partition
         SchemaPartition schemaPartition = new SchemaPartition( schemaManager );



Mime
View raw message