Return-Path: Delivered-To: apmail-xml-cocoon-cvs-archive@xml.apache.org Received: (qmail 88973 invoked by uid 500); 20 Sep 2002 18:15:36 -0000 Mailing-List: contact cocoon-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: cocoon-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cocoon-cvs@xml.apache.org Received: (qmail 88948 invoked by uid 500); 20 Sep 2002 18:15:36 -0000 Delivered-To: apmail-xml-cocoon2-cvs@apache.org Date: 20 Sep 2002 18:15:31 -0000 Message-ID: <20020920181531.32617.qmail@icarus.apache.org> From: froehlich@apache.org To: xml-cocoon2-cvs@apache.org Subject: cvs commit: xml-cocoon2/src/java/org/apache/cocoon/generation StatusGenerator.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N froehlich 2002/09/20 11:15:31 Modified: src/java/org/apache/cocoon/generation StatusGenerator.java Log: added action to clear the persistent store Revision Changes Path 1.7 +41 -1 xml-cocoon2/src/java/org/apache/cocoon/generation/StatusGenerator.java Index: StatusGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/StatusGenerator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- StatusGenerator.java 6 May 2002 12:28:51 -0000 1.6 +++ StatusGenerator.java 20 Sep 2002 18:15:31 -0000 1.7 @@ -94,6 +94,7 @@ * @author Paul Russell (Luminas Limited) * @author Stefano Mazzocchi * @author Sébastien Kœchlin (iVision) + * @author Gerhard Froehlich * @version CVS $Id$ */ public class StatusGenerator extends ComposerGenerator { @@ -101,6 +102,8 @@ /** The StoreJanitor used to get cache statistics */ protected StoreJanitor storejanitor; + protected Store store_persistent; + /** The XML namespace for the output document. */ @@ -121,6 +124,7 @@ super.compose(manager); try { this.storejanitor = (StoreJanitor)manager.lookup(StoreJanitor.ROLE); + this.store_persistent = (Store)this.manager.lookup(Store.PERSISTENT_STORE); } catch(ComponentException ce) { getLogger().info("StoreJanitor is not available. Sorry, no cache statistics"); } @@ -263,7 +267,43 @@ addValue(ch, "size", String.valueOf(size) + " items in cache (" + empty + " are empty)"); endGroup(ch); }; + endGroup(ch); + + startGroup(ch, store_persistent.getClass().getName()+" (hash = 0x"+Integer.toHexString(store_persistent.hashCode())+")" ); + int size = 0; + int empty = 0; + atts.addAttribute(namespace, "name", "name", "CDATA", "cached"); + ch.startElement(namespace, "value", "value", atts); + Enumeration enum = this.store_persistent.keys(); + while( enum.hasMoreElements() ) { + size++; + + Object key = enum.nextElement(); + Object val = store_persistent.get( key ); + String line = null; + if( val == null ) { + empty++; + } else { + line = key.toString() + " (class: " + val.getClass().getName() + ")" ; + ch.startElement(namespace, "line", "line", atts); + ch.characters(line.toCharArray(), 0, line.length()); + ch.endElement(namespace, "line", "line"); + } + } + + if (size == 0) { + atts.clear(); + ch.startElement(namespace, "line", "line", atts); + String value = "[empty]"; + ch.characters(value.toCharArray(), 0, value.length()); + ch.endElement(namespace, "line", "line"); + } + + ch.endElement(namespace, "value", "value"); + + addValue(ch, "size", String.valueOf(size) + " items in cache (" + empty + " are empty)"); endGroup(ch); + // END Cache // BEGIN OS info ---------------------------------------------------------------------- In case of troubles, e-mail: webmaster@xml.apache.org To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org For additional commands, e-mail: cocoon-cvs-help@xml.apache.org