Index: MRUMemoryStore.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/components/store/MRUMemoryStore.java,v
retrieving revision 1.18
diff -u -r1.18 MRUMemoryStore.java
--- MRUMemoryStore.java	2001/09/05 11:56:26	1.18
+++ MRUMemoryStore.java	2001/09/11 10:07:41
@@ -49,32 +49,13 @@
                                                                 ThreadSafe, Runnable, 
                                                                 Composable, Contextualizable {
  
-  /**
-   * Indicates the daemon thread priority.
-   */
+  
   private int priority;
-
-  /**
-   * Indicates the max. object in the cache
-   */
   private int maxobjects;
-
-  /**
-   * Sets the filesystem store on or off
-   */
   private boolean filesystem;
-
-  /**
-   * The heart of the cache
-   */
   private HashMap cache;
   private LinkedList mrulist;
-
   private Runtime jvm;
-  
-  /**
-   * Filesystem storage;
-   */
   private File cachefile;
   private Store fsstore;
   private StoreJanitor storejanitor;
@@ -83,12 +64,12 @@
   private File cachedir;
   private File workdir;
   private String cachedirstr;
-    
-  /** the component manager */
   protected ComponentManager manager;
 
   /**
-   * Get the filesystem store from the component manager
+   * Get components of the ComponentManager
+   * 
+   * @param the ComponentManager
    */
   public void compose(ComponentManager manager) throws ComponentException {
     try {
@@ -103,7 +84,9 @@
   }
   
   /**
-   * Get the caching directory from the servlet context
+   * Get the context
+   *
+   * @param the Context of the application
    */
   public void contextualize(Context context) throws ContextException {
     this.cachedirstr = new String();
@@ -126,10 +109,13 @@
    * Initialize the MRUMemoryStore.
    * A few options can be used :
    * <UL>
-   *  <LI>maxobjects = how many objects will be stored in memory (Default: 10o objects)</LI>
-   *  <LI>threadpriority = priority of the thread (1-10). (Default: 10)</LI>
+   *  <LI>maxobjects = how many objects will be stored in memory (Default: 10 objects)</LI>
+   *  <LI>threadpriority = priority of the threads (1-10). (Default: 10)</LI>
    *  <LI>filesystem = use filesystem storage to keep object persistent (Default: false)</LI>
    * </UL>
+   *
+   * @param the Configuration of the application
+   * @exception ConfigurationException
    */
   public void configure(Configuration conf) throws ConfigurationException {
     this.jvm         = Runtime.getRuntime();
@@ -161,10 +147,7 @@
   }
 
   /**
-   * Background threads.
-   * Thread checker checks that memory is not running too low in the JVM because of the Store.
-   * It will try to keep overall memory usage below the requested levels.
-   * Thread writer writes objects from the writer stack onto the filesystem.
+   * The writer thread writes objects from the writer stack onto the filesystem.
    */
   public void run() {
     while (true) {
@@ -192,15 +175,21 @@
    * Store the given object in a persistent state. It is up to the
    * caller to ensure that the key has a persistent state across
    * different JVM executions.
+   *
+   * @param the key for the object to store
+   * @param the object to store
    */
   public void store(Object key, Object value) {
     this.hold(key,value);
   }
 
   /**
-   * This method holds the requested object in a HashMap combined with a LinkedList to
-   * create the MRU.
-   * It also can store the objects onto the filesystem if configured.
+   * This method holds the requested object in a HashMap combined 
+   * with a LinkedList to create the MRU.
+   * It also stores objects onto the filesystem if configured.
+   *
+   * @param the key of the object to be stored
+   * @param the object to be stored
    */
   public void hold(Object key, Object value) {
     getLogger().debug("Holding object in memory. key: " + key);
@@ -232,6 +221,9 @@
 
   /**
    * Get the object associated to the given unique key.
+   *
+   * @param the key of the requested object
+   * @return the requested object
    */
   public Object get(Object key) {
     getLogger().debug("Getting object from memory. Key: " + key);
@@ -270,8 +262,9 @@
   }
 
   /**
-   * Remove the object associated to the given key and returns
-   * the object associated to the given key or null if not found.
+   * Remove the object associated to the given key.
+   *
+   * @param the key of to be removed object
    */
   public void remove(Object key) {
     getLogger().debug("Removing object from store");
@@ -284,6 +277,9 @@
 
   /**
    * Indicates if the given key is associated to a contained object.
+   *
+   * @param the key of the object
+   * @return true if the key exists
    */
   public boolean containsKey(Object key) {
     synchronized(this.cache) {
@@ -292,7 +288,9 @@
   }
 
   /**
-   * Returns the list of used keys as an Enumeration of Objects.
+   * Returns the list of used keys as an Enumeration.
+   *
+   * @return the enumeration of the cache
    */
   public Enumeration keys() {
     /* Not yet implemented */
@@ -301,7 +299,7 @@
 
   /**
    * Frees some of the fast memory used by this store.
-   * It removes the last element in the cache.
+   * It removes the last element in the store.
    */
   public void free() {
     try {
@@ -320,6 +318,9 @@
    * This method checks if an object is seriazable. 
    * FIXME: In the moment only CachedEventObject or
    * CachedStreamObject are stored.
+   *
+   * @param the object to be checked
+   * @return true if the object is storeable
    */
   private boolean checkSerializable(Object object) {
     try {
@@ -337,6 +338,14 @@
     }
   }
 
+  /**
+   * This method puts together a filename for 
+   * the object, which shall be stored on the
+   * filesystem.
+   *
+   * @param the key of the object
+   * @return the filename of the key
+   */
   private String getFileName(String key)
   {
       return new StringBuffer()
Index: StoreJanitorImpl.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/components/store/StoreJanitorImpl.java,v
retrieving revision 1.2
diff -u -r1.2 StoreJanitorImpl.java
--- StoreJanitorImpl.java	2001/09/07 10:58:44	1.2
+++ StoreJanitorImpl.java	2001/09/11 10:07:43
@@ -48,6 +48,9 @@
    *  <LI>cleanupthreadinterval = how often (sec) shall run the cleanup thread</LI>
    *  <LI>threadpriority = priority of the thread (1-10). (Default: 10)</LI>
    * </UL>
+   *
+   * @param the Configuration of the application
+   * @exception ConfigurationException
    */
   public void configure(Configuration conf) throws ConfigurationException {
     this.getLogger().debug("Configure StoreJanitorImpl");
@@ -59,6 +62,19 @@
     this.setCleanupthreadinterval(params.getParameterAsInteger("cleanupthreadinterval",10));
     this.setPriority(params.getParameterAsInteger("threadpriority",Thread.currentThread().getPriority()));
 
+    if ((this.getFreememory() < 1)) {
+      throw new ConfigurationException("StoreJanitorImpl freememory parameter has to be greater then 1");
+    }
+    if ((this.getHeapsize() < 1)) {
+       throw new ConfigurationException("StoreJanitorImpl heapsize parameter has to be greater then 1");
+    }
+    if ((this.getCleanupthreadinterval() < 1)) {
+       throw new ConfigurationException("StoreJanitorImpl cleanupthreadinterval parameter has to be greater then 1");
+    }
+    if ((this.getPriority() < 1)) {
+        throw new ConfigurationException("StoreJanitorImpl threadpriority has to be greater then 1");
+    }
+
     this.setStoreList(new ArrayList());
 
     Thread checker = new Thread(this);
@@ -69,6 +85,9 @@
     checker.start();
   }
 
+  /**
+   * The "checker" thread checks if memory is running low in the jvm.
+   */
   public void run() {
     while (true) {
       // amount of memory used is greater then heapsize
@@ -94,7 +113,9 @@
   }
 
   /**
-   * Method to check if memory is running low in the getJVM().
+   * Method to check if memory is running low in the JVM.
+   *
+   * @return true if memory is low
    */
   private boolean memoryLow() {
     this.getLogger().debug("getJVM().totalMemory()=" + this.getJVM().totalMemory());
@@ -105,7 +126,9 @@
   }
 
   /**
-   * This method register the store in the StoreJanitor
+   * This method register the stores
+   *
+   * @param the store to be registered
    */
   public void register(Store store) {
     this.getLogger().debug("Registering store instance");
@@ -114,7 +137,9 @@
   }
 
   /**
-   * This method unregister the store in the StoreJanitor
+   * This method unregister the stores
+   *
+   * @param the store to be unregistered
    */
   public void unregister(Store store) {
     this.getLogger().debug("Unregister store instance");
@@ -161,9 +186,6 @@
     this.getJVM().gc();
   }
 
-  /** 
-   * Getter and setter methods
-   */
   private int getFreememory() {
     return freememory;
   }
