[prev in list] [next in list] [prev in thread] [next in thread]
List: xml-cocoon-cvs
Subject: cvs commit: xml-cocoon2/src/org/apache/cocoon/transformation I18nTransformer.java TraxTransformer.ja
From: cziegeler () apache ! org
Date: 2001-06-28 9:58:25
[Download RAW message or body]
cziegeler 01/06/28 02:58:25
Modified: . Tag: cocoon_20_branch changes.xml todo.xml
src/org/apache/cocoon Tag: cocoon_20_branch Cocoon.java
src/org/apache/cocoon/components/language/markup/xsp Tag:
cocoon_20_branch XSPFormValidatorHelper.java
src/org/apache/cocoon/environment Tag: cocoon_20_branch
AbstractEnvironment.java FactoryURLResolver.java
Source.java SourceResolver.java URLResolver.java
src/org/apache/cocoon/generation Tag: cocoon_20_branch
FileGenerator.java
src/org/apache/cocoon/sitemap Tag: cocoon_20_branch
AbstractSitemap.java ContentAggregator.java
Handler.java Sitemap.java
src/org/apache/cocoon/transformation Tag: cocoon_20_branch
I18nTransformer.java TraxTransformer.java
Added: src/org/apache/cocoon/environment Tag: cocoon_20_branch
URLSource.java
src/org/apache/cocoon/sitemap Tag: cocoon_20_branch
SitemapSource.java SitemapURLResolver.java
Log:
Added the cocoon: protocol
Revision Changes Path
No revision
No revision
1.2.2.14 +4 -1 xml-cocoon2/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/changes.xml,v
retrieving revision 1.2.2.13
retrieving revision 1.2.2.14
diff -u -r1.2.2.13 -r1.2.2.14
--- changes.xml 2001/06/20 13:16:29 1.2.2.13
+++ changes.xml 2001/06/28 09:58:10 1.2.2.14
@@ -4,7 +4,7 @@
<!--
History of Cocoon changes
- $Id: changes.xml,v 1.2.2.13 2001/06/20 13:16:29 cziegeler Exp $
+ $Id: changes.xml,v 1.2.2.14 2001/06/28 09:58:10 cziegeler Exp $
-->
<changes title="History of Changes">
@@ -24,6 +24,9 @@
</devs>
<release version="2.0b1-dev" date="@date@">
+ <action dev="CZ" type="add">
+ Added the cocoon: protocol to access pipelines.
+ </action>
<action dev="CZ" type="add">
Removed XInclude/CIncludeSAXConnectors and added LoggingSAXConnector.
</action>
1.1.1.1.2.2 +2 -6 xml-cocoon2/todo.xml
Index: todo.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/todo.xml,v
retrieving revision 1.1.1.1.2.1
retrieving revision 1.1.1.1.2.2
diff -u -r1.1.1.1.2.1 -r1.1.1.1.2.2
--- todo.xml 2001/06/22 05:58:18 1.1.1.1.2.1
+++ todo.xml 2001/06/28 09:58:10 1.1.1.1.2.2
@@ -4,7 +4,7 @@
<!--
History of Cocoon changes
- $Id: todo.xml,v 1.1.1.1.2.1 2001/06/22 05:58:18 cziegeler Exp $
+ $Id: todo.xml,v 1.1.1.1.2.2 2001/06/28 09:58:10 cziegeler Exp $
-->
@@ -37,11 +37,7 @@
</action>
<action context="code" assigned-to="open">
- Make the automatic announcement system working.
- </action>
-
- <action context="code" assigned-to="open">
- Add the cocoon: URL.
+ Finish the cocoon: protocol.
</action>
<action context="code" assigned-to="open">
No revision
No revision
1.9.2.7 +7 -4 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.6
retrieving revision 1.9.2.7
diff -u -r1.9.2.6 -r1.9.2.7
--- Cocoon.java 2001/06/22 18:19:25 1.9.2.6
+++ Cocoon.java 2001/06/28 09:58:11 1.9.2.7
@@ -39,7 +39,9 @@
import org.apache.cocoon.components.store.FilesystemStore;
import org.apache.cocoon.components.url.URLFactory;
import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.FactoryURLResolver;
import org.apache.cocoon.environment.Source;
+import org.apache.cocoon.environment.URLSource;
import org.apache.cocoon.serialization.Serializer;
import org.apache.cocoon.sitemap.Manager;
import org.apache.cocoon.sitemap.AbstractSitemap;
@@ -55,7 +57,7 @@
*
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a> (Apache \
Software Foundation, Exoffice Technologies)
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.9.2.6 $ $Date: 2001/06/22 18:19:25 $
+ * @version CVS $Revision: 1.9.2.7 $ $Date: 2001/06/28 09:58:11 $
*/
public class Cocoon extends AbstractLoggable implements ThreadSafe, Component, \
Initializable, Disposable, Modifiable, Processor, Contextualizable { /** The \
application context */ @@ -103,7 +105,8 @@
this.classpath = (String)context.get(Constants.CONTEXT_CLASSPATH);
this.workDir = (File)context.get(Constants.CONTEXT_WORK_DIR);
try {
- this.configurationFile = new \
Source((URL)context.get(Constants.CONTEXT_CONFIG_URL)); + \
this.configurationFile = new \
URLSource((URL)context.get(Constants.CONTEXT_CONFIG_URL), + \
this.componentManager); } catch (IOException ioe) {
getLogger().error("Could not open configuration file.", ioe);
throw new ContextException("Could not open configuration file.", \
ioe); @@ -370,7 +373,7 @@
try {
programGenerator = (ProgramGenerator) \
this.componentManager.lookup(Roles.PROGRAM_GENERATOR);
urlFactory = (URLFactory) \
this.componentManager.lookup(Roles.URL_FACTORY);
- environment.setURLResolver(new \
org.apache.cocoon.environment.FactoryURLResolver(urlFactory)); + \
environment.setURLResolver(new FactoryURLResolver(this.componentManager, \
urlFactory)); String markupLanguage = "sitemap";
String programmingLanguage = "java";
@@ -405,7 +408,7 @@
programGenerator = (ProgramGenerator) \
this.componentManager.lookup(Roles.PROGRAM_GENERATOR);
urlFactory = (URLFactory) \
this.componentManager.lookup(Roles.URL_FACTORY);
- environment.setURLResolver(new \
org.apache.cocoon.environment.FactoryURLResolver(urlFactory)); + \
environment.setURLResolver(new FactoryURLResolver(this.componentManager, \
urlFactory)); String markupLanguage = "xsp";
String programmingLanguage = "java";
No revision
No revision
1.1.2.2 +3 -2 \
xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPFormValidatorHelper.java
Index: XSPFormValidatorHelper.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPFormValidatorHelper.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- XSPFormValidatorHelper.java 2001/06/15 11:29:26 1.1.2.1
+++ XSPFormValidatorHelper.java 2001/06/28 09:58:12 1.1.2.2
@@ -20,6 +20,7 @@
import org.apache.cocoon.components.language.markup.xsp.XSPObjectHelper;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.Source;
+import org.apache.cocoon.environment.URLSource;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
@@ -38,7 +39,7 @@
* The <code>ValidatorActionResult</code> object helper
*
* @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/06/15 11:29:26 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/06/28 09:58:12 $
*/
public class XSPFormValidatorHelper {
/**
@@ -470,7 +471,7 @@
try {
urlFactory = (URLFactory) manager.lookup(Roles.URL_FACTORY);
URL resource = urlFactory.getURL(descriptor);
- source = new Source(resource);
+ source = new URLSource(resource, manager);
if (conf == null || ( reloadable && conf.lastModified < \
source.getLastModified())) {
logger.debug("XSPFormValidatorHelper.getConfiguration: (Re)Loading " + \
descriptor);
No revision
No revision
1.6.2.1 +9 -5 \
xml-cocoon2/src/org/apache/cocoon/environment/AbstractEnvironment.java
Index: AbstractEnvironment.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/AbstractEnvironment.java,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- AbstractEnvironment.java 2001/05/31 20:37:05 1.6
+++ AbstractEnvironment.java 2001/06/28 09:58:14 1.6.2.1
@@ -15,6 +15,7 @@
import java.util.HashMap;
import java.util.Map;
import org.apache.avalon.framework.logger.AbstractLoggable;
+import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.environment.Environment;
import org.apache.log.LogKit;
import org.xml.sax.InputSource;
@@ -194,22 +195,23 @@
* Resolve an entity.
*/
public Source resolve(String systemId)
- throws SAXException, IOException {
+ throws ProcessingException, SAXException, IOException {
if (systemId == null) throw new SAXException("Invalid System ID");
if (systemId.length() == 0)
- return new Source(this.context);
+ return this.urlResolver.getSource(this, \
this.context.toExternalForm()); if (systemId.indexOf(":") > 1)
- return new Source(this.urlResolver.getURL(systemId));
+ return this.urlResolver.getSource(this, systemId);
if (systemId.charAt(0) == '/')
- return new Source(this.urlResolver.getURL(this.context.getProtocol() + \
":" + systemId));
- return new Source(this.urlResolver.getURL(this.context, systemId));
+ return this.urlResolver.getSource(this, this.context.getProtocol() + \
":" + systemId); + return this.urlResolver.getSource(this, this.context, \
systemId); }
/**
* Push a new URI for processing
*/
public void pushURI(String uri) {
+ this.uris.add(this.urlResolver);
this.uris.add(uri);
}
@@ -218,6 +220,8 @@
*/
public String popURI() {
String uri = (String)this.uris.get(this.uris.size()-1);
+ this.uris.remove(this.uris.size()-1);
+ this.urlResolver = (URLResolver)this.uris.get(this.uris.size()-1);
this.uris.remove(this.uris.size()-1);
return uri;
}
1.1.2.1 +18 -8 \
xml-cocoon2/src/org/apache/cocoon/environment/FactoryURLResolver.java
Index: FactoryURLResolver.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/FactoryURLResolver.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- FactoryURLResolver.java 2001/05/22 14:38:51 1.1
+++ FactoryURLResolver.java 2001/06/28 09:58:15 1.1.2.1
@@ -8,10 +8,14 @@
package org.apache.cocoon.environment;
+import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;
-
+import org.apache.avalon.framework.component.ComponentManager;
+import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.url.URLFactory;
+import org.apache.cocoon.environment.Source;
+import org.apache.cocoon.environment.URLSource;
/**
* This interface describes the URLResolver which is used by the
@@ -22,31 +26,37 @@
* This class used only the <code>URLFactory</code>.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/05/22 14:38:51 $
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/06/28 09:58:15 $
*/
public final class FactoryURLResolver
implements URLResolver {
private URLFactory factory;
+
+ private ComponentManager manager;
- public FactoryURLResolver(URLFactory factory) {
+ public FactoryURLResolver(ComponentManager manager,
+ URLFactory factory) {
+ this.manager = manager;
this.factory = factory;
}
/**
* Resolve the source
*/
- public URL getURL(String location) throws MalformedURLException {
- return this.factory.getURL(location);
+ public Source getSource(Environment environment, String location)
+ throws ProcessingException, IOException, MalformedURLException {
+ return new URLSource(this.factory.getURL(location), manager);
}
/**
* Resolve the source
*/
- public URL getURL(URL base, String location) throws MalformedURLException {
- return this.factory.getURL(base, location);
+ public Source getSource(Environment environment, URL base, String location)
+ throws ProcessingException, IOException, MalformedURLException {
+ return new URLSource(this.factory.getURL(base, location), manager);
}
-}
\ No newline at end of file
+}
1.6.2.1 +20 -104 xml-cocoon2/src/org/apache/cocoon/environment/Source.java
Index: Source.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/Source.java,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- Source.java 2001/05/31 13:17:41 1.6
+++ Source.java 2001/06/28 09:58:16 1.6.2.1
@@ -17,155 +17,71 @@
import java.io.Reader;
import java.net.URL;
import java.net.URLConnection;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.xml.XMLConsumer;
import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
/**
* Description of a source. This interface provides a simple interface
* for accessing any resource (URL, local file etc).
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.6 $ $Date: 2001/05/31 13:17:41 $
+ * @version CVS $Revision: 1.6.2.1 $ $Date: 2001/06/28 09:58:16 $
*/
-public final class Source {
-
- /** Identifier for file urls */
- private final String FILE = "file:";
-
- /** The last modification date or 0 */
- private long lastModificationDate;
-
- /** The content length */
- private long contentLength;
-
- /** The system id */
- private String systemId;
-
- /** The URL of the source */
- private URL url;
-
- /** The connection for a real URL */
- private URLConnection connection;
-
- /** Is this a file or a "real" URL */
- private boolean isFile;
-
- /** Are we initialized? */
- private boolean gotInfos;
-
- /**
- * Construct a new object
- */
- public Source(URL url)
- throws IOException {
- this.systemId = url.toExternalForm();
- this.isFile = systemId.startsWith(FILE);
- this.url = url;
- this.gotInfos = false;
- }
-
- /**
- * Get the last modification date and content length of the source.
- * Any exceptions are ignored.
- */
- private void getInfos() {
- if (this.gotInfos == false) {
- if (this.isFile == true) {
- File file = new File(systemId.substring(FILE.length()));
- this.lastModificationDate = file.lastModified();
- this.contentLength = file.length();
- } else {
- try {
- if (this.connection == null)
- this.connection = this.url.openConnection();
- this.lastModificationDate = this.connection.getLastModified();
- this.contentLength = this.connection.getContentLength();
- } catch (IOException ignore) {
- this.lastModificationDate = 0;
- this.contentLength = -1;
- }
- }
- this.gotInfos = true;
- }
- }
-
+public interface Source {
/**
* Get the last modification date of the source or 0 if it
* is not possible to determine the date.
*/
- public long getLastModified() {
- this.getInfos();
- return this.lastModificationDate;
- }
+ long getLastModified();
/**
* Get the content length of the source or -1 if it
* is not possible to determine the length.
*/
- public long getContentLength() {
- this.getInfos();
- return this.contentLength;
- }
+ long getContentLength();
/**
* Return an <code>InputStream</code> object to read from the source.
*/
- public InputStream getInputStream()
- throws IOException {
- if (this.isFile == true) {
- return new FileInputStream(this.systemId.substring(FILE.length()));
- } else {
- if (this.connection == null)
- this.connection = this.url.openConnection();
- return this.connection.getInputStream();
- }
- }
+ InputStream getInputStream()
+ throws ProcessingException, IOException;
/**
* Return the unique identifer for this source
*/
- public String getSystemId() {
- return this.systemId;
- }
+ String getSystemId();
/**
* Is this a file, then the <code>getFile</code> method can
* return a <code>File</code> object for this source.
*/
- public boolean isFile() {
- return this.isFile;
- }
+ boolean isFile();
/**
* Return a <code>File</code> object if this is a local file
* (if the <code>isFile</code> method returns true).
*/
- public File getFile() {
- if (this.isFile == true) {
- return new File(this.systemId.substring(FILE.length()));
- }
- return null;
- }
+ File getFile();
/**
* Refresh this object and update the last modified date
* and content length.
*/
- public void refresh() {
- // reset connection
- this.connection = null;
- this.gotInfos = false;
- }
+ void refresh();
/**
* Return a new <code>InputSource</code> object
*/
- public InputSource getInputSource()
- throws IOException {
- InputSource newObject = new InputSource(this.getInputStream());
- newObject.setSystemId(this.systemId);
- return newObject;
- }
+ InputSource getInputSource()
+ throws ProcessingException, IOException;
+ /**
+ * Stream content to the consumer
+ */
+ void stream(XMLConsumer consumer)
+ throws ProcessingException, SAXException, IOException;
}
1.2.2.1 +3 -3 \
xml-cocoon2/src/org/apache/cocoon/environment/SourceResolver.java
Index: SourceResolver.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/SourceResolver.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- SourceResolver.java 2001/05/23 08:57:26 1.2
+++ SourceResolver.java 2001/06/28 09:58:17 1.2.2.1
@@ -9,13 +9,14 @@
package org.apache.cocoon.environment;
import java.io.IOException;
+import org.apache.cocoon.ProcessingException;
import org.xml.sax.SAXException;
/**
* Base interface for resolving a source by system identifiers.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/23 08:57:26 $
+ * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/06/28 09:58:17 $
*/
public interface SourceResolver {
@@ -26,7 +27,6 @@
* (<code>java.net.URL</code> or a local file.
*/
Source resolve(String systemID)
- throws SAXException, IOException;
-
+ throws ProcessingException, SAXException, IOException;
}
1.1.2.1 +15 -6 xml-cocoon2/src/org/apache/cocoon/environment/URLResolver.java
Index: URLResolver.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/URLResolver.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- URLResolver.java 2001/05/22 14:38:53 1.1
+++ URLResolver.java 2001/06/28 09:58:17 1.1.2.1
@@ -8,29 +8,38 @@
package org.apache.cocoon.environment;
+import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.Source;
/**
* This interface describes the URLResolver which is used by the
* <code>SourceResolver</code>.
* The <code>URLResolver</code> separates the <code>SourceResolver</code>
- * from the <code>URLFactory</code>.
+ * from the <code>URLFactory</code>. The context for the factory is
+ * calculated by this object.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/05/22 14:38:53 $
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/06/28 09:58:17 $
*/
public interface URLResolver {
/**
- * Resolve the source
+ * Resolve the source according to the environment.
+ * @param environment The current environment or <code>null</code>.
*/
- URL getURL(String location) throws MalformedURLException;
+ Source getSource(Environment environment, String location)
+ throws ProcessingException, IOException, MalformedURLException;
/**
- * Resolve the source
+ * Resolve the source according to the environment.
+ * @param environment The current environment or <code>null</code>.
*/
- URL getURL(URL base, String location) throws MalformedURLException;
+ Source getSource(Environment environment, URL base, String location)
+ throws ProcessingException, IOException, MalformedURLException;
}
No revision
No revision
1.1.2.1 +0 -0 xml-cocoon2/src/org/apache/cocoon/environment/URLSource.java
Index: URLSource.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/URLSource.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- URLSource.java 2001/06/28 09:56:37 1.1
+++ URLSource.java 2001/06/28 09:58:17 1.1.2.1
@@ -30,7 +30,7 @@
* Description of a source which is described by an URL.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/06/28 09:56:37 $
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/06/28 09:58:17 $
*/
public final class URLSource
No revision
No revision
1.9.2.5 +2 -10 \
xml-cocoon2/src/org/apache/cocoon/generation/FileGenerator.java
Index: FileGenerator.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/FileGenerator.java,v
retrieving revision 1.9.2.4
retrieving revision 1.9.2.5
diff -u -r1.9.2.4 -r1.9.2.5
--- FileGenerator.java 2001/06/19 07:37:52 1.9.2.4
+++ FileGenerator.java 2001/06/28 09:58:19 1.9.2.5
@@ -39,7 +39,7 @@
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.9.2.4 $ $Date: 2001/06/19 07:37:52 $
+ * @version CVS $Revision: 1.9.2.5 $ $Date: 2001/06/28 09:58:19 $
*/
public class FileGenerator extends ComposerGenerator
implements Cacheable, Recyclable {
@@ -105,15 +105,12 @@
*/
public void generate()
throws IOException, SAXException, ProcessingException {
- Parser parser = null;
try {
getLogger().debug("processing file " + super.source);
getLogger().debug("file resolved to " + \
this.inputSource.getSystemId());
- parser = (Parser)this.manager.lookup(Roles.PARSER);
+ this.inputSource.stream(super.xmlConsumer);
- parser.setConsumer(super.xmlConsumer);
- parser.parse(this.inputSource.getInputSource());
} catch (FileNotFoundException e) {
getLogger().warn("FileGenerator could not find resource " + \
this.inputSource.getSystemId(), e);
throw new ResourceNotFoundException("FileGenerator could not find \
resource " @@ -124,11 +121,6 @@
} catch (SAXException e) {
getLogger().error("FileGenerator.generate()", e);
throw(e);
- } catch (Exception e){
- getLogger().error("Could not get parser", e);
- throw new ProcessingException("Exception in \
FileGenerator.generate()",e);
- } finally {
- if (parser != null) this.manager.release(parser);
}
}
}
No revision
No revision
1.4.2.13 +8 -1 xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java
Index: AbstractSitemap.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java,v
retrieving revision 1.4.2.12
retrieving revision 1.4.2.13
diff -u -r1.4.2.12 -r1.4.2.13
--- AbstractSitemap.java 2001/06/22 14:47:57 1.4.2.12
+++ AbstractSitemap.java 2001/06/28 09:58:20 1.4.2.13
@@ -43,7 +43,7 @@
* Base class for generated <code>Sitemap</code> classes
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.4.2.12 $ $Date: 2001/06/22 14:47:57 $
+ * @version CVS $Revision: 1.4.2.13 $ $Date: 2001/06/28 09:58:20 $
*/
public abstract class AbstractSitemap extends AbstractLoggable implements Sitemap, \
Disposable, ThreadSafe { private Context context;
@@ -155,6 +155,13 @@
public void contextualize(Context context) throws ContextException {
this.context = context;
+ }
+
+ /**
+ * Return the component manager for this sitemap
+ */
+ public ComponentManager getComponentManager() {
+ return this.manager;
}
/**
1.5.2.5 +28 -99 \
xml-cocoon2/src/org/apache/cocoon/sitemap/ContentAggregator.java
Index: ContentAggregator.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/ContentAggregator.java,v
retrieving revision 1.5.2.4
retrieving revision 1.5.2.5
diff -u -r1.5.2.4 -r1.5.2.5
--- ContentAggregator.java 2001/06/22 02:26:57 1.5.2.4
+++ ContentAggregator.java 2001/06/28 09:58:20 1.5.2.5
@@ -23,10 +23,9 @@
import org.apache.cocoon.caching.AggregatedCacheValidity;
import org.apache.cocoon.caching.Cacheable;
import org.apache.cocoon.caching.PipelineCacheKey;
-import org.apache.cocoon.components.pipeline.EventPipeline;
-import org.apache.cocoon.components.pipeline.CacheableEventPipeline;
-import org.apache.cocoon.components.pipeline.StreamPipeline;
+import org.apache.cocoon.caching.TimeStampCacheValidity;
import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.Source;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.generation.Generator;
import org.apache.cocoon.sitemap.Sitemap;
@@ -42,11 +41,10 @@
/**
* @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
- * @version CVS $Id: ContentAggregator.java,v 1.5.2.4 2001/06/22 02:26:57 \
vgritsenko Exp $ + * @author <a href="mailto:cziegeler@apache.org">Carsten \
Ziegeler</a> + * @version CVS $Id: ContentAggregator.java,v 1.5.2.5 2001/06/28 \
09:58:20 cziegeler Exp $
*/
public class ContentAggregator extends ContentHandlerWrapper implements Generator, \
Cacheable, Composable {
- /** the current sitemap */
- protected Sitemap sitemap;
/** the root element of the aggregated content */
protected String rootElement;
@@ -60,9 +58,6 @@
/** the parts */
protected ArrayList parts = new ArrayList();
- /** The current <code>Environment</code>. */
- protected Environment environment;
-
/** The current <code>SourceResolver</code>. */
protected SourceResolver resolver;
@@ -87,9 +82,6 @@
/** The <code>ComponentManager</code> */
protected ComponentManager manager;
- /** Holds all collected <code>EventPipeline</code>s */
- private ArrayList partEventPipelines = new ArrayList();
-
/** Stacks namespaces during processing */
private ArrayList currentNS = new ArrayList();
@@ -117,10 +109,11 @@
public String element;
public String namespace;
public String prefix;
+ public Source source;
boolean stripRootElement;
public Part(String uri, String element, String namespace, String \
stripRoot, String prefix) {
- this.uri = uri;
+ this.uri = "cocoon://" + uri;
this.element = element;
this.namespace = namespace;
this.prefix = prefix;
@@ -137,11 +130,10 @@
*/
public void generate() throws IOException, SAXException, ProcessingException {
getLogger().debug("ContentAggregator: generating aggregated content");
- collectParts();
this.documentHandler.startDocument();
this.startElem(this.rootElementNS, this.rootElementNSPrefix, \
this.rootElement); try {
- for (int i = 0; i < this.partEventPipelines.size(); i++) {
+ for (int i = 0; i < this.parts.size(); i++) {
Part part = (Part)this.parts.get(i);
this.rootElementIndex = (part.stripRootElement ? 0 : -1);
String ns = part.namespace;
@@ -153,19 +145,10 @@
if (!part.element.equals("")) {
this.startElem(ns, prefix, part.element);
}
- EventPipeline ep = (EventPipeline)this.partEventPipelines.get(i);
- ((XMLProducer)ep).setConsumer(this);
+
try {
- this.environment.pushURI(part.uri);
- ep.process(this.environment);
- } catch (ProcessingException e) {
- // Already reported to log, rethrowing.
- throw e;
- } catch (Exception e) {
- getLogger().error("ContentAggregator: cannot process event \
pipeline for URI " + part.uri, e);
- throw new ProcessingException("ContentAggregator: cannot \
process event pipeline for URI " + part.uri, e); + \
this.resolver.resolve(part.uri).stream(this); } finally {
- this.environment.popURI();
if (!part.element.equals("")) {
this.endElem(prefix, part.element);
}
@@ -178,41 +161,6 @@
getLogger().debug("ContentAggregator: finished aggregating content");
}
- private void collectParts() throws ProcessingException {
- if (this.partEventPipelines.size() == 0) {
- EventPipeline eventPipeline = null;
- StreamPipeline pipeline = null;
- for (int i = 0; i < this.parts.size(); i++) {
- Part part = (Part)this.parts.get(i);
- getLogger().debug("ContentAggregator: collecting internal resource \
" + part.uri);
- try {
- eventPipeline = \
(EventPipeline)this.manager.lookup(Roles.EVENT_PIPELINE);
- this.partEventPipelines.add(eventPipeline);
- pipeline = \
(StreamPipeline)this.manager.lookup(Roles.STREAM_PIPELINE);
- } catch (ComponentException cme) {
- getLogger().error("ContentAggregator: could not lookup \
pipeline components", cme);
- throw new ProcessingException("could not lookup pipeline \
components", cme);
- }
- try {
- pipeline.setEventPipeline(eventPipeline);
- } catch (Exception cme) {
- getLogger().error("ContentAggregator: could not set event \
pipeline on stream pipeline", cme);
- throw new ProcessingException("could not set event pipeline on \
stream pipeline", cme);
- }
- try {
- this.environment.pushURI(part.uri);
- this.sitemap.process(this.environment, pipeline, \
eventPipeline);
- } catch (Exception cme) {
- getLogger().error("ContentAggregator: could not process \
pipeline", cme);
- throw new ProcessingException("could not process pipeline", \
cme);
- } finally {
- this.manager.release(pipeline);
- this.environment.popURI();
- }
- }
- }
- }
-
/**
* Generate the unique key.
* This key must be unique inside the space of this component.
@@ -221,20 +169,14 @@
*/
public long generateKey() {
try {
- collectParts();
long key = 0;
- for (int i = 0; i < this.partEventPipelines.size(); i++) {
- EventPipeline ep = (EventPipeline)this.partEventPipelines.get(i);
- if (ep instanceof CacheableEventPipeline) {
- ((XMLProducer)ep).setConsumer(this);
- PipelineCacheKey pck = \
((CacheableEventPipeline)ep).generateKey(environment);
- if (pck == null) {
+ Source current;
+ for (int i = 0; i < this.parts.size(); i++) {
+ current = ((Part)this.parts.get(i)).source;
+ if (current.getLastModified() == 0) {
return 0;
- } else {
- key += HashUtil.hash(pck.toString());
- }
} else {
- return 0;
+ key += HashUtil.hash(current.getSystemId());
}
}
return key;
@@ -252,37 +194,27 @@
*/
public CacheValidity generateValidity() {
try {
- collectParts();
- final AggregatedCacheValidity v = new AggregatedCacheValidity();
+ AggregatedCacheValidity v = new AggregatedCacheValidity();
+ Source current;
for (int i = 0; i < this.parts.size(); i++) {
- EventPipeline ep = (EventPipeline)this.partEventPipelines.get(i);
- if (ep instanceof CacheableEventPipeline) {
- Map map = \
((CacheableEventPipeline)ep).generateValidity(environment);
- if (map == null) {
+ current = ((Part)this.parts.get(i)).source;
+ if (current.getLastModified() == 0) {
return null;
- }
- Iterator j = map.values().iterator();
- while (j.hasNext()) {
- CacheValidity epv = (CacheValidity)j.next();
- v.add(epv);
- }
} else {
- return null;
+ v.add(new TimeStampCacheValidity(current.getLastModified()));
}
}
return v;
} catch (Exception e) {
- getLogger().error("ContentAggregator: could not generateValidity", e);
+ getLogger().error("ContentAggregator: could not generateKey", e);
return null;
}
}
public void setEnvironment(Environment environment) {
- this.environment = environment;
}
public void setSitemap(Sitemap sitemap) {
- this.sitemap = sitemap;
}
public void setRootElement(String element, String namespace, String prefix) {
@@ -330,7 +262,6 @@
*/
public void recycle() {
super.recycle();
- this.sitemap = null;
this.resolver = null;
this.objectModel = null;
this.source = null;
@@ -339,14 +270,6 @@
this.rootElementNS = null;
this.rootElementNSPrefix = null;
this.parts.clear();
- this.environment = null;
-
- for (int i = 0; i < this.partEventPipelines.size(); i++) {
- Component component = (Component)this.partEventPipelines.get(i);
- this.manager.release(component);
- }
-
- this.partEventPipelines.clear();
this.currentNS.clear();
this.xmlConsumer = null;
this.contentHandler = null;
@@ -357,12 +280,18 @@
* Set the <code>SourceResolver</code>, object model <code>Map</code>,
* the source and sitemap <code>Parameters</code> used to process the request.
*/
- public void setup(SourceResolver resolver, Map objectModel, String src, \
Parameters par) throws ProcessingException,
- SAXException, IOException {
+ public void setup(SourceResolver resolver, Map objectModel, String src, \
Parameters par) + throws ProcessingException, SAXException, IOException {
this.resolver = resolver;
this.objectModel = objectModel;
this.source = src;
this.parameters = par;
+
+ Part current;
+ for(int i=0; i<this.parts.size();i++) {
+ current = (Part)this.parts.get(i);
+ current.source = this.resolver.resolve(current.uri);
+ }
}
private String pushNS(String ns) {
1.9.2.5 +12 -9 xml-cocoon2/src/org/apache/cocoon/sitemap/Handler.java
Index: Handler.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Handler.java,v
retrieving revision 1.9.2.4
retrieving revision 1.9.2.5
diff -u -r1.9.2.4 -r1.9.2.5
--- Handler.java 2001/06/08 15:38:39 1.9.2.4
+++ Handler.java 2001/06/28 09:58:21 1.9.2.5
@@ -28,10 +28,10 @@
import org.apache.cocoon.components.pipeline.EventPipeline;
import org.apache.cocoon.components.pipeline.StreamPipeline;
import org.apache.cocoon.components.url.URLFactory;
-import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.environment.FactoryURLResolver;
-import org.apache.cocoon.environment.URLResolver;
+import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.environment.Source;
+import org.apache.cocoon.environment.URLResolver;
/**
* Handles the manageing and stating of one <code>Sitemap</code>
@@ -39,7 +39,7 @@
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.9.2.4 $ $Date: 2001/06/08 15:38:39 $
+ * @version CVS $Revision: 1.9.2.5 $ $Date: 2001/06/28 09:58:21 $
*/
public class Handler extends AbstractLoggable implements Runnable, Configurable, \
Composable, Contextualizable, Processor, Disposable {
@@ -58,9 +58,6 @@
/** the URLFactory */
private URLFactory urlFactory;
- /** The URLResolver for the sitemap components */
- private URLResolver urlResolver;
-
/** the last error */
private Exception exception;
@@ -76,11 +73,13 @@
/** the sitemaps base path */
private String basePath;
+ /** The URLResolver for the sitemap components */
+ private URLResolver urlResolver;
+
public void compose(ComponentManager manager) {
this.manager = manager;
try {
urlFactory = (URLFactory)manager.lookup(Roles.URL_FACTORY);
- this.urlResolver = new FactoryURLResolver(urlFactory);
} catch (Exception e) {
getLogger().error("cannot obtain URLFactory", e);
}
@@ -123,7 +122,7 @@
this.sourceFileName = this.sourceFileName + "sitemap.xmap";
}
try {
- environment.setURLResolver(this.urlResolver);
+ environment.setURLResolver(new FactoryURLResolver(this.manager, \
this.urlFactory)); this.source = environment.resolve(this.sourceFileName);
} finally {
environment.setURLResolver(null);
@@ -210,7 +209,7 @@
XSLTFactoryLoader.setLogger(getLogger());
programGenerator = \
(ProgramGenerator)this.manager.lookup(Roles.PROGRAM_GENERATOR); try {
- environment.setURLResolver(this.urlResolver);
+ environment.setURLResolver(new \
FactoryURLResolver(this.manager, this.urlFactory));
smap = (Sitemap)programGenerator.load(this.manager, \
this.sourceFileName, markupLanguage, programmingLanguage, environment);
} finally {
@@ -220,6 +219,10 @@
programGenerator.release((CompiledComponent)this.sitemap);
}
this.sitemap = smap;
+ // create the urlResolver
+ this.urlResolver = new \
SitemapURLResolver(this.sitemap.getComponentManager(), + \
this.urlFactory, + \
this.sitemap); getLogger().debug("Sitemap regeneration complete");
if (this.sitemap != null) {
getLogger().debug("The sitemap has been successfully \
compiled!");
1.1.1.1.2.2 +6 -1 xml-cocoon2/src/org/apache/cocoon/sitemap/Sitemap.java
Index: Sitemap.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Sitemap.java,v
retrieving revision 1.1.1.1.2.1
retrieving revision 1.1.1.1.2.2
diff -u -r1.1.1.1.2.1 -r1.1.1.1.2.2
--- Sitemap.java 2001/06/08 14:42:07 1.1.1.1.2.1
+++ Sitemap.java 2001/06/28 09:58:21 1.1.1.1.2.2
@@ -21,7 +21,7 @@
* Base interface for generated <code>Sitemap</code> classes
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.1.1.2.1 $ $Date: 2001/06/08 14:42:07 $
+ * @version CVS $Revision: 1.1.1.1.2.2 $ $Date: 2001/06/28 09:58:21 $
*/
public interface Sitemap extends CompiledComponent, Configurable, \
Contextualizable, Processor { int GENERATOR = 1;
@@ -31,6 +31,11 @@
int ACTION = READER << 1;
int MATCHER = ACTION << 1;
int SELECTOR = MATCHER << 1;
+
+ /**
+ * Return the component manager for this sitemap
+ */
+ ComponentManager getComponentManager();
/**
* Process the given <code>Environment</code>
No revision
No revision
1.1.2.1 +0 -0 xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapSource.java
Index: SitemapSource.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapSource.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- SitemapSource.java 2001/06/28 09:56:46 1.1
+++ SitemapSource.java 2001/06/28 09:58:22 1.1.2.1
@@ -38,7 +38,7 @@
* Description of a source which is described by a pipeline.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/06/28 09:56:46 $
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/06/28 09:58:22 $
*/
public final class SitemapSource
1.1.2.1 +0 -0 \
xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapURLResolver.java
Index: SitemapURLResolver.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapURLResolver.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- SitemapURLResolver.java 2001/06/28 09:56:47 1.1
+++ SitemapURLResolver.java 2001/06/28 09:58:22 1.1.2.1
@@ -28,7 +28,7 @@
* This class used only the <code>URLFactory</code>.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/06/28 09:56:47 $
+ * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/06/28 09:58:22 $
*/
public final class SitemapURLResolver
No revision
No revision
1.8.2.3 +1 -1 \
xml-cocoon2/src/org/apache/cocoon/transformation/I18nTransformer.java
Index: I18nTransformer.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/I18nTransformer.java,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.3
diff -u -r1.8.2.2 -r1.8.2.3
--- I18nTransformer.java 2001/06/19 07:37:53 1.8.2.2
+++ I18nTransformer.java 2001/06/28 09:58:24 1.8.2.3
@@ -855,7 +855,7 @@
*Loads translations from given URL
*/
private void initialiseDictionary(Source inputSource)
- throws SAXException, MalformedURLException, IOException {
+ throws ProcessingException, SAXException, MalformedURLException, IOException {
Parser parser = null;
1.15.2.4 +3 -1 \
xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java
Index: TraxTransformer.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java,v
retrieving revision 1.15.2.3
retrieving revision 1.15.2.4
diff -u -r1.15.2.3 -r1.15.2.4
--- TraxTransformer.java 2001/06/22 02:19:08 1.15.2.3
+++ TraxTransformer.java 2001/06/28 09:58:24 1.15.2.4
@@ -100,7 +100,7 @@
* @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
- * @version CVS $Id: TraxTransformer.java,v 1.15.2.3 2001/06/22 02:19:08 \
vgritsenko Exp $ + * @version CVS $Id: TraxTransformer.java,v 1.15.2.4 2001/06/28 \
09:58:24 cziegeler Exp $
*/
public class TraxTransformer extends ContentHandlerWrapper
implements Transformer, Composable, Recyclable, Configurable, Cacheable, \
Disposable, URIResolver { @@ -279,6 +279,8 @@
throw new javax.xml.transform.TransformerException(e);
} catch (SAXException e) {
throw new javax.xml.transform.TransformerException(e);
+ } catch (ProcessingException e) {
+ throw new javax.xml.transform.TransformerException(e);
}
}
/**
----------------------------------------------------------------------
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic