directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r567224 - in /directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree: IndexAssertionEnumeration.java IndexEnumeration.java NoDupsEnumeration.java Table.java TupleEnumeration.java
Date Sat, 18 Aug 2007 04:05:06 GMT
Author: akarasulu
Date: Fri Aug 17 21:05:05 2007
New Revision: 567224

URL: http://svn.apache.org/viewvc?view=rev&rev=567224
Log:
cleaned up warnings with generics

Modified:
    directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexAssertionEnumeration.java
    directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexEnumeration.java
    directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsEnumeration.java
    directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java
    directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleEnumeration.java

Modified: directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexAssertionEnumeration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexAssertionEnumeration.java?view=diff&rev=567224&r1=567223&r2=567224
==============================================================================
--- directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexAssertionEnumeration.java
(original)
+++ directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexAssertionEnumeration.java
Fri Aug 17 21:05:05 2007
@@ -35,14 +35,14 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class IndexAssertionEnumeration implements NamingEnumeration
+public class IndexAssertionEnumeration implements NamingEnumeration<IndexRecord>
 {
     /** The prefetched candidate */
     private final IndexRecord prefetched = new IndexRecord();
     /** The returned candidate */
     private final IndexRecord candidate = new IndexRecord();
     /** The iteration cursor */
-    private final NamingEnumeration underlying;
+    private final NamingEnumeration<IndexRecord> underlying;
     /** LUT used to avoid returning duplicates */
     private final Map<Object,Object> candidates;
     /** */
@@ -57,7 +57,9 @@
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
 
-    public IndexAssertionEnumeration(NamingEnumeration underlying, IndexAssertion assertion)
throws NamingException
+
+    public IndexAssertionEnumeration( NamingEnumeration<IndexRecord> underlying, IndexAssertion
assertion ) 
+        throws NamingException
     {
         this.underlying = underlying;
         candidates = null;
@@ -67,8 +69,8 @@
     }
 
 
-    public IndexAssertionEnumeration(NamingEnumeration underlying, IndexAssertion assertion,
boolean enableDupCheck)
-        throws NamingException
+    public IndexAssertionEnumeration( NamingEnumeration<IndexRecord> underlying, IndexAssertion
assertion, 
+        boolean enableDupCheck ) throws NamingException
     {
         this.underlying = underlying;
         candidates = new HashMap<Object,Object>();
@@ -85,7 +87,7 @@
     /**
      * @see java.util.Enumeration#nextElement()
      */
-    public Object nextElement()
+    public IndexRecord nextElement()
     {
         try
         {
@@ -114,7 +116,7 @@
     /**
      * @see javax.naming.NamingEnumeration#next()
      */
-    public Object next() throws NamingException
+    public IndexRecord next() throws NamingException
     {
         candidate.copy( prefetched );
         prefetch();
@@ -155,7 +157,7 @@
          */
         while ( underlying.hasMore() )
         {
-            rec = ( IndexRecord ) underlying.next();
+            rec = underlying.next();
 
             // If value is valid then we set it as the next candidate to return
             if ( assertion.assertCandidate( rec ) )

Modified: directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexEnumeration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexEnumeration.java?view=diff&rev=567224&r1=567223&r2=567224
==============================================================================
--- directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexEnumeration.java
(original)
+++ directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexEnumeration.java
Fri Aug 17 21:05:05 2007
@@ -33,7 +33,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class IndexEnumeration implements NamingEnumeration
+public class IndexEnumeration implements NamingEnumeration<IndexRecord>
 {
     /** */
     private final Pattern re;
@@ -46,7 +46,7 @@
     /** */
     private final boolean swapKeyVal;
     /** */
-    private final NamingEnumeration underlying;
+    private final NamingEnumeration<Tuple> underlying;
 
     /** */
     private boolean hasMore = true;
@@ -56,19 +56,21 @@
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
 
-    public IndexEnumeration(NamingEnumeration list) throws NamingException
+    
+    public IndexEnumeration( NamingEnumeration<Tuple> list ) throws NamingException
     {
         this( list, false, null );
     }
 
 
-    public IndexEnumeration(NamingEnumeration list, boolean swapKeyVal) throws NamingException
+    public IndexEnumeration( NamingEnumeration<Tuple> list, boolean swapKeyVal ) throws
NamingException
     {
         this( list, swapKeyVal, null );
     }
 
 
-    public IndexEnumeration(NamingEnumeration list, boolean swapKeyVal, Pattern regex) throws
NamingException
+    public IndexEnumeration( NamingEnumeration<Tuple> list, boolean swapKeyVal, Pattern
regex ) 
+        throws NamingException
     {
         re = regex;
         underlying = list;
@@ -91,7 +93,7 @@
     /**
      * @see javax.naming.NamingEnumeration#next()
      */
-    public Object next() throws NamingException
+    public IndexRecord next() throws NamingException
     {
         returned.copy( prefetched );
         prefetch();
@@ -102,7 +104,7 @@
     /**
      * @see java.util.Enumeration#nextElement()
      */
-    public Object nextElement()
+    public IndexRecord nextElement()
     {
         try
         {

Modified: directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsEnumeration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsEnumeration.java?view=diff&rev=567224&r1=567223&r2=567224
==============================================================================
--- directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsEnumeration.java
(original)
+++ directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsEnumeration.java
Fri Aug 17 21:05:05 2007
@@ -38,7 +38,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class NoDupsEnumeration implements NamingEnumeration
+public class NoDupsEnumeration implements NamingEnumeration<Tuple>
 {
     /** Temporary Tuple used to return results */
     private final Tuple returned = new Tuple();
@@ -56,10 +56,11 @@
     // C O N S T R U C T O R
     // ------------------------------------------------------------------------
 
+    
     /**
      * Creates a cursor over a TupleBrowser where duplicates are not expected.
      */
-    public NoDupsEnumeration(TupleBrowser browser, boolean doAscendingScan) throws NamingException
+    public NoDupsEnumeration( TupleBrowser browser, boolean doAscendingScan ) throws NamingException
     {
         this.browser = browser;
         this.doAscendingScan = doAscendingScan;
@@ -71,12 +72,13 @@
     // NamingEnumeration Interface Method Implementations
     // ------------------------------------------------------------------------
 
+    
     /**
      * Returns the same Tuple every time but with different key/value pairs.
      * 
      * @see javax.naming.NamingEnumeration#next()
      */
-    public Object next() throws NamingException
+    public Tuple next() throws NamingException
     {
         // Load values into the Tuple to return
         returned.setKey( prefetched.getKey() );
@@ -93,7 +95,7 @@
      * 
      * @see java.util.Enumeration#nextElement()
      */
-    public Object nextElement()
+    public Tuple nextElement()
     {
         try
         {
@@ -137,10 +139,6 @@
     }
 
 
-    // ------------------------------------------------------------------------
-    // Private/Package Friendly Methods
-    // ------------------------------------------------------------------------
-
     /**
      * Gets the direction of this NamingEnumeration.
      *
@@ -153,6 +151,11 @@
     }
 
 
+    // ------------------------------------------------------------------------
+    // Private/Package Friendly Methods
+    // ------------------------------------------------------------------------
+
+    
     /**
      * Prefetches a value into prefetched over writing whatever values were 
      * contained in the Tuple.

Modified: directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java?view=diff&rev=567224&r1=567223&r2=567224
==============================================================================
--- directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java
(original)
+++ directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java
Fri Aug 17 21:05:05 2007
@@ -25,10 +25,9 @@
 
 
 /**
- * A backend friendly wrapper around a JDBM BTree that transparent enables
- * duplicates when the BTree does not support them.
- * 
- * TODO Need to rewrite the Javadocs in this interface.
+ * A wrapper interface around a BTree (that does not support duplicate keys) which 
+ * transparently enables duplicate keys and translates underlying exceptions to
+ * NamingExceptions.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
@@ -92,6 +91,7 @@
     // Simple Table Key/Value Assertions 
     // ------------------------------------------------------------------------
 
+    
     /**
      * Checks to see if this table has a key: same as a get call with a check to
      * see if the returned value is null or not.
@@ -198,7 +198,7 @@
      * @param values the values supplied as an enumeration
      * @throws NamingException if something goes wrong
      */
-    Object put( Object key, NamingEnumeration values ) throws NamingException;
+    Object put( Object key, NamingEnumeration<? extends Object> values ) throws NamingException;
 
 
     /**
@@ -236,7 +236,7 @@
      * @throws NamingException if there is a failure to read or write to
      * the underlying Db
      */
-    Object remove( Object key, NamingEnumeration values ) throws NamingException;
+    Object remove( Object key, NamingEnumeration<? extends Object> values ) throws
NamingException;
 
 
     /**
@@ -250,20 +250,21 @@
      * @param key the key to iterate over
      * @throws NamingException if the underlying browser could not be set
      */
-    NamingEnumeration listValues( Object key ) throws NamingException;
+    NamingEnumeration<Tuple> listValues( Object key ) throws NamingException;
 
 
     // ------------------------------------------------------------------------
-    // listTuple overloads
+    // listTuples overloads
     // ------------------------------------------------------------------------
 
+    
     /**
      * Sets a cursor to the first record in the Table and enables single
      * next steps across all records.
      *
      * @throws NamingException if the underlying cursor could not be set.
      */
-    NamingEnumeration listTuples() throws NamingException;
+    NamingEnumeration<Tuple> listTuples() throws NamingException;
 
 
     /**
@@ -274,7 +275,7 @@
      * @param key the key to iterate over
      * @throws NamingException if the underlying cursor could not be set
      */
-    NamingEnumeration listTuples( Object key ) throws NamingException;
+    NamingEnumeration<Tuple> listTuples( Object key ) throws NamingException;
 
 
     /**
@@ -289,7 +290,7 @@
      * iterates down over descending keys less than or equal to key argument
      * @throws NamingException if the underlying cursor could not be set
      */
-    NamingEnumeration listTuples( Object key, boolean isGreaterThan ) throws NamingException;
+    NamingEnumeration<Tuple> listTuples( Object key, boolean isGreaterThan ) throws
NamingException;
 
 
     /**
@@ -314,7 +315,7 @@
      * this method is called over a cursor on a table that does not have sorted
      * duplicates enabled.
      */
-    NamingEnumeration listTuples( Object key, Object val, boolean isGreaterThan ) throws
NamingException;
+    NamingEnumeration<Tuple> listTuples( Object key, Object val, boolean isGreaterThan
) throws NamingException;
 
 
     // ------------------------------------------------------------------------

Modified: directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleEnumeration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleEnumeration.java?view=diff&rev=567224&r1=567223&r2=567224
==============================================================================
--- directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleEnumeration.java
(original)
+++ directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleEnumeration.java
Fri Aug 17 21:05:05 2007
@@ -37,10 +37,10 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class TupleEnumeration implements NamingEnumeration
+public class TupleEnumeration implements NamingEnumeration<Tuple>
 {
     private final Object key;
-    private final Iterator iterator;
+    private final Iterator<? extends Object> iterator;
     private final Tuple tuple = new Tuple();
 
 
@@ -50,7 +50,7 @@
      * @param key the keys whose duplicate values are to be returned
      * @param iterator the underlying iterator this cursor uses
      */
-    public TupleEnumeration( Object key, Iterator iterator )
+    public TupleEnumeration( Object key, Iterator<? extends Object> iterator )
     {
         this.key = key;
         tuple.setKey( key );
@@ -63,7 +63,7 @@
      *
      * @see javax.naming.NamingEnumeration#next()
      */
-    public Object next()
+    public Tuple next()
     {
         tuple.setKey( key );
         tuple.setValue( iterator.next() );
@@ -76,7 +76,7 @@
      *
      * @see javax.naming.NamingEnumeration#nextElement()
      */
-    public Object nextElement()
+    public Tuple nextElement()
     {
         tuple.setKey( key );
         tuple.setValue( iterator.next() );



Mime
View raw message