directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r376623 [14/38] - in /directory/sandbox/akarasulu/rc1/apacheds: core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/ core-shared/src/main/java/org/...
Date Fri, 10 Feb 2006 10:49:57 GMT
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Fri Feb 10 02:48:07 2006
@@ -72,7 +72,6 @@
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
 
-
     /**
      * Creates an Index using an existing record manager based on a file.  The
      * index table B+Tree are created and saved within this file rather than 
@@ -82,70 +81,64 @@
      * @param recMan the record manager
      * @throws NamingException if we fail to create B+Trees using recMan
      */
-    public JdbmIndex( AttributeType attribute, RecordManager recMan )
-        throws NamingException
+    public JdbmIndex(AttributeType attribute, RecordManager recMan) throws NamingException
     {
         this.attribute = attribute;
         keyCache = new SynchronizedLRUMap( 1000 );
         this.recMan = recMan;
         initTables();
     }
-    
 
-    public JdbmIndex( AttributeType attribute, File wkDirPath )
-        throws NamingException
+
+    public JdbmIndex(AttributeType attribute, File wkDirPath) throws NamingException
     {
-        File file = new File( wkDirPath.getPath() + File.separator 
-            + attribute.getName() );
+        File file = new File( wkDirPath.getPath() + File.separator + attribute.getName() );
         this.attribute = attribute;
         keyCache = new SynchronizedLRUMap( 1000 );
 
-        try 
+        try
         {
             String path = file.getAbsolutePath();
             BaseRecordManager base = new BaseRecordManager( path );
             base.disableTransactions();
-            recMan = new CacheRecordManager( base , new MRU( 1000 ) );
-        } 
-        catch ( IOException e ) 
+            recMan = new CacheRecordManager( base, new MRU( 1000 ) );
+        }
+        catch ( IOException e )
         {
-            NamingException ne = new NamingException(
-                "Could not initialize the record manager" );
+            NamingException ne = new NamingException( "Could not initialize the record manager" );
             ne.setRootCause( e );
             throw ne;
         }
 
         initTables();
     }
-    
+
 
     /**
      * Initializes the forward and reverse tables used by this Index.
      * 
      * @throws NamingException if we cannot initialize the forward and reverse 
      * tables
-     */    
+     */
     private void initTables() throws NamingException
     {
         SerializableComparator comp;
         comp = new SerializableComparator( attribute.getEquality().getOid() );
-        
+
         /*
          * The forward key/value map stores attribute values to master table 
          * primary keys.  A value for an attribute can occur several times in
          * different entries so the forward map can have more than one value.
          */
-        forward = new JdbmTable( attribute.getName() + FORWARD_BTREE,
-            true, recMan, new IndexComparator( comp, true ) );
-        
+        forward = new JdbmTable( attribute.getName() + FORWARD_BTREE, true, recMan, new IndexComparator( comp, true ) );
+
         /*
          * Now the reverse map stores the primary key into the master table as
          * the key and the values of attributes as the value.  If an attribute
          * is single valued according to its specification based on a schema 
          * then duplicate keys should not be allowed within the reverse table.
          */
-        reverse = new JdbmTable( attribute.getName() + REVERSE_BTREE,
-            ! attribute.isSingleValue(), recMan, 
+        reverse = new JdbmTable( attribute.getName() + REVERSE_BTREE, !attribute.isSingleValue(), recMan,
             new IndexComparator( comp, false ) );
     }
 
@@ -163,12 +156,10 @@
     // Scan Count Methods
     // ------------------------------------------------------------------------
 
-
     /**
      * @see Index#count()
      */
-    public int count()
-        throws NamingException
+    public int count() throws NamingException
     {
         return forward.count();
     }
@@ -177,8 +168,7 @@
     /**
      * @see Index#count(java.lang.Object)
      */
-    public int count( Object attrVal )
-        throws NamingException
+    public int count( Object attrVal ) throws NamingException
     {
         return forward.count( getNormalized( attrVal ) );
     }
@@ -187,8 +177,7 @@
     /**
      * @see org.apache.directory.server.core.partition.impl.btree.Index#count(java.lang.Object, boolean)
      */
-    public int count( Object attrVal, boolean isGreaterThan )
-        throws NamingException
+    public int count( Object attrVal, boolean isGreaterThan ) throws NamingException
     {
         return forward.count( getNormalized( attrVal ), isGreaterThan );
     }
@@ -198,12 +187,10 @@
     // Forward and Reverse Lookups
     // ------------------------------------------------------------------------
 
-
     /**
      * @see Index#forwardLookup(java.lang.Object)
      */
-    public BigInteger forwardLookup( Object attrVal )
-        throws NamingException
+    public BigInteger forwardLookup( Object attrVal ) throws NamingException
     {
         return ( BigInteger ) forward.get( getNormalized( attrVal ) );
     }
@@ -212,8 +199,7 @@
     /**
      * @see Index#reverseLookup(java.math.BigInteger)
      */
-    public Object reverseLookup( BigInteger id )
-        throws NamingException
+    public Object reverseLookup( BigInteger id ) throws NamingException
     {
         return reverse.get( id );
     }
@@ -223,13 +209,11 @@
     // Add/Drop Methods
     // ------------------------------------------------------------------------
 
-
     /**
      * @see org.apache.directory.server.core.partition.impl.btree.Index#add(java.lang.Object,
      * java.math.BigInteger)
      */
-    public synchronized void add( Object attrVal, BigInteger id )
-        throws NamingException
+    public synchronized void add( Object attrVal, BigInteger id ) throws NamingException
     {
         forward.put( getNormalized( attrVal ), id );
         reverse.put( id, getNormalized( attrVal ) );
@@ -240,13 +224,12 @@
      * @see org.apache.directory.server.core.partition.impl.btree.Index#add(
      * javax.naming.directory.Attribute, java.math.BigInteger)
      */
-    public synchronized void add( Attribute attr, BigInteger id ) 
-        throws NamingException 
+    public synchronized void add( Attribute attr, BigInteger id ) throws NamingException
     {
         // Can efficiently batch add to the reverse table 
         NamingEnumeration values = attr.getAll();
         reverse.put( id, values );
-        
+
         // Have no choice but to add each value individually to forward table
         values = attr.getAll();
         while ( values.hasMore() )
@@ -260,8 +243,7 @@
      * @see Index#add(
      * javax.naming.directory.Attributes, java.math.BigInteger)
      */
-    public synchronized void add( Attributes attrs, BigInteger id ) 
-        throws NamingException
+    public synchronized void add( Attributes attrs, BigInteger id ) throws NamingException
     {
         add( attrs.get( attribute.getName() ), id );
     }
@@ -271,8 +253,7 @@
      * @see org.apache.directory.server.core.partition.impl.btree.Index#drop(java.lang.Object,
      * java.math.BigInteger)
      */
-    public synchronized void drop( Object attrVal, BigInteger id )
-        throws NamingException
+    public synchronized void drop( Object attrVal, BigInteger id ) throws NamingException
     {
         forward.remove( getNormalized( attrVal ), id );
         reverse.remove( id, getNormalized( attrVal ) );
@@ -282,16 +263,15 @@
     /**
      * @see Index#drop(java.math.BigInteger)
      */
-    public void drop( BigInteger entryId ) 
-        throws NamingException 
+    public void drop( BigInteger entryId ) throws NamingException
     {
         NamingEnumeration values = reverse.listValues( entryId );
-        
+
         while ( values.hasMore() )
         {
             forward.remove( values.next(), entryId );
         }
-        
+
         reverse.remove( entryId );
     }
 
@@ -300,21 +280,20 @@
      * @see Index#drop(
      * javax.naming.directory.Attribute, java.math.BigInteger)
      */
-    public void drop( Attribute attr, BigInteger id )
-        throws NamingException 
+    public void drop( Attribute attr, BigInteger id ) throws NamingException
     {
         // Can efficiently batch remove from the reverse table 
         NamingEnumeration values = attr.getAll();
-        
+
         // If their are no values in attr this is a request to drop all
-        if ( ! values.hasMore() )
+        if ( !values.hasMore() )
         {
             drop( id );
             return;
         }
-        
+
         reverse.remove( id, values );
-        
+
         // Have no choice but to remove values individually from forward table
         values = attr.getAll();
         while ( values.hasMore() )
@@ -322,29 +301,26 @@
             forward.remove( values.next(), id );
         }
     }
-        
-    
+
+
     /**
      * @see org.apache.directory.server.core.partition.impl.btree.Index#drop(
      * javax.naming.directory.Attributes, java.math.BigInteger)
      */
-    public void drop( Attributes attrs, BigInteger id )
-        throws NamingException 
+    public void drop( Attributes attrs, BigInteger id ) throws NamingException
     {
         drop( attrs.get( attribute.getName() ), id );
     }
-        
-    
+
+
     // ------------------------------------------------------------------------
     // Index Listing Operations
     // ------------------------------------------------------------------------
 
-
     /**
      * @see Index#listReverseIndices(BigInteger)
      */
-    public IndexEnumeration listReverseIndices( BigInteger id )
-        throws NamingException
+    public IndexEnumeration listReverseIndices( BigInteger id ) throws NamingException
     {
         return new IndexEnumeration( reverse.listTuples( id ), true );
     }
@@ -353,8 +329,7 @@
     /**
      * @see Index#listIndices()
      */
-    public IndexEnumeration listIndices()
-        throws NamingException
+    public IndexEnumeration listIndices() throws NamingException
     {
         return new IndexEnumeration( forward.listTuples() );
     }
@@ -363,11 +338,9 @@
     /**
      * @see org.apache.directory.server.core.partition.impl.btree.Index#listIndices(java.lang.Object)
      */
-    public IndexEnumeration listIndices( Object attrVal ) 
-        throws NamingException
+    public IndexEnumeration listIndices( Object attrVal ) throws NamingException
     {
-        return new IndexEnumeration( forward.listTuples( 
-            getNormalized( attrVal ) ) );
+        return new IndexEnumeration( forward.listTuples( getNormalized( attrVal ) ) );
     }
 
 
@@ -375,19 +348,16 @@
      * @see org.apache.directory.server.core.partition.impl.btree.Index#listIndices(java.lang.Object,
      * boolean)
      */
-    public IndexEnumeration listIndices( Object attrVal, 
-        boolean isGreaterThan ) throws NamingException
+    public IndexEnumeration listIndices( Object attrVal, boolean isGreaterThan ) throws NamingException
     {
-        return new IndexEnumeration( forward.listTuples( 
-            getNormalized( attrVal ), isGreaterThan ) );
+        return new IndexEnumeration( forward.listTuples( getNormalized( attrVal ), isGreaterThan ) );
     }
 
 
     /**
      * @see Index#listIndices(org.apache.regexp.RE)
      */
-    public IndexEnumeration listIndices( Pattern regex )
-        throws NamingException
+    public IndexEnumeration listIndices( Pattern regex ) throws NamingException
     {
         return new IndexEnumeration( forward.listTuples(), false, regex );
     }
@@ -397,11 +367,9 @@
      * @see Index#listIndices(org.apache.regexp.RE,
      * java.lang.String)
      */
-    public IndexEnumeration listIndices( Pattern regex, String prefix )
-        throws NamingException
+    public IndexEnumeration listIndices( Pattern regex, String prefix ) throws NamingException
     {
-        return new IndexEnumeration( forward.listTuples(
-            getNormalized( prefix ), true ), false, regex );
+        return new IndexEnumeration( forward.listTuples( getNormalized( prefix ), true ), false, regex );
     }
 
 
@@ -409,13 +377,11 @@
     // Value Assertion (a.k.a Index Lookup) Methods //
     // ------------------------------------------------------------------------
 
-
     /**
      * @see Index#hasValue(java.lang.Object,
      * java.math.BigInteger)
      */
-    public boolean hasValue( Object attrVal, BigInteger id )
-        throws NamingException
+    public boolean hasValue( Object attrVal, BigInteger id ) throws NamingException
     {
         return forward.has( getNormalized( attrVal ), id );
     }
@@ -425,12 +391,9 @@
      * @see Index#hasValue(java.lang.Object,
      * java.math.BigInteger, boolean)
      */
-    public boolean hasValue( Object attrVal, BigInteger id,
-        boolean isGreaterThan )
-        throws NamingException
+    public boolean hasValue( Object attrVal, BigInteger id, boolean isGreaterThan ) throws NamingException
     {
-        return forward.has( getNormalized( attrVal ), 
-            id, isGreaterThan );
+        return forward.has( getNormalized( attrVal ), id, isGreaterThan );
     }
 
 
@@ -438,11 +401,9 @@
      * @see Index#hasValue(org.apache.regexp.RE,
      * java.math.BigInteger)
      */
-    public boolean hasValue( Pattern regex, BigInteger id )
-        throws NamingException
+    public boolean hasValue( Pattern regex, BigInteger id ) throws NamingException
     {
-        IndexEnumeration list = new IndexEnumeration( 
-            reverse.listTuples( id ), true, regex );
+        IndexEnumeration list = new IndexEnumeration( reverse.listTuples( id ), true, regex );
         boolean hasValue = list.hasMore();
         list.close();
         return hasValue;
@@ -453,24 +414,21 @@
     // Maintenance Methods 
     // ------------------------------------------------------------------------
 
-
     /**
      * @see Index#close()
      */
-    public synchronized void close()
-        throws NamingException
+    public synchronized void close() throws NamingException
     {
-        try 
+        try
         {
             forward.close();
             reverse.close();
             recMan.commit();
             recMan.close();
-        } 
-        catch ( IOException e ) 
+        }
+        catch ( IOException e )
         {
-            NamingException ne = new NamingException( 
-                "Exception while closing backend index file for attribute " 
+            NamingException ne = new NamingException( "Exception while closing backend index file for attribute "
                 + attribute.getName() );
             ne.setRootCause( e );
             throw ne;
@@ -481,17 +439,15 @@
     /**
      * @see Index#sync()
      */
-    public synchronized void sync()
-        throws NamingException
+    public synchronized void sync() throws NamingException
     {
-        try 
+        try
         {
             recMan.commit();
-        } 
-        catch ( IOException e ) 
+        }
+        catch ( IOException e )
         {
-            NamingException ne = new NamingException( 
-                "Exception while syncing backend index file for attribute " 
+            NamingException ne = new NamingException( "Exception while syncing backend index file for attribute "
                 + attribute.getName() );
             ne.setRootCause( e );
             throw ne;
@@ -503,12 +459,11 @@
      * TODO I don't think the keyCache is required anymore since the normalizer
      * will cache values for us.
      */
-    public Object getNormalized( Object attrVal )
-        throws NamingException
+    public Object getNormalized( Object attrVal ) throws NamingException
     {
         Object normalized = keyCache.get( attrVal );
 
-        if ( null == normalized ) 
+        if ( null == normalized )
         {
             normalized = attribute.getEquality().getNormalizer().normalize( attrVal );
 

Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java Fri Feb 10 02:48:07 2006
@@ -39,26 +39,28 @@
 public class JdbmMasterTable extends JdbmTable implements MasterTable
 {
     private static final StringComparator STRCOMP = new StringComparator();
-    private static final SerializableComparator BIG_INTEGER_COMPARATOR =
-        new SerializableComparator( "1.2.6.1.4.1.18060.1.1.1.2.2" )
-        {
-            private static final long serialVersionUID = 4048791282048841016L;
+    private static final SerializableComparator BIG_INTEGER_COMPARATOR = new SerializableComparator(
+        "1.2.6.1.4.1.18060.1.1.1.2.2" )
+    {
+        private static final long serialVersionUID = 4048791282048841016L;
 
-            public int compare( Object o1, Object o2 )
-            {
-                return BigIntegerComparator.INSTANCE.compare( o1, o2 );
-            }
-        };
-    private static final SerializableComparator STRING_COMPARATOR =
-        new SerializableComparator( "1.2.6.1.4.1.18060.1.1.1.2.3" )
+
+        public int compare( Object o1, Object o2 )
         {
-            private static final long serialVersionUID = 3258689922792961845L;
+            return BigIntegerComparator.INSTANCE.compare( o1, o2 );
+        }
+    };
+    private static final SerializableComparator STRING_COMPARATOR = new SerializableComparator(
+        "1.2.6.1.4.1.18060.1.1.1.2.3" )
+    {
+        private static final long serialVersionUID = 3258689922792961845L;
 
-            public int compare( Object o1, Object o2 )
-            {
-                return STRCOMP.compare( o1, o2 );
-            }
-        };
+
+        public int compare( Object o1, Object o2 )
+        {
+            return STRCOMP.compare( o1, o2 );
+        }
+    };
     /**  */
     private JdbmTable adminTbl = null;
 
@@ -69,14 +71,13 @@
      * @param recMan the jdbm record manager
      * @throws NamingException if there is an error opening the Db file.
      */
-    public JdbmMasterTable( RecordManager recMan )
-        throws NamingException
+    public JdbmMasterTable(RecordManager recMan) throws NamingException
     {
         super( DBF, recMan, BIG_INTEGER_COMPARATOR );
         adminTbl = new JdbmTable( "admin", recMan, STRING_COMPARATOR );
         String seqValue = ( String ) adminTbl.get( SEQPROP_KEY );
-        
-        if ( null == seqValue ) 
+
+        if ( null == seqValue )
         {
             adminTbl.put( SEQPROP_KEY, BigInteger.ZERO.toString() );
         }
@@ -137,11 +138,11 @@
     {
         BigInteger id = null;
 
-        synchronized ( adminTbl ) 
+        synchronized ( adminTbl )
         {
             id = new BigInteger( ( String ) adminTbl.get( SEQPROP_KEY ) );
-            
-            if ( null == id ) 
+
+            if ( null == id )
             {
                 adminTbl.put( SEQPROP_KEY, BigInteger.ZERO.toString() );
                 id = BigInteger.ZERO;
@@ -167,17 +168,16 @@
         BigInteger lastVal = null;
         BigInteger nextVal = null;
 
-        synchronized ( adminTbl ) 
+        synchronized ( adminTbl )
         {
-            lastVal = new BigInteger( ( String ) 
-                adminTbl.get( SEQPROP_KEY ) );
-            
-            if ( null == lastVal ) 
+            lastVal = new BigInteger( ( String ) adminTbl.get( SEQPROP_KEY ) );
+
+            if ( null == lastVal )
             {
                 adminTbl.put( SEQPROP_KEY, BigInteger.ONE.toString() );
                 return BigInteger.ONE;
-            } 
-            else 
+            }
+            else
             {
                 nextVal = lastVal.add( BigInteger.ONE );
                 adminTbl.put( SEQPROP_KEY, nextVal.toString() );
@@ -197,7 +197,7 @@
      */
     public String getProperty( String property ) throws NamingException
     {
-        synchronized ( adminTbl ) 
+        synchronized ( adminTbl )
         {
             return ( String ) adminTbl.get( property );
         }
@@ -213,7 +213,7 @@
      */
     public void setProperty( String property, String value ) throws NamingException
     {
-        synchronized ( adminTbl ) 
+        synchronized ( adminTbl )
         {
             adminTbl.put( property, value );
         }

Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Fri Feb 10 02:48:07 2006
@@ -76,7 +76,6 @@
     // C O N S T R U C T O R
     // ------------------------------------------------------------------------
 
-    
     /**
      * Creates a Jdbm BTree based tuple Table abstraction that enables 
      * duplicates.
@@ -87,8 +86,7 @@
      * @param comparator a tuple comparator
      * @throws NamingException if the table's file cannot be created
      */
-    public JdbmTable( String name, boolean allowsDuplicates,
-        RecordManager manager, TupleComparator comparator )
+    public JdbmTable(String name, boolean allowsDuplicates, RecordManager manager, TupleComparator comparator)
         throws NamingException
     {
         this.name = name;
@@ -97,9 +95,9 @@
         this.allowsDuplicates = allowsDuplicates;
 
         long recId;
-        
+
         try
-        { 
+        {
             recId = recMan.getNamedObject( name );
         }
         catch ( IOException e )
@@ -108,14 +106,14 @@
             ne.setRootCause( e );
             throw ne;
         }
-        
+
         try
         {
 
             //            
             // Load existing BTree
             //
-            
+
             if ( recId != 0 )
             {
                 bt = BTree.load( recMan, recId );
@@ -130,8 +128,8 @@
                 recId = recMan.insert( new Integer( 0 ) );
                 recMan.setNamedObject( name + SZSUFFIX, recId );
             }
-        }   
-        catch ( IOException e ) 
+        }
+        catch ( IOException e )
         {
             NamingException ne = new NamingException();
             ne.setRootCause( e );
@@ -149,9 +147,7 @@
      * @param keyComparator a tuple comparator
      * @throws NamingException if the table's file cannot be created
      */
-    public JdbmTable( String name, RecordManager manager,
-                      SerializableComparator keyComparator )
-            throws NamingException
+    public JdbmTable(String name, RecordManager manager, SerializableComparator keyComparator) throws NamingException
     {
         this( name, false, manager, new KeyOnlyComparator( keyComparator ) );
     }
@@ -161,7 +157,6 @@
     // Simple Table Properties
     // ------------------------------------------------------------------------
 
-
     /**
      * @see org.apache.directory.server.core.partition.impl.btree.Table#getComparator()
      */
@@ -217,18 +212,16 @@
         // sorted order.
         return allowsDuplicates;
     }
-    
-    
+
+
     // ------------------------------------------------------------------------
     // Count Overloads
     // ------------------------------------------------------------------------
 
-
     /**
      * @see Table#count(java.lang.Object, boolean)
      */
-    public int count( Object key, boolean isGreaterThan )
-        throws NamingException
+    public int count( Object key, boolean isGreaterThan ) throws NamingException
     {
         throw new UnsupportedOperationException();
     }
@@ -237,16 +230,15 @@
     /**
      * @see Table#count(java.lang.Object)
      */
-    public int count( Object key )
-        throws NamingException
+    public int count( Object key ) throws NamingException
     {
-        if ( ! allowsDuplicates ) 
+        if ( !allowsDuplicates )
         {
-            if ( null == getRaw( key ) ) 
+            if ( null == getRaw( key ) )
             {
                 return 0;
-            } 
-            else 
+            }
+            else
             {
                 return 1;
             }
@@ -254,7 +246,7 @@
 
         TreeSet set = ( TreeSet ) getRaw( key );
 
-        if ( set != null ) 
+        if ( set != null )
         {
             return set.size();
         }
@@ -266,8 +258,7 @@
     /**
      * @see org.apache.directory.server.core.partition.impl.btree.Table#count()
      */
-    public int count()
-        throws NamingException
+    public int count() throws NamingException
     {
         return count;
     }
@@ -277,20 +268,19 @@
     // get/has/put/remove Methods and Overloads
     // ------------------------------------------------------------------------
 
-
     /**
      * @see Table#get(java.lang.Object)
      */
     public Object get( Object key ) throws NamingException
     {
-        if ( allowsDuplicates ) 
+        if ( allowsDuplicates )
         {
             TreeSet set = ( TreeSet ) getRaw( key );
-            if ( null == set || set.size() == 0 ) 
+            if ( null == set || set.size() == 0 )
             {
                 return null;
-            } 
-            else 
+            }
+            else
             {
                 return set.first();
             }
@@ -305,13 +295,12 @@
      * @see Table#has(java.lang.Object,
      * java.lang.Object, boolean)
      */
-    public boolean has( Object key, Object val, boolean isGreaterThan )
-        throws NamingException
+    public boolean has( Object key, Object val, boolean isGreaterThan ) throws NamingException
     {
         TreeSet set = null;
         SortedSet subset = null;
-        
-        if ( ! allowsDuplicates ) 
+
+        if ( !allowsDuplicates )
         {
             Object rval = getRaw( key );
 
@@ -331,7 +320,7 @@
                 return true;
             }
             // val <= val and test is for lesser then return tuple
-            else if ( comparator.compareValue( rval, val ) <= 1 &&! isGreaterThan )
+            else if ( comparator.compareValue( rval, val ) <= 1 && !isGreaterThan )
             {
                 return true;
             }
@@ -340,22 +329,22 @@
         }
 
         set = ( TreeSet ) getRaw( key );
-        
-        if ( null == set || set.size() == 0 ) 
+
+        if ( null == set || set.size() == 0 )
         {
             return false;
         }
 
-        if ( isGreaterThan ) 
+        if ( isGreaterThan )
         {
             subset = set.tailSet( val );
-        } 
-        else 
+        }
+        else
         {
             subset = set.headSet( val );
         }
 
-        if ( subset.size() > 0 || set.contains( val ) ) 
+        if ( subset.size() > 0 || set.contains( val ) )
         {
             return true;
         }
@@ -374,84 +363,81 @@
             // See if we can find the border between keys greater than and less
             // than in the set of keys.  This will be the spot we search from.
             jdbm.helper.Tuple tuple = bt.findGreaterOrEqual( key );
-    
+
             // Test for equality first since it satisfies both greater/less than
-            if ( null != tuple &&
-                comparator.compareKey( tuple.getKey(), key ) == 0 )
+            if ( null != tuple && comparator.compareKey( tuple.getKey(), key ) == 0 )
             {
                 return true;
             }
-    
+
             // Greater searches are easy and quick thanks to findGreaterOrEqual
-            if ( isGreaterThan ) 
+            if ( isGreaterThan )
             {
                 // A null return above means there were no equal or greater keys
-                if ( null == tuple ) 
+                if ( null == tuple )
                 {
                     return false;
                 }
-    
+
                 // Not Null! - we found a tuple with equal or greater key value
                 return true;
             }
-    
+
             // Less than searches occur below and are not as efficient or easy.
             // We need to scan up from the begining if findGreaterOrEqual failed
             // or scan down if findGreaterOrEqual succeed.
             TupleBrowser browser = null;
-            if ( null == tuple ) 
+            if ( null == tuple )
             {
                 // findGreaterOrEqual failed so we create a tuple and scan from
                 // the lowest values up via getNext comparing each key to key
                 tuple = new jdbm.helper.Tuple();
                 browser = bt.browse();
-    
+
                 // We should at most have to read one key.  If 1st key is not
                 // less than or equal to key then all keys are > key
                 // since the keys are assorted in ascending order based on the
                 // comparator.
-                while ( browser.getNext( tuple ) ) 
+                while ( browser.getNext( tuple ) )
                 {
-                    if ( comparator.compareKey( tuple.getKey(), key ) 
-                        <= 0 )
+                    if ( comparator.compareKey( tuple.getKey(), key ) <= 0 )
                     {
                         return true;
-                    } 
+                    }
 
                     return false;
                 }
-            } 
-            else 
+            }
+            else
             {
                 // findGreaterOrEqual succeeded so use the existing tuple and
                 // scan the down from the highest key less than key via
                 // getPrevious while comparing each key to key.
                 browser = bt.browse( tuple.getKey() );
-    
+
                 // The above call positions the browser just before the given
                 // key so we need to step forward once then back.  Remember this
                 // key represents a key greater than or equal to key.
-                if ( comparator.compareKey( tuple.getKey(), key ) <= 0 ) 
+                if ( comparator.compareKey( tuple.getKey(), key ) <= 0 )
                 {
                     return true;
                 }
-                
+
                 browser.getNext( tuple );
-    
+
                 // We should at most have to read one key, but we don't short
                 // the search as in the search above first because the chance of
                 // unneccessarily looping is nil since values get smaller.
-                while ( browser.getPrevious( tuple ) ) 
+                while ( browser.getPrevious( tuple ) )
                 {
-                    if ( comparator.compareKey( tuple.getKey(), key ) 
-                        <= 0 )
+                    if ( comparator.compareKey( tuple.getKey(), key ) <= 0 )
                     {
                         return true;
                     }
                 }
             }
         }
-        catch ( IOException e ) 
+        catch ( IOException e )
         {
             NamingException ne = new NamingException();
             ne.setRootCause( e );
@@ -466,14 +452,13 @@
      * @see org.apache.directory.server.core.partition.impl.btree.Table#has(java.lang.Object,
      * java.lang.Object)
      */
-    public boolean has( Object key, Object value )
-        throws NamingException
+    public boolean has( Object key, Object value ) throws NamingException
     {
-        if ( allowsDuplicates ) 
+        if ( allowsDuplicates )
         {
             TreeSet set = ( TreeSet ) getRaw( key );
-            
-            if ( null == set ) 
+
+            if ( null == set )
             {
                 return false;
             }
@@ -482,8 +467,8 @@
         }
 
         Object obj = getRaw( key );
-        
-        if ( null == obj ) 
+
+        if ( null == obj )
         {
             return false;
         }
@@ -495,8 +480,7 @@
     /**
      * @see Table#has(java.lang.Object)
      */
-    public boolean has( Object key )
-        throws NamingException
+    public boolean has( Object key ) throws NamingException
     {
         return getRaw( key ) != null;
     }
@@ -506,20 +490,19 @@
      * @see org.apache.directory.server.core.partition.impl.btree.Table#put(java.lang.Object,
      * java.lang.Object)
      */
-    public Object put( Object key, Object value )
-        throws NamingException
+    public Object put( Object key, Object value ) throws NamingException
     {
         Object replaced = null;
 
-        if ( allowsDuplicates ) 
+        if ( allowsDuplicates )
         {
             TreeSet set = ( TreeSet ) getRaw( key );
-            
+
             if ( null == set )
             {
                 set = new TreeSet( comparator.getValueComparator() );
-            } 
-            else if ( set.contains( value ) ) 
+            }
+            else if ( set.contains( value ) )
             {
                 return value;
             }
@@ -532,7 +515,7 @@
 
         replaced = putRaw( key, value, true );
 
-        if ( null == replaced ) 
+        if ( null == replaced )
         {
             count++;
         }
@@ -540,13 +523,12 @@
         return replaced;
     }
 
-    
+
     /**
      * @see Table#put(java.lang.Object,
      * javax.naming.NamingEnumeration)
      */
-    public Object put( Object key, NamingEnumeration values )
-        throws NamingException
+    public Object put( Object key, NamingEnumeration values ) throws NamingException
     {
         TreeSet set = null;
 
@@ -556,22 +538,21 @@
          * just return null without doing anything.  If more than one value
          * is in the enumeration than we blow a UnsupportedOperationException.
          */
-        if ( ! allowsDuplicates )
+        if ( !allowsDuplicates )
         {
             if ( values.hasMore() )
             {
                 Object value = values.next();
-                
+
                 if ( values.hasMore() )
                 {
-                    throw new UnsupportedOperationException(
-                        "Attempting to put duplicate keys into table " 
-                        + name + " which does not support duplicates" );    
+                    throw new UnsupportedOperationException( "Attempting to put duplicate keys into table " + name
+                        + " which does not support duplicates" );
                 }
-                
+
                 return put( key, value );
             }
-            
+
             return null;
         }
 
@@ -583,16 +564,16 @@
          */
         set = ( TreeSet ) getRaw( key );
 
-        if ( null == set ) 
+        if ( null == set )
         {
             set = new TreeSet( comparator.getValueComparator() );
-        } 
+        }
 
-        while ( values.hasMore() ) 
+        while ( values.hasMore() )
         {
             Object val = values.next();
-            
-            if ( ! set.contains( val ) ) 
+
+            if ( !set.contains( val ) )
             {
                 set.add( val );
                 count++;
@@ -608,26 +589,25 @@
      * @see Table#remove(java.lang.Object,
      * java.lang.Object)
      */
-    public Object remove( Object key, Object value )
-        throws NamingException
+    public Object remove( Object key, Object value ) throws NamingException
     {
-        if ( allowsDuplicates ) 
+        if ( allowsDuplicates )
         {
             TreeSet set = ( TreeSet ) getRaw( key );
 
-            if ( null == set ) 
+            if ( null == set )
             {
                 return null;
             }
 
             // If removal succeeds then remove if set is empty else replace it
-            if ( set.remove( value ) )  
+            if ( set.remove( value ) )
             {
-                if ( set.isEmpty() ) 
+                if ( set.isEmpty() )
                 {
                     removeRaw( key );
-                } 
-                else 
+                }
+                else
                 {
                     putRaw( key, set, true );
                 }
@@ -641,7 +621,7 @@
         }
 
         // Remove the value only if it is the same as value.
-        if ( getRaw( key ).equals( value ) ) 
+        if ( getRaw( key ).equals( value ) )
         {
             return removeRaw( key );
         }
@@ -654,33 +634,31 @@
      * @see Table#remove(java.lang.Object,
      * javax.naming.NamingEnumeration)
      */
-    public Object remove( Object key, NamingEnumeration values )
-        throws NamingException
+    public Object remove( Object key, NamingEnumeration values ) throws NamingException
     {
         TreeSet set = null;
-        
+
         /*
          * If we do not allow dupliicates call the single remove using the
          * first value in the enumeration if it exists.  If it does not we
          * just return null without doing anything.  If more than one value
          * is in the enumeration than we blow a UnsupportedOperationException.
          */
-        if ( ! allowsDuplicates )
+        if ( !allowsDuplicates )
         {
             if ( values.hasMore() )
             {
                 Object value = values.next();
-                
+
                 if ( values.hasMore() )
                 {
-                    throw new UnsupportedOperationException(
-                        "Attempting to put duplicate keys into table " 
-                        + name + " which does not support duplicates" );    
+                    throw new UnsupportedOperationException( "Attempting to put duplicate keys into table " + name
+                        + " which does not support duplicates" );
                 }
-                
+
                 return remove( key, value );
             }
-            
+
             return null;
         }
 
@@ -690,21 +668,21 @@
          * does not exist for key - nothing to do here.
          */
         set = ( TreeSet ) getRaw( key );
-        if ( null == set ) 
+        if ( null == set )
         {
             return null;
-        } 
+        }
 
         /*
          * So we have a valid TreeSet with values in it.  We check if each value
          * is in the set and remove it if it is present.  We decrement the 
          * counter while doing so.
          */
-        while ( values.hasMore() ) 
+        while ( values.hasMore() )
         {
             Object val = values.next();
-            
-            if ( ! set.contains( val ) ) 
+
+            if ( !set.contains( val ) )
             {
                 set.remove( val );
                 count--;
@@ -719,17 +697,16 @@
     /**
      * @see Table#remove(java.lang.Object)
      */
-    public Object remove( Object key )
-        throws NamingException
+    public Object remove( Object key ) throws NamingException
     {
         Object returned = removeRaw( key );
 
-        if ( null == returned ) 
+        if ( null == returned )
         {
             return null;
         }
 
-        if ( allowsDuplicates ) 
+        if ( allowsDuplicates )
         {
             TreeSet set = ( TreeSet ) returned;
             this.count -= set.size();
@@ -740,24 +717,23 @@
         return returned;
     }
 
-    
+
     /**
      * @see Table#listValues(java.lang.Object)
      */
-    public NamingEnumeration listValues( Object key ) 
-        throws NamingException 
+    public NamingEnumeration listValues( Object key ) throws NamingException
     {
         TreeSet set = null;
-        
-        if ( ! allowsDuplicates )
+
+        if ( !allowsDuplicates )
         {
             Object value = get( key );
-            
+
             if ( null == value )
             {
                 return new EmptyEnumeration();
             }
-            else 
+            else
             {
                 return new SingletonEnumeration( value );
             }
@@ -772,29 +748,33 @@
         final Iterator list = set.iterator();
         return new NamingEnumeration()
         {
-           public void close()
-           {
-           }
-           
-           public Object nextElement()
-           {
-               return list.next();
-           } 
-
-           public Object next()
-           {
-               return list.next();
-           }
-           
-           public boolean hasMore() 
-           {
-               return list.hasNext();
-           }
-           
-           public boolean hasMoreElements()
-           {
-               return list.hasNext();
-           }           
+            public void close()
+            {
+            }
+
+
+            public Object nextElement()
+            {
+                return list.next();
+            }
+
+
+            public Object next()
+            {
+                return list.next();
+            }
+
+
+            public boolean hasMore()
+            {
+                return list.hasNext();
+            }
+
+
+            public boolean hasMoreElements()
+            {
+                return list.hasNext();
+            }
         };
     }
 
@@ -803,28 +783,26 @@
     // listTuple Overloads 
     // ------------------------------------------------------------------------
 
-
     /**
      * @see org.apache.directory.server.core.partition.impl.btree.Table#listTuples()
      */
-    public NamingEnumeration listTuples()
-        throws NamingException
+    public NamingEnumeration listTuples() throws NamingException
     {
         NamingEnumeration list = null;
-        
-        try 
+
+        try
         {
             JdbmTupleBrowser browser = new JdbmTupleBrowser( bt.browse() );
             list = new NoDupsEnumeration( browser, true );
         }
-        catch ( IOException e ) 
+        catch ( IOException e )
         {
             NamingException ne = new NamingException();
             ne.setRootCause( e );
             throw ne;
         }
 
-        if ( allowsDuplicates ) 
+        if ( allowsDuplicates )
         {
             return new DupsEnumeration( ( NoDupsEnumeration ) list );
         }
@@ -836,29 +814,27 @@
     /**
      * @see org.apache.directory.server.core.partition.impl.btree.Table#listTuples(java.lang.Object)
      */
-    public NamingEnumeration listTuples( Object key )
-        throws NamingException
+    public NamingEnumeration listTuples( Object key ) throws NamingException
     {
         TreeSet set = null;
 
         // Handle single and zero value returns without duplicates enabled
-        if ( ! allowsDuplicates ) 
+        if ( !allowsDuplicates )
         {
             Object val = getRaw( key );
-            
-            if ( null == val ) 
+
+            if ( null == val )
             {
                 return new EmptyEnumeration();
-            } 
-            else 
+            }
+            else
             {
-                return new SingletonEnumeration( 
-                    new Tuple( key, getRaw( key ) ) );
+                return new SingletonEnumeration( new Tuple( key, getRaw( key ) ) );
             }
         }
 
         set = ( TreeSet ) getRaw( key );
-        if ( set == null ) 
+        if ( set == null )
         {
             return new EmptyEnumeration();
         }
@@ -871,20 +847,18 @@
      * @see Table#listTuples(java.lang.Object,
      * boolean)
      */
-    public NamingEnumeration listTuples( Object key, boolean isGreaterThan )
-        throws NamingException
+    public NamingEnumeration listTuples( Object key, boolean isGreaterThan ) throws NamingException
     {
         NamingEnumeration list = null;
 
-        try 
+        try
         {
-            if ( isGreaterThan ) 
+            if ( isGreaterThan )
             {
-                JdbmTupleBrowser browser =
-                    new JdbmTupleBrowser( bt.browse( key ) );
+                JdbmTupleBrowser browser = new JdbmTupleBrowser( bt.browse( key ) );
                 list = new NoDupsEnumeration( browser, isGreaterThan );
-            } 
-            else 
+            }
+            else
             {
                 /* According to the jdbm docs a browser is positioned right
                  * before a key greater than or equal to key.  getNext() will
@@ -897,13 +871,13 @@
                  * pass it into the NoDupsCursor constructor.
                  */
                 jdbm.helper.Tuple tuple = new jdbm.helper.Tuple();
-                TupleBrowser browser = bt.browse( key ); 
-                
-                if ( browser.getNext( tuple ) ) 
+                TupleBrowser browser = bt.browse( key );
+
+                if ( browser.getNext( tuple ) )
                 {
                     Object greaterKey = tuple.getKey();
-                    
-                    if ( 0 != comparator.compareKey( key, greaterKey ) ) 
+
+                    if ( 0 != comparator.compareKey( key, greaterKey ) )
                     {
                         // Make sure we don't return greaterKey in cursor
                         browser.getPrevious( tuple );
@@ -911,38 +885,35 @@
                 }
 
                 // If greaterKey != key above then it will not be returned.
-                list = new NoDupsEnumeration( 
-                    new JdbmTupleBrowser( browser ), isGreaterThan );
+                list = new NoDupsEnumeration( new JdbmTupleBrowser( browser ), isGreaterThan );
             }
-        } 
-        catch ( IOException e ) 
+        }
+        catch ( IOException e )
         {
-            NamingException ne = new NamingException(
-                "Failed to get TupleBrowser on table "
-                + name + " using key " + renderKey( key ) );
+            NamingException ne = new NamingException( "Failed to get TupleBrowser on table " + name + " using key "
+                + renderKey( key ) );
             ne.setRootCause( e );
             throw ne;
         }
 
-        if ( allowsDuplicates ) 
+        if ( allowsDuplicates )
         {
             list = new DupsEnumeration( ( NoDupsEnumeration ) list );
         }
 
         return list;
     }
-    
+
 
     /**
      * @see org.apache.directory.server.core.partition.impl.btree.Table#listTuples(java.lang.Object,
      * java.lang.Object, boolean)
      */
-    public NamingEnumeration listTuples( Object key, Object val, 
-        boolean isGreaterThan ) throws NamingException
+    public NamingEnumeration listTuples( Object key, Object val, boolean isGreaterThan ) throws NamingException
     {
         TreeSet set = null;
-        
-        if ( ! allowsDuplicates ) 
+
+        if ( !allowsDuplicates )
         {
             Object rval = getRaw( key );
 
@@ -960,7 +931,7 @@
                 return new SingletonEnumeration( new Tuple( key, val ) );
             }
             // val <= val and test is for lesser then return tuple
-            else if ( comparator.compareValue( val, rval ) <= 1 && ! isGreaterThan )
+            else if ( comparator.compareValue( val, rval ) <= 1 && !isGreaterThan )
             {
                 return new SingletonEnumeration( new Tuple( key, val ) );
             }
@@ -968,19 +939,17 @@
             return new EmptyEnumeration();
         }
 
-        
         set = ( TreeSet ) getRaw( key );
-        if ( set == null ) 
+        if ( set == null )
         {
             return new EmptyEnumeration();
         }
 
-        if ( isGreaterThan ) 
+        if ( isGreaterThan )
         {
-            return new TupleEnumeration( key, 
-                set.tailSet( val ).iterator() );
-        } 
-        else 
+            return new TupleEnumeration( key, set.tailSet( val ).iterator() );
+        }
+        else
         {
             // Get all values from the smallest upto val and put them into
             // a list.  They will be in ascending order so we need to reverse
@@ -993,7 +962,7 @@
             // does not get val if val is in the set.  So we add it now to
             // the end of the list.  List is now ascending from smallest to
             // val
-            if ( set.contains( val ) ) 
+            if ( set.contains( val ) )
             {
                 list.add( val );
             }
@@ -1010,12 +979,10 @@
     // Maintenance Operations 
     // ------------------------------------------------------------------------
 
-
     /**
      * @see Table#close()
      */
-    public synchronized void close()
-        throws NamingException
+    public synchronized void close() throws NamingException
     {
         sync();
     }
@@ -1028,15 +995,15 @@
      */
     public void sync() throws NamingException
     {
-        try 
-        {  
+        try
+        {
             long recId = recMan.getNamedObject( name + SZSUFFIX );
-                  
-            if ( 0 == recId ) 
+
+            if ( 0 == recId )
             {
                 recId = recMan.insert( new Integer( count ) );
-            } 
-            else 
+            }
+            else
             {
                 recMan.update( recId, new Integer( count ) );
             }
@@ -1054,7 +1021,6 @@
     // Private Utility Methods 
     // ------------------------------------------------------------------------
 
-
     /**
      * Renders a key using the renderer associated with this table.
      *
@@ -1066,15 +1032,15 @@
         StringBuffer buf = new StringBuffer();
 
         buf.append( "\'" );
-        if ( null == renderer ) 
+        if ( null == renderer )
         {
             buf.append( obj.toString() );
-        } 
-        else 
+        }
+        else
         {
             buf.append( renderer.getKeyString( obj ) );
         }
-        
+
         buf.append( "\'" );
         return buf.toString();
     }
@@ -1091,7 +1057,7 @@
     private Object getRaw( Object key ) throws NamingException
     {
         Object val = null;
-        
+
         if ( null == key )
         {
             return null;
@@ -1099,16 +1065,16 @@
 
         try
         {
-            if ( ! allowsDuplicates )
+            if ( !allowsDuplicates )
             {
                 val = bt.find( key );
             }
-            else 
+            else
             {
                 val = bt.find( key );
             }
         }
-        catch ( IOException e ) 
+        catch ( IOException e )
         {
             NamingException ne = new NamingException();
             ne.setRootCause( e );
@@ -1129,22 +1095,21 @@
      * @return the raw value object removed from the btree on replacement
      * @throws NamingException if there are any problems accessing the btree.
      */
-    private Object putRaw( Object key, Object value, boolean doReplace )
-        throws NamingException
+    private Object putRaw( Object key, Object value, boolean doReplace ) throws NamingException
     {
         Object val = null;
-        
+
         try
         {
             val = bt.insert( key, value, doReplace );
         }
-        catch ( IOException e ) 
+        catch ( IOException e )
         {
             NamingException ne = new NamingException();
             ne.setRootCause( e );
             throw ne;
         }
-        
+
         return val;
     }
 
@@ -1157,22 +1122,21 @@
      * @return the raw value object removed from the btree
      * @throws NamingException if there are any problems accessing the btree.
      */
-    private Object removeRaw( Object key )
-        throws NamingException
+    private Object removeRaw( Object key ) throws NamingException
     {
         Object val = null;
-        
+
         try
         {
             val = bt.remove( key );
         }
-        catch ( IOException e ) 
+        catch ( IOException e )
         {
             NamingException ne = new NamingException();
             ne.setRootCause( e );
             throw ne;
         }
-        
+
         return val;
     }
 }

Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTupleBrowser.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTupleBrowser.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTupleBrowser.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTupleBrowser.java Fri Feb 10 02:48:07 2006
@@ -35,28 +35,28 @@
 {
     /** underlying wrapped jdbm.helper.TupleBrowser */
     private jdbm.helper.TupleBrowser jdbmBrowser;
-    /** safe temp jdbm.helper.Tuple used to store next/previous tuples */ 
+    /** safe temp jdbm.helper.Tuple used to store next/previous tuples */
     private jdbm.helper.Tuple jdbmTuple = new jdbm.helper.Tuple();
-    
-    
+
+
     /**
      * Creates a JdbmTupleBrowser.
      *
      * @param jdbmBrowser JDBM browser to wrap.
      */
-    public JdbmTupleBrowser( jdbm.helper.TupleBrowser jdbmBrowser )
+    public JdbmTupleBrowser(jdbm.helper.TupleBrowser jdbmBrowser)
     {
         this.jdbmBrowser = jdbmBrowser;
     }
-    
-    
+
+
     /**
      * @see TupleBrowser#getNext(org.apache.directory.server.core.partition.impl.btree.Tuple)
      */
     public boolean getNext( Tuple tuple ) throws NamingException
     {
         boolean isSuccess = false;
-        
+
         synchronized ( jdbmTuple )
         {
             try
@@ -65,12 +65,11 @@
             }
             catch ( IOException ioe )
             {
-                NamingException ne = new NamingException( 
-                    "Failed on call to jdbm TupleBrowser.getNext()" );
+                NamingException ne = new NamingException( "Failed on call to jdbm TupleBrowser.getNext()" );
                 ne.setRootCause( ioe );
                 throw ne;
             }
-            
+
             if ( isSuccess )
             {
                 tuple.setKey( jdbmTuple.getKey() );
@@ -80,15 +79,15 @@
 
         return isSuccess;
     }
-    
-    
+
+
     /**
      * @see TupleBrowser#getPrevious(Tuple)
      */
     public boolean getPrevious( Tuple tuple ) throws NamingException
     {
         boolean isSuccess = false;
-        
+
         synchronized ( jdbmTuple )
         {
             try
@@ -97,12 +96,11 @@
             }
             catch ( IOException ioe )
             {
-                NamingException ne = new NamingException( 
-                    "Failed on call to jdbm TupleBrowser.getPrevious()" );
+                NamingException ne = new NamingException( "Failed on call to jdbm TupleBrowser.getPrevious()" );
                 ne.setRootCause( ioe );
                 throw ne;
             }
-            
+
             if ( isSuccess )
             {
                 tuple.setKey( jdbmTuple.getKey() );

Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java Fri Feb 10 02:48:07 2006
@@ -51,7 +51,7 @@
 
         for ( int ii = 0; ii < comps.length; ii++ )
         {
-            if ( comps[ii] != null && ! comps[ii].trim().equals( "" ) )
+            if ( comps[ii] != null && !comps[ii].trim().equals( "" ) )
             {
                 dn.add( "prefNodeName=" + comps[ii] );
             }

Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java Fri Feb 10 02:48:07 2006
@@ -40,6 +40,7 @@
 
     public Preferences userRoot()
     {
-        throw new NotImplementedException( "userRoot() in org.apache.directory.server.prefs.ServerPreferencesFactory not implemented!" );
+        throw new NotImplementedException(
+            "userRoot() in org.apache.directory.server.prefs.ServerPreferencesFactory not implemented!" );
     }
 }

Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java Fri Feb 10 02:48:07 2006
@@ -30,22 +30,26 @@
 {
     private static final long serialVersionUID = -2042269063779317751L;
 
+
     public ServerSystemPreferenceException()
     {
         super();
     }
 
-    public ServerSystemPreferenceException( String message )
+
+    public ServerSystemPreferenceException(String message)
     {
         super( message );
     }
 
-    public ServerSystemPreferenceException( String message, Throwable cause )
+
+    public ServerSystemPreferenceException(String message, Throwable cause)
     {
         super( message, cause );
     }
 
-    public ServerSystemPreferenceException( Throwable cause )
+
+    public ServerSystemPreferenceException(Throwable cause)
     {
         super( cause );
     }

Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java Fri Feb 10 02:48:07 2006
@@ -66,10 +66,10 @@
     private LdapContext ctx;
 
     /** the changes (ModificationItems) representing cached alterations to preferences */
-    private ArrayList changes = new ArrayList(3);
+    private ArrayList changes = new ArrayList( 3 );
 
     /** maps changes based on key: key->list of mods (on same key) */
-    private HashMap keyToChange = new HashMap(3);
+    private HashMap keyToChange = new HashMap( 3 );
 
 
     /**
@@ -83,7 +83,7 @@
 
         MutableStartupConfiguration cfg = new MutableStartupConfiguration();
         cfg.setAllowAnonymousAccess( true );
-        
+
         Hashtable env = new Hashtable( cfg.toJndiEnvironment() );
         env.put( Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName() );
         env.put( Context.PROVIDER_URL, PreferencesUtils.SYSPREF_BASE );
@@ -97,10 +97,11 @@
             throw new ServerSystemPreferenceException( "Failed to open.", e );
         }
     }
-    
+
+
     public synchronized void close()
     {
-        if( this.parent() != null )
+        if ( this.parent() != null )
         {
             throw new ServerSystemPreferenceException( "Cannot close child preferences." );
         }
@@ -123,7 +124,7 @@
     /**
      * Creates a preferences object using a relative name.
      */
-    public ServerSystemPreferences( ServerSystemPreferences parent, String name )
+    public ServerSystemPreferences(ServerSystemPreferences parent, String name)
     {
         super( parent, name );
         LdapContext parentCtx = parent.getLdapContext();
@@ -156,7 +157,6 @@
     // Utility Methods
     // ------------------------------------------------------------------------
 
-
     /**
      * Wrapps this ServerPreferences object as a Dictionary.
      *
@@ -208,7 +208,6 @@
     // Protected SPI Methods
     // ------------------------------------------------------------------------
 
-
     protected void flushSpi() throws BackingStoreException
     {
         if ( ctx == null )
@@ -216,7 +215,6 @@
             throw new BackingStoreException( "Ldap context not available for " + super.absolutePath() );
         }
 
-
         if ( changes.isEmpty() )
         {
             return;
@@ -259,7 +257,6 @@
         {
             throw new BackingStoreException( "Ldap context not available for " + super.absolutePath() );
         }
-
 
         if ( changes.isEmpty() )
         {

Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralLut.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralLut.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralLut.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralLut.java Fri Feb 10 02:48:07 2006
@@ -41,12 +41,11 @@
     /** the set of names in the LUT */
     private Set names = new HashSet();
 
-    
+
     // -----------------------------------------------------------------------
     // Methods to access the LUT: all names are expected to be normalized
     // -----------------------------------------------------------------------
-    
-    
+
     /**
      * Checks if a the entry at a name is a referral.
      * 
@@ -54,11 +53,12 @@
      */
     public boolean isReferral( Name dn )
     {
-        if ( dn == null ) throw new IllegalArgumentException( "dn cannot be null" );
+        if ( dn == null )
+            throw new IllegalArgumentException( "dn cannot be null" );
         return names.contains( dn.toString() );
     }
-    
-    
+
+
     /**
      * Checks if a the entry at a name is a referral.
      * 
@@ -66,11 +66,12 @@
      */
     public boolean isReferral( String dn )
     {
-        if ( dn == null ) throw new IllegalArgumentException( "dn cannot be null" );
+        if ( dn == null )
+            throw new IllegalArgumentException( "dn cannot be null" );
         return names.contains( dn );
     }
-    
-    
+
+
     /**
      * Gets the normalized name of the farthest ancestor that is a referral. If the argument 
      * is a referral it will not be returned.  Only ancestor's (includes parent) are considered.
@@ -78,9 +79,10 @@
      * @param dn the name to get the farthest ancestor referral name for
      * @return the farthest referral ancestor
      */
-    public Name getFarthestReferralAncestor( Name dn ) 
+    public Name getFarthestReferralAncestor( Name dn )
     {
-        if ( dn == null ) throw new IllegalArgumentException( "dn cannot be null" );
+        if ( dn == null )
+            throw new IllegalArgumentException( "dn cannot be null" );
         Name farthest = new LdapName();
         for ( int ii = 0; ii < dn.size(); ii++ )
         {
@@ -100,8 +102,8 @@
         }
         return null;
     }
-    
-    
+
+
     /**
      * Gets the normalized name of the nearest ancestor that is a referral.  If the argument
      * is a referral it will not be returned.  Only ancestor's (includes parent) are considered.
@@ -109,13 +111,14 @@
      * @param dn the name to get the nearest ancestor referral name for
      * @return the nearest referral ancestor or null if one does not exist
      */
-    public Name getNearestReferralAncestor( Name dn ) 
+    public Name getNearestReferralAncestor( Name dn )
     {
-        if ( dn == null ) throw new IllegalArgumentException( "dn cannot be null" );
+        if ( dn == null )
+            throw new IllegalArgumentException( "dn cannot be null" );
         Name cloned = ( Name ) dn.clone();
-        
+
         // do not return the argument dn if it is a referral (skip it)
-        if ( cloned.size() > 0 ) 
+        if ( cloned.size() > 0 )
         {
             try
             {
@@ -130,8 +133,8 @@
         {
             return null;
         }
-        
-        while ( ! isReferral( cloned ) && cloned.size() > 0 )
+
+        while ( !isReferral( cloned ) && cloned.size() > 0 )
         {
             try
             {
@@ -145,12 +148,11 @@
         return cloned.isEmpty() ? null : cloned;
     }
 
-    
+
     // -----------------------------------------------------------------------
     // Methods that notify this lookup table of changes to referrals
     // -----------------------------------------------------------------------
-    
-    
+
     /**
      * Called to add an entry to the LUT when a referral is added.
      * 
@@ -158,14 +160,15 @@
      */
     public void referralAdded( Name dn )
     {
-        if ( dn == null ) throw new IllegalArgumentException( "dn cannot be null" );
-        if ( ! names.add( dn.toString() ) && log.isWarnEnabled() )
+        if ( dn == null )
+            throw new IllegalArgumentException( "dn cannot be null" );
+        if ( !names.add( dn.toString() ) && log.isWarnEnabled() )
         {
             log.warn( "found " + dn + " in refname lut while adding it" );
         }
     }
-    
-    
+
+
     /**
      * Called to add an entry to the LUT when a referral is added.
      * 
@@ -173,14 +176,15 @@
      */
     public void referralAdded( String dn )
     {
-        if ( dn == null ) throw new IllegalArgumentException( "dn cannot be null" );
-        if ( ! names.add( dn ) && log.isWarnEnabled() )
+        if ( dn == null )
+            throw new IllegalArgumentException( "dn cannot be null" );
+        if ( !names.add( dn ) && log.isWarnEnabled() )
         {
             log.warn( "found " + dn + " in refname lut while adding it" );
         }
     }
-    
-    
+
+
     /**
      * Called delete an entry from the LUT when a referral is deleted.
      * 
@@ -188,14 +192,15 @@
      */
     public void referralDeleted( Name dn )
     {
-        if ( dn == null ) throw new IllegalArgumentException( "dn cannot be null" );
-        if ( ! names.remove( dn.toString() ) && log.isWarnEnabled() )
+        if ( dn == null )
+            throw new IllegalArgumentException( "dn cannot be null" );
+        if ( !names.remove( dn.toString() ) && log.isWarnEnabled() )
         {
             log.warn( "cound not find " + dn + " in refname lut while deleting it" );
         }
     }
-    
-    
+
+
     /**
      * Called delete an entry from the LUT when a referral is deleted.
      * 
@@ -203,14 +208,15 @@
      */
     public void referralDeleted( String dn )
     {
-        if ( dn == null ) throw new IllegalArgumentException( "dn cannot be null" );
-        if ( ! names.remove( dn ) && log.isWarnEnabled() )
+        if ( dn == null )
+            throw new IllegalArgumentException( "dn cannot be null" );
+        if ( !names.remove( dn ) && log.isWarnEnabled() )
         {
             log.warn( "cound not find " + dn + " in refname lut while deleting it" );
         }
     }
-    
-    
+
+
     /**
      * Called to update the LUT when the name of the referral changes due to 
      * a rename or move in the DIT.
@@ -220,18 +226,19 @@
      */
     public void referralChanged( Name oldDn, Name newDn )
     {
-        if ( oldDn == null || newDn == null ) throw new IllegalArgumentException( "old or new dn cannot be null" );
-        if ( ! names.remove( oldDn.toString() ) && log.isWarnEnabled() )
+        if ( oldDn == null || newDn == null )
+            throw new IllegalArgumentException( "old or new dn cannot be null" );
+        if ( !names.remove( oldDn.toString() ) && log.isWarnEnabled() )
         {
             log.warn( "cound not find old name (" + oldDn + ") in refname lut while moving or renaming it" );
         }
-        if ( ! names.add( newDn.toString() ) && log.isWarnEnabled() )
+        if ( !names.add( newDn.toString() ) && log.isWarnEnabled() )
         {
             log.warn( "found new name (" + newDn + ") in refname lut while moving or renaming " + oldDn );
         }
     }
-    
-    
+
+
     /**
      * Called to update the LUT when the name of the referral changes due to 
      * a rename or move in the DIT.
@@ -241,18 +248,19 @@
      */
     public void referralChanged( String oldDn, String newDn )
     {
-        if ( oldDn == null || newDn == null ) throw new IllegalArgumentException( "old or new dn cannot be null" );
-        if ( ! names.remove( oldDn ) && log.isWarnEnabled() )
+        if ( oldDn == null || newDn == null )
+            throw new IllegalArgumentException( "old or new dn cannot be null" );
+        if ( !names.remove( oldDn ) && log.isWarnEnabled() )
         {
             log.warn( "cound not find old name (" + oldDn + ") in refname lut while moving or renaming it" );
         }
-        if ( ! names.add( newDn ) && log.isWarnEnabled() )
+        if ( !names.add( newDn ) && log.isWarnEnabled() )
         {
             log.warn( "found new name (" + newDn + ") in refname lut while moving or renaming " + oldDn );
         }
     }
-    
-    
+
+
     /**
      * Called to update the LUT when the name of the referral changes due to 
      * a rename or move in the DIT.
@@ -262,18 +270,19 @@
      */
     public void referralChanged( Name oldDn, String newDn )
     {
-        if ( oldDn == null || newDn == null ) throw new IllegalArgumentException( "old or new dn cannot be null" );
-        if ( ! names.remove( oldDn.toString() ) && log.isWarnEnabled() )
+        if ( oldDn == null || newDn == null )
+            throw new IllegalArgumentException( "old or new dn cannot be null" );
+        if ( !names.remove( oldDn.toString() ) && log.isWarnEnabled() )
         {
             log.warn( "cound not find old name (" + oldDn + ") in refname lut while moving or renaming it" );
         }
-        if ( ! names.add( newDn ) && log.isWarnEnabled() )
+        if ( !names.add( newDn ) && log.isWarnEnabled() )
         {
             log.warn( "found new name (" + newDn + ") in refname lut while moving or renaming " + oldDn );
         }
     }
-    
-    
+
+
     /**
      * Called to update the LUT when the name of the referral changes due to 
      * a rename or move in the DIT.
@@ -283,12 +292,13 @@
      */
     public void referralChanged( String oldDn, Name newDn )
     {
-        if ( oldDn == null || newDn == null ) throw new IllegalArgumentException( "old or new dn cannot be null" );
-        if ( ! names.remove( oldDn ) && log.isWarnEnabled() )
+        if ( oldDn == null || newDn == null )
+            throw new IllegalArgumentException( "old or new dn cannot be null" );
+        if ( !names.remove( oldDn ) && log.isWarnEnabled() )
         {
             log.warn( "cound not find old name (" + oldDn + ") in refname lut while moving or renaming it" );
         }
-        if ( ! names.add( newDn ) && log.isWarnEnabled() )
+        if ( !names.add( newDn ) && log.isWarnEnabled() )
         {
             log.warn( "found new name (" + newDn + ") in refname lut while moving or renaming " + oldDn );
         }



Mime
View raw message