directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r925506 - in /directory/apacheds/trunk: avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/ core-api/src/main/java/org/apache/directory/server/core/partition/ core/src/main/java/org/apache/directory/server/core/parti...
Date Sat, 20 Mar 2010 00:50:21 GMT
Author: elecharny
Date: Sat Mar 20 00:50:21 2010
New Revision: 925506

URL: http://svn.apache.org/viewvc?rev=925506&view=rev
Log:
Refactored the Partition classes inheritence to be more consistent (DIRSERVER-1483)

Modified:
    directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlPartition.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/partition/NullPartition.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
    directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
    directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java

Modified: directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlPartition.java?rev=925506&r1=925505&r2=925506&view=diff
==============================================================================
--- directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlPartition.java
(original)
+++ directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlPartition.java
Sat Mar 20 00:50:21 2010
@@ -61,7 +61,7 @@ public class AvlPartition extends Abstra
     /**
      * {@inheritDoc}
      */
-    public void initialize() throws Exception
+    protected void doInit() throws Exception
     {
         setSchemaManager( schemaManager );
 

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?rev=925506&r1=925505&r2=925506&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
Sat Mar 20 00:50:21 2010
@@ -83,9 +83,7 @@ public abstract class AbstractPartition 
      * Override this method to put your initialization code.
      * @throws Exception 
      */
-    protected void doInit() throws InvalidNameException, Exception
-    {
-    }
+    protected abstract void doInit() throws InvalidNameException, Exception;
 
 
     /**
@@ -93,7 +91,7 @@ public abstract class AbstractPartition 
      * and clears default properties.  Once this method is invoked, {@link #isInitialized()}
      * will return <tt>false</tt>.
      */
-    public final void destroy()
+    public final void destroy() throws Exception
     {
         try
         {
@@ -109,15 +107,13 @@ public abstract class AbstractPartition 
     /**
      * Override this method to put your initialization code.
      */
-    protected void doDestroy()
-    {
-    }
+    protected abstract void doDestroy() throws Exception;
 
 
     /**
      * Returns <tt>true</tt> if this context partition is initialized successfully.
      */
-    public final boolean isInitialized()
+    public boolean isInitialized()
     {
         return initialized;
     }
@@ -126,9 +122,7 @@ public abstract class AbstractPartition 
     /**
      * This method does nothing by default.
      */
-    public void sync() throws Exception
-    {
-    }
+    public abstract void sync() throws Exception;
 
 
     /**
@@ -154,8 +148,5 @@ public abstract class AbstractPartition 
      * with null <tt>attributeIds</tt> by default.  Please override
      * this method if there is more effective way for your implementation.
      */
-    public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception
-    {
-        return null;
-    }
+    public abstract ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws
Exception;
 }

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/partition/NullPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/partition/NullPartition.java?rev=925506&r1=925505&r2=925506&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/partition/NullPartition.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/partition/NullPartition.java
Sat Mar 20 00:50:21 2010
@@ -24,6 +24,8 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
+import javax.naming.InvalidNameException;
+
 import org.apache.commons.collections.iterators.EmptyIterator;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.filtering.EntryFilter;
@@ -32,6 +34,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
 import org.apache.directory.server.core.interceptor.context.ListOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
@@ -326,14 +329,36 @@ public class NullPartition extends Abstr
 
     public SchemaManager getSchemaManager()
     {
-        // TODO Auto-generated method stub
         return null;
     }
 
 
     public void setSchemaManager( SchemaManager schemaManager )
     {
-        // TODO Auto-generated method stub
-        
+    }
+
+
+    @Override
+    protected void doDestroy() throws Exception
+    {
+    }
+
+
+    @Override
+    protected void doInit() throws InvalidNameException, Exception
+    {
+    }
+
+
+    @Override
+    public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception
+    {
+        return null;
+    }
+
+
+    @Override
+    public void sync() throws Exception
+    {
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=925506&r1=925505&r2=925506&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
Sat Mar 20 00:50:21 2010
@@ -115,7 +115,7 @@ import org.slf4j.LoggerFactory;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DefaultPartitionNexus implements PartitionNexus
+public class DefaultPartitionNexus  extends AbstractPartition implements PartitionNexus
 {
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( DefaultPartitionNexus.class
);
@@ -211,7 +211,7 @@ public class DefaultPartitionNexus imple
     /* (non-Javadoc)
      * @see org.apache.directory.server.core.partition.PartitionNexus#initialize()
      */
-    public void initialize( ) throws Exception
+    protected void doInit( ) throws Exception
     {
         // NOTE: We ignore ContextPartitionConfiguration parameter here.
         if ( initialized )
@@ -365,7 +365,7 @@ public class DefaultPartitionNexus imple
     /* (non-Javadoc)
      * @see org.apache.directory.server.core.partition.PartitionNexus#destroy()
      */
-    public synchronized void destroy()
+    protected synchronized void doDestroy()
     {
         if ( !initialized )
         {

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=925506&r1=925505&r2=925506&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Sat Mar 20 00:50:21 2010
@@ -58,7 +58,7 @@ public class JdbmPartition extends Abstr
 
 
     @SuppressWarnings("unchecked")
-    public final void initialize() throws Exception
+    protected void doInit() throws Exception
     {
         store.setWorkingDirectory( getPartitionDir() );
 

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=925506&r1=925505&r2=925506&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
(original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
Sat Mar 20 00:50:21 2010
@@ -160,7 +160,7 @@ public class LdifPartition extends BTree
     /**
      * {@inheritDoc}
      */
-    public void initialize() throws Exception
+    protected void doInit() throws Exception
     {
         // Initialize the AvlPartition
         wrappedPartition.setId( id );
@@ -774,7 +774,7 @@ public class LdifPartition extends BTree
 
 
     @Override
-    public void destroy() throws Exception
+    protected void doDestroy() throws Exception
     {
         wrappedPartition.destroy();
     }

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=925506&r1=925505&r2=925506&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
(original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
Sat Mar 20 00:50:21 2010
@@ -43,6 +43,7 @@ import org.apache.directory.server.core.
 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.SearchOperationContext;
+import org.apache.directory.server.core.partition.AbstractPartition;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.xdbm.Index;
@@ -63,7 +64,7 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public abstract class BTreePartition<ID> implements Partition
+public abstract class BTreePartition<ID> extends AbstractPartition
 {
     protected static final Set<String> SYS_INDEX_OIDS;
 
@@ -344,12 +345,6 @@ public abstract class BTreePartition<ID>
     public abstract void sync() throws Exception;
 
 
-    public abstract void destroy() throws Exception;
-
-
-    public abstract boolean isInitialized();
-
-
     ////////////////////
     // public abstract methods
 

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java?rev=925506&r1=925505&r2=925506&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java
(original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java
Sat Mar 20 00:50:21 2010
@@ -65,7 +65,7 @@ public abstract class AbstractXdbmPartit
     /**
      * {@inheritDoc}
      */
-    public void destroy() throws Exception
+    protected void doDestroy() throws Exception
     {
         store.destroy();
     }



Mime
View raw message