You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/05/21 02:32:05 UTC

svn commit: r658514 - in /directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition: Partition.java impl/btree/BTreePartition.java

Author: akarasulu
Date: Tue May 20 17:32:05 2008
New Revision: 658514

URL: http://svn.apache.org/viewvc?rev=658514&view=rev
Log:
preparing interfaces to use new partition with Cursors

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java?rev=658514&r1=658513&r2=658514&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java Tue May 20 17:32:05 2008
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -38,8 +39,6 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
 
 
 /**
@@ -119,7 +118,6 @@
     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
@@ -147,9 +145,9 @@
      * Initializes this partition.
      *
      * @param core the directory core for the server.
-     * @throws NamingException if initialization fails in any way
+     * @throws Exception if initialization fails in any way
      */
-    void init( DirectoryService core ) throws NamingException;
+    void init( DirectoryService core ) throws Exception;
 
 
     /**
@@ -167,9 +165,9 @@
 
     /**
      * Flushes any changes made to this partition now.
-     * @throws NamingException if buffers cannot be flushed to disk
+     * @throws Exception if buffers cannot be flushed to disk
      */
-    void sync() throws NamingException;
+    void sync() throws Exception;
 
 
     /**
@@ -178,9 +176,10 @@
      *
      * @return Name representing the distinguished/absolute name of this
      * ContextPartitions root context.
-     * @throws NamingException if access or suffix parsing fails
+     * @throws Exception if access or suffix parsing fails
      */
-    LdapDN getSuffixDn() throws NamingException;
+    LdapDN getSuffixDn() throws Exception;
+
 
     /**
      * Gets the distinguished/absolute name of the suffix for all entries
@@ -188,9 +187,10 @@
      *
      * @return Name representing the distinguished/absolute name of this
      * ContextPartitions root context.
-     * @throws NamingException if access or suffix parsing fails
+     * @throws Exception if access or suffix parsing fails
      */
-    LdapDN getUpSuffixDn() throws NamingException;
+    LdapDN getUpSuffixDn() throws Exception;
+
 
     /**
      * Deletes a leaf entry from this ContextPartition: non-leaf entries cannot be 
@@ -198,18 +198,18 @@
      *
      * @param opContext the context of the entry to
      * delete from this ContextPartition.
-     * @throws NamingException if there are any problems
+     * @throws Exception if there are any problems
      */
-    void delete( DeleteOperationContext opContext ) throws NamingException;
+    void delete( DeleteOperationContext opContext ) throws Exception;
 
 
     /**
      * Adds an entry to this ContextPartition.
      *
      * @param opContext the context used  to add and entry to this ContextPartition
-     * @throws NamingException if there are any problems
+     * @throws Exception if there are any problems
      */
-    void add( AddOperationContext opContext ) throws NamingException;
+    void add( AddOperationContext opContext ) throws Exception;
 
 
     /**
@@ -220,13 +220,13 @@
      * DirContext interface:
      * <code>ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE</code>.
      * 
-     * @throws NamingException if there are any problems
+     * @throws Exception if there are any problems
      * @see javax.naming.directory.DirContext
      * @see javax.naming.directory.DirContext#ADD_ATTRIBUTE
      * @see javax.naming.directory.DirContext#REMOVE_ATTRIBUTE
      * @see javax.naming.directory.DirContext#REPLACE_ATTRIBUTE
      */
-    void modify( ModifyOperationContext opContext ) throws NamingException;
+    void modify( ModifyOperationContext opContext ) throws Exception;
 
 
     /**
@@ -236,10 +236,10 @@
      * retrieval.
      *
      * @param opContext the context containing the distinguished/absolute name for the search/listing
-     * @return a NamingEnumeration containing objects of type {@link SearchResult}
-     * @throws NamingException if there are any problems
+     * @return a NamingEnumeration containing objects of type {@link ServerSearchResult}
+     * @throws Exception if there are any problems
      */
-    NamingEnumeration<ServerSearchResult> list( ListOperationContext opContext ) throws NamingException;
+    Cursor<ServerSearchResult> list( ListOperationContext opContext ) throws Exception;
 
 
     /**
@@ -251,13 +251,13 @@
      * Controls.
      *
      * @param opContext The context containing the information used by the operation
-     * @throws NamingException if there are any problems
+     * @throws Exception if there are any problems
      * @return a NamingEnumeration containing objects of type 
      * <a href="http://java.sun.com/j2se/1.4.2/docs/api/
      * javax/naming/directory/SearchResult.html">SearchResult</a>.
      */
-    NamingEnumeration<ServerSearchResult> search( SearchOperationContext opContext )
-        throws NamingException;
+    Cursor<ServerSearchResult> search( SearchOperationContext opContext )
+        throws Exception;
 
 
     /**
@@ -270,18 +270,18 @@
      *
      * @param lookupContext The context containing the parameters
      * @return an Attributes object representing the entry
-     * @throws NamingException if there are any problems
+     * @throws Exception if there are any problems
      */
-    ServerEntry lookup( LookupOperationContext lookupContext ) throws NamingException;
+    ServerEntry lookup( LookupOperationContext lookupContext ) throws Exception;
 
     /**
      * Fast operation to check and see if a particular entry exists.
      *
      * @param opContext The context used to pass informations
      * @return true if the entry exists, false if it does not
-     * @throws NamingException if there are any problems
+     * @throws Exception if there are any problems
      */
-    boolean hasEntry( EntryOperationContext opContext ) throws NamingException;
+    boolean hasEntry( EntryOperationContext opContext ) throws Exception;
 
     /**
      * Modifies an entry by changing its relative name. Optionally attributes
@@ -290,9 +290,9 @@
      * if it is irrelavent.
      *
      * @param opContext the modify DN context
-     * @throws NamingException if there are any problems
+     * @throws Exception if there are any problems
      */
-    void rename( RenameOperationContext opContext ) throws NamingException;
+    void rename( RenameOperationContext opContext ) throws Exception;
 
 
     /**
@@ -300,9 +300,9 @@
      * parent entry.
      *
      * @param opContext The context containing the DNs to move
-     * @throws NamingException if there are any problems
+     * @throws Exception if there are any problems
      */
-    void move( MoveOperationContext opContext ) throws NamingException;
+    void move( MoveOperationContext opContext ) throws Exception;
 
 
     /**
@@ -315,9 +315,9 @@
      *
      * @param opContext The context contain all the information about
      * the modifyDN operation
-     * @throws NamingException if there are any problems
+     * @throws Exception if there are any problems
      */
-    void moveAndRename( MoveAndRenameOperationContext opContext ) throws NamingException;
+    void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception;
 
 
     /**
@@ -326,9 +326,9 @@
      * interested in implementing virtual directories with ApacheDS.
      * 
      * @param opContext the bind context, containing all the needed informations to bind
-     * @throws NamingException if something goes wrong
+     * @throws Exception if something goes wrong
      */
-    void bind( BindOperationContext opContext ) throws NamingException;
+    void bind( BindOperationContext opContext ) throws Exception;
 
     /**
      * Represents an unbind operation issued by an authenticated client.  Partitions
@@ -336,7 +336,7 @@
      * interested in implementing virtual directories with ApacheDS.
      * 
      * @param opContext the context used to unbind
-     * @throws NamingException if something goes wrong
+     * @throws Exception if something goes wrong
      */
-    void unbind( UnbindOperationContext opContext ) throws NamingException;
+    void unbind( UnbindOperationContext opContext ) throws Exception;
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=658514&r1=658513&r2=658514&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Tue May 20 17:32:05 2008
@@ -46,8 +46,6 @@
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
 import javax.naming.directory.SearchControls;
 import java.util.Collections;
 import java.util.HashSet;
@@ -235,7 +233,7 @@
     // ------------------------------------------------------------------------
 
 
-    public void delete( DeleteOperationContext opContext ) throws NamingException
+    public void delete( DeleteOperationContext opContext ) throws Exception
     {
     	LdapDN dn = opContext.getDn();
     	
@@ -259,16 +257,16 @@
     }
 
 
-    public abstract void add( AddOperationContext opContext ) throws NamingException;
+    public abstract void add( AddOperationContext opContext ) throws Exception;
 
 
-    public abstract void modify( ModifyOperationContext opContext ) throws NamingException;
+    public abstract void modify( ModifyOperationContext opContext ) throws Exception;
 
 
     private static final String[] ENTRY_DELETED_ATTRS = new String[] { "entrydeleted" };
 
 
-    public NamingEnumeration<ServerSearchResult> list( ListOperationContext opContext ) throws NamingException
+    public Cursor<ServerSearchResult> list( ListOperationContext opContext ) throws Exception
     {
         SearchResultEnumeration list;
         list = new BTreeSearchResultEnumeration( ENTRY_DELETED_ATTRS, list( getEntryId( opContext.getDn().getNormName() ) ),
@@ -277,14 +275,13 @@
     }
 
 
-    public NamingEnumeration<ServerSearchResult> search( SearchOperationContext opContext )
-        throws NamingException
+    public Cursor<ServerSearchResult> search( SearchOperationContext opContext ) throws Exception
     {
         SearchControls searchCtls = opContext.getSearchControls();
         String[] attrIds = searchCtls.getReturningAttributes();
         Cursor<IndexEntry> underlying;
 
-        underlying = searchEngine.search( 
+        underlying = searchEngine.cursor( 
             opContext.getDn(),
             opContext.getAliasDerefMode(),
             opContext.getFilter(), 
@@ -294,7 +291,7 @@
     }
 
 
-    public ServerEntry lookup( LookupOperationContext opContext ) throws NamingException
+    public ServerEntry lookup( LookupOperationContext opContext ) throws Exception
     {
         ServerEntry entry = lookup( getEntryId( opContext.getDn().getNormName() ) );
 
@@ -319,23 +316,22 @@
     }
 
 
-    public boolean hasEntry( EntryOperationContext opContext ) throws NamingException
+    public boolean hasEntry( EntryOperationContext opContext ) throws Exception
     {
         return null != getEntryId( opContext.getDn().getNormName() );
     }
 
 
-    public abstract void rename( RenameOperationContext opContext ) throws NamingException;
+    public abstract void rename( RenameOperationContext opContext ) throws Exception;
 
 
-    public abstract void move( MoveOperationContext opContext ) throws NamingException;
+    public abstract void move( MoveOperationContext opContext ) throws Exception;
 
 
-    public abstract void moveAndRename( MoveAndRenameOperationContext opContext )
-        throws NamingException;
+    public abstract void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception;
 
 
-    public abstract void sync() throws NamingException;
+    public abstract void sync() throws Exception;
 
 
     public abstract void destroy();
@@ -358,13 +354,13 @@
     // Index Operations 
     // ------------------------------------------------------------------------
 
-    public abstract void addIndexOn( Index index ) throws NamingException;
+    public abstract void addIndexOn( Index index ) throws Exception;
 
 
-    public abstract boolean hasUserIndexOn( String attribute ) throws NamingException;
+    public abstract boolean hasUserIndexOn( String attribute ) throws Exception;
 
 
-    public abstract boolean hasSystemIndexOn( String attribute ) throws NamingException;
+    public abstract boolean hasSystemIndexOn( String attribute ) throws Exception;
 
 
     public abstract Index getExistanceIndex();
@@ -431,45 +427,45 @@
      * be the aliasedObjectName and for X.500 would be aliasedEntryName.
      * 
      * @param index the index on the ALIAS_ATTRIBUTE
-     * @throws NamingException if there is a problem setting up the index
+     * @throws Exception if there is a problem setting up the index
      */
-    public abstract void setAliasIndexOn( Index index ) throws NamingException;
+    public abstract void setAliasIndexOn( Index index ) throws Exception;
 
 
     /**
      * Sets the attribute existance Index.
      *
      * @param index the attribute existance Index
-     * @throws NamingException if there is a problem setting up the index
+     * @throws Exception if there is a problem setting up the index
      */
-    public abstract void setExistanceIndexOn( Index index ) throws NamingException;
+    public abstract void setExistanceIndexOn( Index index ) throws Exception;
 
 
     /**
      * Sets the hierarchy Index.
      *
      * @param index the hierarchy Index
-     * @throws NamingException if there is a problem setting up the index
+     * @throws Exception if there is a problem setting up the index
      */
-    public abstract void setHierarchyIndexOn( Index index ) throws NamingException;
+    public abstract void setHierarchyIndexOn( Index index ) throws Exception;
 
 
     /**
      * Sets the user provided distinguished name Index.
      *
      * @param index the updn Index
-     * @throws NamingException if there is a problem setting up the index
+     * @throws Exception if there is a problem setting up the index
      */
-    public abstract void setUpdnIndexOn( Index index ) throws NamingException;
+    public abstract void setUpdnIndexOn( Index index ) throws Exception;
 
 
     /**
      * Sets the normalized distinguished name Index.
      *
      * @param index the ndn Index
-     * @throws NamingException if there is a problem setting up the index
+     * @throws Exception if there is a problem setting up the index
      */
-    public abstract void setNdnIndexOn( Index index ) throws NamingException;
+    public abstract void setNdnIndexOn( Index index ) throws Exception;
 
 
     /**
@@ -478,9 +474,9 @@
      * aliases on one/single level scoped searches.
      * 
      * @param index a one level alias index
-     * @throws NamingException if there is a problem setting up the index
+     * @throws Exception if there is a problem setting up the index
      */
-    public abstract void setOneAliasIndexOn( Index index ) throws NamingException;
+    public abstract void setOneAliasIndexOn( Index index ) throws Exception;
 
 
     /**
@@ -489,27 +485,27 @@
      * subtree scoped searches.
      * 
      * @param index a subtree alias index
-     * @throws NamingException if there is a problem setting up the index
+     * @throws Exception if there is a problem setting up the index
      */
-    public abstract void setSubAliasIndexOn( Index index ) throws NamingException;
+    public abstract void setSubAliasIndexOn( Index index ) throws Exception;
 
 
-    public abstract Index getUserIndex( String attribute ) throws IndexNotFoundException;
+    public abstract Index getUserIndex( String attribute ) throws Exception;
 
 
-    public abstract Index getSystemIndex( String attribute ) throws IndexNotFoundException;
+    public abstract Index getSystemIndex( String attribute ) throws Exception;
 
 
-    public abstract Long getEntryId( String dn ) throws NamingException;
+    public abstract Long getEntryId( String dn ) throws Exception;
 
 
-    public abstract String getEntryDn( Long id ) throws NamingException;
+    public abstract String getEntryDn( Long id ) throws Exception;
 
 
-    public abstract Long getParentId( String dn ) throws NamingException;
+    public abstract Long getParentId( String dn ) throws Exception;
 
 
-    public abstract Long getParentId( Long childId ) throws NamingException;
+    public abstract Long getParentId( Long childId ) throws Exception;
 
 
     /**
@@ -517,9 +513,9 @@
      *
      * @param id the entry id
      * @return the user provided distinguished name
-     * @throws NamingException if the updn index cannot be accessed
+     * @throws Exception if the updn index cannot be accessed
      */
-    public abstract String getEntryUpdn( Long id ) throws NamingException;
+    public abstract String getEntryUpdn( Long id ) throws Exception;
 
 
     /**
@@ -527,30 +523,30 @@
      *
      * @param dn the normalized distinguished name
      * @return the user provided distinguished name
-     * @throws NamingException if the updn and ndn indices cannot be accessed
+     * @throws Exception if the updn and ndn indices cannot be accessed
      */
-    public abstract String getEntryUpdn( String dn ) throws NamingException;
+    public abstract String getEntryUpdn( String dn ) throws Exception;
 
 
-    public abstract ServerEntry lookup( Long id ) throws NamingException;
+    public abstract ServerEntry lookup( Long id ) throws Exception;
 
 
-    public abstract void delete( Long id ) throws NamingException;
+    public abstract void delete( Long id ) throws Exception;
 
 
-    public abstract NamingEnumeration<ForwardIndexEntry> list( Long id ) throws NamingException;
+    public abstract IndexCursor<Long,ForwardIndexEntry> list( Long id ) throws Exception;
 
 
-    public abstract int getChildCount( Long id ) throws NamingException;
+    public abstract int getChildCount( Long id ) throws Exception;
 
 
-    public abstract ServerEntry getSuffixEntry() throws NamingException;
+    public abstract ServerEntry getSuffixEntry() throws Exception;
 
 
-    public abstract void setProperty( String key, String value ) throws NamingException;
+    public abstract void setProperty( String key, String value ) throws Exception;
 
 
-    public abstract String getProperty( String key ) throws NamingException;
+    public abstract String getProperty( String key ) throws Exception;
 
 
     public abstract Iterator<String> getUserIndices();
@@ -559,7 +555,7 @@
     public abstract Iterator<String> getSystemIndices();
 
 
-    public abstract ServerEntry getIndices( Long id ) throws NamingException;
+    public abstract ServerEntry getIndices( Long id ) throws Exception;
 
 
     /**
@@ -568,7 +564,7 @@
      * TODO shouldn't this be a BigInteger instead of an int? 
      * 
      * @return the number of entries in the database 
-     * @throws NamingException if there is a failure to read the count
+     * @throws Exception if there is a failure to read the count
      */
-    public abstract int count() throws NamingException;
+    public abstract int count() throws Exception;
 }