cziegeler 02/05/28 00:11:44
Modified: src/java/org/apache/cocoon/caching
AggregatedCacheValidity.java CacheValidity.java
Cacheable.java CachedEventObject.java
CachedStreamObject.java ComponentCacheKey.java
CompositeCacheValidity.java
DeltaTimeCacheValidity.java
IncludeCacheValidity.java NOPCacheValidity.java
ParametersCacheValidity.java PipelineCacheKey.java
TimeStampCacheValidity.java
src/java/org/apache/cocoon/sitemap Sitemap.java
Added: src/java/org/apache/cocoon/components/profiler
ProfilingCachingProcessingPipeline.java
ProfilingNonCachingProcessingPipeline.java
Removed: src/java/org/apache/cocoon/components/pipeline
AbstractEventPipeline.java
AbstractStreamPipeline.java
CacheableEventPipeline.java
CachingEventPipeline.java
CachingStreamPipeline.java EventPipeline.java
NonCachingEventPipeline.java
NonCachingStreamPipeline.java StreamPipeline.java
src/java/org/apache/cocoon/components/profiler
ProfilingCachingEventPipeline.java
ProfilingNonCachingEventPipeline.java
Log:
Removed event and stream pipeline and changed cache key implementations :)
Revision Changes Path
1.8 +2 -1
xml-cocoon2/src/java/org/apache/cocoon/caching/AggregatedCacheValidity.java
Index: AggregatedCacheValidity.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/AggregatedCacheValidity.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AggregatedCacheValidity.java 21 Apr 2002 17:29:50 -0000 1.7
+++ AggregatedCacheValidity.java 28 May 2002 07:11:43 -0000 1.8
@@ -59,8 +59,9 @@
* {@link CompositeCacheValidity} with the difference that the amount of
* aggregated objects is not limited.
*
+ * @deprecated Use the Avalon Excalibur SourceValidity implementations instead
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @version CVS $Id: AggregatedCacheValidity.java,v 1.7 2002/04/21 17:29:50
vgritsenko Exp $
+ * @version CVS $Id: AggregatedCacheValidity.java,v 1.8 2002/05/28 07:11:43
cziegeler Exp $
*/
public final class AggregatedCacheValidity
implements CacheValidity {
1.6 +2 -1
xml-cocoon2/src/java/org/apache/cocoon/caching/CacheValidity.java
Index: CacheValidity.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/CacheValidity.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CacheValidity.java 22 Feb 2002 07:03:49 -0000 1.5
+++ CacheValidity.java 28 May 2002 07:11:43 -0000 1.6
@@ -56,8 +56,9 @@
* For example, the FileGenerator stores only the timestamp for the read
* xml file in this container.
*
+ * @deprecated Use the Avalon Excalibur SourceValidity implementations instead
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: CacheValidity.java,v 1.5 2002/02/22 07:03:49 cziegeler Exp $
+ * @version CVS $Id: CacheValidity.java,v 1.6 2002/05/28 07:11:43 cziegeler Exp $
*/
public interface CacheValidity extends java.io.Serializable {
1.6 +2 -2 xml-cocoon2/src/java/org/apache/cocoon/caching/Cacheable.java
Index: Cacheable.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/Cacheable.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Cacheable.java 22 Feb 2002 07:03:49 -0000 1.5
+++ Cacheable.java 28 May 2002 07:11:43 -0000 1.6
@@ -53,9 +53,9 @@
/**
* This marker interface declares a (sitemap) component as cacheable.
*
- *
+ * @deprecated by the {@link CacheableProcessingComponent} interface
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: Cacheable.java,v 1.5 2002/02/22 07:03:49 cziegeler Exp $
+ * @version CVS $Id: Cacheable.java,v 1.6 2002/05/28 07:11:43 cziegeler Exp $
*/
public interface Cacheable {
1.8 +2 -1
xml-cocoon2/src/java/org/apache/cocoon/caching/CachedEventObject.java
Index: CachedEventObject.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/CachedEventObject.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- CachedEventObject.java 3 May 2002 11:55:05 -0000 1.7
+++ CachedEventObject.java 28 May 2002 07:11:43 -0000 1.8
@@ -55,8 +55,9 @@
/**
* This is a cached object as it is stored in the <code>EventCache</code>
*
+ * @deprecated by the {@link CachedResponse}
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: CachedEventObject.java,v 1.7 2002/05/03 11:55:05 cziegeler Exp
$
+ * @version CVS $Id: CachedEventObject.java,v 1.8 2002/05/28 07:11:43 cziegeler Exp
$
*/
public final class CachedEventObject implements java.io.Serializable {
1.7 +2 -1
xml-cocoon2/src/java/org/apache/cocoon/caching/CachedStreamObject.java
Index: CachedStreamObject.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/CachedStreamObject.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CachedStreamObject.java 22 Feb 2002 07:03:49 -0000 1.6
+++ CachedStreamObject.java 28 May 2002 07:11:43 -0000 1.7
@@ -55,8 +55,9 @@
/**
* This is an cached object as it is stored in the <code>StreamCache</code>
*
+ * @deprecated by the {@link CachedResponse}
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: CachedStreamObject.java,v 1.6 2002/02/22 07:03:49 cziegeler
Exp $
+ * @version CVS $Id: CachedStreamObject.java,v 1.7 2002/05/28 07:11:43 cziegeler
Exp $
*/
public final class CachedStreamObject implements java.io.Serializable {
1.7 +30 -22
xml-cocoon2/src/java/org/apache/cocoon/caching/ComponentCacheKey.java
Index: ComponentCacheKey.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/ComponentCacheKey.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ComponentCacheKey.java 19 Apr 2002 19:06:54 -0000 1.6
+++ ComponentCacheKey.java 28 May 2002 07:11:43 -0000 1.7
@@ -50,45 +50,53 @@
*/
package org.apache.cocoon.caching;
+import java.io.Serializable;
/**
* This is the cache key for one sitemap component.
- * It consists of two parts:<br>
+ * It consists of three parts:<br/>
+ * a.) The component type (generator, transformer etc.)<br/>
* a.) The component identifier - a unique handle for the sitemap
- * component<br>
+ * component<br/>
* b.) The cache key - a key, generated by the component, which
- * is unique inside the component space.
+ * is unique inside the components space.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: ComponentCacheKey.java,v 1.6 2002/04/19 19:06:54 vgritsenko
Exp $
+ * @version CVS $Id: ComponentCacheKey.java,v 1.7 2002/05/28 07:11:43 cziegeler Exp
$
*/
-public final class ComponentCacheKey implements java.io.Serializable {
+public final class ComponentCacheKey
+ implements Serializable {
public static final int ComponentType_Generator = 1;
public static final int ComponentType_Transformer = 2;
public static final int ComponentType_Serializer = 3;
public static final int ComponentType_Reader = 4;
- private String key;
+ /** The component type */
+ private int type;
+ /** The component identifier */
+ private String identifier;
+ /** The unique key */
+ private Serializable key;
+
+ public ComponentCacheKey(int componentType,
+ String componentIdentifier,
+ Serializable cacheKey) {
+ this.type = componentType;
+ this.identifier = componentIdentifier;
+ this.key = cacheKey;
- public ComponentCacheKey(int componentType,
- String componentIdentifier,
- long cacheKey) {
- // generate the toString value
- this.key = "CCK:"
- + componentType + '-'
- + componentIdentifier + '-'
- + cacheKey;
- }
-
- public String toString() {
- return this.key;
}
public boolean equals(Object object) {
- return this.key.equals(object.toString());
+ if (object instanceof ComponentCacheKey) {
+ ComponentCacheKey ccp = (ComponentCacheKey)object;
+ if (this.type == ccp.type
+ && this.identifier.equals(ccp.identifier)
+ && this.key.equals(ccp.key)) {
+ return true;
+ }
+ }
+ return false;
}
- public int hashCode() {
- return this.key.hashCode();
- }
}
1.8 +2 -1
xml-cocoon2/src/java/org/apache/cocoon/caching/CompositeCacheValidity.java
Index: CompositeCacheValidity.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/CompositeCacheValidity.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- CompositeCacheValidity.java 21 Apr 2002 17:29:50 -0000 1.7
+++ CompositeCacheValidity.java 28 May 2002 07:11:43 -0000 1.8
@@ -57,8 +57,9 @@
* {@link AggregatedCacheValidity} with the difference that the amount of
* aggregated objects is limited.
*
+ * @deprecated Use the Avalon Excalibur SourceValidity implementations instead
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @version CVS $Id: CompositeCacheValidity.java,v 1.7 2002/04/21 17:29:50
vgritsenko Exp $
+ * @version CVS $Id: CompositeCacheValidity.java,v 1.8 2002/05/28 07:11:43
cziegeler Exp $
*/
public final class CompositeCacheValidity
implements CacheValidity {
1.9 +2 -1
xml-cocoon2/src/java/org/apache/cocoon/caching/DeltaTimeCacheValidity.java
Index: DeltaTimeCacheValidity.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/DeltaTimeCacheValidity.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DeltaTimeCacheValidity.java 21 Apr 2002 17:29:50 -0000 1.8
+++ DeltaTimeCacheValidity.java 28 May 2002 07:11:43 -0000 1.9
@@ -56,8 +56,9 @@
/**
* A validation object that remains valid for a specified amount of time.
*
+ * @deprecated Use the Avalon Excalibur SourceValidity implementations instead
* @author <a href="mailto:[EMAIL PROTECTED]">Michael Homeijer</a>
- * @version CVS $Id: DeltaTimeCacheValidity.java,v 1.8 2002/04/21 17:29:50
vgritsenko Exp $
+ * @version CVS $Id: DeltaTimeCacheValidity.java,v 1.9 2002/05/28 07:11:43
cziegeler Exp $
*/
public final class DeltaTimeCacheValidity implements CacheValidity {
1.8 +2 -1
xml-cocoon2/src/java/org/apache/cocoon/caching/IncludeCacheValidity.java
Index: IncludeCacheValidity.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/IncludeCacheValidity.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- IncludeCacheValidity.java 21 Apr 2002 17:29:50 -0000 1.7
+++ IncludeCacheValidity.java 28 May 2002 07:11:43 -0000 1.8
@@ -61,8 +61,9 @@
/**
* A validation object used in CachingCIncludeTransformer
*
+ * @deprecated Use the Avalon Excalibur SourceValidity implementations instead
* @author <a href="mailto:[EMAIL PROTECTED]">Maciek Kaminski</a>
- * @version CVS $Id: IncludeCacheValidity.java,v 1.7 2002/04/21 17:29:50 vgritsenko
Exp $
+ * @version CVS $Id: IncludeCacheValidity.java,v 1.8 2002/05/28 07:11:43 cziegeler
Exp $
*/
public final class IncludeCacheValidity implements CacheValidity {
1.8 +2 -1
xml-cocoon2/src/java/org/apache/cocoon/caching/NOPCacheValidity.java
Index: NOPCacheValidity.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/NOPCacheValidity.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- NOPCacheValidity.java 21 Apr 2002 17:29:50 -0000 1.7
+++ NOPCacheValidity.java 28 May 2002 07:11:43 -0000 1.8
@@ -54,8 +54,9 @@
* A validation object which is always valid.
* This might be the most used CacheValidity object for serializers.
*
+ * @deprecated Use the Avalon Excalibur SourceValidity implementations instead
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: NOPCacheValidity.java,v 1.7 2002/04/21 17:29:50 vgritsenko Exp
$
+ * @version CVS $Id: NOPCacheValidity.java,v 1.8 2002/05/28 07:11:43 cziegeler Exp $
*/
public final class NOPCacheValidity
implements CacheValidity {
1.8 +2 -1
xml-cocoon2/src/java/org/apache/cocoon/caching/ParametersCacheValidity.java
Index: ParametersCacheValidity.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/ParametersCacheValidity.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ParametersCacheValidity.java 21 Apr 2002 17:29:50 -0000 1.7
+++ ParametersCacheValidity.java 28 May 2002 07:11:43 -0000 1.8
@@ -55,8 +55,9 @@
/**
* A validation object using a set of key/value pairs contained in a
<code>Map</code>.
*
+ * @deprecated Use the Avalon Excalibur SourceValidity implementations instead
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @version CVS $Id: ParametersCacheValidity.java,v 1.7 2002/04/21 17:29:50
vgritsenko Exp $
+ * @version CVS $Id: ParametersCacheValidity.java,v 1.8 2002/05/28 07:11:43
cziegeler Exp $
*/
public final class ParametersCacheValidity
implements CacheValidity {
1.7 +31 -25
xml-cocoon2/src/java/org/apache/cocoon/caching/PipelineCacheKey.java
Index: PipelineCacheKey.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/PipelineCacheKey.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PipelineCacheKey.java 19 Apr 2002 19:06:54 -0000 1.6
+++ PipelineCacheKey.java 28 May 2002 07:11:43 -0000 1.7
@@ -55,44 +55,50 @@
/**
* This is the cache key for one pipeline. It consists of one
- * or more <code>ComponentCacheKey</code> objects.
+ * or more {@link ComponentCacheKey}s.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: PipelineCacheKey.java,v 1.6 2002/04/19 19:06:54 vgritsenko Exp
$
+ * @version CVS $Id: PipelineCacheKey.java,v 1.7 2002/05/28 07:11:43 cziegeler Exp $
*/
-public final class PipelineCacheKey {
+public final class PipelineCacheKey
+ implements java.io.Serializable {
- private StringBuffer value;
- private String toStringValue;
+ /** The keys */
+ private List keys;
- public void addKey(ComponentCacheKey key) {
- if (this.value == null) {
- this.value = new StringBuffer("PCK:");
- }
- this.value.append(key.toString());
- toStringValue = null;
+ /**
+ * Constructor
+ */
+ public PipelineCacheKey() {
+ this.keys = new ArrayList(4);
}
- public void addKey(PipelineCacheKey key) {
- if (this.value == null) {
- this.value = new StringBuffer("PCK:");
- }
- this.value.append(key.toString());
- toStringValue = null;
- }
+ private StringBuffer value;
+ private String toStringValue;
- public String toString() {
- if (value == null) {
- return "PCK:";
- }
- return (toStringValue = value.toString());
+ public void addKey(ComponentCacheKey key) {
+ this.keys.add(key);
}
public boolean equals(Object object) {
- return this.toString().equals(object.toString());
+ if (object instanceof PipelineCacheKey) {
+ PipelineCacheKey pck = (PipelineCacheKey)object;
+ final int len = this.keys.size();
+ if (pck.keys.size() == len) {
+ boolean cont = false;
+ int i = 0;
+ while (i < len && cont) {
+ cont = this.keys.get(i).equals(pck.keys.get(i));
+ i++;
+ }
+ return cont;
+ }
+ }
+ return false;
}
public int hashCode() {
- return this.toString().hashCode();
+ // FIXME (CZ) we need a good one here...
+ return this.keys.hashCode();
}
}
1.7 +2 -1
xml-cocoon2/src/java/org/apache/cocoon/caching/TimeStampCacheValidity.java
Index: TimeStampCacheValidity.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/TimeStampCacheValidity.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TimeStampCacheValidity.java 21 Apr 2002 17:29:50 -0000 1.6
+++ TimeStampCacheValidity.java 28 May 2002 07:11:43 -0000 1.7
@@ -54,8 +54,9 @@
* A validation object for time-stamps.
* This is might be the most used CacheValidity object.
*
+ * @deprecated Use the Avalon Excalibur SourceValidity implementations instead
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: TimeStampCacheValidity.java,v 1.6 2002/04/21 17:29:50
vgritsenko Exp $
+ * @version CVS $Id: TimeStampCacheValidity.java,v 1.7 2002/05/28 07:11:43
cziegeler Exp $
*/
public final class TimeStampCacheValidity
implements CacheValidity {
1.1
xml-cocoon2/src/java/org/apache/cocoon/components/profiler/ProfilingCachingProcessingPipeline.java
Index: ProfilingCachingProcessingPipeline.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
[EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.components.profiler;
import org.apache.avalon.excalibur.pool.Recyclable;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline;
import org.apache.cocoon.environment.Environment;
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a>
* @version CVS $Id: ProfilingCachingProcessingPipeline.java,v 1.1 2002/05/28
07:11:44 cziegeler Exp $
*/
public class ProfilingCachingProcessingPipeline
extends CachingProcessingPipeline {
private ComponentManager manager;
private Profiler profiler;
private ProfilerData data = null;
public void compose(ComponentManager manager)
throws ComponentException {
super.compose(manager);
this.manager = manager;
this.profiler = (Profiler)manager.lookup(Profiler.ROLE);
}
public void dispose() {
super.dispose();
if(this.profiler != null){
this.manager.release(this.profiler);
this.profiler = null;
}
this.manager = null;
}
public void setGenerator (String role, String source, Parameters param)
throws ProcessingException {
super.setGenerator(role, source, param);
if(this.data == null)
this.data = new ProfilerData();
this.data.setGenerator(super.generator, role, source);
}
public void addTransformer (String role, String source, Parameters param)
throws ProcessingException {
super.addTransformer(role, source, param);
if(this.data == null)
this.data = new ProfilerData();
this.data.addComponent(super.transformers.get(super.transformers.size()-1),
role, source);
}
public boolean process(Environment environment)
throws ProcessingException {
this.data.addComponent(super.lastConsumer, null, null);
environment.getObjectModel().put("profiler", data);
// Execute pipeline
long time = System.currentTimeMillis();
boolean result = super.process(environment);
this.data.setTime(0, System.currentTimeMillis() - time);
// Report
profiler.addResult(environment.getURI(), data);
return result;
}
public void recycle() {
this.data = null;
super.recycle();
}
}
1.1
xml-cocoon2/src/java/org/apache/cocoon/components/profiler/ProfilingNonCachingProcessingPipeline.java
Index: ProfilingNonCachingProcessingPipeline.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
[EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.components.profiler;
import org.apache.avalon.excalibur.pool.Recyclable;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.pipeline.impl.NonCachingProcessingPipeline;
import org.apache.cocoon.environment.Environment;
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a>
* @version CVS $Id: ProfilingNonCachingProcessingPipeline.java,v 1.1 2002/05/28
07:11:44 cziegeler Exp $
*/
public class ProfilingNonCachingProcessingPipeline
extends NonCachingProcessingPipeline
implements Disposable {
private ComponentManager manager;
private Profiler profiler;
private ProfilerData data = null;
public void compose(ComponentManager manager)
throws ComponentException {
super.compose(manager);
this.manager = manager;
this.profiler = (Profiler)manager.lookup(Profiler.ROLE);
}
public void dispose() {
if (this.profiler != null){
this.manager.release(this.profiler);
this.profiler = null;
}
this.manager = null;
}
public void setGenerator (String role, String source, Parameters param)
throws ProcessingException {
super.setGenerator(role, source, param);
if(this.data == null)
this.data = new ProfilerData();
this.data.setGenerator(super.generator, role, source);
}
public void addTransformer (String role, String source, Parameters param)
throws ProcessingException {
super.addTransformer(role, source, param);
if(this.data == null)
this.data = new ProfilerData();
this.data.addComponent(super.transformers.get(super.transformers.size()-1),
role, source);
}
public boolean process(Environment environment)
throws ProcessingException {
this.data.addComponent(super.lastConsumer, null, null);
environment.getObjectModel().put("profiler", data);
// Execute pipeline
long time = System.currentTimeMillis();
boolean result = super.process(environment);
this.data.setTime(0, System.currentTimeMillis() - time);
// Report
profiler.addResult(environment.getURI(), data);
return result;
}
public void recycle() {
this.data = null;
super.recycle();
}
}
1.7 +1 -13 xml-cocoon2/src/java/org/apache/cocoon/sitemap/Sitemap.java
Index: Sitemap.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/Sitemap.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Sitemap.java 26 Apr 2002 12:21:53 -0000 1.6
+++ Sitemap.java 28 May 2002 07:11:44 -0000 1.7
@@ -55,15 +55,13 @@
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.cocoon.Processor;
import org.apache.cocoon.components.language.generator.CompiledComponent;
-import org.apache.cocoon.components.pipeline.EventPipeline;
-import org.apache.cocoon.components.pipeline.StreamPipeline;
import org.apache.cocoon.environment.Environment;
/**
* Base interface for generated <code>Sitemap</code> classes
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Id: Sitemap.java,v 1.6 2002/04/26 12:21:53 cziegeler Exp $
+ * @version CVS $Id: Sitemap.java,v 1.7 2002/05/28 07:11:44 cziegeler Exp $
*/
public interface Sitemap extends CompiledComponent, Configurable, Contextualizable,
Processor {
int GENERATOR = 1;
@@ -79,14 +77,4 @@
*/
ComponentManager getComponentManager();
- /**
- * Process the given <code>Environment</code>
- */
- boolean process(Environment environment) throws Exception;
-
- /**
- * Process the given <code>Environment</code> assebling
- * a <code>StreamPipeline</code> and an <code>EventPipeline</code>
- */
- boolean process(Environment environment, StreamPipeline pipeline, EventPipeline
eventPipeline) throws Exception;
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]