froehlich 02/01/15 10:16:16
Modified: src/scratchpad/src/org/apache/cocoon/jispstore
MRUMemoryStore.java JispStringKey.java
JispFilesystemStore.java
Added: src/scratchpad/src/org/apache/cocoon/jispstore
StoreJanitorImpl.java cocoon.xconf cocoon.roles
Removed: src/scratchpad/src/org/apache/cocoon/jispstore
FilesystemQueueImpl.java
Log:
test version for 2.01
Revision Changes Path
1.4 +54 -64
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/jispstore/MRUMemoryStore.java
Index: MRUMemoryStore.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/jispstore/MRUMemoryStore.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MRUMemoryStore.java 6 Jan 2002 17:18:26 -0000 1.3
+++ MRUMemoryStore.java 15 Jan 2002 18:16:16 -0000 1.4
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.jispstore;
import org.apache.avalon.framework.activity.Disposable;
@@ -17,12 +18,14 @@
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;
-import org.apache.cocoon.components.store.FilesystemQueueObject;
+
+//only for scratchpad
import org.apache.cocoon.components.store.Store;
import org.apache.cocoon.components.store.StoreJanitor;
+
import org.apache.cocoon.util.ClassUtils;
+import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.LinkedList;
@@ -44,18 +47,16 @@
Disposable {
private int mMaxobjects;
- private boolean mFilesystem;
private Hashtable mCache;
private LinkedList mMRUList;
private Store mFsstore;
private StoreJanitor mStorejanitor;
- private FilesystemQueue mFilesystemQueue;
private ComponentManager mComponetManager;
/**
* Get the object associated to the given unique key.
*
- * @param the Key Object
+ * @param key the Key Object
* @return the Object associated with Key Object
*/
public Object get(Object key) {
@@ -70,31 +71,29 @@
}
this.getLogger().debug("Object not found in memory");
- if (this.mFilesystem) {
- tmpobject = this.mFsstore.get(key);
- if (tmpobject == null) {
- if (getLogger().isDebugEnabled()) {
- this.getLogger().debug("Object was NOT found on fs. "
- + "Looked for: " + key);
- }
- return null;
- } else {
- if (getLogger().isDebugEnabled()) {
- this.getLogger().debug("Object was found on fs");
- }
- if (!this.mCache.containsKey(key)) {
- this.hold(key, tmpobject);
- }
- return tmpobject;
+
+ tmpobject = this.mFsstore.get(key);
+ if (tmpobject == null) {
+ if (getLogger().isDebugEnabled()) {
+ this.getLogger().debug("Object was NOT found on fs. "
+ + "Looked for: " + key);
+ }
+ return null;
+ } else {
+ if (getLogger().isDebugEnabled()) {
+ this.getLogger().debug("Object was found on fs");
+ }
+ if (!this.mCache.containsKey(key)) {
+ this.hold(key, tmpobject);
}
+ return tmpobject;
}
- return null;
}
/**
* Get components of the ComponentManager
*
- * @param the Component Manager
+ * @param manager the Component Manager
* @exception ComponentException
*/
public void compose(ComponentManager manager)
@@ -111,30 +110,23 @@
getLogger().debug("Looking up " + StoreJanitor.ROLE);
}
this.mStorejanitor = (StoreJanitor)
manager.lookup(StoreJanitor.ROLE);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Looking up " + FilesystemQueue.ROLE);
- }
- this.mFilesystemQueue = (FilesystemQueue)
manager.lookup(FilesystemQueue.ROLE);
}
/**
- * Configure the MRUMemoryStore. A few options can be used :
+ * Configure the MRUMemoryStore. This options can be used :
* <UL>
- * <LI> mMaxobjects = how many objects will be stored in memory
(Default:
+ * <LI> maxobjects = how many objects will be stored in memory
(Default:
* 10 objects)</LI>
- * <LI> mFilesystem = use filesystem storage to keep object persistent
* (Default: false)</LI>
* </UL>
*
- *
- * @param the Configuration Parameters
+ * @param params the configuration parameters
* @exception ParameterException
*/
public void parameterize(Parameters params)
throws ParameterException {
this.mMaxobjects = params.getParameterAsInteger("maxobjects", 100);
- this.mFilesystem = params.getParameterAsBoolean("filesystem", false);
if ((this.mMaxobjects < 1)) {
throw new ParameterException("MRUMemoryStore maxobjects must be "
+ "at least 1 milli second!");
@@ -155,8 +147,6 @@
if (this.mComponetManager != null) {
this.mComponetManager.release(this.mStorejanitor);
this.mStorejanitor = null;
- this.mComponetManager.release(this.mFilesystemQueue);
- this.mFilesystemQueue = null;
this.mComponetManager.release(this.mFsstore);
this.mFsstore = null;
}
@@ -167,21 +157,19 @@
* ensure that the key has a persistent state across different JVM
* executions.
*
- * @param the Key Object
- * @param the Value Object
+ * @param key the key object
+ * @param value the value object
*/
public void store(Object key, Object value) {
- if (this.mFilesystem) {
- if (this.checkSerializable(value) &&
- !this.mFsstore.containsKey(key)) {
- if (getLogger().isDebugEnabled()) {
- this.getLogger().debug("Storing object on fs");
- }
- try {
- this.mFilesystemQueue.insert(new
FilesystemQueueObject(key, value));
- } catch (Exception e) {
- this.getLogger().error("Error storing Object on fs", e);
- }
+ if (this.checkSerializable(value)) {
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Holding object on FS. key: " + key);
+ getLogger().debug("Holding object on FS. value: " + value);
+ }
+ try {
+ this.mFsstore.store(key,value);
+ } catch (IOException ioe) {
+ this.getLogger().error("Error storing Object on
Filesystem",ioe);
}
}
}
@@ -191,8 +179,8 @@
* LinkedList to create the MRU. It also stores objects onto the
filesystem
* if configured.
*
- * @param the Key Object
- * @param the Value Object
+ * @param key the key object
+ * @param value the value object
*/
public void hold(Object key, Object value) {
if (getLogger().isDebugEnabled()) {
@@ -213,9 +201,9 @@
}
/**
- * Remove the object associated to the given key.
+ * Remove the object associated to the given key.
*
- * @param the Key object
+ * @param key the key object
*/
public void remove(Object key) {
if (getLogger().isDebugEnabled()) {
@@ -223,7 +211,7 @@
}
this.mCache.remove(key);
this.mMRUList.remove(key);
- if (this.mFilesystem && key != null) {
+ if (key != null) {
this.mFsstore.remove(key);
}
}
@@ -231,22 +219,17 @@
/**
* Indicates if the given key is associated to a contained object.
*
- * @param the Key Object
- * @return true if Key exists and false if not
+ * @param key the key object
+ * @return true if key exists and false if not
*/
public boolean containsKey(Object key) {
- if (mFilesystem) {
- return (this.mCache.containsKey(key)
- || this.mFsstore.containsKey(key));
- } else {
- return this.mCache.containsKey(key);
- }
+ return (this.mCache.containsKey(key));
}
/**
* Returns the list of used keys as an Enumeration.
*
- * @return the enumeration of the cache
+ * @return the enumeration of the cache
*/
public Enumeration keys() {
return this.mCache.keys();
@@ -260,8 +243,15 @@
try {
if (this.mCache.size() > 0) {
this.getLogger().debug("Freeing cache");
+
+
if(checkSerializable(this.mCache.get(this.mMRUList.getLast()))) {
+ this.mFsstore.store(this.mMRUList.getLast(),
+
this.mCache.get(this.mMRUList.getLast()));
+ }
+
this.mCache.remove(this.mMRUList.getLast());
this.mMRUList.removeLast();
+
if (getLogger().isDebugEnabled()) {
this.getLogger().debug("Cache size=" + mCache.size());
}
@@ -275,8 +265,8 @@
* This method checks if an object is seriazable. FIXME: In the moment
only
* CachedEventObject or CachedStreamObject are stored.
*
- * @param the Object to be tested
- * @return true if the object is storeable
+ * @param object the object to be tested
+ * @return true if the object is storeable
*/
private boolean checkSerializable(Object object) {
try {
1.4 +21 -17
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/jispstore/JispStringKey.java
Index: JispStringKey.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/jispstore/JispStringKey.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JispStringKey.java 6 Jan 2002 17:18:26 -0000 1.3
+++ JispStringKey.java 15 Jan 2002 18:16:16 -0000 1.4
@@ -14,13 +14,11 @@
import java.io.ObjectOutput;
/**
- * Wrapper class to make our cache Key compatible with the Jisp KeyObject
NOTE:
- * This Wrapper is only for String Keys.
+ * Wrapper class for String Keys to be compatible with the
+ * Jisp KeyObject.
*
- * @author Gerhard Froehlich <a href="mailto:[EMAIL PROTECTED]">
- * [EMAIL PROTECTED]</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Gerhard Froehlich</a>
*/
-
final class JispStringKey extends KeyObject {
final static long serialVersionUID = -6894793231339165076L;
private String mKey;
@@ -35,16 +33,16 @@
/**
* Constructor for the JispStringKey object
*
- * @param the Value of the Key as String
+ * @param keyValue the Value of the Key as String
*/
public JispStringKey(String keyValue) {
mKey = keyValue;
}
/**
- * Compares two Keys
+ * Compares two String Keys
*
- * @param the KeyObject to be compared
+ * @param key the KeyObject to be compared
* @return 0 if equal, 1 if greater, -1 if less
*/
@@ -75,10 +73,13 @@
}
/**
+ * The object implements the writeExternal method to save its contents
+ * by calling the methods of DataOutput for its primitive values or
+ * calling the writeObject method of ObjectOutput for objects, strings,
+ * and arrays.
*
- *
- * @param out Description of Parameter
- * @exception IOException Description of Exception
+ * @param out the stream to write the object to
+ * @exception IOException
*/
public void writeExternal(ObjectOutput out)
throws IOException {
@@ -88,11 +89,14 @@
}
/**
- * Description of the Method
- *
- * @param in Description of Parameter
- * @exception IOException Description of Exception
- * @exception ClassNotFoundException Description of Exception
+ * The object implements the readExternal method to restore its contents
+ * by calling the methods of DataInput for primitive types and
readObject
+ * for objects, strings and arrays. The readExternal method must read
the
+ * values in the same sequence and with the same types as were written
by writeExternal.
+ *
+ * @param in the stream to read data from in order to restore the object
+ * @exception IOException
+ * @exception ClassNotFoundException
*/
public void readExternal(ObjectInput in)
@@ -101,7 +105,7 @@
}
/**
- * Overrides the toString() method
+ * Overrides the toString() method
*
* @return the Key as String
*/
1.4 +76 -71
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/jispstore/JispFilesystemStore.java
Index: JispFilesystemStore.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/jispstore/JispFilesystemStore.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JispFilesystemStore.java 6 Jan 2002 17:18:26 -0000 1.3
+++ JispFilesystemStore.java 15 Jan 2002 18:16:16 -0000 1.4
@@ -1,10 +1,11 @@
-/**
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- *
------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software
License *
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file. *
- */
+/*****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved.
*
+ * -------------------------------------------------------------------------
*
+ * This software is published under the terms of the Apache Software License
*
+ * version 1.1, a copy of which has been included with this distribution in
*
+ * the LICENSE file.
*
+
*****************************************************************************/
+
package org.apache.cocoon.jispstore;
import org.apache.avalon.framework.activity.Initializable;
@@ -17,12 +18,16 @@
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.Constants;
+
+//only for scratchpad
import org.apache.cocoon.components.store.Store;
+
import org.apache.cocoon.util.IOUtils;
import com.coyotegulch.jisp.BTreeIndex;
import com.coyotegulch.jisp.IndexedObjectDatabase;
import com.coyotegulch.jisp.KeyNotFound;
+import com.coyotegulch.jisp.KeyObject;
import java.io.File;
import java.io.IOException;
@@ -32,12 +37,10 @@
/**
* 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.
+ * to access variable-length serialized data stored in files.
*
- * @author Gerhard Froehlich
- * <a href="mailto:[EMAIL PROTECTED]">Gerhard Froehlich</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Gerhard Froehlich</a>
*/
-
public final class JispFilesystemStore
extends AbstractLoggable
implements Store,
@@ -50,14 +53,8 @@
* The directory repository
*/
protected File mDirectoryFile;
-
- /**
- * Description of the Field
- */
protected volatile String mDirectoryPath;
-
-
/**
* The database
*/
@@ -70,7 +67,7 @@
/**
* Sets the repository's location
*
- * @param the new directory value
+ * @param directory the new directory value
* @exception IOException
*/
public void setDirectory(final String directory)
@@ -81,7 +78,7 @@
/**
* Sets the repository's location
*
- * @param the new directory value
+ * @param directory the new directory value
* @exception IOException
*/
@@ -89,19 +86,11 @@
throws IOException {
this.mDirectoryFile = directory;
- /*
- * Save directory path prefix
- */
this.mDirectoryPath = IOUtils.getFullFilename(this.mDirectoryFile);
this.mDirectoryPath += File.separator;
- /*
- * Does directory exist?
- */
if (!this.mDirectoryFile.exists()) {
- /*
- * Create it anew
- */
+ /* Create it new */
if (!this.mDirectoryFile.mkdir()) {
throw new IOException(
"Error creating store directory '"
@@ -109,17 +98,13 @@
}
}
- /*
- * Is given file actually a directory?
- */
+ /* Is given file actually a directory? */
if (!this.mDirectoryFile.isDirectory()) {
throw new IOException("'" + this.mDirectoryPath
+ "' is not a directory");
}
- /*
- * Is directory readable and writable?
- */
+ /* Is directory readable and writable? */
if (!(this.mDirectoryFile.canRead()
&& this.mDirectoryFile.canWrite())) {
throw new IOException(
@@ -130,7 +115,7 @@
}
/**
- * Returns the repository's full pathname
+ * Returns the repository's full pathname
*
* @return the directory as String
*/
@@ -139,9 +124,9 @@
}
/**
- * Returns a Object from the store associated with the Key Object
+ * Returns a Object from the store associated with the Key Object
*
- * @param the Key object
+ * @param key the Key object
* @return the Object associated with Key Object
*/
public Object get(Object key) {
@@ -151,7 +136,7 @@
Object readObj = null;
try {
- readObj = mDatabase.read(new JispStringKey(key.toString()),
mIndex);
+ readObj = mDatabase.read(this.wrapKeyObject(key), mIndex);
if (getLogger().isDebugEnabled()) {
if (readObj != null) {
this.getLogger().debug("get(): FOUND!!= " + readObj);
@@ -166,18 +151,16 @@
}
/**
- * Contextualize the Component
+ * Contextualize the Component
*
- * @param the Context of the Application
+ * @param context the Context of the Application
* @exception ContextException
*/
public void contextualize(final Context context)
throws ContextException {
try {
setDirectory((File) context.get(Constants.CONTEXT_WORK_DIR));
- } catch (Exception e) {
- // ignore
- }
+ } catch (Exception ignore) {;}
}
/**
@@ -202,7 +185,6 @@
+ mDatabaseName, false);
mIndex = new BTreeIndex(this.getDirectoryPath() +
mIndexName);
mDatabase.attachIndex(mIndex);
- mIndex.dumpTree();
} else {
if (getLogger().isDebugEnabled()) {
this.getLogger().debug("initialize(): Datafile not
exists");
@@ -212,7 +194,6 @@
mIndex = new BTreeIndex(this.getDirectoryPath() + mIndexName,
mOrder, new JispStringKey(), false);
mDatabase.attachIndex(mIndex);
- mIndex.dumpTree();
}
} catch (KeyNotFound ignore) {
} catch (Exception e) {
@@ -221,24 +202,24 @@
}
/**
- * Configure the Component. A few options can be used :
+ * Configure the Component.<br>
+ * A few options can be used
* <UL>
- * <LI> mDatabaseName = the name of the data file (Default:
cocoon.dat)
+ * <LI> datafile = the name of the data file (Default: cocoon.dat)
* </LI>
- * <LI> mIndexName = the name of the index file (Default: cocoon.idx)
+ * <LI> indexfile = the name of the index file (Default: cocoon.idx)
* </LI>
- * <LI> mOrder = The page size of the B-Tree</LI>
+ * <LI> order = The page size of the B-Tree</LI>
* </UL>
*
- *
- * @param The Configuration Paramter
+ * @param params the configuration paramters
* @exception ParameterException
*/
- public void parameterize(Parameters params)
- throws ParameterException {
+ public void parameterize(Parameters params) {
+
mDatabaseName = params.getParameter("datafile", "cocoon.dat");
mIndexName = params.getParameter("indexfile", "cocoon.idx");
- mOrder = params.getParameterAsInteger("order", 1001);
+ mOrder = params.getParameterAsInteger("order", 301);
if (getLogger().isDebugEnabled()) {
this.getLogger().debug("parameterize(..): mDatabaseName="
@@ -250,10 +231,10 @@
}
/**
- * Store the given Object in the indexed data file.
+ * Store the given object in the indexed data file.
*
- * @param the Key Object
- * @param the Value Object
+ * @param key the key object
+ * @param value the value object
* @exception IOException
*/
public void store(Object key, Object value)
@@ -262,12 +243,14 @@
if (getLogger().isDebugEnabled()) {
this.getLogger().debug("store(): Store file with key: "
+ key.toString());
+ this.getLogger().debug("store(): Store file with value: "
+ + value.toString());
}
if (value instanceof Serializable) {
try {
- JispStringKey[] keyArray = new JispStringKey[1];
- keyArray[0] = new JispStringKey(key.toString());
+ KeyObject[] keyArray = new KeyObject[1];
+ keyArray[0] = this.wrapKeyObject(key);
mDatabase.write(keyArray, (Serializable) value);
} catch (Exception e) {
this.getLogger().error("store(..): Exception", e);
@@ -278,11 +261,11 @@
}
/**
- * Holds the given Object in the indexed data file.
+ * Holds the given object in the indexed data file.
*
- * @param the Key Object
- * @param the Value Object
- * @exception IOException
+ * @param key the key object
+ * @param value the value object
+ * @exception IOException
*/
public void hold(Object key, Object value)
throws IOException {
@@ -290,16 +273,17 @@
}
/**
- * Frees some values of the data file
+ * Frees some values of the data file.<br>
+ * TODO: implementation
*/
public void free() {
//TODO: implementation
}
/**
- * Removes a value from the data file with the given key.
+ * Removes a value from the data file with the given key.
*
- * @param the Key Object
+ * @param key the key object
*/
public void remove(Object key) {
if (getLogger().isDebugEnabled()) {
@@ -307,8 +291,8 @@
}
try {
- JispStringKey[] keyArray = new JispStringKey[1];
- keyArray[0] = new JispStringKey(key.toString());
+ KeyObject[] keyArray = new KeyObject[1];
+ keyArray[0] = this.wrapKeyObject(key);
mDatabase.remove(keyArray);
} catch (KeyNotFound ignore) {
} catch (Exception e) {
@@ -319,14 +303,14 @@
/**
* Test if the the index file contains the given key
*
- * @param the Key Object
+ * @param key the key object
* @return true if Key exists and false if not
*/
public boolean containsKey(Object key) {
long res = -1;
try {
- res = mIndex.findKey(new JispStringKey(key.toString()));
+ res = mIndex.findKey(this.wrapKeyObject(key));
if (getLogger().isDebugEnabled()) {
this.getLogger().debug("containsKey(..): res=" + res);
}
@@ -343,13 +327,34 @@
}
/**
- * Returns a Enumeration of all Keys in the indexed file
+ * Returns a Enumeration of all Keys in the indexed file.<br>
+ * TODO: Implementation
*
* @return Enumeration Object with all existing keys
*/
public Enumeration keys() {
//TODO: Implementation
return null;
+ }
+
+ /**
+ * This method wraps around the key Object a Jisp KeyObject.
+ *
+ * @param key the key object
+ * @return the wrapped key object
+ */
+ private KeyObject wrapKeyObject(Object key) {
+
+ if(key.toString() instanceof String) {
+ if (getLogger().isDebugEnabled()) {
+ this.getLogger().debug("wrapKeyObject() Key is String");
+ }
+
+ return new JispStringKey(key.toString());
+ } else {
+ //TODO: Implementation of Integer and Long keys
+ return null;
+ }
}
}
1.1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/jispstore/StoreJanitorImpl.java
Index: StoreJanitorImpl.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.cocoon.jispstore;
import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.parameters.ParameterException;
import org.apache.avalon.framework.parameters.Parameterizable;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.logger.AbstractLoggable;
import org.apache.avalon.framework.thread.ThreadSafe;
//only for scratchpad
import org.apache.cocoon.components.store.StoreJanitor;
import org.apache.cocoon.components.store.Store;
import java.util.ArrayList;
import java.util.Iterator;
/**
* This class is a implentation of a StoreJanitor. Store classes
* can register to the StoreJanitor. When memory is too low,
* the StoreJanitor frees the registered caches until memory is normal.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Christian Schmitt</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Gerhard Froehlich</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a>
*/
public class StoreJanitorImpl extends AbstractLoggable implements
StoreJanitor,
Parameterizable,
ThreadSafe,
Runnable,
Startable {
private int mFreeMemory = -1;
private int mHeapSize = -1;
private int mCleanupThreadInterval = -1;
private int mPriority = -1;
private Runtime mJVM;
private ArrayList mStoreList;
private int mIndex = -1;
private static boolean mDoRun = false;
/**
* Initialize the StoreJanitorImpl.<br>
* A few options can be used :
* <UL>
* <LI>freememory = how many bytes shall be always free in the jvm</LI>
* <LI>heapsize = max. size of jvm memory consumption</LI>
* <LI>cleanupthreadinterval = how often (sec) shall run the cleanup
thread</LI>
* <LI>threadpriority = priority of the thread (1-10). (Default: 10)</LI>
* </UL>
*
* @param params the Configuration of the application
* @exception ConfigurationException
*/
public void parameterize(Parameters params)
throws ParameterException {
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("Configure StoreJanitorImpl");
}
this.setJVM(Runtime.getRuntime());
this.setFreememory(params.getParameterAsInteger("freememory",1000000));
this.setHeapsize(params.getParameterAsInteger("heapsize",60000000));
this.setCleanupthreadinterval(params.getParameterAsInteger("cleanupthreadinterval",10));
this.setPriority(params.getParameterAsInteger("threadpriority",Thread.currentThread().getPriority()));
if ((this.getFreememory() < 1)) {
throw new ParameterException("StoreJanitorImpl freememory
parameter has to be greater then 1");
}
if ((this.getHeapsize() < 1)) {
throw new ParameterException("StoreJanitorImpl heapsize parameter
has to be greater then 1");
}
if ((this.getCleanupthreadinterval() < 1)) {
throw new ParameterException("StoreJanitorImpl
cleanupthreadinterval parameter has to be greater then 1");
}
if ((this.getPriority() < 1)) {
throw new ParameterException("StoreJanitorImpl threadpriority has
to be greater then 1");
}
this.setStoreList(new ArrayList());
}
/**
* Starts the cleanup Thread
*/
public void start() {
mDoRun = true;
Thread checker = new Thread(this);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("Intializing checker thread");
}
checker.setPriority(this.getPriority());
checker.setDaemon(true);
checker.setName("checker");
checker.start();
}
/**
* Stops the cleanup Thread
*/
public void stop() {
mDoRun = false;
}
/**
* The "checker" thread checks if memory is running low in the jvm.
*/
public void run() {
while (mDoRun) {
// amount of memory used is greater then heapsize
if (this.memoryLow()) {
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("Invoking garbage collection,
total memory = "
+ this.getJVM().totalMemory() + ", free memory = "
+ this.getJVM().freeMemory());
}
this.freePhysicalMemory();
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("Garbage collection complete,
total memory = "
+ this.getJVM().totalMemory() + ", free memory = "
+ this.getJVM().freeMemory());
}
synchronized (this) {
while (this.memoryLow() && this.getStoreList().size() >
0) {
this.freeMemory();
}
this.resetIndex();
}
}
try {
Thread.currentThread().sleep(this.mCleanupThreadInterval *
1000);
} catch (InterruptedException ignore) {}
}
}
/**
* Method to check if memory is running low in the JVM.
*
* @return true if memory is low
*/
private boolean memoryLow() {
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("getJVM().totalMemory()=" +
this.getJVM().totalMemory());
this.getLogger().debug("getHeapsize()=" + this.getHeapsize());
this.getLogger().debug("getJVM().freeMemory()=" +
this.getJVM().freeMemory());
this.getLogger().debug("getFreememory()=" + this.getFreememory());
}
return this.getJVM().totalMemory() > this.getHeapsize() &&
this.getJVM().freeMemory() < this.getFreememory();
}
/**
* This method register the stores
*
* @param store the store to be registered
*/
public void register(Store store) {
this.getStoreList().add(store);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("Registering store instance");
this.getLogger().debug("Size of StoreJanitor now:" +
this.getStoreList().size());
}
}
/**
* This method unregister the stores
*
* @param store the store to be unregistered
*/
public void unregister(Store store) {
this.getStoreList().remove(store);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("Unregister store instance");
this.getLogger().debug("Size of StoreJanitor now:" +
this.getStoreList().size());
}
}
/**
* This method return a java.util.Iterator of every registered stores
*
* <i>The iterators returned is fail-fast: if list is structurally
* modified at any time after the iterator is created, in any way, the
* iterator will throw a ConcurrentModificationException. Thus, in the
* face of concurrent modification, the iterator fails quickly and
* cleanly, rather than risking arbitrary, non-deterministic behavior at
* an undetermined time in the future.</i>
*
* @return a java.util.Iterator
*/
public Iterator iterator() {
return this.getStoreList().iterator();
}
/**
* Round Robin alghorithm for freeing the registerd caches.
*/
private void freeMemory() {
try {
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("StoreJanitor freeing memory!");
this.getLogger().debug("StoreList size=" +
this.getStoreList().size());
this.getLogger().debug("Index before=" + this.getIndex());
}
if (this.getIndex() < this.getStoreList().size()) {
if(this.getIndex() == -1) {
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("Freeing at index=" +
this.getIndex());
}
((Store)this.getStoreList().get(0)).free();
this.setIndex(0);
} else {
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("Freeing at index=" +
this.getIndex());
}
((Store)this.getStoreList().get(this.getIndex())).free();
this.setIndex(this.getIndex() + 1);
}
} else {
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("Starting from the beginning");
}
this.resetIndex();
((Store)this.getStoreList().get(0)).free();
this.setIndex(0);
}
this.freePhysicalMemory();
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("Index after=" + this.getIndex());
}
} catch(Exception e) {
this.getLogger().error("Error in freeMemory()",e);
}
}
/**
* This method forces the garbage collector
*/
private void freePhysicalMemory() {
this.getJVM().runFinalization();
this.getJVM().gc();
}
private int getFreememory() {
return mFreeMemory;
}
private void setFreememory(int _freememory) {
this.mFreeMemory = _freememory;
}
private int getHeapsize() {
return this.mHeapSize;
}
private void setHeapsize(int _heapsize) {
this.mHeapSize = _heapsize;
}
private int getCleanupthreadinterval() {
return this.mCleanupThreadInterval;
}
private void setCleanupthreadinterval(int _cleanupthreadinterval) {
this.mCleanupThreadInterval = _cleanupthreadinterval;
}
private int getPriority() {
return this.mPriority;
}
private void setPriority(int _priority) {
this.mPriority = _priority;
}
private Runtime getJVM() {
return this.mJVM;
}
private void setJVM(Runtime _runtime) {
this.mJVM = _runtime;
}
private ArrayList getStoreList() {
return this.mStoreList;
}
private void setStoreList(ArrayList _storelist) {
this.mStoreList = _storelist;
}
private void setIndex(int _index) {
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("Setting index=" + _index);
}
this.mIndex = _index;
}
private int getIndex() {
return this.mIndex;
}
private void resetIndex() {
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("Reseting index");
}
this.mIndex = -1;
}
}
1.1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/jispstore/cocoon.xconf
Index: cocoon.xconf
===================================================================
<?xml version="1.0"?>
<cocoon version="2.0">
<!-- ================ Apache Cocoon configuration file ================== -->
<!-- Please refer to the online documentation for full descriptions.
The notes that accompany the settings below are intended to be concise.
-->
<!-- ===================== General Components =========================== -->
<!-- Parser:
The default parser used in the Apache Cocoon 2 system is
org.apache.cocoon.components.parser.JaxpParser
Apache Cocoon 2 system requires a JAXP 1.1 parser.
If you have problems because your servlet environment uses its own
parser not conforming to JAXP 1.1 try using the alternative
XercesParser instead of the JaxpParser. To activate the XercesParser,
move the line below starting with <parser ...> out of this comment block.
You also than have to add a system property to your JVM
(probably on the startup of your servlet engine like this:
-Dorg.apache.cocoon.components.parser.Parser=org.apache.cocoon.components.parser.XercesParser
<parser class="org.apache.cocoon.components.parser.XercesParser"/>
-->
<parser logger="core.parser"/>
<!-- HSQLDB Server for samples:
Comment this section out if you don't care about the samples.
port : number port where the server is listening
silent : true/false display all queries
trace : true/false display JDBC trace messages
-->
<hsqldb-server class="org.apache.cocoon.components.hsqldb.ServerImpl"
logger="core.hsqldb-server"
pool-max="1" pool-min="1">
<parameter name="port" value="9002"/>
<parameter name="silent" value="true"/>
<parameter name="trace" value="false"/>
</hsqldb-server>
<!-- ============================ Storing ===============================
-->
<!-- Memory Store:
maxobjects: Indicates how many objects will be hold in the cache.
-->
<store class="org.apache.cocoon.jispstore.MRUMemoryStore"
logger="core.store">
<parameter name="maxobjects" value="5"/>
</store>
<!-- Store Persitence:
datafile = file where the swaped objects are stored
indexfile = index file for fast access on the swaped objects
order = page size of the B-Tree index
-->
<store-persistence class="org.apache.cocoon.jispstore.JispFilesystemStore"
logger="core.store-persistence">
<parameter name="datafile" value="cocoon-store.dat"/>
<parameter name="indexfile" value="cocoon-store.idx"/>
<parameter name="order" value="301"/>
</store-persistence>
<!-- Store Janitor:
freememory: How much free memory shall be available in the JVM
heapsize: Indicates the limit of the JVM memory consumption
cleanupthreadinterval: How often shall the cleanup Thread check memory
threadpriority: Indicates the thread priority of the cleanup Thread
Be careful with the heapsize and freememory paramters. Wrong values can
cause high cpu usage.
Example configuration:
JVM settings (for i.e. Tomcat):
-Xms100000000 -Xmx200000000
store-janitor settings:
<parameter name="freememory" value="50000000"/>
<parameter name="heapsize" value="150000000"/>
Heapsize must be higher then the -Xms parameter and freememory
between those both.
-->
<store-janitor class="org.apache.cocoon.jispstore.StoreJanitorImpl"
logger="core.store-janitor">
<parameter name="freememory" value="1000000"/>
<parameter name="heapsize" value="60000000"/>
<parameter name="cleanupthreadinterval" value="10"/>
<parameter name="threadpriority" value="5"/>
</store-janitor>
<!-- ============================ Storing End ===========================
-->
<!-- Entity resolution catalogs:
catalog:
The default catalog is distributed at /resources/entities/catalog
This is the contextual pathname for Cocoon resources.
You can override this path, if necessary, using the "catalog" parameter.
<parameter name="catalog" value="/resources/entities/catalog"/>
However, it is probably desirable to leave this default catalog config
and declare your own local catalogs, which are loaded in addition to
the system catalog.
There are various ways to do local configuration (see "Entity Catalogs"
documentation). One way is via the CatalogManager.properties file.
As an additional method, you can specify the "local-catalog" parameter
here.
local-catalog:
The full filesystem pathname to a single local catalog file.
<parameter name="local-catalog" value="/usr/local/sgml/mycatalog"/>
verbosity:
The level of messages for status/debug (messages go to standard output)
The following messages are provided ...
0 = none
1 = ? (... not sure yet)
2 = 1+, Loading catalog, Resolved public, Resolved system
3 = 2+, Catalog does not exist, resolvePublic, resolveSystem
10 = 3+, List all catalog entries when loading a catalog
(Cocoon also logs the "Resolved public" messages.)
TODO: determine all messages at each level
<parameter name="verbosity" value="2"/>
-->
<resolver class="org.apache.cocoon.components.resolver.ResolverImpl"
logger="core.resolver">
<parameter name="catalog" value="/resources/entities/catalog"/>
<parameter name="verbosity" value="1"/>
</resolver>
<!-- XSLT Processor:
For Xalan: Turn 'incremental-processing' to true if you want a continous
output (if set to false the transformer
delivers SAX events after all transformations has been done). -->
<xslt-processor class="org.apache.cocoon.components.xslt.XSLTProcessorImpl"
logger="core.xslt-processor">
<parameter name="use-store" value="true"/>
<parameter name="incremental-processing" value="true"/>
</xslt-processor>
<!-- Xpath Processor:
-->
<xpath-processor
class="org.apache.cocoon.components.xpath.XPathProcessorImpl"
logger="core.xpath-processor"/>
<!-- URL Factory:
The url factory adds special url protocols to the system, they are then
available inside Cocoon, e.g. as a source argument for one of the sitemap
components.
-->
<url-factory logger="core.url-factory">
<protocol name="resource"
class="org.apache.cocoon.components.url.ResourceURLFactory"/>
<protocol name="context"
class="org.apache.cocoon.components.url.ContextURLFactory"/>
</url-factory>
<!-- Source Handler:
The source handler adds special url protocols to the system, they are
then available inside Cocoon, e.g. as a source argument for one of the
sitemap components.
-->
<source-handler logger="core.source-handler">
<!-- xmldb pseudo protocol -->
<protocol name="xmldb"
class="org.apache.cocoon.components.source.XMLDBSourceFactory">
<!-- dbXML driver -->
<driver type="dbxml" class="org.dbxml.client.xmldb.DatabaseImpl"/>
<!-- Add here other XML:DB compliant databases drivers -->
</protocol>
</source-handler>
<!-- Program Generator:
The ProgamGenerator builds programs from a XML document written in a
MarkupLanguage.
auto-reload:
root-package: persistent code repository.
preload:
-->
<program-generator logger="core.program-generator">
<parameter name="auto-reload" value="true"/>
<parameter name="root-package" value="org.apache.cocoon.www"/>
<parameter name="preload" value="true"/>
</program-generator>
<!-- JSP Engine:
The JspGenerator selects a JSPEngine component. The JSPEngine component
launches a JSP servlet engine of your servlet container, feeds the
HttpRequest into the JSP servlet engine, and pipes the jsp response as
SAX events into Cocoon2. The JSP page is specified by the HttpRequest.
This way you can continue to use your JSP pages. Your migration from JSP
to XSP may be done step by step. You may specify your JSP pages either as
JSP scriptlets or as JSP-XML. But keep in mind that your JSP output should
be valid XML.
-->
<jsp-engine logger="core.jsp-engine">
<parameter name="servlet-class"
value="org.apache.jasper.servlet.JspServlet"/>
<parameter name="servlet-name" value="*.jsp"/>
</jsp-engine>
<!-- Deli support -->
<deli>
<parameter name="deli-config-file" value="deliCocoonConfig.xml"/>
<parameter name="use-deli" value="false"/>
</deli>
<!-- Xscript:
-->
<xscript logger="core.xscript">
<parameter name="xscript:copy-of"
value="resource://org/apache/cocoon/components/xscript/xslt/copy-of.xsl"/>
<parameter name="xscript:value-of"
value="resource://org/apache/cocoon/components/xscript/xslt/value-of.xsl"/>
</xscript>
<!-- Programming Languages:
-->
<programming-languages>
<java-language name="java" logger="core.language.java">
<!-- compiler parameter specifies which class to use to compile Java.
Possible variants are Javac and Jikes compilers.
Javac requires javac.jar (included with Cocoon distribution).
Jikes requires IBM jikes compiler to be present in the PATH -->
<parameter name="compiler"
value="org.apache.cocoon.components.language.programming.java.Javac"/>
<!-- Specifies which formatter to use to format source code.
This parameter is optional. -->
<parameter name="code-formatter"
value="org.apache.cocoon.components.language.programming.java.JstyleFormatter"/>
<!-- A singleton-like implementation of a ClassLoader -->
<parameter name="class-loader"
value="org.apache.cocoon.components.classloader.ClassLoaderManagerImpl"/>
</java-language>
</programming-languages>
<!-- Class loader:
A singleton-like implementation of a ClassLoader.
-->
<classloader
class="org.apache.cocoon.components.classloader.ClassLoaderManagerImpl"
logger="core.classloader"/>
<!-- Markup Languages:
This section defines several builtin logicsheets. A logicsheet is an XML
filter used to translate user-defined, dynamic markup into equivalent
code embedding directives for a given markup language.
-->
<markup-languages>
<xsp-language name="xsp" logger="core.markup.xsp">
<parameter name="prefix" value="xsp"/>
<parameter name="uri" value="http://apache.org/xsp"/>
<!-- Defines the XSP Core logicsheet for the Java language -->
<target-language name="java">
<parameter name="core-logicsheet"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl"/>
<!-- The Request logicsheet (taglib) is an XSP logicsheet that wraps
XML tags
around standard request operations -->
<builtin-logicsheet>
<parameter name="prefix" value="xsp-request"/>
<parameter name="uri" value="http://apache.org/xsp/request/2.0"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/request.xsl"/>
</builtin-logicsheet>
<!-- The Response logicsheet (taglib) is an XSP logicsheet that wraps
XML tags
around standard response operations -->
<builtin-logicsheet>
<parameter name="prefix" value="xsp-response"/>
<parameter name="uri" value="http://apache.org/xsp/response/2.0"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/response.xsl"/>
</builtin-logicsheet>
<!-- The Session logicsheet (taglib) is an XSP logicsheet that wraps
XML tags around
standard session operations. Specifically, the Session
logicsheet provides an
XML interface to most methods of the HttpSession object (see the
Java Servlet API
Specification, version 2.2 ) for more information. -->
<builtin-logicsheet>
<parameter name="prefix" value="session"/>
<parameter name="uri" value="http://apache.org/xsp/session/2.0"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/session.xsl"/>
</builtin-logicsheet>
<builtin-logicsheet>
<parameter name="prefix" value="xsp-cookie"/>
<parameter name="uri" value="http://apache.org/xsp/cookie/2.0"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/cookie.xsl"/>
</builtin-logicsheet>
<!-- The ESQL logicsheet is an XSP logicsheet that performs sql
queries and
serializes their results as XML. This allows you to work with
data from a
wide variety of different sources when using Apache Cocoon. -->
<builtin-logicsheet>
<parameter name="prefix" value="esql"/>
<parameter name="uri" value="http://apache.org/cocoon/SQL/v2"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/esql.xsl"/>
</builtin-logicsheet>
<builtin-logicsheet>
<parameter name="prefix" value="log"/>
<parameter name="uri" value="http://apache.org/xsp/log/2.0"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/log.xsl"/>
</builtin-logicsheet>
<builtin-logicsheet>
<parameter name="prefix" value="util"/>
<parameter name="uri" value="http://apache.org/xsp/util/2.0"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/util.xsl"/>
</builtin-logicsheet>
<!-- The xsp-formval taglib serves as interface to retrieve
validation results
from a request attribute -->
<builtin-logicsheet>
<parameter name="prefix" value="xsp-formval"/>
<parameter name="uri"
value="http://apache.org/xsp/form-validator/2.0"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/form-validator.xsl"/>
</builtin-logicsheet>
<!-- The sel taglib allows to put multiple pages / view into
one xsp. While in general it is good style to put
different views into different xsp because they're more
easily maintained, this is a useful feature with
e.g. with long forms that are broken into parts -->
<builtin-logicsheet>
<parameter name="prefix" value="sel"/>
<parameter name="uri" value="http://apache.org/xsp/sel/1.0"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/sel.xsl"/>
</builtin-logicsheet>
<builtin-logicsheet>
<parameter name="prefix" value="action"/>
<parameter name="uri" value="http://apache.org/cocoon/action/1.0"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/action.xsl"/>
</builtin-logicsheet>
<!-- The capture taglib is for capturing parts of the XSP-generated
XML as
XML fragments or DOM nodes -->
<builtin-logicsheet>
<parameter name="prefix" value="capture"/>
<parameter name="uri" value="http://apache.org/cocoon/capture/1.0"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/capture.xsl"/>
</builtin-logicsheet>
<builtin-logicsheet>
<parameter name="prefix" value="xscript"/>
<parameter name="uri" value="http://apache.org/xsp/xscript/1.0"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/xscript.xsl"/>
</builtin-logicsheet>
<builtin-logicsheet>
<parameter name="prefix" value="soap"/>
<parameter name="uri" value="http://apache.org/xsp/soap/3.0"/>
<parameter name="href"
value="resource://org/apache/cocoon/components/language/markup/xsp/java/soap.xsl"/>
</builtin-logicsheet>
</target-language>
</xsp-language>
<!-- Defines Sitemap Core logicsheet for the Java language -->
<sitemap-language name="sitemap" logger="core.markup.sitemap">
<parameter name="prefix" value="map"/>
<parameter name="uri" value="http://apache.org/cocoon/sitemap/1.0"/>
<target-language name="java">
<parameter name="core-logicsheet"
value="resource://org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl"/>
</target-language>
</sitemap-language>
</markup-languages>
<!-- Datasources:
-->
<datasources>
<jdbc name="personnel" logger="core.datasources.personnel">
<!--
If you have an Oracle database, and are using the the
pool-controller below, you should add the attribute
"oradb" and set it to true.
<pool-controller min="5" max="10" oradb="true"/>
That way the test to see if the server has disconnected
the JdbcConnection will function properly.
-->
<pool-controller min="5" max="10"/>
<!--
If you need to ensure an autocommit is set to true or
false, then create the "auto-commit" element below.
<auto-commit>false</auto-commit>
The default is true.
-->
<dburl>@database-url@</dburl>
<user>@database-user@</user>
<password>@database-password@</password>
</jdbc>
</datasources>
<!-- Stream Pipeline:
Either collects a Reader and lets it produce a character stream
or connects an EventPipeline with a Serializer and lets them produce
the character stream. Alternatives to CachingStreamPipeline are:
<stream-pipeline
class="org.apache.cocoon.components.pipeline.NonCachingStreamPipeline"/>
-->
<stream-pipeline
class="org.apache.cocoon.components.pipeline.CachingStreamPipeline"
logger="core.stream-pipeline"
pool-max="32" pool-min="16" pool-grow="4"/>
<!-- Event Pipeline:
Connects the generator and the various transformers and produces a
character stream. Alternatives to CachingEventPipeline are:
<event-pipeline
class="org.apache.cocoon.components.pipeline.NonCachingEventPipeline"/>
<event-pipeline
class="org.apache.cocoon.components.profiler.ProfilingCachingEventPipeline"/>
<event-pipeline
class="org.apache.cocoon.components.profiler.ProfilingNonCachingEventPipeline"/>
-->
<event-pipeline
class="org.apache.cocoon.components.pipeline.CachingEventPipeline"
logger="core.event-pipeline"
pool-max="32" pool-min="16" pool-grow="4"/>
<!-- Compiling xml to byte streams.
The xml-serializer "compiles" xml sax events into a byte stream
and the xml-deserializer does the same vice versa.
Make sure, that if you change one of these components, that you
may have to change the other one as well, as they might have
a dependency.
-->
<xml-serializer
class="org.apache.cocoon.components.sax.XMLByteStreamCompiler"
logger="core.xml-serializer"/>
<xml-deserializer
class="org.apache.cocoon.components.sax.XMLByteStreamInterpreter"
logger="core.xml-deserializer"/>
<!-- SAXConnector:
Connects the various pipeline components.
LoggingSAXConnector logs SAX events between pipeline components
into cocoon's log file.
ProfilingSAXConnector gathers timing information.
Uncomment one of the following lines for using the SAXConnector.
<sax-connector
class="org.apache.cocoon.components.saxconnector.LoggingSAXConnector"/>
<sax-connector
class="org.apache.cocoon.components.profiler.ProfilingSAXConnector"/>
-->
<!-- Profiler:
The profiler facilitates the gathering of statistics about timings of
different steps of pipelines. Profiler consists of several components:
profiling pipeline, profiling SAX connector, and profiler generator
which are used to generate the profile report. You need to enable all of
these components to use profiler.
Uncomment the following line to use profiler.
<profiler/>
-->
<!-- Search:
These are the components that handle the search.
Cocoon indexer write into an index.
Cocoon searcher reads form an index, returning matched hits.
Cocoon crawler crawls all links starting from a given base URI.
Lucene xml indexer build a lucene document from XML content.
-->
<cocoon-indexer logger="core.search.indexer"/>
<cocoon-searcher logger="core.search.searcher"/>
<cocoon-crawler logger="core.search.crawler"/>
<lucene-xml-indexer logger="core.search.lucene"/>
<!-- Resource Monitor:
The Monitor keeps track on changes to a Resource.
-->
<monitor logger="core.monitor">
<thread priority="5" frequency="10000"/>
</monitor>
<!-- ======================== The sitemap ============================== -->
<!-- Reloading of the sitemap:
The check-reload attribute determines if the sitemap is reloaded on
change.
Set to "no", the sitemap is generated once at startup.
Set to "yes", the sitemap is regenerated if it changes.
The reload-method specifies the method for the regeneration:
asynchron: If the sitemap changes, the sitemap is regenerated at the
next request in the background and the incoming request is
served with the old sitemap. All subsequent requests are
served with the old sitemap until the regeneration in the
background has finished.
synchron: If the sitemap changes, the sitemap is regenerated at the
next request. When the regeneration is finished, the request
(and all subsequent ones) is served with the new sitemap.
For development environment, set the reload-method to synchron and the
check-reload to yes.
For production environment, it is advisable to set the reload-method to
asynchron and for more safety the check-reload to no.
-->
<sitemap file="sitemap.xmap" reload-method="asynchron" check-reload="yes"
logger="sitemap"/>
</cocoon>
1.1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/jispstore/cocoon.roles
Index: cocoon.roles
===================================================================
<?xml version="1.0"?>
<!DOCTYPE role-list [
<!ELEMENT role-list (role+)>
<!ELEMENT role (hint*)>
<!ELEMENT hint EMPTY>
<!ATTLIST role name CDATA #REQUIRED
shorthand CDATA #REQUIRED
default-class CDATA #IMPLIED
>
<!ATTLIST hint shorthand CDATA #REQUIRED
class CDATA #REQUIRED
>
]>
<role-list>
<role name="org.apache.cocoon.components.parser.Parser"
shorthand="parser"
default-class="org.apache.cocoon.components.parser.JaxpParser"/>
<role name="org.apache.cocoon.components.xslt.XSLTProcessor"
shorthand="xslt-processor"
default-class="org.apache.cocoon.components.xslt.XSLTProcessorImpl"/>
<role name="org.apache.cocoon.components.xpath.XPathProcessor"
shorthand="xpath-processor"
default-class="org.apache.cocoon.components.xpath.XPathProcessorImpl"/>
<role name="org.apache.cocoon.components.browser.Browser"
shorthand="browser"
default-class="org.apache.cocoon.components.browser.BrowserImpl"/>
<!-- For backwards compatibility, the shorthand for this role is "sitemap"
<role name="org.apache.cocoon.Processor"
shorthand="processor"/>
-->
<role name="org.apache.cocoon.components.deli.Deli"
shorthand="deli"
default-class="org.apache.cocoon.components.deli.DeliImpl"/>
<role name="org.apache.cocoon.Processor"
shorthand="sitemap"
default-class="org.apache.cocoon.sitemap.SitemapManager"/>
<role name="org.apache.cocoon.components.store.Store"
shorthand="store"
default-class="org.apache.cocoon.jispstore.MRUMemoryStore"/>
<role name="org.apache.cocoon.components.store.Store/Filesystem"
shorthand="repository"
default-class="org.apache.cocoon.jispstore.FilesystemStore"/>
<role name="org.apache.cocoon.components.store.StoreJanitor"
shorthand="store-janitor"
default-class="org.apache.cocoon.jispstore.StoreJanitorImpl"/>
<role name="org.apache.cocoon.components.store.Store/JispFilesystemStore"
shorthand="store-persistence"
default-class="org.apache.cocoon.jispstore.JispFilesystemStore"/>
<role
name="org.apache.cocoon.components.language.generator.ServerPagesSelector"
shorthand="server-pages"
default-class="org.apache.cocoon.components.language.generator.GeneratorSelector"/>
<role
name="org.apache.cocoon.components.language.markup.MarkupLanguageSelector"
shorthand="markup-languages"
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
<hint shorthand="sitemap-language"
class="org.apache.cocoon.components.language.markup.sitemap.SitemapMarkupLanguage"/>
<hint shorthand="xsp-language"
class="org.apache.cocoon.components.language.markup.xsp.XSPMarkupLanguage"/>
</role>
<role
name="org.apache.cocoon.components.language.programming.ProgrammingLanguageSelector"
shorthand="programming-languages"
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
<hint shorthand="java-language"
class="org.apache.cocoon.components.language.programming.java.JavaLanguage"/>
</role>
<role name="org.apache.cocoon.components.language.generator.ProgramGenerator"
shorthand="program-generator"
default-class="org.apache.cocoon.components.language.generator.ProgramGeneratorImpl"/>
<role name="org.apache.cocoon.components.jsp.JSPEngine"
shorthand="jsp-engine"
default-class="org.apache.cocoon.components.jsp.JSPEngineImpl"/>
<role name="org.apache.cocoon.components.resolver.Resolver"
shorthand="resolver"
default-class="org.apache.cocoon.components.resolver.ResolverImpl"/>
<role name="org.apache.cocoon.components.classloader.ClassLoaderManager"
shorthand="classloader"
default-class="org.apache.cocoon.components.classloader.ClassLoaderManagerImpl"/>
<role name="org.apache.cocoon.components.image.ImageEncoderSelector"
shorthand="image-encoder"/>
<role
name="org.apache.avalon.excalibur.datasource.DataSourceComponentSelector"
shorthand="datasources"
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
<hint shorthand="jdbc"
class="org.apache.avalon.excalibur.datasource.JdbcDataSource"/>
<hint shorthand="j2ee"
class="org.apache.avalon.excalibur.datasource.J2eeDataSource"/>
<hint shorthand="informix"
class="org.apache.avalon.excalibur.datasource.InformixDataSource"/>
</role>
<role name="org.apache.cocoon.components.url.URLFactory"
shorthand="url-factory"
default-class="org.apache.cocoon.components.url.URLFactoryImpl"/>
<role name="org.apache.cocoon.components.source.SourceHandler"
shorthand="source-handler"
default-class="org.apache.cocoon.components.source.SourceHandlerImpl"/>
<role name="org.apache.cocoon.components.sax.XMLSerializer"
shorthand="xml-serializer"
default-class="org.apache.cocoon.components.sax.XMLByteStreamCompiler"/>
<role name="org.apache.cocoon.components.sax.XMLDeserializer"
shorthand="xml-deserializer"
default-class="org.apache.cocoon.components.sax.XMLByteStreamInterpreter"/>
<role name="org.apache.cocoon.components.hsqldb.Server"
shorthand="hsqldb-server"
default-class="org.apache.cocoon.components.hsqldb.ServerImpl"/>
<role name="org.apache.cocoon.components.profiler.Profiler"
shorthand="profiler"
default-class="org.apache.cocoon.components.profiler.SimpleProfiler"/>
<role name="org.apache.cocoon.components.xscript.XScriptManager"
shorthand="xscript"
default-class="org.apache.cocoon.components.xscript.XScriptManagerImpl"/>
<role name="org.apache.cocoon.components.pipeline.StreamPipeline"
shorthand="stream-pipeline"
default-class="org.apache.cocoon.components.pipeline.NonCachingStreamPipeline"/>
<role name="org.apache.cocoon.components.pipeline.EventPipeline"
shorthand="event-pipeline"
default-class="org.apache.cocoon.components.pipeline.NonCachingEventPipeline"/>
<role name="org.apache.cocoon.components.saxconnector.SAXConnector"
shorthand="sax-connector"/>
<!-- Lucene Components -->
<role name="org.apache.cocoon.components.search.LuceneCocoonIndexer"
shorthand="cocoon-indexer"
default-class="org.apache.cocoon.components.search.SimpleLuceneCocoonIndexerImpl"
/>
<role name="org.apache.cocoon.components.search.LuceneCocoonSearcher"
shorthand="cocoon-searcher"
default-class="org.apache.cocoon.components.search.SimpleLuceneCocoonSearcherImpl"
/>
<role name="org.apache.cocoon.components.search.LuceneXMLIndexer"
shorthand="lucene-xml-indexer"
default-class="org.apache.cocoon.components.search.SimpleLuceneXMLIndexerImpl"
/>
<role name="org.apache.cocoon.components.crawler.CocoonCrawler"
shorthand="cocoon-crawler"
default-class="org.apache.cocoon.components.crawler.SimpleCocoonCrawlerImpl"
/>
</role-list>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]