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 2010/02/25 00:40:15 UTC

svn commit: r916040 - in /directory/apacheds/trunk/jdbm/src/main/java/jdbm: RecordManager.java RecordManagerFactory.java RecordManagerOptions.java RecordManagerProvider.java helper/MRU.java recman/Provider.java

Author: akarasulu
Date: Wed Feb 24 23:40:14 2010
New Revision: 916040

URL: http://svn.apache.org/viewvc?rev=916040&view=rev
Log:
more formatting

Modified:
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManager.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerFactory.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerOptions.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerProvider.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/MRU.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/Provider.java

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManager.java?rev=916040&r1=916039&r2=916040&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManager.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManager.java Wed Feb 24 23:40:14 2010
@@ -53,13 +53,13 @@
 
 
 /**
- *  An interface to manages records, which are uninterpreted blobs of data.
- *  <p>
- *  The set of record operations is simple: fetch, insert, update and delete.
- *  Each record is identified using a "rowid" and contains a byte[] data block.
- *  Rowids are returned on inserts and you can store them someplace safe
- *  to be able to get  back to them.  Data blocks can be as long as you wish,
- *  and may have lengths different from the original when updating.
+ * An interface to manages records, which are uninterpreted blobs of data.
+ * <p>
+ * The set of record operations is simple: fetch, insert, update and delete.
+ * Each record is identified using a "rowid" and contains a byte[] data block.
+ * Rowids are returned on inserts and you can store them someplace safe
+ * to be able to get  back to them.  Data blocks can be as long as you wish,
+ * and may have lengths different from the original when updating.
  *
  * @author <a href="mailto:boisvert@intalio.com">Alex Boisvert</a>
  * @author <a href="cg@cdegroot.com">Cees de Groot</a>
@@ -67,139 +67,128 @@
  */
 public interface RecordManager
 {
-    /**
-     * Reserved slot for name directory.
-     */
+    /** Reserved slot for name directory. */
     int NAME_DIRECTORY_ROOT = 0;
 
 
-    /**
-     *  Inserts a new record using standard java object serialization.
+    /** 
+     * Inserts a new record using standard java object serialization.
      *
-     *  @param obj the object for the new record.
-     *  @return the rowid for the new record.
-     *  @throws IOException when one of the underlying I/O operations fails.
+     * @param obj the object for the new record.
+     * @return the rowid for the new record.
+     * @throws IOException when one of the underlying I/O operations fails.
      */
     long insert( Object obj ) throws IOException;
 
     
     /**
-     *  Inserts a new record using a custom serializer.
+     * Inserts a new record using a custom serializer.
      *
-     *  @param obj the object for the new record.
-     *  @param serializer a custom serializer
-     *  @return the rowid for the new record.
-     *  @throws IOException when one of the underlying I/O operations fails.
+     * @param obj the object for the new record.
+     * @param serializer a custom serializer
+     * @return the rowid for the new record.
+     * @throws IOException when one of the underlying I/O operations fails.
      */
     long insert( Object obj, Serializer serializer ) throws IOException;
 
 
     /**
-     *  Deletes a record.
+     * Deletes a record.
      *
-     *  @param recid the rowid for the record that should be deleted.
-     *  @throws IOException when one of the underlying I/O operations fails.
+     * @param recid the rowid for the record that should be deleted.
+     * @throws IOException when one of the underlying I/O operations fails.
      */
     void delete( long recid ) throws IOException;
 
 
     /**
-     *  Updates a record using standard java object serialization.
+     * Updates a record using standard java object serialization.
      *
-     *  @param recid the recid for the record that is to be updated.
-     *  @param obj the new object for the record.
-     *  @throws IOException when one of the underlying I/O operations fails.
+     * @param recid the recid for the record that is to be updated.
+     * @param obj the new object for the record.
+     * @throws IOException when one of the underlying I/O operations fails.
      */
     void update( long recid, Object obj ) throws IOException;
 
 
     /**
-     *  Updates a record using a custom serializer.
+     * Updates a record using a custom serializer.
      *
-     *  @param recid the recid for the record that is to be updated.
-     *  @param obj the new object for the record.
-     *  @param serializer a custom serializer
-     *  @throws IOException when one of the underlying I/O operations fails.
+     * @param recid the recid for the record that is to be updated.
+     * @param obj the new object for the record.
+     * @param serializer a custom serializer
+     * @throws IOException when one of the underlying I/O operations fails.
      */
     void update( long recid, Object obj, Serializer serializer ) throws IOException;
 
     
     /**
-     *  Fetches a record using standard java object serialization.
+     * Fetches a record using standard java object serialization.
      *
-     *  @param recid the recid for the record that must be fetched.
-     *  @return the object contained in the record.
-     *  @throws IOException when one of the underlying I/O operations fails.
+     * @param recid the recid for the record that must be fetched.
+     * @return the object contained in the record.
+     * @throws IOException when one of the underlying I/O operations fails.
      */
     Object fetch( long recid ) throws IOException;
 
 
     /**
-     *  Fetches a record using a custom serializer.
+     * Fetches a record using a custom serializer.
      *
-     *  @param recid the recid for the record that must be fetched.
-     *  @param serializer a custom serializer
-     *  @return the object contained in the record.
-     *  @throws IOException when one of the underlying I/O operations fails.
+     * @param recid the recid for the record that must be fetched.
+     * @param serializer a custom serializer
+     * @return the object contained in the record.
+     * @throws IOException when one of the underlying I/O operations fails.
      */
     Object fetch( long recid, Serializer serializer ) throws IOException;
 
 
     /**
-     *  Closes the record manager.
+     * Closes the record manager.
      *
-     *  @throws IOException when one of the underlying I/O operations fails.
+     * @throws IOException when one of the underlying I/O operations fails.
      */
     void close() throws IOException;
 
 
     /**
-     *  Returns the number of slots available for "root" rowids. These slots
-     *  can be used to store special rowids, like rowids that point to
-     *  other rowids. Root rowids are useful for bootstrapping access to
-     *  a set of data.
+     * Returns the number of slots available for "root" rowids. These slots
+     * can be used to store special rowids, like rowids that point to
+     * other rowids. Root rowids are useful for bootstrapping access to
+     * a set of data.
      */
     int getRootCount();
 
 
     /**
-     *  Returns the indicated root rowid.
+     * Returns the indicated root rowid.
      *
-     *  @see #getRootCount
+     * @see #getRootCount
      */
     long getRoot( int id ) throws IOException;
 
 
     /**
-     *  Sets the indicated root rowid.
+     * Sets the indicated root rowid.
      *
-     *  @see #getRootCount
+     * @see #getRootCount
      */
     void setRoot( int id, long rowid ) throws IOException;
 
 
-    /**
-     * Commit (make persistent) all changes since beginning of transaction.
-     */
+    /** Commit (make persistent) all changes since beginning of transaction. */
     void commit() throws IOException;
 
 
-    /**
-     * Rollback (cancel) all changes since beginning of transaction.
-     */
+    /** Rollback (cancel) all changes since beginning of transaction. */
     void rollback() throws IOException;
 
 
-    /**
-     * Obtain the record id of a named object. Returns 0 if named object
-     * doesn't exist.
-     */
+    /** Obtain the record id of a named object. Returns 0 if named object doesn't exist. */
     long getNamedObject( String name ) throws IOException;
 
 
-    /**
-     * Set the record id of a named object.
-     */
+    /** Set the record id of a named object. */
     void setNamedObject( String name, long recid ) throws IOException;
 }
 

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerFactory.java?rev=916040&r1=916039&r2=916040&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerFactory.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerFactory.java Wed Feb 24 23:40:14 2010
@@ -45,14 +45,15 @@
  *
  * $Id: RecordManagerFactory.java,v 1.2 2005/06/25 23:12:31 doomdark Exp $
  */
-
 package jdbm;
 
+
 import java.io.IOException;
 import java.util.Properties;
 
 import org.apache.directory.server.i18n.I18n;
 
+
 /**
  * This is the factory class to use for instantiating {@link RecordManager}
  * instances.
@@ -74,8 +75,7 @@
      *                                      implementation.
      * @throws IllegalArgumentException if some options are invalid.
      */
-    public static RecordManager createRecordManager( String name )
-        throws IOException
+    public static RecordManager createRecordManager( String name ) throws IOException
     {
         return createRecordManager( name, new Properties() );
     }
@@ -92,25 +92,25 @@
      *                                      implementation.
      * @throws IllegalArgumentException if some options are invalid.
      */
-    public static RecordManager createRecordManager( String name,
-                                                     Properties options )
-        throws IOException
+    public static RecordManager createRecordManager( String name, Properties options ) throws IOException
     {
         String                 provider;
-        Class                  clazz;
+        Class<?>               clazz;
         RecordManagerProvider  factory;
 
-        provider = options.getProperty( RecordManagerOptions.PROVIDER_FACTORY,
-                                        "jdbm.recman.Provider" );
+        provider = options.getProperty( RecordManagerOptions.PROVIDER_FACTORY, "jdbm.recman.Provider" );
 
-        try {
+        try 
+        {
             clazz = Thread.currentThread().getContextClassLoader().loadClass( provider );
-            factory = (RecordManagerProvider) clazz.newInstance();
-        } catch ( Exception except ) {
+            factory = ( RecordManagerProvider ) clazz.newInstance();
+        } 
+        catch ( Exception except ) 
+        {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_567, provider, except.getClass().getName(),
                 except.getLocalizedMessage() ) );
         }
+        
         return factory.createRecordManager( name, options );
     }
-
 }

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerOptions.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerOptions.java?rev=916040&r1=916039&r2=916040&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerOptions.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerOptions.java Wed Feb 24 23:40:14 2010
@@ -45,9 +45,9 @@
  *
  * $Id: RecordManagerOptions.java,v 1.1 2002/05/31 06:33:20 boisvert Exp $
  */
-
 package jdbm;
 
+
 /**
  * Standard options for RecordManager.
  *
@@ -55,50 +55,37 @@
  * @author <a href="cg@cdegroot.com">Cees de Groot</a>
  * @version $Id: RecordManagerOptions.java,v 1.1 2002/05/31 06:33:20 boisvert Exp $
  */
-public class RecordManagerOptions
+public interface RecordManagerOptions
 {
-
-    /**
-     * Option to create a thread-safe record manager.
-     */
-    public static final String PROVIDER_FACTORY = "jdbm.provider";
+    /** Option to create a thread-safe record manager. */
+    String PROVIDER_FACTORY = "jdbm.provider";
 
 
-    /**
-     * Option to create a thread-safe record manager.
-     */
-    public static final String THREAD_SAFE = "jdbm.threadSafe";
+    /** Option to create a thread-safe record manager. */
+    String THREAD_SAFE = "jdbm.threadSafe";
 
 
-    /**
-     * Option to automatically commit data after each operation.
-     */
-    public static final String AUTO_COMMIT = "jdbm.autoCommit";
+    /** Option to automatically commit data after each operation. */
+    String AUTO_COMMIT = "jdbm.autoCommit";
 
 
     /**
      * Option to disable transaction (to increase performance at the cost of
      * potential data loss).
      */
-    public static final String DISABLE_TRANSACTIONS = "jdbm.disableTransactions";
+    String DISABLE_TRANSACTIONS = "jdbm.disableTransactions";
 
 
-    /**
-     * Cache type.
-     */
-    public static final String CACHE_TYPE = "jdbm.cache.type";
+    /** Cache type. */
+    String CACHE_TYPE = "jdbm.cache.type";
 
 
-    /**
-     * Cache size (when applicable)
-     */
-    public static final String CACHE_SIZE = "jdbm.cache.size";
+    /** Cache size (when applicable) */
+    String CACHE_SIZE = "jdbm.cache.size";
 
 
-    /**
-     * Use normal (strong) object references for the record cache.
-     */
-    public static final String NORMAL_CACHE = "normal";
+    /** Use normal (strong) object references for the record cache. */
+    String NORMAL_CACHE = "normal";
 
 
     /**
@@ -108,7 +95,7 @@
      * Soft references are cleared at the discretion of the garbage collector
      * in response to memory demand.
      */
-    public static final String SOFT_REF_CACHE = "soft";
+    String SOFT_REF_CACHE = "soft";
 
 
     /**
@@ -118,6 +105,5 @@
      * Weak references do not prevent their referents from being made
      * finalizable, finalized, and then reclaimed.
      */
-    public static final String WEAK_REF_CACHE = "weak";
-
+    String WEAK_REF_CACHE = "weak";
 }

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerProvider.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerProvider.java?rev=916040&r1=916039&r2=916040&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerProvider.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/RecordManagerProvider.java Wed Feb 24 23:40:14 2010
@@ -45,15 +45,16 @@
  *
  * $Id: RecordManagerProvider.java,v 1.2 2005/06/25 23:12:31 doomdark Exp $
  */
-
 package jdbm;
 
+
 import java.io.IOException;
 import java.util.Properties;
 
+
 /**
- *  Provider of RecordManager implementation.  Classes implementing this
- *  interface act as a factory to provide implementations of RecordManager.
+ * Provider of RecordManager implementation.  Classes implementing this
+ * interface act as a factory to provide implementations of RecordManager.
  *
  * @author <a href="mailto:boisvert@intalio.com">Alex Boisvert</a>
  * @version $Id: RecordManagerProvider.java,v 1.2 2005/06/25 23:12:31 doomdark Exp $
@@ -72,7 +73,5 @@
      *                                      implementation.
      * @throws IllegalArgumentException if some options are invalid.
      */
-    public RecordManager createRecordManager( String filename,
-                                              Properties options )
-        throws IOException;
+    RecordManager createRecordManager( String filename, Properties options ) throws IOException;
 }

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/MRU.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/MRU.java?rev=916040&r1=916039&r2=916040&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/MRU.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/MRU.java Wed Feb 24 23:40:14 2010
@@ -62,7 +62,8 @@
  * @author <a href="mailto:boisvert@intalio.com">Alex Boisvert</a>
  * @version $Id: MRU.java,v 1.8 2005/06/25 23:12:31 doomdark Exp $
  */
-public class MRU implements CachePolicy {
+public class MRU implements CachePolicy 
+{
 
     /** Cached object hashtable */
     Hashtable _hash = new Hashtable();

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/Provider.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/Provider.java?rev=916040&r1=916039&r2=916040&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/Provider.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/Provider.java Wed Feb 24 23:40:14 2010
@@ -65,10 +65,8 @@
  * @author <a href="mailto:boisvert@intalio.com">Alex Boisvert</a>
  * @version $Id: Provider.java,v 1.3 2005/06/25 23:12:32 doomdark Exp $
  */
-public final class Provider
-    implements RecordManagerProvider
+public final class Provider implements RecordManagerProvider
 {
-
     /**
      * Create a default implementation record manager.
      *
@@ -80,9 +78,7 @@
      *                                      implementation.
      * @throws IllegalArgumentException if some options are invalid.
      */
-    public RecordManager createRecordManager( String name,
-                                              Properties options )
-        throws IOException
+    public RecordManager createRecordManager( String name, Properties options ) throws IOException
     {
         RecordManager  recman;
         String         value;
@@ -91,28 +87,35 @@
         recman = new BaseRecordManager( name );
 
         value = options.getProperty( RecordManagerOptions.DISABLE_TRANSACTIONS, "false" );
-        if ( value.equalsIgnoreCase( "TRUE" ) ) {
-            ( (BaseRecordManager) recman ).disableTransactions();
+        
+        if ( value.equalsIgnoreCase( "TRUE" ) ) 
+        {
+            ( ( BaseRecordManager ) recman ).disableTransactions();
         }
 
         value = options.getProperty( RecordManagerOptions.CACHE_SIZE, "1000" );
         cacheSize = Integer.parseInt( value );
 
-        value = options.getProperty( RecordManagerOptions.CACHE_TYPE,
-                                     RecordManagerOptions.NORMAL_CACHE );
-        if ( value.equalsIgnoreCase( RecordManagerOptions.NORMAL_CACHE ) ) {
+        value = options.getProperty( RecordManagerOptions.CACHE_TYPE, RecordManagerOptions.NORMAL_CACHE );
+        
+        if ( value.equalsIgnoreCase( RecordManagerOptions.NORMAL_CACHE ) ) 
+        {
             MRU cache = new MRU( cacheSize );
             recman = new CacheRecordManager( recman, cache );
-        } else if ( value.equalsIgnoreCase( RecordManagerOptions.SOFT_REF_CACHE ) ) {
+        } 
+        else if ( value.equalsIgnoreCase( RecordManagerOptions.SOFT_REF_CACHE ) ) 
+        {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_551 ) );
-        } else if ( value.equalsIgnoreCase( RecordManagerOptions.WEAK_REF_CACHE ) ) {
+        } 
+        else if ( value.equalsIgnoreCase( RecordManagerOptions.WEAK_REF_CACHE ) ) 
+        {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_552 ) );
-        } else {
+        } 
+        else 
+        {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_553, value ) );
         }
 
         return recman;
     }
-
-
 }