directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r763045 - in /directory/apacheds/branches/ldif-partition: core-api/src/main/java/org/apache/directory/server/core/partition/ core-integ/src/test/java/org/apache/directory/server/core/configuration/ core-integ/src/test/java/org/apache/direct...
Date Tue, 07 Apr 2009 23:52:33 GMT
Author: akarasulu
Date: Tue Apr  7 23:52:33 2009
New Revision: 763045

URL: http://svn.apache.org/viewvc?rev=763045&view=rev
Log:
cleaned up a few implementation specific methods on the Partition interface and constants
which are not used.

Modified:
    directory/apacheds/branches/ldif-partition/core-api/src/main/java/org/apache/directory/server/core/partition/Partition.java
    directory/apacheds/branches/ldif-partition/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
    directory/apacheds/branches/ldif-partition/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java
    directory/apacheds/branches/ldif-partition/core/src/main/java/org/apache/directory/server/core/impl/DefaultDirectoryService.java
    directory/apacheds/branches/ldif-partition/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/branches/ldif-partition/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java

Modified: directory/apacheds/branches/ldif-partition/core-api/src/main/java/org/apache/directory/server/core/partition/Partition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/ldif-partition/core-api/src/main/java/org/apache/directory/server/core/partition/Partition.java?rev=763045&r1=763044&r2=763045&view=diff
==============================================================================
--- directory/apacheds/branches/ldif-partition/core-api/src/main/java/org/apache/directory/server/core/partition/Partition.java
(original)
+++ directory/apacheds/branches/ldif-partition/core-api/src/main/java/org/apache/directory/server/core/partition/Partition.java
Tue Apr  7 23:52:33 2009
@@ -38,37 +38,17 @@
 import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
-import javax.naming.Context;
-
 
 /**
- * An interfaces that bridges between underlying JNDI entries and JNDI
- * {@link Context} API.  DIT (Directory Information Tree) consists one or
- * above {@link Partition}s whose parent is {@link PartitionNexus},
- * and all of them are mapped to different
- * base suffix.  Each partition contains entries whose name ends with that
- * base suffix.
- *
+ * Interface for entry stores containing a part of the DIB (Directory 
+ * Information Base).  Partitions are associated with a specific suffix, and
+ * all entries contained in the them have the same DN suffix.
+ * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public interface Partition
 {
-    /** The name of reserved system partition */
-    String SYSTEM_PARTITION_NAME = "system";
-    
-    /** default partition implementation class */
-    String DEFAULT_PARTITION_IMPLEMENTATION = "org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition";
-    
-    /** the default entry cache size to use for a partition */
-    int DEFAULT_CACHE_SIZE = 10000;
-    
-
-    // -----------------------------------------------------------------------
-    // C O N F I G U R A T I O N   M E T H O D S
-    // -----------------------------------------------------------------------
-
-    
     /**
      * Gets the unique identifier for this partition.
      *
@@ -78,53 +58,6 @@
 
 
     /**
-     * Sets the unique identifier for this partition.
-     *
-     * @param id the unique identifier for this partition
-     */
-    void setId( String id );
-
-
-    /**
-     * Gets the non-normalized suffix for this Partition as a string.
-     *
-     * @return the suffix string for this Partition.
-     */
-    String getSuffix();
-
-
-    /**
-     * Sets the non-normalized suffix for this Partition as a string.
-     *
-     * @param suffix the suffix string for this Partition.
-     */
-    void setSuffix( String suffix );
-
-
-    /**
-     * Used to specify the entry cache size for a Partition.  Various Partition
-     * implementations may interpret this value in different ways: i.e. total cache
-     * size limit verses the number of entries to cache.
-     *
-     * @param cacheSize the size of the cache
-     */
-    void setCacheSize( int cacheSize );
-
-
-    /**
-     * Gets the entry cache size for this partition.
-     *
-     * @return the size of the cache
-     */
-    int getCacheSize();
-
-
-    // -----------------------------------------------------------------------
-    // E N D   C O N F I G U R A T I O N   M E T H O D S
-    // -----------------------------------------------------------------------
-
-
-    /**
      * Initializes this partition.
      *
      * @param core the directory core for the server.
@@ -134,7 +67,7 @@
 
 
     /**
-     * Deinitialized this partition.
+     * Signals to this partition that it should release its resources.
      */
     void destroy() throws Exception;
 
@@ -154,42 +87,39 @@
 
 
     /**
-     * Gets the distinguished/absolute name of the suffix for all entries
-     * stored within this ContextPartition.
+     * Gets the suffix distinguished name of this Partition.
      *
-     * @return Name representing the distinguished/absolute name of this
-     * ContextPartitions root context.
+     * @return LdapDN the distinguished name of this Partition's root entry
      * @throws Exception if access or suffix parsing fails
      */
     LdapDN getSuffixDn() throws Exception;
 
 
     /**
-     * Gets the distinguished/absolute name of the suffix for all entries
-     * stored within this ContextPartition.
+     * Gets the distinguished name of the suffix for all entries stored within 
+     * this Partition.
      *
-     * @return Name representing the distinguished/absolute name of this
-     * ContextPartitions root context.
+     * @return LdapDN representing the distinguished name of this Partition's 
+     * root entry.
      * @throws Exception if access or suffix parsing fails
      */
     LdapDN getUpSuffixDn() throws Exception;
 
 
     /**
-     * Deletes a leaf entry from this ContextPartition: non-leaf entries cannot be 
+     * Deletes a leaf entry from this Partition: non-leaf entries cannot be 
      * deleted until this operation has been applied to their children.
      *
-     * @param opContext the context of the entry to
-     * delete from this ContextPartition.
+     * @param opContext the context of the entry to delete from this Partition
      * @throws Exception if there are any problems
      */
     void delete( DeleteOperationContext opContext ) throws Exception;
 
 
     /**
-     * Adds an entry to this ContextPartition.
+     * Adds an entry to this Partition.
      *
-     * @param opContext the context used  to add and entry to this ContextPartition
+     * @param opContext the context used  to add and entry to this Partition
      * @throws Exception if there are any problems
      */
     void add( AddOperationContext opContext ) throws Exception;
@@ -198,7 +128,7 @@
     /**
      * Modifies an entry by adding, removing or replacing a set of attributes.
      *
-     * @param opContext The contetx containin the modification operation 
+     * @param opContext the context containing the modification operation 
      * to perform on the entry which is one of constants specified by the 
      * DirContext interface:
      * <code>ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE</code>.
@@ -218,7 +148,7 @@
      * used to optimize operations rather than conducting a full search with 
      * retrieval.
      *
-     * @param opContext the context containing the distinguished/absolute name for the search/listing
+     * @param opContext the context containing the distinguished name for the search/listing
      * @return a NamingEnumeration containing objects of type {@link ServerSearchResult}
      * @throws Exception if there are any problems
      */
@@ -255,6 +185,15 @@
     ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception;
     
     
+    /**
+     * Convenience method to lookup an entry by ID.
+     *
+     * TODO not used yet since we are not exposing global IDs 
+     * 
+     * @param id
+     * @return
+     * @throws Exception
+     */
     ClonedServerEntry lookup( Long id ) throws Exception;
     
 
@@ -267,6 +206,7 @@
      */
     boolean hasEntry( EntryOperationContext opContext ) throws Exception;
 
+    
     /**
      * Modifies an entry by changing its relative name. Optionally attributes
      * associated with the old relative name can be removed from the entry.

Modified: directory/apacheds/branches/ldif-partition/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/ldif-partition/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java?rev=763045&r1=763044&r2=763045&view=diff
==============================================================================
--- directory/apacheds/branches/ldif-partition/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
(original)
+++ directory/apacheds/branches/ldif-partition/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
Tue Apr  7 23:52:33 2009
@@ -27,7 +27,6 @@
 import org.apache.directory.server.core.integ.CiRunner;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.jndi.CoreContextFactory;
-import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.jdbm.JdbmPartition;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.junit.Test;
@@ -54,7 +53,7 @@
     @Test
     public void testAddAndRemove() throws Exception
     {
-        Partition partition = new JdbmPartition();
+        JdbmPartition partition = new JdbmPartition();
         partition.setId( "removable" );
         partition.setSuffix( "ou=removable" );
         

Modified: directory/apacheds/branches/ldif-partition/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/ldif-partition/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java?rev=763045&r1=763044&r2=763045&view=diff
==============================================================================
--- directory/apacheds/branches/ldif-partition/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java
(original)
+++ directory/apacheds/branches/ldif-partition/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java
Tue Apr  7 23:52:33 2009
@@ -85,12 +85,12 @@
             DirectoryService service = new DefaultDirectoryService();
             service.getChangeLog().setEnabled( true );
             
-            Partition foo = new JdbmPartition();
+            JdbmPartition foo = new JdbmPartition();
             foo.setId( "foo" );
             foo.setSuffix( "dc=foo,dc=com" );
             service.addPartition( foo );
             
-            Partition bar = new JdbmPartition();
+            JdbmPartition bar = new JdbmPartition();
             bar.setId( "bar" );
             bar.setSuffix( "dc=bar,dc=com" );
             service.addPartition( bar );

Modified: directory/apacheds/branches/ldif-partition/core/src/main/java/org/apache/directory/server/core/impl/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/ldif-partition/core/src/main/java/org/apache/directory/server/core/impl/DefaultDirectoryService.java?rev=763045&r1=763044&r2=763045&view=diff
==============================================================================
--- directory/apacheds/branches/ldif-partition/core/src/main/java/org/apache/directory/server/core/impl/DefaultDirectoryService.java
(original)
+++ directory/apacheds/branches/ldif-partition/core/src/main/java/org/apache/directory/server/core/impl/DefaultDirectoryService.java
Tue Apr  7 23:52:33 2009
@@ -1443,7 +1443,8 @@
             
             if( changeLog.isExposeChangeLog() && changeLog.isTagSearchSupported()
)
             {
-                String clSuffix = ( ( TaggableSearchableChangeLogStore ) changeLog.getChangeLogStore()
).getPartition().getSuffix();
+                String clSuffix = ( ( TaggableSearchableChangeLogStore ) changeLog.getChangeLogStore()
)
+                    .getPartition().getSuffixDn().getUpName();
                 partitionNexus.getRootDSE( null ).getOriginalEntry().add( SchemaConstants.CHANGELOG_CONTEXT_AT,
clSuffix );
             }
         }

Modified: directory/apacheds/branches/ldif-partition/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/ldif-partition/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=763045&r1=763044&r2=763045&view=diff
==============================================================================
--- directory/apacheds/branches/ldif-partition/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
(original)
+++ directory/apacheds/branches/ldif-partition/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
Tue Apr  7 23:52:33 2009
@@ -364,11 +364,12 @@
         }
         else
         {
-            system = new JdbmPartition();
-            system.setId( "system" );
-            system.setCacheSize( 500 );
-            system.setSuffix( ServerDNConstants.SYSTEM_DN );
-//            throw new LdapConfigurationException( "No system partition found" );
+            JdbmPartition jdbmPartition = new JdbmPartition();
+            jdbmPartition.setId( "system" );
+            jdbmPartition.setCacheSize( 500 );
+            jdbmPartition.setSuffix( ServerDNConstants.SYSTEM_DN );
+
+            system = jdbmPartition;
         }
 
         system.init( directoryService );
@@ -575,7 +576,7 @@
         Partition partition = opContext.getPartition();
 
         // Turn on default indices
-        String key = partition.getSuffix();
+        String key = partition.getSuffixDn().getUpName();
         
         if ( partitions.containsKey( key ) )
         {

Modified: directory/apacheds/branches/ldif-partition/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/ldif-partition/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java?rev=763045&r1=763044&r2=763045&view=diff
==============================================================================
--- directory/apacheds/branches/ldif-partition/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
(original)
+++ directory/apacheds/branches/ldif-partition/core/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
Tue Apr  7 23:52:33 2009
@@ -47,13 +47,13 @@
     /**
      * Test the addition of a single partition
      */
-    @Test public void testNewPartitionTree() throws NamingException
+    @Test public void testNewPartitionTree() throws Exception
     {
         /** A structure to hold all the partitions */
         DnBranchNode<Partition> partitionLookupTree = new DnBranchNode<Partition>();
         
         LdapDN suffix = new LdapDN( "dc=example, dc=com" );
-        Partition partition = new JdbmPartition();
+        JdbmPartition partition = new JdbmPartition();
         partition.setSuffix( suffix.getUpName() );
         
         partitionLookupTree.add( suffix, partition );
@@ -67,26 +67,26 @@
         assertTrue( ((DnBranchNode<Partition>)child).contains( "dc=example" ) );
 
         child = ((DnBranchNode<Partition>)child).getChild( "dc=example" );
-        assertEquals( "dc=example, dc=com", ((DnLeafNode<Partition>)child).getElement().getSuffix()
);
+        assertEquals( "dc=example, dc=com", ((DnLeafNode<Partition>)child).getElement().getSuffixDn().getUpName()
);
     }
 
 
     /**
      * Test the addition of a two disjointed partition
      */
-    @Test public void testNewPartitionTree2Nodes() throws NamingException
+    @Test public void testNewPartitionTree2Nodes() throws Exception
     {
         /** A structure to hold all the partitions */
         DnBranchNode<Partition> partitionLookupTree = new DnBranchNode<Partition>();
         
         LdapDN suffix1 = new LdapDN( "dc=example, dc=com" );
-        Partition partition1 = new JdbmPartition();
+        JdbmPartition partition1 = new JdbmPartition();
         partition1.setSuffix( suffix1.getUpName() );
         
         partitionLookupTree.add( suffix1, partition1 );
         
         LdapDN suffix2 = new LdapDN( "ou=system" );
-        Partition partition2 = new JdbmPartition();
+        JdbmPartition partition2 = new JdbmPartition();
         partition2.setSuffix( suffix2.getUpName() );
         
         partitionLookupTree.add( suffix2, partition2 );
@@ -98,7 +98,7 @@
         
         DnNode<Partition> child = ((DnBranchNode<Partition>)partitionLookupTree).getChild(
"ou=system" );
         assertTrue( child instanceof DnLeafNode );
-        assertEquals( "ou=system", ((DnLeafNode<Partition>)child).getElement().getSuffix()
);
+        assertEquals( "ou=system", ((DnLeafNode<Partition>)child).getElement().getSuffixDn().getUpName()
);
 
         child = ((DnBranchNode<Partition>)partitionLookupTree).getChild( "dc=com" );
         assertTrue( child instanceof DnBranchNode );
@@ -106,26 +106,26 @@
         
         child = ((DnBranchNode<Partition>)child).getChild( "dc=example" );
         assertTrue( child instanceof DnLeafNode );
-        assertEquals( "dc=example, dc=com", ((DnLeafNode<Partition>)child).getElement().getSuffix()
);
+        assertEquals( "dc=example, dc=com", ((DnLeafNode<Partition>)child).getElement().getSuffixDn().getUpName()
);
     }
 
 
     /**
      * Test the addition of a two overlapping partitions
      */
-    @Test public void testNewPartitionTree2OverlapingNodes() throws NamingException
+    @Test public void testNewPartitionTree2OverlapingNodes() throws Exception
     {
         /** A structure to hold all the partitions */
         DnBranchNode<Partition> partitionLookupTree = new DnBranchNode<Partition>();
         
         LdapDN suffix1 = new LdapDN( "dc=com" );
-        Partition partition1 = new JdbmPartition();
+        JdbmPartition partition1 = new JdbmPartition();
         partition1.setSuffix( suffix1.getUpName() );
         
         partitionLookupTree.add( suffix1, partition1 );
         
         LdapDN suffix2 = new LdapDN( "dc=example, dc=com" );
-        Partition partition2 = new JdbmPartition();
+        JdbmPartition partition2 = new JdbmPartition();
         partition2.setSuffix( suffix2.getUpName() );
         
         try
@@ -143,19 +143,19 @@
     /**
      * Test the addition of a two partitions with the same root
      */
-    @Test public void testNewPartitionTree2NodesWithSameRoot() throws NamingException
+    @Test public void testNewPartitionTree2NodesWithSameRoot() throws Exception
     {
         /** A structure to hold all the partitions */
         DnBranchNode<Partition> partitionLookupTree = new DnBranchNode<Partition>();
         
         LdapDN suffix1 = new LdapDN( "dc=example1, dc=com" );
-        Partition partition1 = new JdbmPartition();
+        JdbmPartition partition1 = new JdbmPartition();
         partition1.setSuffix( suffix1.getUpName() );
         
         partitionLookupTree.add( suffix1, partition1 );
         
         LdapDN suffix2 = new LdapDN( "dc=example2, dc=com" );
-        Partition partition2 = new JdbmPartition();
+        JdbmPartition partition2 = new JdbmPartition();
         partition2.setSuffix( suffix2.getUpName() );
         
         partitionLookupTree.add( suffix2, partition2 );
@@ -175,10 +175,10 @@
         
         DnNode<Partition> child1 = ((DnBranchNode<Partition>)child).getChild(
"dc=example1" );
         assertTrue( child1 instanceof DnLeafNode );
-        assertEquals( "dc=example1, dc=com", ((DnLeafNode<Partition>)child1).getElement().getSuffix()
);
+        assertEquals( "dc=example1, dc=com", ((DnLeafNode<Partition>)child1).getElement().getSuffixDn().getUpName()
);
 
         DnNode<Partition> child2 = ((DnBranchNode<Partition>)child).getChild(
"dc=example1" );
         assertTrue( child2 instanceof DnLeafNode );
-        assertEquals( "dc=example1, dc=com", ((DnLeafNode<Partition>)child2).getElement().getSuffix()
);
+        assertEquals( "dc=example1, dc=com", ((DnLeafNode<Partition>)child2).getElement().getSuffixDn().getUpName()
);
     }
 }



Mime
View raw message