bloritsch 01/05/09 11:34:22
Modified: src/org/apache/cocoon/components/language/markup/sitemap/java
Tag: xml-cocoon2 sitemap.xsl
src/org/apache/cocoon/components/pipeline Tag: xml-cocoon2
CachingStreamPipeline.java
src/org/apache/cocoon/generation Tag: xml-cocoon2
FileGenerator.java HTMLGenerator.java
ServerPagesGenerator.java
src/org/apache/cocoon/reading Tag: xml-cocoon2
DatabaseReader.java ResourceReader.java
src/org/apache/cocoon/serialization Tag: xml-cocoon2
AbstractTextSerializer.java
src/org/apache/cocoon/transformation Tag: xml-cocoon2
FragmentExtractorTransformer.java
Added: src/org/apache/cocoon Tag: xml-cocoon2
ConnectionResetException.java
Log:
Updates to make sitemap components Cacheable AND Poolable. Also, add a
formal exception type calls ConnectionResetException (common in HTTP
environments) that is ignored so that the log file isn't too cluttered.
Revision Changes Path
No revision
No revision
1.1.2.1 +33 -0
xml-cocoon/src/org/apache/cocoon/Attic/ConnectionResetException.java
No revision
No revision
1.1.2.112 +6 -31
xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl
Index: sitemap.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
retrieving revision 1.1.2.111
retrieving revision 1.1.2.112
diff -u -r1.1.2.111 -r1.1.2.112
--- sitemap.xsl 2001/05/09 16:42:15 1.1.2.111
+++ sitemap.xsl 2001/05/09 18:33:26 1.1.2.112
@@ -79,6 +79,7 @@
import org.apache.cocoon.Roles;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.ResourceNotFoundException;
+ import org.apache.cocoon.ConnectionResetException;
import org.apache.cocoon.acting.Action;
import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.matching.Matcher;
@@ -98,7 +99,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo
Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin
Loritsch</a>
- * @version CVS $Id: sitemap.xsl,v 1.1.2.111 2001/05/09 16:42:15 dims
Exp $
+ * @version CVS $Id: sitemap.xsl,v 1.1.2.112 2001/05/09 18:33:26
bloritsch Exp $
*/
public class <xsl:value-of select="@file-name"/> extends AbstractSitemap
{
static final String LOCATION = "<xsl:value-of
select="translate(@file-path, '/', '.')"/>.<xsl:value-of select="@file-name"/>";
@@ -170,7 +171,7 @@
<xsl:variable name="type" select="translate(@name, '- ', '__')"/>
<xsl:variable name="default" select="@name = ../@default"/>
<xsl:variable name="config" select="descendant-or-self::*"/>
- private boolean <xsl:value-of select="$name"/>Select
(<xsl:value-of select="java:getParameterSource($factory-loader,
string($src),$config)"/> pattern, Map objectModel, Parameters param) {
+ private boolean <xsl:value-of select="$name"/>Select
(<xsl:value-of select="java:getParameterSource($factory-loader,
string($src),$config)"/> pattern, Map objectModel) {
<xsl:value-of select="java:getMethodSource($factory-loader,
string($src),$config)"/>
}
<xsl:for-each
select="/map:sitemap/map:pipelines/map:pipeline/descendant::map:[EMAIL
PROTECTED] or (not(@type) and $default)]/map:when">
@@ -430,6 +431,8 @@
</xsl:if>
try {
<xsl:apply-templates select="./*"/>
+ } catch (ConnectionResetException cre) {
+ getLogger().debug("Connection reset by peer");
} catch (ResourceNotFoundException rse) {
getLogger().warn("404 Resource Not Found", rse);
throw rse;
@@ -565,33 +568,7 @@
<xsl:with-param name="default"><xsl:value-of
select="/map:sitemap/map:components/map:selectors/@default"/></xsl:with-param>
</xsl:call-template>
</xsl:variable>
-
- <!-- Modified 20010509 L.Sutic Changed to pass sitemap parameters. -->
-
- <!-- test if we have to define parameters for this action -->
- <xsl:if test="count(parameter)>0">
- param = new Parameters ();
- </xsl:if>
- <!-- generate the value used for the parameter argument in the
invocation of the act method of this action -->
- <xsl:variable name="component-param">
- <xsl:choose>
- <xsl:when test="count(parameter)>0">
- param
- </xsl:when>
- <xsl:otherwise>
- emptyParam
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <!-- collect the parameters -->
- <xsl:apply-templates select="parameter">
- <xsl:with-param name="param">param</xsl:with-param>
- </xsl:apply-templates>
-
- <!-- modification end -->
-
<!-- loop through all the when cases -->
<xsl:for-each select="./map:when">
@@ -627,17 +604,15 @@
</xsl:choose>
</xsl:variable>
-
- <!-- Modified 20010509 L.Sutic Changed to pass sitemap parameters. -->
<!-- gets the string how the selector is to be invoced in java code -->
<xsl:variable name="selector-name">
<!-- check if we have a selector definition in this sitemap
otherwise get it from the parent -->
<xsl:choose>
<xsl:when test="string($is-factory)='true'">
- <xsl:value-of select="translate($selector-type, '- ',
'__')"/>Select(<xsl:value-of select="$selector-name2"/>_expr, objectModel,
<xsl:value-of select="$component-param"/>)
+ <xsl:value-of select="translate($selector-type, '- ',
'__')"/>Select(<xsl:value-of select="$selector-name2"/>_expr, objectModel)
</xsl:when>
<xsl:otherwise>
- ((Selector)this.selectors.select("<xsl:value-of
select="$selector-type"/>")).select(substitute(listOfMaps,"<xsl:value-of
select="$test-value"/>"), objectModel, <xsl:value-of
select="$component-param"/>)
+ ((Selector)this.selectors.select("<xsl:value-of
select="$selector-type"/>")).select(substitute(listOfMaps,"<xsl:value-of
select="$test-value"/>"), objectModel)
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
No revision
No revision
1.1.2.13 +18 -6
xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/CachingStreamPipeline.java
Index: CachingStreamPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/CachingStreamPipeline.java,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -r1.1.2.12 -r1.1.2.13
--- CachingStreamPipeline.java 2001/05/08 16:32:32 1.1.2.12
+++ CachingStreamPipeline.java 2001/05/09 18:33:35 1.1.2.13
@@ -9,6 +9,7 @@
import java.io.IOException;
import java.io.OutputStream;
+import java.net.SocketException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -17,6 +18,7 @@
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.ConnectionResetException;
import org.apache.cocoon.Roles;
import org.apache.cocoon.caching.CacheValidity;
import org.apache.cocoon.caching.Cacheable;
@@ -44,7 +46,7 @@
* </ul>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/05/08 16:32:32 $
+ * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/05/09 18:33:35 $
*/
public class CachingStreamPipeline extends AbstractStreamPipeline {
@@ -182,8 +184,8 @@
environment.setContentLength(response.length);
outputStream.write(response);
}
- }
-
+ }
+
if(usedCache == false) {
getLogger().debug("Cached content is invalid for '"
+ environment.getURI() + "'.");
@@ -213,7 +215,17 @@
((CachingOutputStream)outputStream).getContent()));
}
}
+ } catch ( SocketException se ) {
+ if (se.getMessage().indexOf("reset") > 0) {
+ throw new ConnectionResetException("Connection reset by
peer", se);
+ } else {
+ getLogger().debug("IOException in ProcessReader", se);
+ throw new ProcessingException(
+ "Failed to execute pipeline.",
+ se
+ );
+ }
} catch ( Exception e ) {
getLogger().debug("IOException in ProcessReader", e);
@@ -301,8 +313,8 @@
environment.setContentLength(bytes.length);
outputStream.write(bytes);
}
- }
-
+ }
+
if (usedCache == false) {
getLogger().debug("Cached content is invalid for
'" + environment.getURI() + "'.");
@@ -330,7 +342,7 @@
if (pcKey != null) {
byte[] bytes =
((CachingOutputStream)outputStream).getContent();
environment.setContentLength(bytes.length);
-
+
this.streamCache.store(pcKey,
new CachedStreamObject(validityObjects, bytes));
}
No revision
No revision
1.1.2.34 +3 -2
xml-cocoon/src/org/apache/cocoon/generation/Attic/FileGenerator.java
Index: FileGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/FileGenerator.java,v
retrieving revision 1.1.2.33
retrieving revision 1.1.2.34
diff -u -r1.1.2.33 -r1.1.2.34
--- FileGenerator.java 2001/05/03 12:16:36 1.1.2.33
+++ FileGenerator.java 2001/05/09 18:33:41 1.1.2.34
@@ -14,6 +14,7 @@
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.ResourceNotFoundException;
import org.apache.cocoon.Roles;
@@ -37,10 +38,10 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1.2.33 $ $Date: 2001/05/03 12:16:36 $
+ * @version CVS $Revision: 1.1.2.34 $ $Date: 2001/05/09 18:33:41 $
*/
public class FileGenerator extends ComposerGenerator
-implements Cacheable {
+implements Cacheable, Poolable {
/** The input source */
private InputSource inputSource;
1.1.2.21 +3 -2
xml-cocoon/src/org/apache/cocoon/generation/Attic/HTMLGenerator.java
Index: HTMLGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/HTMLGenerator.java,v
retrieving revision 1.1.2.20
retrieving revision 1.1.2.21
diff -u -r1.1.2.20 -r1.1.2.21
--- HTMLGenerator.java 2001/05/09 15:25:08 1.1.2.20
+++ HTMLGenerator.java 2001/05/09 18:33:44 1.1.2.21
@@ -18,6 +18,7 @@
import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.ResourceNotFoundException;
import org.apache.cocoon.Roles;
@@ -36,9 +37,9 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1.2.20 $ $Date: 2001/05/09 15:25:08 $
+ * @version CVS $Revision: 1.1.2.21 $ $Date: 2001/05/09 18:33:44 $
*/
-public class HTMLGenerator extends ComposerGenerator implements Cacheable {
+public class HTMLGenerator extends ComposerGenerator implements Cacheable,
Poolable {
/** The system ID of the input source */
private String systemID;
1.1.2.30 +4 -3
xml-cocoon/src/org/apache/cocoon/generation/Attic/ServerPagesGenerator.java
Index: ServerPagesGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/ServerPagesGenerator.java,v
retrieving revision 1.1.2.29
retrieving revision 1.1.2.30
diff -u -r1.1.2.29 -r1.1.2.30
--- ServerPagesGenerator.java 2001/05/07 09:38:56 1.1.2.29
+++ ServerPagesGenerator.java 2001/05/09 18:33:46 1.1.2.30
@@ -19,6 +19,7 @@
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.ResourceNotFoundException;
import org.apache.cocoon.Roles;
@@ -46,11 +47,11 @@
* delegating actual SAX event generation.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.29 $ $Date: 2001/05/07 09:38:56 $
+ * @version CVS $Revision: 1.1.2.30 $ $Date: 2001/05/09 18:33:46 $
*/
public class ServerPagesGenerator
extends ServletGenerator
- implements ContentHandler, LexicalHandler, Recyclable, Disposable,
Cacheable
+ implements ContentHandler, LexicalHandler, Recyclable, Disposable,
Cacheable, Poolable
{
/**
* The sitemap-defined server pages program generator
@@ -96,7 +97,7 @@
/**
* Generate the validity object.
- *
+ *
* @return The generated validity object or <code>null</code> if the
* component is currently not cachable.
*/
No revision
No revision
1.1.2.19 +2 -1
xml-cocoon/src/org/apache/cocoon/reading/Attic/DatabaseReader.java
Index: DatabaseReader.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/DatabaseReader.java,v
retrieving revision 1.1.2.18
retrieving revision 1.1.2.19
diff -u -r1.1.2.18 -r1.1.2.19
--- DatabaseReader.java 2001/05/07 15:50:39 1.1.2.18
+++ DatabaseReader.java 2001/05/09 18:34:00 1.1.2.19
@@ -29,6 +29,7 @@
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.excalibur.datasource.DataSourceComponent;
+import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.cocoon.Constants;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.ResourceNotFoundException;
@@ -50,7 +51,7 @@
*
* @author <a href="[EMAIL PROTECTED]">Berin Loritsch</a>
*/
-public class DatabaseReader extends AbstractReader implements Composable,
Configurable, Disposable, Cacheable {
+public class DatabaseReader extends AbstractReader implements Composable,
Configurable, Disposable, Cacheable, Poolable {
private ComponentSelector dbselector;
private String dsn;
private long lastModified = 0;
1.1.2.33 +3 -2
xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java
Index: ResourceReader.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java,v
retrieving revision 1.1.2.32
retrieving revision 1.1.2.33
diff -u -r1.1.2.32 -r1.1.2.33
--- ResourceReader.java 2001/04/30 14:17:33 1.1.2.32
+++ ResourceReader.java 2001/05/09 18:34:03 1.1.2.33
@@ -24,6 +24,7 @@
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.cocoon.Constants;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.ResourceNotFoundException;
@@ -42,7 +43,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.32 $ $Date: 2001/04/30 14:17:33 $
+ * @version CVS $Revision: 1.1.2.33 $ $Date: 2001/05/09 18:34:03 $
*
* The <code>ResourceReader</code> component is used to serve binary data
* in a sitemap pipeline. It makes use of HTTP Headers to determine if
@@ -59,7 +60,7 @@
* </dl>
*/
public class ResourceReader extends AbstractReader
- implements Composable, Cacheable {
+ implements Composable, Cacheable, Poolable {
private ComponentManager manager;
No revision
No revision
1.1.2.16 +20 -19
xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractTextSerializer.java
Index: AbstractTextSerializer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractTextSerializer.java,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -u -r1.1.2.15 -r1.1.2.16
--- AbstractTextSerializer.java 2001/05/04 11:02:14 1.1.2.15
+++ AbstractTextSerializer.java 2001/05/09 18:34:10 1.1.2.16
@@ -17,6 +17,7 @@
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.cocoon.Constants;
import org.apache.cocoon.caching.CacheValidity;
import org.apache.cocoon.caching.Cacheable;
@@ -31,9 +32,9 @@
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.1.2.15 $ $Date: 2001/05/04 11:02:14 $
+ * @version CVS $Revision: 1.1.2.16 $ $Date: 2001/05/09 18:34:10 $
*/
-public abstract class AbstractTextSerializer extends AbstractSerializer
implements Configurable, Cacheable {
+public abstract class AbstractTextSerializer extends AbstractSerializer
implements Configurable, Cacheable, Poolable {
/**
* The trax <code>TransformerFactory</code> used by this serializer.
@@ -44,17 +45,17 @@
* The <code>Properties</code> used by this serializer.
*/
protected Properties format = new Properties();
-
+
/**
* The prefixes of startPreficMapping() declarations for the coming
element.
*/
private List prefixList = new ArrayList();
-
+
/**
* The URIs of startPrefixMapping() declarations for the coming element.
*/
private List uriList = new ArrayList();
-
+
/**
* True if there has been some startPrefixMapping() for the coming
element.
*/
@@ -152,7 +153,7 @@
clearMappings();
super.recycle();
}
-
+
/**
*
*/
@@ -162,7 +163,7 @@
clearMappings();
super.startDocument();
}
-
+
/**
* Add tracking of mappings to be able to add <code>xmlns:</code>
attributes
* in <code>startElement()</code>.
@@ -173,10 +174,10 @@
this.hasMappings = true;
this.prefixList.add(prefix);
this.uriList.add(uri);
-
+
super.startPrefixMapping(prefix, uri);
}
-
+
/**
* Ensure all namespace declarations are present as <code>xmlns:</code>
attributes
* and add those needed before calling superclass. This is a workaround
for a Xalan bug
@@ -185,18 +186,18 @@
*/
public void startElement(String eltUri, String eltLocalName, String
eltQName, Attributes attrs)
throws SAXException {
-
+
if (this.hasMappings) {
// Add xmlns* attributes where needed
-
+
// New Attributes if we have to add some.
AttributesImpl newAttrs = null;
-
+
int mappingCount = this.prefixList.size();
int attrCount = attrs.getLength();
-
+
for(int mapping = 0; mapping < mappingCount; mapping++) {
-
+
// Build infos for this namespace
String uri = (String)this.uriList.get(mapping);
String prefix = (String)this.prefixList.get(mapping);
@@ -215,7 +216,7 @@
break find;
}
}
-
+
if (!found) {
// Need to add this namespace
if (newAttrs == null) {
@@ -226,7 +227,7 @@
else
newAttrs = new AttributesImpl(attrs);
}
-
+
if (prefix.equals("")) {
newAttrs.addAttribute(Constants.XML_NAMESPACE_URI,
"xmlns", "xmlns", "CDATA", uri);
} else {
@@ -234,10 +235,10 @@
}
}
} // end for mapping
-
+
// Cleanup for the next element
clearMappings();
-
+
// Start element with new attributes, if any
super.startElement(eltUri, eltLocalName, eltQName, newAttrs ==
null ? attrs : newAttrs);
}
@@ -246,7 +247,7 @@
super.startElement(eltUri, eltLocalName, eltQName, attrs);
}
}
-
+
private void clearMappings()
{
this.hasMappings = false;
No revision
No revision
1.1.2.12 +3 -2
xml-cocoon/src/org/apache/cocoon/transformation/Attic/FragmentExtractorTransformer.java
Index: FragmentExtractorTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/FragmentExtractorTransformer.java,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -r1.1.2.11 -r1.1.2.12
--- FragmentExtractorTransformer.java 2001/04/30 14:17:45 1.1.2.11
+++ FragmentExtractorTransformer.java 2001/05/09 18:34:17 1.1.2.12
@@ -17,6 +17,7 @@
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.Roles;
import org.apache.cocoon.caching.CacheValidity;
@@ -42,10 +43,10 @@
* <a href="http://c2.com/cgi/wiki?YouArentGonnaNeedIt">you aren't gonna
need it</a>,
* so I've just used very simple extraction based on a URI and local name.
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Russell</a>
- * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/04/30 14:17:45 $
+ * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/05/09 18:34:17 $
*/
public class FragmentExtractorTransformer extends AbstractTransformer
- implements Composable, Disposable, Cacheable {
+ implements Composable, Disposable, Cacheable, Poolable {
private static String EXTRACT_URI="http://www.w3.org/2000/svg";
private static String EXTRACT_ELEMENT="svg";
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]