directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r813058 - in /directory/apacheds/branches/apacheds-schema: core-api/src/main/java/org/apache/directory/server/core/interceptor/ core-api/src/main/java/org/apache/directory/server/core/partition/ core-api/src/main/java/org/apache/directory/s...
Date Wed, 09 Sep 2009 17:51:14 GMT
Author: elecharny
Date: Wed Sep  9 17:51:13 2009
New Revision: 813058

URL: http://svn.apache.org/viewvc?rev=813058&view=rev
Log:
Many fixes, core-integ is close to work, but not yet.

Modified:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
    directory/apacheds/branches/apacheds-schema/core-integ/pom.xml
    directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java
    directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/ReferralManagerImpl.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
    directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java
    directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java
    directory/apacheds/branches/apacheds-schema/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/branches/apacheds-schema/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
Wed Sep  9 17:51:13 2009
@@ -264,6 +264,7 @@
 
             if ( t instanceof Exception )
             {
+                t.printStackTrace();
                 throw ( Exception ) t;
             }
             else

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
Wed Sep  9 17:51:13 2009
@@ -89,6 +89,10 @@
             doInit();
             initialized = true;
         }
+        catch ( Exception e )
+        {
+            e.printStackTrace();
+        }
         finally
         {
             if ( !initialized )

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
Wed Sep  9 17:51:13 2009
@@ -232,10 +232,13 @@
 
         wrapped.setId( ID );
         wrapped.setSuffix( ServerDNConstants.OU_SCHEMA_DN );
+        wrapped.getSuffixDn().normalize( registries.getAttributeTypeRegistry().getNormalizerMapping()
);
+        wrapped.setRegistries( registries );
         
         try
         {
             wrapped.initialize();
+            
             PartitionSchemaLoader partitionLoader = new PartitionSchemaLoader( wrapped, registries
);
             synchronizer = new RegistrySynchronizerAdaptor( registries, partitionLoader );
             loader = partitionLoader;

Modified: directory/apacheds/branches/apacheds-schema/core-integ/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/pom.xml?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/pom.xml (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/pom.xml Wed Sep  9 17:51:13 2009
@@ -71,6 +71,12 @@
       <version>${pom.version}</version>
     </dependency>  
 
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-avl-partition</artifactId>
+      <version>${pom.version}</version>
+    </dependency>  
   </dependencies>
 
   <profiles>

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java
Wed Sep  9 17:51:13 2009
@@ -19,10 +19,22 @@
 package org.apache.directory.server.core.integ;
 
 
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.partition.Partition;
+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.partition.ldif.LdifPartition;
 import org.apache.directory.server.core.schema.SchemaPartition;
+import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.schema.registries.Registries;
 
 
 /**
@@ -44,17 +56,68 @@
     {
         public DirectoryService newInstance() throws Exception
         {
+            String workingDirectory = System.getProperty( "workingDirectory" );
+
+            if ( workingDirectory == null )
+            {
+                String path = DirectoryServiceFactory.class.getResource( "" ).getPath();
+                int targetPos = path.indexOf( "target" );
+                workingDirectory = path.substring( 0, targetPos + 6 );
+            }
+
             DirectoryService service = new DefaultDirectoryService();
-            SchemaPartition schemaPartition = new SchemaPartition();
-            LdifPartition wrapped = new LdifPartition();
-            schemaPartition.setWrappedPartition( wrapped );
-            service.getSchemaService().setSchemaPartition( schemaPartition );
+            SchemaPartition schemaPartition = service.getSchemaService().getSchemaPartition();
+            Registries registries = service.getRegistries();
+            
+            // Init the LdifPartition
+            LdifPartition ldifPartition = new LdifPartition();
+            
+            ldifPartition.setWorkingDirectory( workingDirectory + "/schema" );
+            
+            // Init the AvlPartition
+            //AvlPartition avlPartition = new AvlPartition();
+            //avlPartition.setId( "schema" );
+            //avlPartition.setSuffix( "ou=schema" );
+            //avlPartition.setRegistries( registries );
+            
+            // Inject the AvlPartition into the LdifPartition
+            //ldifPartition.setWrappedPartition( avlPartition );
+            
+            // Extract the schema on disk (a brand new one) and load the registries
+            //File schemaRepository = new File( workingDirectory, "schema" );
+            //SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory
) );
+            //extractor.extractOrCopy();
+            //LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
+            //loader.loadAllEnabled( registries );
+
+            // Initialize the LdifPartition now that the registries are loaded
+            //ldifPartition.initialize();
+            
+            schemaPartition.setWrappedPartition( ldifPartition );
+            schemaPartition.setRegistries( registries );
+            
             service.getChangeLog().setEnabled( true );
 
             // change the working directory to something that is unique
             // on the system and somewhere either under target directory
             // or somewhere in a temp area of the machine.
-
+            
+            // Inject the System Partition
+            Partition systemPartition = new JdbmPartition();
+            systemPartition.setId( "system" );
+            ((JdbmPartition)systemPartition).setCacheSize( 500 );
+            systemPartition.setSuffix( ServerDNConstants.SYSTEM_DN );
+            systemPartition.setRegistries( registries );
+            ((JdbmPartition)systemPartition).setPartitionDir( new File( workingDirectory
) );
+    
+            // Add objectClass attribute for the system partition
+            Set<Index<?,ServerEntry>> indexedAttrs = new HashSet<Index<?,ServerEntry>>();
+            indexedAttrs.add( 
+                new JdbmIndex<Object,ServerEntry>( SchemaConstants.OBJECT_CLASS_AT
) );
+            ( ( JdbmPartition ) systemPartition ).setIndexedAttributes( indexedAttrs );
+            
+            service.setSystemPartition( systemPartition );
+            
             return service;
         }
     };

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
Wed Sep  9 17:51:13 2009
@@ -19,13 +19,14 @@
 package org.apache.directory.server.core.integ.state;
 
 
+import static org.apache.directory.server.core.integ.IntegrationUtils.doDelete;
+
 import java.io.IOException;
 
 import javax.naming.NamingException;
 
 import org.apache.directory.server.core.integ.DirectoryServiceFactory;
 import org.apache.directory.server.core.integ.InheritableSettings;
-import static org.apache.directory.server.core.integ.IntegrationUtils.doDelete;
 import org.junit.runner.notification.RunNotifier;
 import org.junit.runners.model.Statement;
 import org.junit.runners.model.TestClass;
@@ -83,6 +84,7 @@
         }
         catch ( Exception e )
         {
+            e.printStackTrace();
             throw new NamingException( e.getMessage() );
         }
     }
@@ -128,7 +130,7 @@
      * PRISTINE and ROLLBACK modes we do the same but cleanup() before a
      * restart.
      *
-     * @see TestServiceState#test(TestClass, TestMethod, RunNotifier, InheritableSettings)

+     * @see TestServiceState#test(TestClass, RunNotifier, InheritableSettings) 
      */
     public void test( TestClass testClass, Statement statement, RunNotifier notifier, InheritableSettings
settings )
     {

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Wed Sep  9 17:51:13 2009
@@ -20,6 +20,20 @@
 package org.apache.directory.server.core;
 
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.naming.NamingException;
+
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
 import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
@@ -49,15 +63,13 @@
 import org.apache.directory.server.core.journal.JournalInterceptor;
 import org.apache.directory.server.core.normalization.NormalizationInterceptor;
 import org.apache.directory.server.core.operational.OperationalAttributeInterceptor;
-
-import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.DefaultPartitionNexus;
+import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.PartitionNexus;
-
 import org.apache.directory.server.core.referral.ReferralInterceptor;
 import org.apache.directory.server.core.replication.ReplicationConfiguration;
-import org.apache.directory.server.core.schema.SchemaInterceptor;
 import org.apache.directory.server.core.schema.DefaultSchemaService;
+import org.apache.directory.server.core.schema.SchemaInterceptor;
 import org.apache.directory.server.core.schema.SchemaService;
 import org.apache.directory.server.core.security.TlsKeyGenerator;
 import org.apache.directory.server.core.subtree.SubentryInterceptor;
@@ -87,20 +99,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingException;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
 
 /**
  * Default implementation of {@link DirectoryService}.
@@ -1409,6 +1407,8 @@
 
         // triggers partition to load schema fully from schema partition
         schemaService.getSchemaPartition().initialize( );
+        partitions.add( schemaService.getSchemaPartition() );
+        systemPartition.getSuffixDn().normalize( getRegistries().getAttributeTypeRegistry().getNormalizerMapping()
);
 
         adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
         adminDn.normalize( getRegistries().getAttributeTypeRegistry().getNormalizerMapping()
);
@@ -1416,8 +1416,9 @@
         
         // @TODO - NOTE: Need to find a way to instantiate without dependency on DPN
         partitionNexus = new DefaultPartitionNexus( new DefaultServerEntry( getRegistries(),
LdapDN.EMPTY_LDAPDN ) );
+        partitionNexus.setDirectoryService( this );
         partitionNexus.initialize( );
-        partitionNexus.addContextPartition( new AddContextPartitionOperationContext( adminSession,
schemaService.getSchemaPartition() ) );
+        //partitionNexus.addContextPartition( new AddContextPartitionOperationContext( adminSession,
schemaService.getSchemaPartition() ) );
 
         // --------------------------------------------------------------------
         // Create all the bootstrap entries before initializing chain

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/ReferralManagerImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/ReferralManagerImpl.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/ReferralManagerImpl.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/ReferralManagerImpl.java
Wed Sep  9 17:51:13 2009
@@ -20,7 +20,7 @@
 package org.apache.directory.server.core;
 
 
-import java.util.Set; 
+import java.util.Set;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import javax.naming.NamingException;
@@ -30,13 +30,13 @@
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.tree.DnBranchNode;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.util.tree.DnBranchNode;
 
 
 /**
@@ -155,6 +155,7 @@
         {
             // We will store each entry's DN into the Referral tree
             LdapDN suffixDn = new LdapDN( suffix );
+            suffixDn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping()
);
             EntryFilteringCursor cursor = nexus.search( new SearchOperationContext( adminSession,
suffixDn, AliasDerefMode.DEREF_ALWAYS,
                 referralFilter, searchControl ) );
             

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
Wed Sep  9 17:51:13 2009
@@ -20,15 +20,15 @@
 package org.apache.directory.server.core.authz;
 
 
-import javax.naming.directory.SearchControls;
-import javax.naming.NamingException;
-
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.naming.NamingException;
+import javax.naming.directory.SearchControls;
+
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.entry.ServerAttribute;
@@ -138,7 +138,7 @@
 
         for ( String suffix:suffixes )
         {
-            LdapDN baseDn = new LdapDN( suffix );
+            LdapDN baseDn = new LdapDN( suffix ).normalize( normalizerMap );
             SearchControls ctls = new SearchControls();
             ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
Wed Sep  9 17:51:13 2009
@@ -232,6 +232,7 @@
         
         List<Partition> initializedPartitions = new ArrayList<Partition>();
         initializedPartitions.add( 0, this.system );
+
     
         try
         {
@@ -297,6 +298,9 @@
 
             system = override;
         }
+        else
+        {
+        }
 
         system.initialize( );
         
@@ -838,6 +842,7 @@
             throw new LdapNameNotFoundException();
         }
     
+        base.normalize( atRegistry.getNormalizerMapping() );
         Partition backend = getPartition( base );
         return backend.search( opContext );
     }
@@ -1087,4 +1092,22 @@
         
         partitions.remove( partition.getSuffixDn().getUpName() );
     }
+
+
+    /**
+     * @return the directoryService
+     */
+    public DirectoryService getDirectoryService()
+    {
+        return directoryService;
+    }
+
+
+    /**
+     * @param directoryService the directoryService to set
+     */
+    public void setDirectoryService( DirectoryService directoryService )
+    {
+        this.directoryService = directoryService;
+    }
 }

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
Wed Sep  9 17:51:13 2009
@@ -20,6 +20,17 @@
 package org.apache.directory.server.core.trigger;
 
 
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.NamingException;
+import javax.naming.directory.SearchControls;
+
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.CoreSession;
@@ -37,6 +48,7 @@
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
@@ -46,19 +58,9 @@
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.trigger.TriggerSpecification;
 import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
-import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.directory.SearchControls;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 
 /**
  * A cache for Trigger Specifications which responds to specific events to

Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java
Wed Sep  9 17:51:13 2009
@@ -20,11 +20,9 @@
 package org.apache.directory.server.core.authz.support;
 
 
-import org.apache.directory.server.core.authz.support.OperationScope;
-import org.junit.Test;
-
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
+
+import org.junit.Test;
 
 
 /**

Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java
Wed Sep  9 17:51:13 2009
@@ -20,6 +20,8 @@
 package org.apache.directory.server.core.authz.support;
 
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -28,11 +30,6 @@
 
 import javax.naming.NamingException;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-import org.apache.directory.server.core.authz.support.OperationScope;
-import org.apache.directory.server.core.authz.support.RelatedUserClassFilter;
 import org.apache.directory.server.core.subtree.SubtreeEvaluator;
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;

Modified: directory/apacheds/branches/apacheds-schema/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/branches/apacheds-schema/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Wed Sep  9 17:51:13 2009
@@ -20,6 +20,13 @@
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
 
 
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.naming.NamingException;
+
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
@@ -45,13 +52,6 @@
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
-import javax.naming.NamingException;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
 
 /**
  * A {@link Partition} that stores entries in
@@ -119,7 +119,8 @@
     @SuppressWarnings("unchecked")
     public final void initialize( ) throws Exception
     {
-        store.init( registries );
+        store.setWorkingDirectory( getPartitionDir() );
+        //store.init( registries );
 
         EvaluatorBuilder evaluatorBuilder = new EvaluatorBuilder( store, registries );
         CursorBuilder cursorBuilder = new CursorBuilder( store, evaluatorBuilder );

Modified: directory/apacheds/branches/apacheds-schema/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=813058&r1=813057&r2=813058&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
(original)
+++ directory/apacheds/branches/apacheds-schema/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
Wed Sep  9 17:51:13 2009
@@ -40,6 +40,7 @@
 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
 import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
+import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.avl.AvlPartition;
 import org.apache.directory.server.core.partition.impl.btree.BTreePartition;
 import org.apache.directory.server.xdbm.Index;
@@ -137,9 +138,13 @@
     /** The extension used for LDIF entry files */
     private static final String CONF_FILE_EXTN = ".ldif";
 
-    /** We use an AVL partition to manage searches on this partition */
+    /** We use a partition to manage searches on this partition */
     private AvlPartition wrappedPartition;
 
+    /** A default CSN factory */
+    private static CsnFactory defaultCSNFactory;
+    
+    
     /**
      * Creates a new instance of LdifPartition.
      */
@@ -154,7 +159,15 @@
      */
     public void initialize() throws Exception
     {
+        // Initialize the AvlPartition
+        wrappedPartition.setId( id );
+        wrappedPartition.setSuffix( suffix.getUpName() );
+        wrappedPartition.setRegistries( registries );
         wrappedPartition.initialize();
+        
+        // Create the CsnFactory with a invalid ReplicaId
+        // @TODO : inject a correct ReplicaId
+        defaultCSNFactory = new CsnFactory( 0 );
 
         this.searchEngine = wrappedPartition.getSearchEngine();
 
@@ -209,8 +222,6 @@
             
             if ( contextEntry.get( SchemaConstants.ENTRY_CSN_AT ) == null )
             {
-                CsnFactory defaultCSNFactory = new CsnFactory( 0 );
-
                 contextEntry.add( SchemaConstants.ENTRY_CSN_AT, defaultCSNFactory.newInstance().toString()
);
             }
             
@@ -400,6 +411,16 @@
                     LOG.debug( "Adding entry {}", ldifEntry );
 
                     ServerEntry serverEntry = new DefaultServerEntry( registries, ldifEntry.getEntry()
);
+                    
+                    if ( !serverEntry.containsAttribute( SchemaConstants.ENTRY_CSN_AT ) )
+                    {
+                        serverEntry.put( SchemaConstants.ENTRY_CSN_AT, defaultCSNFactory.newInstance().toString()
);
+                    }
+                    
+                    if ( !serverEntry.containsAttribute( SchemaConstants.ENTRY_UUID_AT )
)
+                    {
+                        serverEntry.put( SchemaConstants.ENTRY_UUID_AT, SchemaUtils.uuidToBytes(
UUID.randomUUID() ) );
+                    }
 
                     // call add on the wrapped partition not on the self
                     wrappedPartition.getStore().add( serverEntry );
@@ -814,7 +835,7 @@
     @Override
     public boolean isInitialized()
     {
-        return wrappedPartition.isInitialized();
+        return wrappedPartition != null && wrappedPartition.isInitialized();
     }
 
 
@@ -878,7 +899,6 @@
     public void setRegistries( Registries registries )
     {
         super.setRegistries( registries );
-        wrappedPartition.setRegistries( registries );
     }
 
 
@@ -912,7 +932,7 @@
 
     public LdapDN getSuffixDn()
     {
-        return wrappedPartition.getSuffixDn();
+        return suffix;
     }
 
 
@@ -994,4 +1014,22 @@
         
         this.contextEntry = new DefaultServerEntry( registries, entries.get( 0 ).getEntry()
);
     }
+
+
+    /**
+     * @return the wrappedPartition
+     */
+    public Partition getWrappedPartition()
+    {
+        return wrappedPartition;
+    }
+
+
+    /**
+     * @param wrappedPartition the wrappedPartition to set
+     */
+    public void setWrappedPartition( AvlPartition wrappedPartition )
+    {
+        this.wrappedPartition = wrappedPartition;
+    }
 }
\ No newline at end of file



Mime
View raw message