cziegeler 01/07/09 06:22:27
Modified: src/org/apache/cocoon Tag: cocoon_20_branch Cocoon.java
Processor.java
src/org/apache/cocoon/components/pipeline Tag:
cocoon_20_branch AbstractEventPipeline.java
CachingEventPipeline.java EventPipeline.java
NonCachingEventPipeline.java StreamPipeline.java
src/org/apache/cocoon/components/source Tag:
cocoon_20_branch SitemapSource.java
Added: src/org/apache/cocoon Tag: cocoon_20_branch
ProcessorWrapper.java
Log:
Next step to the working cocoon:// url.
Added a processor for the root sitemap to the component manager.
Revision Changes Path
No revision
No revision
1.9.2.10 +5 -1 xml-cocoon2/src/org/apache/cocoon/Cocoon.java
Index: Cocoon.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.9.2.9
retrieving revision 1.9.2.10
diff -u -r1.9.2.9 -r1.9.2.10
--- Cocoon.java 2001/07/07 19:07:36 1.9.2.9
+++ Cocoon.java 2001/07/09 13:22:18 1.9.2.10
@@ -57,7 +57,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a> (Apache
Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.9.2.9 $ $Date: 2001/07/07 19:07:36 $
+ * @version CVS $Revision: 1.9.2.10 $ $Date: 2001/07/09 13:22:18 $
*/
public class Cocoon extends AbstractLoggable implements ThreadSafe, Component,
Initializable, Disposable, Modifiable, Processor, Contextualizable {
/** The application context */
@@ -303,6 +303,10 @@
getLogger().debug("Setting up components...");
this.componentManager.configure(conf);
+
+ // adding the processor itself to the available components
+ // we need a wrapper to avoid infinite dispose loops
+ this.componentManager.addComponentInstance(Processor.ROLE, new
ProcessorWrapper(this));
return conf;
}
1.1.1.1.2.1 +15 -1 xml-cocoon2/src/org/apache/cocoon/Processor.java
Index: Processor.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Processor.java,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- Processor.java 2001/05/09 20:49:27 1.1.1.1
+++ Processor.java 2001/07/09 13:22:19 1.1.1.1.2.1
@@ -7,18 +7,32 @@
*****************************************************************************/
package org.apache.cocoon;
+import org.apache.cocoon.components.pipeline.EventPipeline;
+import org.apache.cocoon.components.pipeline.StreamPipeline;
import org.apache.cocoon.environment.Environment;
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.1.1 $ $Date: 2001/05/09 20:49:27 $
+ * @version CVS $Revision: 1.1.1.1.2.1 $ $Date: 2001/07/09 13:22:19 $
*/
public interface Processor {
+
+ String ROLE = "org.apache.cocoon.Processor";
+
/**
* Process the given <code>Environment</code> producing the output
*/
boolean process(Environment environment)
+ throws Exception;
+
+ /**
+ * Process the given <code>Environment</code> to assemble
+ * a <code>StreamPipeline</code> and an <code>EventPipeline</code>.
+ */
+ boolean process(Environment environment,
+ StreamPipeline pipeline,
+ EventPipeline eventPipeline)
throws Exception;
}
No revision
No revision
1.1.2.1 +0 -0 xml-cocoon2/src/org/apache/cocoon/ProcessorWrapper.java
Index: ProcessorWrapper.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/ProcessorWrapper.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- ProcessorWrapper.java 2001/07/09 13:19:49 1.1
+++ ProcessorWrapper.java 2001/07/09 13:22:20 1.1.2.1
@@ -18,7 +18,7 @@
* This class is a wrapper around the real processor (the <code>Cocoon</code>
class).
* It is necessary to avoid infinite dispose loops
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/07/09 13:19:49 $
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/09 13:22:20 $
*/
public final class ProcessorWrapper
implements Processor, Component, Disposable, ThreadSafe {
No revision
No revision
1.5.2.7 +1 -2
xml-cocoon2/src/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java
Index: AbstractEventPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java,v
retrieving revision 1.5.2.6
retrieving revision 1.5.2.7
diff -u -r1.5.2.6 -r1.5.2.7
--- AbstractEventPipeline.java 2001/07/07 19:08:01 1.5.2.6
+++ AbstractEventPipeline.java 2001/07/09 13:22:22 1.5.2.7
@@ -18,7 +18,6 @@
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.Processor;
import org.apache.cocoon.components.saxconnector.SAXConnector;
import org.apache.cocoon.components.saxconnector.NullSAXConnector;
import org.apache.cocoon.environment.Environment;
@@ -33,7 +32,7 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:cziegeler@Carsten Ziegeler">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.5.2.6 $ $Date: 2001/07/07 19:08:01 $
+ * @version CVS $Revision: 1.5.2.7 $ $Date: 2001/07/09 13:22:22 $
*/
public abstract class AbstractEventPipeline
extends AbstractXMLProducer
1.7.2.8 +1 -2
xml-cocoon2/src/org/apache/cocoon/components/pipeline/CachingEventPipeline.java
Index: CachingEventPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/CachingEventPipeline.java,v
retrieving revision 1.7.2.7
retrieving revision 1.7.2.8
diff -u -r1.7.2.7 -r1.7.2.8
--- CachingEventPipeline.java 2001/07/07 19:08:01 1.7.2.7
+++ CachingEventPipeline.java 2001/07/09 13:22:22 1.7.2.8
@@ -20,7 +20,6 @@
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.excalibur.pool.Recyclable;
import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.Processor;
import org.apache.cocoon.caching.CacheValidity;
import org.apache.cocoon.caching.Cacheable;
import org.apache.cocoon.caching.CachedEventObject;
@@ -51,7 +50,7 @@
* does not cache! (If it would cache, the response would be cached twice!)
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.7.2.7 $ $Date: 2001/07/07 19:08:01 $
+ * @version CVS $Revision: 1.7.2.8 $ $Date: 2001/07/09 13:22:22 $
*/
public final class CachingEventPipeline
extends AbstractEventPipeline
1.2.2.5 +8 -4
xml-cocoon2/src/org/apache/cocoon/components/pipeline/EventPipeline.java
Index: EventPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/EventPipeline.java,v
retrieving revision 1.2.2.4
retrieving revision 1.2.2.5
diff -u -r1.2.2.4 -r1.2.2.5
--- EventPipeline.java 2001/07/07 19:08:02 1.2.2.4
+++ EventPipeline.java 2001/07/09 13:22:23 1.2.2.5
@@ -10,7 +10,6 @@
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.Processor;
import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.generation.Generator;
import org.apache.cocoon.sitemap.Sitemap;
@@ -18,15 +17,20 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.2.2.4 $ $Date: 2001/07/07 19:08:02 $
+ * @version CVS $Revision: 1.2.2.5 $ $Date: 2001/07/09 13:22:23 $
*/
-public interface EventPipeline extends Component, Composable, Recyclable, Processor
{
+public interface EventPipeline extends Component, Composable, Recyclable {
String ROLE = "org.apache.cocoon.components.pipeline.EventPipeline";
+ /**
+ * Process the given <code>Environment</code> producing the output
+ */
+ boolean process(Environment environment)
+ throws Exception;
+
void setGenerator (String role, String source, Parameters param, Exception e)
throws Exception;
void setGenerator (String role, String source, Parameters param) throws
Exception;
Generator getGenerator ();
void addTransformer (String role, String source, Parameters param) throws
Exception;
- boolean process(Environment environment) throws Exception;
}
1.4.2.2 +1 -2
xml-cocoon2/src/org/apache/cocoon/components/pipeline/NonCachingEventPipeline.java
Index: NonCachingEventPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/NonCachingEventPipeline.java,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- NonCachingEventPipeline.java 2001/07/07 19:08:03 1.4.2.1
+++ NonCachingEventPipeline.java 2001/07/09 13:22:23 1.4.2.2
@@ -17,7 +17,6 @@
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.excalibur.pool.Recyclable;
import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.Processor;
import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.generation.Generator;
import org.apache.cocoon.sitemap.ErrorNotifier;
@@ -29,7 +28,7 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.4.2.1 $ $Date: 2001/07/07 19:08:03 $
+ * @version CVS $Revision: 1.4.2.2 $ $Date: 2001/07/09 13:22:23 $
*/
public class NonCachingEventPipeline extends AbstractEventPipeline implements
Recyclable {
1.2.2.4 +32 -3
xml-cocoon2/src/org/apache/cocoon/components/pipeline/StreamPipeline.java
Index: StreamPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/StreamPipeline.java,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -u -r1.2.2.3 -r1.2.2.4
--- StreamPipeline.java 2001/07/07 19:08:03 1.2.2.3
+++ StreamPipeline.java 2001/07/09 13:22:23 1.2.2.4
@@ -10,8 +10,8 @@
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.Processor;
import org.apache.avalon.excalibur.pool.Recyclable;
+import org.apache.cocoon.environment.Environment;
/** A <CODE>StreamPipeline</CODE> either
* <UL>
@@ -20,16 +20,45 @@
* <CODE>Serializer</CODE> and let them produce the character stream
* </UL>
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.2.2.3 $ $Date: 2001/07/07 19:08:03 $
+ * @version CVS $Revision: 1.2.2.4 $ $Date: 2001/07/09 13:22:23 $
*/
-public interface StreamPipeline extends Component, Composable, Recyclable,
Processor {
+public interface StreamPipeline extends Component, Composable, Recyclable {
String ROLE = "org.apache.cocoon.components.pipeline.StreamPipeline";
+ /**
+ * Process the given <code>Environment</code> producing the output
+ */
+ boolean process(Environment environment)
+ throws Exception;
+
+ /**
+ * Set the <code>EventPipeline</code>
+ */
void setEventPipeline (EventPipeline eventPipeline) throws Exception;
+
+ /**
+ * Get the <code>EventPipeline</code>
+ */
EventPipeline getEventPipeline ();
+
+ /**
+ * Set the reader for this pipeline
+ */
void setReader (String role, String source, Parameters param) throws Exception;
+
+ /**
+ * Set the reader for this pipeline
+ */
void setReader (String role, String source, Parameters param, String mimeType)
throws Exception;
+
+ /**
+ * Set the serializer for this pipeline
+ */
void setSerializer (String role, String source, Parameters param) throws
Exception;
+
+ /**
+ * Set the serializer for this pipeline
+ */
void setSerializer (String role, String source, Parameters param, String
mimeType) throws Exception;
}
No revision
No revision
1.1.2.6 +27 -8
xml-cocoon2/src/org/apache/cocoon/components/source/SitemapSource.java
Index: SitemapSource.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/source/SitemapSource.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- SitemapSource.java 2001/07/07 19:08:07 1.1.2.5
+++ SitemapSource.java 2001/07/09 13:22:26 1.1.2.6
@@ -22,6 +22,7 @@
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.cocoon.Constants;
+import org.apache.cocoon.Processor;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.pipeline.EventPipeline;
import org.apache.cocoon.components.pipeline.StreamPipeline;
@@ -42,7 +43,7 @@
* Description of a source which is defined by a pipeline.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/07/07 19:08:07 $
+ * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/07/09 13:22:26 $
*/
public final class SitemapSource
@@ -63,8 +64,8 @@
/** The current ComponentManager */
private ComponentManager manager;
- /** The sitemap */
- private Sitemap sitemap;
+ /** The processor */
+ private Processor processor;
/** The environment */
private Environment environment;
@@ -78,6 +79,9 @@
String uri)
throws IOException, ProcessingException {
+ this.manager = manager;
+ this.environment = env;
+
// remove the protocol
int protocolEnd = uri.indexOf(':');
if (protocolEnd != -1) {
@@ -89,8 +93,16 @@
uri = uri.substring(2);
// FIXME (CZ) The root sitemap is not available
// so resolve it to the current sitemap
+ Processor processor = null;
+ try {
+ processor = (Processor)this.manager.lookup(Processor.ROLE);
+ } catch (ComponentException e) {
+ throw new ProcessingException("Cannot get Processor instance", e);
+ }
+ this.processor = processor;
} else if (uri.startsWith("/") == true) {
uri = uri.substring(1);
+ this.processor = sitemap;
}
Request request=
(Request)env.getObjectModel().get(Constants.REQUEST_OBJECT);
@@ -101,9 +113,6 @@
this.uri = uri;
this.contentLength = -1;
this.lastModificationDate = 0;
- this.manager = manager;
- this.sitemap = sitemap;
- this.environment = env;
}
/**
@@ -144,7 +153,12 @@
try {
this.environment.pushURI(this.uri);
- this.sitemap.process(this.environment, pipeline, eventPipeline);
+ this.processor.process(this.environment, pipeline, eventPipeline);
+ } finally {
+ this.environment.popURI();
+ }
+ try {
+ this.environment.pushURI(this.uri);
((XMLProducer)eventPipeline).setConsumer(serializer);
eventPipeline.process(this.environment);
} finally {
@@ -222,8 +236,13 @@
pipeline.setEventPipeline(eventPipeline);
try {
+ this.environment.pushURI(this.uri);
+ this.processor.process(this.environment, pipeline, eventPipeline);
+ } finally {
+ this.environment.popURI();
+ }
+ try {
this.environment.pushURI(this.uri);
- this.sitemap.process(this.environment, pipeline, eventPipeline);
((XMLProducer)eventPipeline).setConsumer(consumer);
eventPipeline.process(this.environment);
} finally {
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]