froehlich 01/12/14 05:09:30 Modified: scratchpad/src/org/apache/cocoon/jispstore MRUMemoryStore.java JispFilesystemStore.java Log: some cosmetic fixes Revision Changes Path 1.3 +0 -4 xml-cocoon2/scratchpad/src/org/apache/cocoon/jispstore/MRUMemoryStore.java Index: MRUMemoryStore.java =================================================================== RCS file: /home/cvs/xml-cocoon2/scratchpad/src/org/apache/cocoon/jispstore/MRUMemoryStore.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MRUMemoryStore.java 2001/12/13 16:24:28 1.2 +++ MRUMemoryStore.java 2001/12/14 13:09:29 1.3 @@ -15,7 +15,6 @@ import org.apache.avalon.framework.parameters.Parameterizable; import org.apache.avalon.framework.parameters.ParameterException; import org.apache.avalon.framework.logger.AbstractLoggable; -import org.apache.avalon.framework.parameters.Parameters; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.Constants; import org.apache.cocoon.components.store.FilesystemQueue; @@ -32,9 +31,6 @@ * This class provides a cache algorithm for the requested documents. * It combines a HashMap and a LinkedList to create a so called MRU * (Most Recently Used) cache. - * - * The idea was taken from the "Writing Advanced Application Tutorial" from - * javasoft. Many thanx to the writers! * * @author <a href="mailto:[EMAIL PROTECTED]">Gerhard Froehlich</a> * @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a> 1.6 +67 -7 xml-cocoon2/scratchpad/src/org/apache/cocoon/jispstore/JispFilesystemStore.java Index: JispFilesystemStore.java =================================================================== RCS file: /home/cvs/xml-cocoon2/scratchpad/src/org/apache/cocoon/jispstore/JispFilesystemStore.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- JispFilesystemStore.java 2001/12/13 18:37:14 1.5 +++ JispFilesystemStore.java 2001/12/14 13:09:29 1.6 @@ -7,22 +7,21 @@ *****************************************************************************/ package org.apache.cocoon.jispstore; +import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.context.ContextException; import org.apache.avalon.framework.context.Contextualizable; -import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.logger.AbstractLoggable; -import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.avalon.framework.parameters.Parameters; import org.apache.avalon.framework.parameters.Parameterizable; import org.apache.avalon.framework.parameters.ParameterException; - +import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.Constants; -import org.apache.cocoon.util.IOUtils; import org.apache.cocoon.components.store.Store; +import org.apache.cocoon.util.IOUtils; -import com.coyotegulch.jisp.IndexedObjectDatabase; import com.coyotegulch.jisp.BTreeIndex; +import com.coyotegulch.jisp.IndexedObjectDatabase; import com.coyotegulch.jisp.KeyNotFound; import java.io.File; @@ -31,7 +30,9 @@ import java.util.Enumeration; /** - * JispFilesystemStore + * This store is based on the Jisp library (http://www.coyotegulch.com/jisp/index.html) + * This store uses B-Tree indexes to access variable-length serialized data + * stored in files. * * @author <a href="mailto:[EMAIL PROTECTED]">Gerhard Froehlich</a> */ @@ -56,12 +57,19 @@ /** * Sets the repository's location + * + * @param the directory as String */ public void setDirectory(final String directory) throws IOException { this.setDirectory(new File(directory)); } + /** + * Contextualize the Component + * + * @param the Context object + */ public void contextualize(final Context context) throws ContextException { try { @@ -71,6 +79,10 @@ } } + /** + * Initialize the Component + * + */ public void initialize() { /** determine datafile */ getLogger().debug("initialize() JispFilesystemStore"); @@ -100,6 +112,18 @@ } } + /** + * Configure the Component. + * A few options can be used : + * <UL> + * <LI>mDatabaseName = the name of the data file (Default: cocoon.dat)</LI> + * <LI>mIndexName = the name of the index file (Default: cocoon.idx)</LI> + * <LI>mOrder = The page size of the B-Tree</LI> + * </UL> + * + * @param the Parameters of the application + * @exception ParameterException + */ public void parameterize(Parameters params) throws ParameterException { mDatabaseName = params.getParameter("datafile","cocoon.dat"); mIndexName = params.getParameter("indexfile","cocoon.idx"); @@ -112,6 +136,8 @@ /** * Sets the repository's location + * + * @param the directory as File */ public void setDirectory(final File directory) throws IOException { @@ -145,6 +171,8 @@ /** * Returns the repository's full pathname + * + * @return the directory as String */ public String getDirectoryPath() { return this.mDirectoryPath; @@ -168,6 +196,12 @@ return readObj; } + /** + * Store the given Object in the indexed data file. + * + * @param the Key Object + * @param the Value Object + */ public void store(Object key, Object value) throws IOException { this.getLogger().debug("store(): Store file with key: " + key.toString()); @@ -186,14 +220,28 @@ } } + /** + * Holds the given Object in the indexed data file. + * + * @param the Key Object + * @param the Value Object + */ public void hold(Object key, Object value) throws IOException { this.store(key,value); } + /** + * Frees some values of the data file + */ public void free() { - + //TODO: Implementation } + /** + * Removes a value from the data file with the given key. + * + * @param the Key Object + */ public void remove(Object key) { this.getLogger().debug("remove(..) Remove item"); @@ -209,6 +257,12 @@ } } + /** + * Test if the the index file contains the given key + * + * @param the Key Object + * @retrun true if Key exists and false if not + */ public boolean containsKey(Object key) { long res = -1; @@ -228,7 +282,13 @@ } } + /** + * Returns a Enumeration of all Key in the indexed file + * + * @retrun Enumeration Object with all existing keys + */ public Enumeration keys() { + //TODO: Implementation return null; } }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]