You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2004/08/16 12:08:41 UTC
svn commit: rev 36466 - in cocoon/branches/BRANCH_2_1_X/src: blocks/repository/java/org/apache/cocoon/components/source/impl java/org/apache/cocoon/components/source/impl java/org/apache/cocoon/components/store/impl java/org/apache/cocoon/generation java/org/apache/cocoon/reading java/org/apache/cocoon/transformation java/org/apache/cocoon/transformation/pagination
Author: cziegeler
Date: Mon Aug 16 03:08:39 2004
New Revision: 36466
Removed:
cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/impl/MultiSourceValidity.java
Modified:
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SourceDeferredValidity.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/JCSDefaultStore.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/CalendarGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/DirectoryGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/FileGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ImageDirectoryGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/LinkStatusGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/MP3DirectoryGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/RequestGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ServletGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/SessionAttributeGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/StatusGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/StreamGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/XPathDirectoryGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ImageReader.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ResourceReader.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/AugmentTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/EncodeURLTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/FilterTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/JPathTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/JXTemplateTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/LogTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/ReadDOMSessionTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/RoleFilterTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/SimpleFormInstanceExtractionTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/SourceWritingTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/TraxTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/WriteDOMSessionTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/pagination/Pagesheet.java
Log:
Sync generators, transformers, some readers and some components
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java Mon Aug 16 03:08:39 2004
@@ -63,7 +63,7 @@
private SourceValidity sourceValidity;
/** The system id */
- private String systemId;
+ private final String systemId;
/** The system id used for caching */
private String systemIdForCaching;
@@ -78,7 +78,7 @@
private Processor pipelineProcessor;
/** The environment */
- private MutableEnvironmentFacade environment;
+ private final MutableEnvironmentFacade environment;
/** The <code>ProcessingPipeline</code> */
private ProcessingPipeline processingPipeline;
@@ -99,7 +99,7 @@
private Object processKey;
/** The used protocol */
- private String protocol;
+ private final String protocol;
/** SourceResolver (for the redirect source) */
private SourceResolver sourceResolver;
@@ -320,8 +320,8 @@
* and content length.
*/
public void refresh() {
- reset();
- init();
+ this.reset();
+ this.init();
}
/**
@@ -391,7 +391,7 @@
public void toSAX(ContentHandler contentHandler)
throws SAXException {
if (this.needsRefresh) {
- refresh();
+ this.refresh();
}
if (this.exception != null) {
throw this.exception;
@@ -459,9 +459,10 @@
* Recyclable
*/
public void recycle() {
- reset();
+ this.reset();
if (this.sourceResolver != null) {
this.manager.release(this.sourceResolver);
+ this.sourceResolver = null;
}
}
@@ -491,4 +492,5 @@
public Iterator getParameterNames() {
return java.util.Collections.EMPTY_LIST.iterator();
}
+
}
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SourceDeferredValidity.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SourceDeferredValidity.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SourceDeferredValidity.java Mon Aug 16 03:08:39 2004
@@ -24,7 +24,7 @@
* by invoking a pipeline.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: SourceDeferredValidity.java,v 1.2 2004/03/05 13:02:50 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public final class SourceDeferredValidity implements DeferredValidity {
@@ -40,5 +40,4 @@
public SourceValidity getValidity() {
return this.source.getValidity();
}
-
}
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/JCSDefaultStore.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/JCSDefaultStore.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/JCSDefaultStore.java Mon Aug 16 03:08:39 2004
@@ -51,7 +51,7 @@
* This is the default store implementation based on JCS
* http://jakarta.apache.org/turbine/jcs/BasicJCSConfiguration.html
*
- * @version CVS $Id: JCSDefaultStore.java,v 1.3 2004/05/20 10:48:16 cziegeler Exp $
+ * @version CVS $Id$
*/
public class JCSDefaultStore
extends AbstractLogEnabled
@@ -354,11 +354,11 @@
super(cacheControl);
}
- private int getSize() {
+ /*private int getSize() {
return super.cacheControl.getSize();
- }
+ }*/
- protected void dispose() {
+ public void dispose() {
super.dispose();
}
}
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/CalendarGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/CalendarGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/CalendarGenerator.java Mon Aug 16 03:08:39 2004
@@ -37,9 +37,11 @@
import org.xml.sax.helpers.AttributesImpl;
/**
+ * @cocoon.sitemap.component.documentation
* Generates an XML document representing a calendar for a given month and year.
* <p>
* Here is a sample output:
+ * </p>
* <pre>
* <calendar:calendar xmlns:calendar="http://apache.org/cocoon/calendar/1.0"
* year="2004" month="January" prevMonth="12" prevYear="2003"
@@ -59,22 +61,31 @@
* <p>
* <b>Configuration options:</b>
* <dl>
- * <dt> <i>month</i> (optional)
- * <dd> Sets the month for the calendar (January is 1). Default is the current month.
- * <dt> <i>year</i> (optional)
- * <dd> Sets the year for the calendar. Default is the current year.
- * <dt> <i>dateFormat</i> (optional)
+ * <dt> <i>month</i> (optional)</dt>
+ * <dd> Sets the month for the calendar (January is 1). Default is the current month.</dd>
+ * <dt> <i>year</i> (optional)</dt>
+ * <dd> Sets the year for the calendar. Default is the current year.</dd>
+ * <dt> <i>dateFormat</i> (optional)</dt>
* <dd> Sets the format for the date attribute of each node, as
* described in java.text.SimpleDateFormat. If unset, the default
- * format for the current locale will be used.
- * <dt> <i>lang</i> (optional)
- * <dd> Sets the ISO language code for determining the locale.
- * <dt> <i>country</i> (optional)
- * <dd> Sets the ISO country code for determining the locale.
+ * format for the current locale will be used.</dd>
+ * <dt> <i>lang</i> (optional)</dt>
+ * <dd> Sets the ISO language code for determining the locale.</dd>
+ * <dt> <i>country</i> (optional)</dt>
+ * <dd> Sets the ISO country code for determining the locale.</dd>
+ * <dt> <i>padWeeks</i> (optional)</dt>
+ * <dd> If set to true, full weeks will be generated by adding
+ * days from the end of the previous month and the beginning
+ * of the following month.</dd>
* </dl>
* </p>
*
- * @version CVS $Id: CalendarGenerator.java,v 1.8 2004/04/19 15:58:58 ugo Exp $
+ * @cocoon.sitemap.component.name calendar
+ * @cocoon.sitemap.component.label content
+ * @cocoon.sitemap.component.logger sitemap.generator.calendar
+ * @cocoon.sitemap.component.documentation.caching TBD
+ *
+ * @version CVS $Id$
*/
public class CalendarGenerator extends ServiceableGenerator implements CacheableProcessingComponent {
@@ -124,6 +135,9 @@
/** The current locale */
protected Locale locale;
+ /** Do we need to pad out the first and last weeks? */
+ protected boolean padWeeks;
+
/**
* Set the request parameters. Must be called before the generate method.
*
@@ -165,8 +179,9 @@
} else {
this.dateFormatter = DateFormat.getDateInstance(DateFormat.LONG, locale);
}
- this.monthFormatter = new SimpleDateFormat("MMMM", locale);
-
+ this.padWeeks = par.getParameterAsBoolean("padWeeks", false);
+ this.cacheKeyParList.add(new Boolean(this.padWeeks));
+ this.monthFormatter = new SimpleDateFormat("MMMM", locale);
this.attributes = new AttributesImpl();
}
@@ -208,14 +223,34 @@
this.contentHandler.startElement(URI, CALENDAR_NODE_NAME,
PREFIX + ':' + CALENDAR_NODE_NAME, attributes);
int weekNo = start.get(Calendar.WEEK_OF_MONTH);
- if (start.get(Calendar.DAY_OF_WEEK) != start.getFirstDayOfWeek()) {
+ int firstDay = start.getFirstDayOfWeek();
+ if (start.get(Calendar.DAY_OF_WEEK) != firstDay) {
attributes.clear();
attributes.addAttribute("", NUMBER_ATTR_NAME, NUMBER_ATTR_NAME, "CDATA", String.valueOf(weekNo));
this.contentHandler.startElement(URI, WEEK_NODE_NAME,
PREFIX + ':' + WEEK_NODE_NAME, attributes);
+ if (padWeeks) {
+ Calendar previous = (Calendar) start.clone();
+ while (previous.get(Calendar.DAY_OF_WEEK) != firstDay) {
+ previous.add(Calendar.DAY_OF_MONTH, -1);
+ }
+ while (previous.before(start)) {
+ attributes.clear();
+ attributes.addAttribute("", NUMBER_ATTR_NAME, NUMBER_ATTR_NAME, "CDATA",
+ String.valueOf(previous.get(Calendar.DAY_OF_MONTH)));
+ attributes.addAttribute("", DATE_ATTR_NAME, DATE_ATTR_NAME, "CDATA",
+ dateFormatter.format(previous.getTime()));
+ this.contentHandler.startElement(URI, DAY_NODE_NAME,
+ PREFIX + ':' + DAY_NODE_NAME, attributes);
+ addContent(previous, locale);
+ this.contentHandler.endElement(URI, DAY_NODE_NAME,
+ PREFIX + ':' + DAY_NODE_NAME);
+ previous.add(Calendar.DAY_OF_MONTH, 1);
+ }
+ }
}
while (start.before(end)) {
- if (start.get(Calendar.DAY_OF_WEEK) == start.getFirstDayOfWeek()) {
+ if (start.get(Calendar.DAY_OF_WEEK) == firstDay) {
weekNo = start.get(Calendar.WEEK_OF_MONTH);
attributes.clear();
attributes.addAttribute("", NUMBER_ATTR_NAME, NUMBER_ATTR_NAME, "CDATA", String.valueOf(weekNo));
@@ -233,13 +268,30 @@
this.contentHandler.endElement(URI, DAY_NODE_NAME,
PREFIX + ':' + DAY_NODE_NAME);
start.add(Calendar.DAY_OF_MONTH, 1);
- if (start.get(Calendar.DAY_OF_WEEK) == start.getFirstDayOfWeek()
- || ! start.before(end)) {
+ if (start.get(Calendar.DAY_OF_WEEK) == firstDay
+ || (!padWeeks && ! start.before(end))) {
this.contentHandler.endElement(URI, WEEK_NODE_NAME,
PREFIX + ':' + WEEK_NODE_NAME);
}
}
+ if (padWeeks) {
+ while (firstDay != end.get(Calendar.DAY_OF_WEEK)) {
+ attributes.clear();
+ attributes.addAttribute("", NUMBER_ATTR_NAME, NUMBER_ATTR_NAME, "CDATA",
+ String.valueOf(end.get(Calendar.DAY_OF_MONTH)));
+ attributes.addAttribute("", DATE_ATTR_NAME, DATE_ATTR_NAME, "CDATA",
+ dateFormatter.format(end.getTime()));
+ this.contentHandler.startElement(URI, DAY_NODE_NAME,
+ PREFIX + ':' + DAY_NODE_NAME, attributes);
+ addContent(end, locale);
+ this.contentHandler.endElement(URI, DAY_NODE_NAME,
+ PREFIX + ':' + DAY_NODE_NAME);
+ end.add(Calendar.DAY_OF_MONTH, 1);
+ }
+ this.contentHandler.endElement(URI, WEEK_NODE_NAME,
+ PREFIX + ':' + WEEK_NODE_NAME);
+ }
this.contentHandler.endElement(URI, CALENDAR_NODE_NAME,
PREFIX + ':' + CALENDAR_NODE_NAME);
this.contentHandler.endPrefixMapping(PREFIX);
@@ -263,7 +315,7 @@
StringBuffer buffer = new StringBuffer();
int len = this.cacheKeyParList.size();
for (int i = 0; i < len; i++) {
- buffer.append((String)this.cacheKeyParList.get(i) + ":");
+ buffer.append(this.cacheKeyParList.get(i) + ":");
}
return buffer.toString();
}
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/DirectoryGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/DirectoryGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/DirectoryGenerator.java Mon Aug 16 03:08:39 2004
@@ -43,52 +43,24 @@
import java.util.Comparator;
/**
+ * @cocoon.sitemap.component.documentation
* Generates an XML directory listing.
- * <p>
- * The root node of the generated document will normally be a
- * <code>directory</code> node, and a directory node can contain zero
- * or more <code>file</code> or directory nodes. A file node has no
- * children. Each node will contain the following attributes:
- * <blockquote>
- * <dl>
- * <dt> name
- * <dd> the name of the file or directory
- * <dt> lastModified
- * <dd> the time the file was last modified, measured as the number of
- * milliseconds since the epoch (as in java.io.File.lastModified)
- * <dt> size
- * <dd> the file size, in bytes (as in java.io.File.length)
- * <dt> date (optional)
- * <dd> the time the file was last modified in human-readable form
- * </dl>
- * </blockquote>
- * <p>
- * <b>Configuration options:</b>
- * <dl>
- * <dt> <i>depth</i> (optional)
- * <dd> Sets how deep DirectoryGenerator should delve into the
- * directory structure. If set to 1 (the default), only the starting
- * directory's immediate contents will be returned.
- * <dt> <i>sort</i> (optional)
- * <dd> Sort order in which the nodes are returned. Possible values are
- * name, size, time, directory. directory is the same as name,
- * except that the directory entries are listed first. System order is default.
- * <dt> <i>reverse</i> (optional)
- * <dd> Reverse the order of the sort
- * <dt> <i>dateFormat</i> (optional)
- * <dd> Sets the format for the date attribute of each node, as
- * described in java.text.SimpleDateFormat. If unset, the default
- * format for the current locale will be used.
- * <dt> <i>refreshDelay</i> (optional)
- * <dd> Sets the delay (in seconds) between checks on the filesystem for changed content.
- * Defaults to 1 second.
- * </dl>
+ *
+ * @cocoon.sitemap.component.name directory
+ * @cocoon.sitemap.component.label content
+ * @cocoon.sitemap.component.logger sitemap.generator.directory
+ * @cocoon.sitemap.component.documentation.caching
+ * Uses the last modification date of the directory and the contained files
+ *
+ * @cocoon.sitemap.component.pooling.min 2
+ * @cocoon.sitemap.component.pooling.max 16
+ * @cocoon.sitemap.component.pooling.grow 2
*
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* (Apache Software Foundation)
* @author <a href="mailto:conny@smb-tec.com">Conny Krappatsch</a>
* (SMB GmbH) for Virbus AG
- * @version CVS $Id: DirectoryGenerator.java,v 1.10 2004/03/05 13:02:55 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class DirectoryGenerator
extends ServiceableGenerator
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/FileGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/FileGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/FileGenerator.java Mon Aug 16 03:08:39 2004
@@ -26,6 +26,7 @@
import org.xml.sax.SAXException;
import java.io.IOException;
+import java.io.Serializable;
import java.util.Map;
/**
@@ -47,7 +48,7 @@
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* (Apache Software Foundation)
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: FileGenerator.java,v 1.8 2004/05/01 18:06:12 cziegeler Exp $
+ * @version CVS $Id$
*/
public class FileGenerator extends ServiceableGenerator
implements CacheableProcessingComponent {
@@ -88,7 +89,7 @@
*
* @return The generated key hashes the src
*/
- public java.io.Serializable getKey() {
+ public Serializable getKey() {
return this.inputSource.getURI();
}
@@ -114,23 +115,8 @@
" resolved to " + this.inputSource.getURI());
}
SourceUtil.parse(this.manager, this.inputSource, super.xmlConsumer);
-
} catch (SAXException e) {
- final Exception cause = e.getException();
- if (cause != null) {
- if (cause instanceof ProcessingException) {
- throw (ProcessingException)cause;
- }
- if (cause instanceof IOException) {
- throw (IOException)cause;
- }
- if (cause instanceof SAXException) {
- throw (SAXException)cause;
- }
- throw new ProcessingException("Could not read resource " +
- this.inputSource.getURI(), cause);
- }
- throw e;
+ SourceUtil.handleSAXException(this.inputSource.getURI(), e);
}
}
}
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ImageDirectoryGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ImageDirectoryGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ImageDirectoryGenerator.java Mon Aug 16 03:08:39 2004
@@ -26,12 +26,25 @@
import org.xml.sax.SAXException;
/**
- * An extension of DirectoryGenerators that adds extra attributes for image
- * files.
+ * @cocoon.sitemap.component.documentation
+ * Generates an XML directory listing. This is an extension of
+ * the <link href="directory-generator.html">Directory Generator</link> that
+ * adds extra attributes for image files.
+ *
+ * @cocoon.sitemap.component.name imagedirectory
+ * @cocoon.sitemap.component.label content
+ * @cocoon.sitemap.component.logger sitemap.generator.imagedirectory
+ * @cocoon.sitemap.component.documentation.caching
+ * Uses the last modification date of the directory and the contained files
+ *
+ * @cocoon.sitemap.component.pooling.min 2
+ * @cocoon.sitemap.component.pooling.max 16
+ * @cocoon.sitemap.component.pooling.grow 2
+ *
*
* @author <a href="mailto:balld@webslingerZ.com">Donald A. Ball Jr.</a>
* @author <a href="mailto:tcurdt@apache.org">Torsten Curdt</a>
- * @version CVS $Id: ImageDirectoryGenerator.java,v 1.2 2004/03/05 13:02:55 bdelacretaz Exp $
+ * @version CVS $Id$
*/
final public class ImageDirectoryGenerator extends DirectoryGenerator {
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/LinkStatusGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/LinkStatusGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/LinkStatusGenerator.java Mon Aug 16 03:08:39 2004
@@ -45,12 +45,17 @@
import java.util.ArrayList;
/**
+ * @cocoon.sitemap.component.documentation
* Generates a list of links that are reachable from the src and their status.
*
+ * @cocoon.sitemap.component.name linkstatus
+ * @cocoon.sitemap.component.label content
+ * @cocoon.sitemap.component.logger sitemap.generator.linkstatus
+ *
* @author Michael Homeijer
* @author Nicola Ken Barozzi (nicolaken@apache.org)
* @author Bernhard Huber (huber@apache.org)
- * @version CVS $Id: LinkStatusGenerator.java,v 1.9 2004/03/28 14:28:04 antonio Exp $
+ * @version CVS $Id$
*/
public class LinkStatusGenerator extends ServiceableGenerator implements Recyclable, Configurable {
/** The URI of the namespace of this generator. */
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/MP3DirectoryGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/MP3DirectoryGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/MP3DirectoryGenerator.java Mon Aug 16 03:08:39 2004
@@ -22,28 +22,19 @@
import java.io.RandomAccessFile;
/**
+ * @cocoon.sitemap.component.documentation
* An extension of DirectoryGenerators that adds extra attributes for MP3
* files.
- * <p>
- * Following extra attributes added to valid MP3 files:
- * <blockquote>
- * <dl>
- * <dt> frequency
- * <dd> the frequency of the MP3 file in KHz (most common: 44.1)
- * <dt> bitrate
- * <dd> the bitrate of the MP3 file in Kbit, from 8 to 448.
- * <dt> mode
- * <dd> the mode of the MP3 file, one of the following: Stereo, Joint stereo,
- * Dual channel, Single channel.
- * <dt> variable-rate (optional)
- * <dd> value is "yes" if VBR header is detected
- * <dt> title, artitst, album, year, comment, track, genre (all optional)
- * <dd> values obtained from MP3 ID3 tag
- * </dl>
- * </blockquote>
+ *
+ * @cocoon.sitemap.component.name mp3directory
+ * @cocoon.sitemap.component.label content
+ * @cocoon.sitemap.component.logger sitemap.generator.mp3directory
+ * @cocoon.sitemap.component.documentation.caching
+ * Uses the last modification date of the directory and the contained files
+ *
*
* @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
- * @version CVS $Id: MP3DirectoryGenerator.java,v 1.4 2004/03/05 13:02:55 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class MP3DirectoryGenerator extends DirectoryGenerator
{
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/RequestGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/RequestGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/RequestGenerator.java Mon Aug 16 03:08:39 2004
@@ -37,7 +37,17 @@
import org.xml.sax.helpers.AttributesImpl;
/**
+ * @cocoon.sitemap.component.documentation
* Generates an XML representation of the incoming request.
+ *
+ * @cocoon.sitemap.component.name request
+ * @cocoon.sitemap.component.label content
+ * @cocoon.sitemap.component.logger sitemap.generator.request
+ *
+ * @cocoon.sitemap.component.pooling.min 2
+ * @cocoon.sitemap.component.pooling.max 16
+ * @cocoon.sitemap.component.pooling.grow 2
+ *
* <p>
* <b>Configuration options:</b>
* <dl>
@@ -55,7 +65,7 @@
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Id: RequestGenerator.java,v 1.9 2004/03/05 13:02:55 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class RequestGenerator extends ServiceableGenerator implements Parameterizable {
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ServletGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ServletGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ServletGenerator.java Mon Aug 16 03:08:39 2004
@@ -32,7 +32,7 @@
/**
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Id: ServletGenerator.java,v 1.3 2004/03/05 13:02:55 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public abstract class ServletGenerator extends ComposerGenerator {
@@ -49,8 +49,8 @@
this.context = ObjectModelHelper.getContext(objectModel);
}
- /**
- * Recycle the generator by removing references
+ /* (non-Javadoc)
+ * @see org.apache.avalon.excalibur.pool.Recyclable#recycle()
*/
public void recycle() {
super.recycle();
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/SessionAttributeGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/SessionAttributeGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/SessionAttributeGenerator.java Mon Aug 16 03:08:39 2004
@@ -32,6 +32,13 @@
import java.util.Map;
/**
+ * @cocoon.sitemap.component.documentation
+ * Generates a document from a session attribute.
+ *
+ * @cocoon.sitemap.component.name sessionattribute
+ * @cocoon.sitemap.component.label content
+ * @cocoon.sitemap.component.logger sitemap.generator.sessionattribute
+ *
* Generates a document from a session attribute. The attribute may be a DOM
* node, an <code>XMLizable</code>, or any other object, and is streamed using
* the same rules as for <xsp:expr> in XSPs (see {@link
@@ -66,7 +73,7 @@
* @see org.apache.cocoon.transformation.WriteDOMSessionTransformer
* @author <a href="mailto:cedric.damioli@anyware-tech.com">Cédric Damioli</a>
* @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
- * @version CVS $Id: SessionAttributeGenerator.java,v 1.4 2004/03/05 13:02:55 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class SessionAttributeGenerator extends AbstractGenerator {
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/StatusGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/StatusGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/StatusGenerator.java Mon Aug 16 03:08:39 2004
@@ -36,7 +36,17 @@
import org.xml.sax.helpers.AttributesImpl;
/**
+ * @cocoon.sitemap.component.documentation
* Generates an XML representation of the current status of Cocoon.
+ *
+ * @cocoon.sitemap.component.name status
+ * @cocoon.sitemap.component.label content
+ * @cocoon.sitemap.component.logger sitemap.generator.status
+ *
+ * @cocoon.sitemap.component.pooling.min 2
+ * @cocoon.sitemap.component.pooling.max 16
+ * @cocoon.sitemap.component.pooling.grow 2
+ *
* Potted DTD:
*
* <code>
@@ -64,7 +74,7 @@
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:skoechlin@ivision.fr">Sébastien Kœchlin</a> (iVision)
* @author <a href="mailto:g-froehlich@gmx.de">Gerhard Froehlich</a>
- * @version CVS $Id: StatusGenerator.java,v 1.8 2004/05/20 10:48:16 cziegeler Exp $
+ * @version CVS $Id$
*/
public class StatusGenerator extends ServiceableGenerator {
@@ -74,7 +84,6 @@
protected StoreJanitor storejanitor;
protected Store store_persistent;
-
/**
* The XML namespace for the output document.
*/
@@ -147,7 +156,6 @@
// The current date and time.
String dateTime = DateFormat.getDateTimeInstance().format(new Date());
-
String localHost;
// The local host.
@@ -189,8 +197,7 @@
atts.clear();
// qName = prefix + ':' + localName
atts.addAttribute(xlinkNamespace, "type", xlinkPrefix + ":type", "CDATA", "simple");
- atts.addAttribute(xlinkNamespace, "href", xlinkPrefix + ":href", "CDATA",
- SystemUtils.JAVA_VENDOR_URL);
+ atts.addAttribute(xlinkNamespace, "href", xlinkPrefix + ":href", "CDATA", SystemUtils.JAVA_VENDOR_URL);
addValue(ch, "java-vendor", SystemUtils.JAVA_VENDOR, atts);
endGroup(ch);
// END JRE
@@ -242,8 +249,7 @@
ch.characters(line.toCharArray(), 0, line.length());
ch.endElement(namespace, "line", "line");
}
- }
-
+ }
if (size == 0) {
ch.startElement(namespace, "line", "line", atts);
String value = "[empty]";
@@ -280,8 +286,7 @@
ch.characters(line.toCharArray(), 0, line.length());
ch.endElement(namespace, "line", "line");
}
- }
-
+ }
if (size == 0) {
ch.startElement(namespace, "line", "line", atts);
String value = "[empty]";
@@ -306,12 +311,7 @@
/** Utility function to begin a <code>group</code> tag pair with added attributes. */
private void startGroup(ContentHandler ch, String name, Attributes atts) throws SAXException {
- AttributesImpl ai;
- if (atts == null) {
- ai = new AttributesImpl();
- } else {
- ai = new AttributesImpl(atts);
- }
+ AttributesImpl ai = (atts == null) ? new AttributesImpl() : new AttributesImpl(atts);
ai.addAttribute(namespace, "name", "name", "CDATA", name);
ch.startElement(namespace, "group", "group", ai);
}
@@ -328,12 +328,7 @@
/** Utility function to begin and end a <code>value</code> tag pair with added attributes. */
private void addValue(ContentHandler ch, String name, String value, Attributes atts) throws SAXException {
- AttributesImpl ai;
- if (atts == null) {
- ai = new AttributesImpl();
- } else {
- ai = new AttributesImpl(atts);
- }
+ AttributesImpl ai = (atts == null) ? new AttributesImpl() : new AttributesImpl(atts);
ai.addAttribute(namespace, "name", "name", "CDATA", name);
ch.startElement(namespace, "value", "value", ai);
ch.startElement(namespace, "line", "line", new AttributesImpl());
@@ -353,12 +348,7 @@
/** Utility function to begin and end a <code>value</code> tag pair with added attributes. */
private void addMultilineValue(ContentHandler ch, String name, List values, Attributes atts) throws SAXException {
- AttributesImpl ai;
- if (atts == null) {
- ai = new AttributesImpl();
- } else {
- ai = new AttributesImpl(atts);
- }
+ AttributesImpl ai = (atts == null) ? new AttributesImpl() : new AttributesImpl(atts);
ai.addAttribute(namespace, "name", "name", "CDATA", name);
ch.startElement(namespace, "value", "value", ai);
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/StreamGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/StreamGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/StreamGenerator.java Mon Aug 16 03:08:39 2004
@@ -34,10 +34,18 @@
import java.io.StringReader;
/**
- *
+ * @cocoon.sitemap.component.documentation
* The <code>StreamGenerator</code> is a class that reads XML from a
* request InputStream and generates SAX Events.
*
+ * @cocoon.sitemap.component.name stream
+ * @cocoon.sitemap.component.label content
+ * @cocoon.sitemap.component.logger sitemap.generator.stream
+ *
+ * @cocoon.sitemap.component.pooling.min 1
+ * @cocoon.sitemap.component.pooling.max 16
+ * @cocoon.sitemap.component.pooling.grow 2
+ *
* For the POST requests with a mimetype of application/x-www-form-urlencoded,
* or multipart/form-data the xml data is expected to be associated with the
* sitemap parameter 'form-name'.
@@ -55,7 +63,7 @@
* number of bytes read is equal to the getContentLength() value.
*
* @author <a href="mailto:Kinga_Dziembowski@hp.com">Kinga Dziembowski</a>
- * @version CVS $Id: StreamGenerator.java,v 1.9 2004/03/06 14:24:51 joerg Exp $
+ * @version CVS $Id$
*/
public class StreamGenerator extends ServiceableGenerator
{
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/XPathDirectoryGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/XPathDirectoryGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/XPathDirectoryGenerator.java Mon Aug 16 03:08:39 2004
@@ -53,6 +53,18 @@
/**
+ * @cocoon.sitemap.component.documentation
+ * Generates an XML directory listing performing XPath queries on XML files. It can be used both as a plain
+ * DirectoryGenerator or, by specifying a parameter <code>xpath</code>, it will perform an XPath query on every XML
+ * resource.
+ *
+ * @cocoon.sitemap.component.name xpathdirectory
+ * @cocoon.sitemap.component.label content
+ * @cocoon.sitemap.component.logger sitemap.generator.xpathdirectory
+ * @cocoon.sitemap.component.documentation.caching
+ * Uses the last modification date of the directory and the contained documents
+ *
+ *
* <p>
* Generates an XML directory listing performing XPath queries on XML files. It can be used both as a plain
* DirectoryGenerator or, by specifying a parameter <code>xpath</code>, it will perform an XPath query on every XML
@@ -111,7 +123,7 @@
* @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
* @author <a href="mailto:gianugo@apache.org">Gianugo Rabellino</a>
* @author <a href="mailto:joerg@apache.org">J\u00F6rg Heinicke</a>
- * @version CVS $Id: XPathDirectoryGenerator.java,v 1.9 2004/05/07 21:13:50 joerg Exp $
+ * @version CVS $Id$
*/
public class XPathDirectoryGenerator
extends DirectoryGenerator {
@@ -316,7 +328,7 @@
* The MappingInfo class to reolve namespace prefixes to their namespace URI
*
* @author <a href="mailto:giacomo(at)apache.org">Giacomo Pati</a>
- * @version CVS $Id: XPathDirectoryGenerator.java,v 1.9 2004/05/07 21:13:50 joerg Exp $
+ * @version CVS $Id$
*/
private static class MappingInfo
implements PrefixResolver {
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ImageReader.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ImageReader.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ImageReader.java Mon Aug 16 03:08:39 2004
@@ -24,6 +24,7 @@
import java.awt.image.WritableRaster;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.Serializable;
import java.util.Map;
@@ -82,7 +83,7 @@
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
* @author <a href="mailto:tcurdt@apache.org">Torsten Curdt</a>
- * @version CVS $Id: ImageReader.java,v 1.10 2004/03/28 20:51:24 antonio Exp $
+ * @version CVS $Id$
*/
final public class ImageReader extends ResourceReader {
@@ -185,7 +186,7 @@
return new AffineTransform(wm, 0.0d, 0.0d, hm, 0.0d, 0.0d);
}
- protected void processStream() throws IOException, ProcessingException {
+ protected void processStream(InputStream inputStream) throws IOException, ProcessingException {
if (width > 0 || height > 0 || null != colorFilter || null != grayscaleFilter) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("image " + ((width == 0) ? "?" : Integer.toString(width))
@@ -274,7 +275,7 @@
if (getLogger().isDebugEnabled()) {
getLogger().debug("passing original resource");
}
- super.processStream();
+ super.processStream(inputStream);
}
}
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ResourceReader.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ResourceReader.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ResourceReader.java Mon Aug 16 03:08:39 2004
@@ -64,7 +64,7 @@
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:tcurdt@apache.org">Torsten Curdt</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: ResourceReader.java,v 1.6 2004/03/11 18:46:31 joerg Exp $
+ * @version CVS $Id$
*/
public class ResourceReader
extends AbstractReader
@@ -74,7 +74,6 @@
private static final Map documents = new HashMap();
protected Source inputSource;
- protected InputStream inputStream;
protected boolean quickTest;
protected boolean byteRanges;
@@ -173,10 +172,18 @@
}
}
- protected void processStream() throws IOException, ProcessingException {
+ protected void processStream(InputStream inputStream)
+ throws IOException, ProcessingException {
byte[] buffer = new byte[bufferSize];
int length = -1;
+ // tell the client whether we support byte range requests or not
+ if(byteRanges) {
+ response.setHeader("Accept-Ranges", "bytes");
+ } else {
+ response.setHeader("Accept-Ranges", "none");
+ }
+
String ranges = request.getHeader("Ranges");
ByteRange byteRange;
@@ -196,8 +203,7 @@
}
}
}
- }
- else {
+ } else {
byteRange = null;
}
@@ -221,8 +227,6 @@
((HttpResponse)response).setStatus(206);
}
- response.setHeader("Accept-Ranges", "bytes");
-
int pos = 0;
int posEnd;
while ((length = inputStream.read(buffer)) > -1) {
@@ -233,15 +237,11 @@
}
pos += length;
}
- }
- else {
+ } else {
if (contentLength != -1) {
response.setHeader("Content-Length", Long.toString(contentLength));
}
- // Bug #9539: This resource reader does not support ranges
- response.setHeader("Accept-Ranges", "none");
-
while ((length = inputStream.read(buffer)) > -1) {
out.write(buffer, 0, length);
}
@@ -253,12 +253,13 @@
/**
* Generates the requested resource.
*/
- public void generate() throws IOException, ProcessingException {
+ public void generate()
+ throws IOException, ProcessingException {
try {
if (expires > 0) {
response.setDateHeader("Expires", System.currentTimeMillis() + expires);
- }
- else {
+ } else {
+ // See Bug #14048
response.addHeader("Vary", "Host");
}
@@ -267,18 +268,18 @@
response.setDateHeader("Last-Modified", lastModified);
}
+ InputStream inputStream;
try {
inputStream = inputSource.getInputStream();
- }
- catch (SourceException se) {
- throw SourceUtil.handle("Error during resolving of the input stream", se);
+ } catch (SourceException e) {
+ throw SourceUtil.handle("Error during resolving of the input stream", e);
}
- // Bugzilla Bug 25069, close inputStream in finally block
- // this will close inputStream even if processStream throws
+ // Bugzilla Bug #25069, close inputStream in finally block.
+ // This will close inputStream even if processStream throws
// an exception
try {
- processStream();
+ processStream(inputStream);
} finally {
if (inputStream != null) {
inputStream.close();
@@ -290,8 +291,7 @@
// (see http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=102921894301915&w=2 )
documents.put(request.getRequestURI(), inputSource.getURI());
}
- }
- catch (IOException e) {
+ } catch (IOException e) {
getLogger().debug("Received an IOException, assuming client severed connection on purpose");
}
}
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java Mon Aug 16 03:08:39 2004
@@ -93,7 +93,7 @@
*
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
- * @version CVS $Id: AbstractSAXTransformer.java,v 1.11 2004/03/17 11:50:21 cziegeler Exp $
+ * @version CVS $Id$
*/
public abstract class AbstractSAXTransformer
extends AbstractTransformer
@@ -175,14 +175,14 @@
private String ourPrefix;
/* (non-Javadoc)
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+ * @see Configurable#configure(Configuration)
*/
public void configure(Configuration configuration)
throws ConfigurationException {
}
/* (non-Javadoc)
- * @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
+ * @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(SourceResolver, Map, String, Parameters)
*/
public void setup(SourceResolver resolver,
Map objectModel,
@@ -191,8 +191,8 @@
throws ProcessingException,
SAXException,
IOException {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("BEGIN setup resolver="+resolver+
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Setup resolver=" + resolver +
", objectModel="+objectModel+
", src="+src+
", parameters="+par);
@@ -219,10 +219,6 @@
this.ignoreEventsCount = 0;
this.ignoreWhitespaces = true;
this.ignoreEmptyCharacters = false;
-
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("END setup");
- }
}
/* (non-Javadoc)
@@ -244,7 +240,7 @@
}
/* (non-Javadoc)
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+ * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
*/
public void service(ServiceManager manager) throws ServiceException {
this.manager = manager;
@@ -253,6 +249,7 @@
/**
* Process the SAX event. A new document is processed. The hook (method)
* <code>setupTransforming()</code> is invoked.
+ *
* @see org.xml.sax.ContentHandler#startDocument()
*/
public void startDocument()
@@ -267,7 +264,9 @@
}
this.isInitialized = true;
}
- if (this.ignoreEventsCount == 0) super.startDocument();
+ if (this.ignoreEventsCount == 0) {
+ super.startDocument();
+ }
}
/**
@@ -276,7 +275,9 @@
*/
public void endDocument()
throws SAXException {
- if (this.ignoreEventsCount == 0) super.endDocument();
+ if (this.ignoreEventsCount == 0) {
+ super.endDocument();
+ }
}
/**
@@ -303,7 +304,9 @@
throw new SAXException("Exception occured during processing: " + ioe, ioe);
}
} else {
- if (ignoreEventsCount == 0) super.startElement(uri, name, raw, attr);
+ if (ignoreEventsCount == 0) {
+ super.startElement(uri, name, raw, attr);
+ }
}
}
@@ -322,14 +325,15 @@
// this is our namespace:
try {
this.endTransformingElement(uri, name, raw);
- } catch (ProcessingException pException) {
- throw new SAXException("ProcessingException: " + pException,
- pException);
+ } catch (ProcessingException e) {
+ throw new SAXException("ProcessingException: " + e, e);
} catch (IOException ioe) {
throw new SAXException("Exception occured during processing: " + ioe, ioe);
}
} else {
- if (ignoreEventsCount == 0) super.endElement(uri, name, raw);
+ if (ignoreEventsCount == 0) {
+ super.endElement(uri, name, raw);
+ }
}
}
@@ -355,7 +359,9 @@
*/
public void ignorableWhitespace(char[] p0, int p1, int p2)
throws SAXException {
- if (ignoreWhitespaces == false && ignoreEventsCount == 0) super.ignorableWhitespace(p0, p1, p2);
+ if (ignoreWhitespaces == false && ignoreEventsCount == 0) {
+ super.ignorableWhitespace(p0, p1, p2);
+ }
}
/*
@@ -424,23 +430,19 @@
}
/**
- * Start recording of text.
- * All events are not forwarded and the characters events
- * are merged to a string
+ * Start recording of a text.
+ * No events forwarded, and all characters events
+ * are collected into a string.
*/
public void startTextRecording()
throws SAXException {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("BEGIN startTextRecording");
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Start text recording");
}
XMLConsumer recorder = new TextRecorder();
- this.addRecorder(recorder);
-
- this.sendStartPrefixMapping();
+ addRecorder(recorder);
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("END startTextRecording");
- }
+ sendStartPrefixMapping();
}
/**
@@ -449,17 +451,12 @@
*/
public String endTextRecording()
throws SAXException {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("BEGIN endTextRecording");
- }
-
- this.sendEndPrefixMapping();
+ sendEndPrefixMapping();
TextRecorder recorder = (TextRecorder)this.removeRecorder();
String text = recorder.getText();
-
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("END endTextRecording text="+text);
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("End text recording. Text=" + text);
}
return text;
}
@@ -473,14 +470,11 @@
*/
public void startSerializedXMLRecording(Properties format)
throws SAXException {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("BEGIN startSerializedXMLRecording format="+format);
- }
- this.stack.push((format == null ? XMLUtils.createPropertiesForXML(false) : format));
- this.startRecording();
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("END startSerializedXMLRecording");
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Start serialized XML recording. Format=" + format);
}
+ this.stack.push(format == null? XMLUtils.createPropertiesForXML(false): format);
+ startRecording();
}
/**
@@ -490,13 +484,10 @@
*/
public String endSerializedXMLRecording()
throws SAXException, ProcessingException {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("BEGIN endSerializedXMLRecording");
- }
- DocumentFragment fragment = this.endRecording();
+ DocumentFragment fragment = endRecording();
String text = XMLUtils.serializeNode(fragment, (Properties)this.stack.pop());
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("END endSerializedXMLRecording xml="+text);
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("End serialized XML recording. XML=" + text);
}
return text;
}
@@ -510,17 +501,13 @@
*/
public void startParametersRecording()
throws SAXException {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("BEGIN startParametersRecording");
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Start parameters recording");
}
XMLConsumer recorder = new ParametersRecorder();
- this.addRecorder(recorder);
+ addRecorder(recorder);
- this.sendStartPrefixMapping();
-
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("END startParametersRecording");
- }
+ sendStartPrefixMapping();
}
/**
@@ -532,17 +519,14 @@
*/
public SourceParameters endParametersRecording(Parameters source)
throws SAXException {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("BEGIN endParametersRecording source="+source);
- }
- this.sendEndPrefixMapping();
- ParametersRecorder recorder = (ParametersRecorder)this.removeRecorder();
- SourceParameters pars = recorder.getParameters(source);
+ sendEndPrefixMapping();
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("END endParametersRecording parameters="+pars);
+ ParametersRecorder recorder = (ParametersRecorder)this.removeRecorder();
+ SourceParameters parameters = recorder.getParameters(source);
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("End parameters recording. Parameters=" + parameters);
}
- return pars;
+ return parameters;
}
/**
@@ -554,17 +538,14 @@
*/
public SourceParameters endParametersRecording(SourceParameters source)
throws SAXException {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("BEGIN endParametersRecording source="+source);
- }
- this.sendEndPrefixMapping();
- ParametersRecorder recorder = (ParametersRecorder)this.removeRecorder();
- SourceParameters pars = recorder.getParameters(source);
+ sendEndPrefixMapping();
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("END endParametersRecording parameters="+pars);
+ ParametersRecorder recorder = (ParametersRecorder)this.removeRecorder();
+ SourceParameters parameters = recorder.getParameters(source);
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("End parameters recording. Parameters=" + parameters);
}
- return pars;
+ return parameters;
}
/**
@@ -574,19 +555,15 @@
*/
public void startRecording()
throws SAXException {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("BEGIN startRecording");
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Start recording");
}
DOMBuilder builder = new DOMBuilder();
- this.addRecorder(builder);
+ addRecorder(builder);
builder.startDocument();
builder.startElement("", "cocoon", "cocoon", new AttributesImpl());
- this.sendStartPrefixMapping();
-
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("END startRecording");
- }
+ sendStartPrefixMapping();
}
/**
@@ -596,13 +573,9 @@
*/
public DocumentFragment endRecording()
throws SAXException {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("BEGIN endRecording");
- }
-
- this.sendEndPrefixMapping();
+ sendEndPrefixMapping();
- DOMBuilder builder = (DOMBuilder)this.removeRecorder();
+ DOMBuilder builder = (DOMBuilder)removeRecorder();
builder.endElement("", "cocoon", "cocoon");
builder.endDocument();
@@ -611,10 +584,9 @@
final DocumentFragment recordedDocFrag = doc.createDocumentFragment();
final Node root = doc.getDocumentElement();
root.normalize();
- Node child;
boolean appendedNode = false;
while (root.hasChildNodes() == true) {
- child = root.getFirstChild();
+ Node child = root.getFirstChild();
root.removeChild(child);
// Leave out empty text nodes before any other node
if (appendedNode == true
@@ -625,14 +597,14 @@
}
}
- if (this.getLogger().isDebugEnabled()) {
+ if (getLogger().isDebugEnabled()) {
Object serializedXML = null;
try {
- serializedXML = (recordedDocFrag == null ? "null" : XMLUtils.serializeNode(recordedDocFrag, XMLUtils.createPropertiesForXML(false)));
+ serializedXML = recordedDocFrag == null? "null": XMLUtils.serializeNode(recordedDocFrag, XMLUtils.createPropertiesForXML(false));
} catch (ProcessingException ignore) {
serializedXML = recordedDocFrag;
}
- this.getLogger().debug("END endRecording fragment=" + serializedXML);
+ getLogger().debug("End recording. Fragment=" + serializedXML);
}
return recordedDocFrag;
}
@@ -649,16 +621,13 @@
*/
public void setupTransforming()
throws IOException, ProcessingException, SAXException {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("BEGIN setupTransforming");
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("setupTransforming");
}
this.stack.clear();
this.recorderStack.clear();
this.ignoreWhitespaces = true;
this.ignoreEmptyCharacters = false;
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("END setupTransforming");
- }
}
/**
@@ -674,13 +643,9 @@
String raw,
Attributes attr)
throws ProcessingException, IOException, SAXException {
- //if (this.getLogger().isDebugEnabled()) {
- // this.getLogger().debug("BEGIN startTransformingElement uri=" + uri + ", name=" + name + ", raw=" + raw + ", attr=" + attr + ")");
- //}
- if (this.ignoreEventsCount == 0) super.startElement(uri, name, raw, attr);
- //if (this.getLogger().isDebugEnabled()) {
- // this.getLogger().debug("END startTransformingElement");
- //}
+ if (this.ignoreEventsCount == 0) {
+ super.startElement(uri, name, raw, attr);
+ }
}
/**
@@ -694,13 +659,9 @@
String name,
String raw)
throws ProcessingException, IOException, SAXException {
- //if (this.getLogger().isDebugEnabled()) {
- // this.getLogger().debug("BEGIN endTransformingElement uri=" + uri + ", name=" + name + ", raw=" + raw + ")");
- //}
- if (this.ignoreEventsCount == 0) super.endElement(uri, name, raw);
- //if (this.getLogger().isDebugEnabled()) {
- // this.getLogger().debug("END endTransformingElement");
- //}
+ if (this.ignoreEventsCount == 0) {
+ super.endElement(uri, name, raw);
+ }
}
/**
@@ -811,19 +772,17 @@
*/
public void sendParametersEvents(SourceParameters pars)
throws SAXException {
+
if (pars != null) {
Iterator names = pars.getParameterNames();
- String currentName;
- String currentValue;
- Iterator values;
- while (names.hasNext() == true) {
- currentName = (String)names.next();
- values = pars.getParameterValues(currentName);
- while (values.hasNext() == true) {
- currentValue = (String)values.next();
- this.sendStartElementEvent(currentName);
- this.sendTextEvent(currentValue);
- this.sendEndElementEvent(currentName);
+ while (names.hasNext()) {
+ final String currentName = (String)names.next();
+ Iterator values = pars.getParameterValues(currentName);
+ while (values.hasNext()) {
+ final String currentValue = (String)values.next();
+ sendStartElementEvent(currentName);
+ sendTextEvent(currentValue);
+ sendEndElementEvent(currentName);
}
}
}
@@ -834,7 +793,9 @@
*/
public void startEntity (String name)
throws SAXException {
- if (this.ignoreEventsCount == 0) super.startEntity(name);
+ if (this.ignoreEventsCount == 0) {
+ super.startEntity(name);
+ }
}
/**
@@ -842,7 +803,9 @@
*/
public void endEntity (String name)
throws SAXException {
- if (this.ignoreEventsCount == 0) super.endEntity(name);
+ if (this.ignoreEventsCount == 0) {
+ super.endEntity(name);
+ }
}
/**
@@ -850,11 +813,10 @@
*/
protected void sendStartPrefixMapping()
throws SAXException {
- int i,l;
- l = this.namespaces.size();
- String[] prefixAndUri;
- for(i=0; i<l; i++) {
- prefixAndUri = (String[])this.namespaces.get(i);
+
+ final int l = this.namespaces.size();
+ for(int i = 0; i < l; i++) {
+ String[] prefixAndUri = (String[])this.namespaces.get(i);
super.contentHandler.startPrefixMapping(prefixAndUri[0], prefixAndUri[1]);
}
}
@@ -864,11 +826,10 @@
*/
protected void sendEndPrefixMapping()
throws SAXException {
- int i,l;
- l = this.namespaces.size();
- String[] prefixAndUri;
- for(i=0; i<l; i++) {
- prefixAndUri = (String[])this.namespaces.get(i);
+
+ final int l = this.namespaces.size();
+ for(int i=0; i<l; i++) {
+ String[] prefixAndUri = (String[])this.namespaces.get(i);
super.contentHandler.endPrefixMapping(prefixAndUri[0]);
}
}
@@ -877,7 +838,9 @@
* SAX Event handling
*/
public void setDocumentLocator(Locator locator) {
- if (this.ignoreEventsCount == 0) super.setDocumentLocator(locator);
+ if (this.ignoreEventsCount == 0) {
+ super.setDocumentLocator(locator);
+ }
}
/**
@@ -885,11 +848,15 @@
*/
public void startPrefixMapping(String prefix, String uri)
throws SAXException {
- if (prefix != null) this.namespaces.add(new String[] {prefix, uri});
+ if (prefix != null) {
+ this.namespaces.add(new String[] {prefix, uri});
+ }
if ( this.namespaceURI != null && this.namespaceURI.equals(uri)) {
this.ourPrefix = prefix;
}
- if (this.ignoreEventsCount == 0) super.startPrefixMapping(prefix, uri);
+ if (this.ignoreEventsCount == 0) {
+ super.startPrefixMapping(prefix, uri);
+ }
}
/**
@@ -897,14 +864,14 @@
*/
public void endPrefixMapping(String prefix)
throws SAXException {
+
if (prefix != null) {
// search the namespace prefix
boolean found = false;
int l = this.namespaces.size();
int i = l-1;
- String currentPrefix;
while (!found && i >= 0) {
- currentPrefix = ((String[])this.namespaces.get(i))[0];
+ String currentPrefix = ((String[])this.namespaces.get(i))[0];
if (currentPrefix.equals(prefix)) {
found = true;
} else {
@@ -914,6 +881,7 @@
if (!found) {
throw new SAXException("Namespace for prefix '"+ prefix + "' not found.");
}
+
this.namespaces.remove(i);
if ( prefix.equals(this.ourPrefix) ) {
this.ourPrefix = null;
@@ -921,9 +889,8 @@
found = false;
l = this.namespaces.size();
i = l-1;
- String currentNS;
while (!found && i >= 0) {
- currentNS = ((String[])this.namespaces.get(i))[1];
+ String currentNS = ((String[])this.namespaces.get(i))[1];
if (currentNS.equals(this.namespaceURI)) {
found = true;
} else {
@@ -935,7 +902,9 @@
}
}
}
- if (this.ignoreEventsCount == 0) super.endPrefixMapping(prefix);
+ if (this.ignoreEventsCount == 0) {
+ super.endPrefixMapping(prefix);
+ }
}
/* (non-Javadoc)
@@ -943,7 +912,9 @@
*/
public void processingInstruction(String target, String data)
throws SAXException {
- if (this.ignoreEventsCount == 0) super.processingInstruction(target, data);
+ if (this.ignoreEventsCount == 0) {
+ super.processingInstruction(target, data);
+ }
}
/* (non-Javadoc)
@@ -951,7 +922,9 @@
*/
public void skippedEntity(String name)
throws SAXException {
- if (this.ignoreEventsCount == 0) super.skippedEntity(name);
+ if (this.ignoreEventsCount == 0) {
+ super.skippedEntity(name);
+ }
}
/* (non-Javadoc)
@@ -959,28 +932,36 @@
*/
public void startDTD(String name, String public_id, String system_id)
throws SAXException {
- if (this.ignoreEventsCount == 0) super.startDTD(name, public_id, system_id);
+ if (this.ignoreEventsCount == 0) {
+ super.startDTD(name, public_id, system_id);
+ }
}
/* (non-Javadoc)
* @see org.xml.sax.ext.LexicalHandler#endDTD()
*/
public void endDTD() throws SAXException {
- if (this.ignoreEventsCount == 0) super.endDTD();
+ if (this.ignoreEventsCount == 0) {
+ super.endDTD();
+ }
}
/* (non-Javadoc)
* @see org.xml.sax.ext.LexicalHandler#startCDATA()
*/
public void startCDATA() throws SAXException {
- if (this.ignoreEventsCount == 0) super.startCDATA();
+ if (this.ignoreEventsCount == 0) {
+ super.startCDATA();
+ }
}
/* (non-Javadoc)
* @see org.xml.sax.ext.LexicalHandler#endCDATA()
*/
public void endCDATA() throws SAXException {
- if (this.ignoreEventsCount == 0) super.endCDATA();
+ if (this.ignoreEventsCount == 0) {
+ super.endCDATA();
+ }
}
/* (non-Javadoc)
@@ -988,7 +969,8 @@
*/
public void comment(char ary[], int start, int length)
throws SAXException {
- if (this.ignoreEventsCount == 0) super.comment(ary, start, length);
+ if (this.ignoreEventsCount == 0) {
+ super.comment(ary, start, length);
+ }
}
-
}
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/AugmentTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/AugmentTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/AugmentTransformer.java Mon Aug 16 03:08:39 2004
@@ -28,20 +28,17 @@
import java.util.Map;
/**
- * <p>Augments all <code>href</code> attributes with the full path to
- * the request.</p>
+* @cocoon.sitemap.component.documentation
+ * Augments all <code>href</code> attributes with the full path to
+ * the request. You can optionally specify the <code>mount</code>
+ * parameter.
*
- * <p>Usage in sitemap:</p>
- *
- * <pre>
- * <map:transform type="augment">
- * <map:parameter name="mount" value="directory/to/be/appended"/>
- * </map:transform>
- * </pre>
+ * @cocoon.sitemap.component.name augment
+ * @cocoon.sitemap.component.logger sitemap.transformer.augment
*
* @author <a href="mailto:ovidiu@cup.hp.com">Ovidiu Predescu</a>
* @since October 10, 2001
- * @version CVS $Id: AugmentTransformer.java,v 1.5 2004/03/06 02:26:13 antonio Exp $
+ * @version CVS $Id$
*/
public class AugmentTransformer
extends AbstractTransformer {
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java Mon Aug 16 03:08:39 2004
@@ -51,6 +51,7 @@
import java.util.Map;
/**
+* @cocoon.sitemap.component.documentation
* This transformer triggers for the element <code>include</code> in the
* namespace "http://apache.org/cocoon/include/1.0".
* The <code>src</code> attribute contains the url which points to
@@ -58,6 +59,15 @@
* With the attributes <code>element</code>, <code>ns</code> and
* <code>prefix</code> it is possible to specify an element
* which surrounds the included content.
+ *
+ * @cocoon.sitemap.component.name cinclude
+ * @cocoon.sitemap.component.logger sitemap.transformer.cinclude
+ * @cocoon.sitemap.component.documentation.caching
+ * See documentation for further information.
+ *
+ * @cocoon.sitemap.component.pooling.min 2
+ * @cocoon.sitemap.component.pooling.max 16
+ * @cocoon.sitemap.component.pooling.grow 2
*
* This transformer also supports a more verbose but flexible version:
* <cinclude:includexml xmlns:cinclude="http://apache.org/cocoon/include/1.0" ignoreErrors="false">
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/EncodeURLTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/EncodeURLTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/EncodeURLTransformer.java Mon Aug 16 03:08:39 2004
@@ -38,6 +38,18 @@
import org.xml.sax.helpers.AttributesImpl;
/**
+ * @cocoon.sitemap.component.documentation
+ * The encodeURL transformer emits encoded URLs.
+ *
+ * @cocoon.sitemap.component.name encodeURL
+ * @cocoon.sitemap.component.logger sitemap.transformer.encodeURL
+ * @cocoon.sitemap.component.documentation.caching
+ * TBD
+ *
+ * @cocoon.sitemap.component.pooling.min 8
+ * @cocoon.sitemap.component.pooling.max 32
+ * @cocoon.sitemap.component.pooling.grow 4
+ *
* The encodeURL transformer emits encoded URLs.
* <p>
* This transformer applies encodeURL method to URLs.
@@ -75,7 +87,7 @@
* </pre></tt>
*
* @author <a href="mailto:bh22351@i-one.at">Bernhard Huber</a>
- * @version CVS $Id: EncodeURLTransformer.java,v 1.7 2004/03/06 04:58:58 joerg Exp $
+ * @version CVS $Id$
*/
public class EncodeURLTransformer
extends AbstractTransformer
@@ -310,7 +322,7 @@
* </p>
*
* @author <a href="mailto:bh22351@i-one.at">Bernhard Huber</a>
- * @version CVS $Id: EncodeURLTransformer.java,v 1.7 2004/03/06 04:58:58 joerg Exp $
+ * @version CVS $Id$
*/
public class ElementAttributeMatching {
/**
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/FilterTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/FilterTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/FilterTransformer.java Mon Aug 16 03:08:39 2004
@@ -29,6 +29,16 @@
import java.util.Map;
/**
+ * @cocoon.sitemap.component.documentation
+ * The filter transformer can be used to let only an amount of elements through in
+ * a given block.
+ *
+ * @cocoon.sitemap.component.name filter
+ * @cocoon.sitemap.component.logger sitemap.transformer.filter
+ * @cocoon.sitemap.component.documentation.caching
+ * TBD
+ *
+ *
* The filter transformer can be used to let only an amount of elements through in
* a given block.
*
@@ -46,7 +56,7 @@
*
* @author <a href="mailto:sven.beauprez@the-ecorp.com">Sven Beauprez</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: FilterTransformer.java,v 1.5 2004/03/09 00:57:35 joerg Exp $
+ * @version CVS $Id$
*/
public class FilterTransformer
extends AbstractTransformer
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/JPathTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/JPathTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/JPathTransformer.java Mon Aug 16 03:08:39 2004
@@ -32,11 +32,12 @@
import org.xml.sax.helpers.AttributesImpl;
/**
- * JPath Transformer.
- *
- * <p>
+ * @cocoon.sitemap.component.documentation
* Transformer implementation of the JPath XSP tag library.
- * </p>
+ *
+ * @cocoon.sitemap.component.name jpath
+ * @cocoon.sitemap.component.logger sitemap.transformer.jpath
+ *
*
* <p>
* This transformer (so far) supports the following jpath elements:
@@ -53,7 +54,7 @@
* </p>
*
* @author <a href="mailto:crafterm@apache.org">Marcus Crafter</a>
- * @version CVS $Id: JPathTransformer.java,v 1.5 2004/03/05 13:02:59 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class JPathTransformer
extends AbstractSAXTransformer implements Initializable {
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/JXTemplateTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/JXTemplateTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/JXTemplateTransformer.java Mon Aug 16 03:08:39 2004
@@ -19,6 +19,7 @@
/**
* Transformer adapter for {@link org.apache.cocoon.generation.JXTemplateGenerator}
+ *
*/
public class JXTemplateTransformer extends JXTemplateGenerator.TransformerAdapter {
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/LogTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/LogTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/LogTransformer.java Mon Aug 16 03:08:39 2004
@@ -31,6 +31,18 @@
import java.util.Map;
/**
+ * @cocoon.sitemap.component.documentation
+ * The <code>LogTransformer</code> is a class that can be plugged into a pipeline
+ * to print the SAX events which passes thru this transformer in a readable form
+ * to a file.
+ *
+ * @cocoon.sitemap.component.name log
+ * @cocoon.sitemap.component.logger sitemap.transformer.log
+ *
+ * @cocoon.sitemap.component.pooling.min 2
+ * @cocoon.sitemap.component.pooling.max 16
+ * @cocoon.sitemap.component.pooling.grow 2
+ *
*
* The <code>LogTransformer</code> is a class that can be plugged into a pipeline
* to print the SAX events which passes thru this transformer in a readable form
@@ -55,7 +67,7 @@
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @author <a href="mailto:giacomo.pati@pwr.ch">Giacomo Pati</a>
* (PWR Organisation & Entwicklung)
- * @version CVS $Id: LogTransformer.java,v 1.4 2004/03/05 13:02:59 bdelacretaz Exp $
+ * @version CVS $Id$
*
*/
public class LogTransformer
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/ReadDOMSessionTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/ReadDOMSessionTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/ReadDOMSessionTransformer.java Mon Aug 16 03:08:39 2004
@@ -31,6 +31,14 @@
/**
+ * @cocoon.sitemap.component.documentation
+ * With this transformer, an object that is stored in the session, can be inserted
+ * in the SAX stream at a given position, using usual <xsp:expr> rules.
+ * Object can be DOM Node, XMLizable, or any other object supported by <xsp:expr>.
+ *
+ * @cocoon.sitemap.component.name readDOMsession
+ * @cocoon.sitemap.component.logger sitemap.transformer.readDOMsession
+ *
* With this transformer, an object that is stored in the session, can be inserted
* in the SAX stream at a given position, using usual <xsp:expr> rules.
* Object can be DOM Node, XMLizable, or any other object supported by <xsp:expr>.
@@ -54,7 +62,7 @@
*
* @author <a href="mailto:sven.beauprez@the-ecorp.com">Sven Beauprez</a>
* @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
- * @version CVS $Id: ReadDOMSessionTransformer.java,v 1.3 2004/03/05 13:02:59 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class ReadDOMSessionTransformer extends AbstractTransformer {
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/RoleFilterTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/RoleFilterTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/RoleFilterTransformer.java Mon Aug 16 03:08:39 2004
@@ -29,6 +29,16 @@
import java.util.StringTokenizer;
/**
+ * @cocoon.sitemap.component.documentation
+ * Filter XML fragments based on a user's role. This will help in
+ * the development of smart forms that must only show information to
+ * people who are logged in and have the correct role. The Role is
+ * specified by the Request semantics. You can specify multiple roles
+ * by using comma delimiting.
+ *
+ * @cocoon.sitemap.component.name role-filter
+ * @cocoon.sitemap.component.logger sitemap.transformer.role-filter
+ *
* Filter XML fragments based on a user's role. This will help in
* the development of smart forms that must only show information to
* people who are logged in and have the correct role. The Role is
@@ -51,7 +61,7 @@
* will work as expected.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Id: RoleFilterTransformer.java,v 1.4 2004/03/05 13:02:59 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class RoleFilterTransformer extends FilterTransformer {
private final static String URI = "http://apache.org/cocoon/role-filter/1.0";
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/SimpleFormInstanceExtractionTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/SimpleFormInstanceExtractionTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/SimpleFormInstanceExtractionTransformer.java Mon Aug 16 03:08:39 2004
@@ -39,6 +39,7 @@
import org.xml.sax.SAXException;
/**
+ * @cocoon.sitemap.component.documentation
* This transformer sieves an incoming stream of xml and extracts a
* document fragment from it depending on a given tag and stores the
* fragment using an OutputModule with a name based an attribute of
@@ -50,8 +51,11 @@
* that the extracted form instance data is used only when no similar
* request parameter exists.
*
+ * @cocoon.sitemap.component.name simple-form-instance
+ * @cocoon.sitemap.component.logger sitemap.transformer.simple-form-instance
+ *
* @author <a href="mailto:haul@apache.org">Christian Haul</a>
- * @version CVS $Id: SimpleFormInstanceExtractionTransformer.java,v 1.3 2004/03/05 13:02:59 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class SimpleFormInstanceExtractionTransformer extends AbstractExtractionTransformer
implements Configurable, Serviceable, Recyclable {
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java Mon Aug 16 03:08:39 2004
@@ -44,9 +44,14 @@
import java.util.Map;
/**
+ * @cocoon.sitemap.component.documentation
* Eliminates the need for XSP to use FormValidatorAction or HTML forms.
* Caveat: Select options need a value attribute to work correctly.
*
+ * @cocoon.sitemap.component.name simple-form
+ * @cocoon.sitemap.component.logger sitemap.transformer.simple-form
+ *
+ *
* <p>This transformer fills all HTML 4 form elements with values from
* an InputModule, e.g. request, with the same name. It handles select
* boxes, textareas, checkboxes, radio buttons, password and text
@@ -140,7 +145,7 @@
* </pre></p>
*
* @author <a href="mailto:haul@apache.org">Christian Haul</a>
- * @version CVS $Id: SimpleFormTransformer.java,v 1.15 2004/03/28 22:03:02 antonio Exp $
+ * @version CVS $Id$
*/
public class SimpleFormTransformer extends AbstractSAXTransformer implements Recyclable {
@@ -293,7 +298,7 @@
/**
* Keep track of multiple values.
*/
- protected class ValueList {
+ protected static class ValueList {
private int current = -1;
private Object[] values = null;
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/SourceWritingTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/SourceWritingTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/SourceWritingTransformer.java Mon Aug 16 03:08:39 2004
@@ -46,6 +46,12 @@
import org.xml.sax.SAXException;
/**
+ * @cocoon.sitemap.component.documentation
+ * This transformer allows you to output to a ModifiableSource.
+ *
+ * @cocoon.sitemap.component.name write-source
+ * @cocoon.sitemap.component.logger sitemap.transformer.write-source
+ *
* This transformer allows you to output to a ModifiableSource.
*
* <p>Definition:</p>
@@ -216,14 +222,14 @@
* reinsert a replaced node at a given path in the new fragment.
*
* <b>
- * TODO: Use the serializer instead of the XMLUtils for inserting of fragments
+ * TODO: Use the serializer instead of the XMLUtils for inserting of fragments<br/>
* TODO: Add a <source:before/> tag.
* </b>
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
* @author <a href="mailto:jeremy@apache.org">Jeremy Quinn</a>
* @author <a href="mailto:gianugo@apache.org">Gianugo Rabellino</a>
- * @version CVS $Id: SourceWritingTransformer.java,v 1.11 2004/03/17 12:09:52 cziegeler Exp $
+ * @version CVS $Id$
*/
public class SourceWritingTransformer
extends AbstractSAXTransformer
@@ -303,7 +309,9 @@
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
throws ProcessingException, SAXException, IOException {
super.setup(resolver, objectModel, src, par);
- this.configuredSerializerName = par.getParameter(SERIALIZER_ATTRIBUTE, this.configuredSerializerName);
+
+ this.configuredSerializerName = par.getParameter(SERIALIZER_ATTRIBUTE,
+ this.configuredSerializerName);
this.state = STATE_OUTSIDE;
}
@@ -323,9 +331,10 @@
public void startTransformingElement(String uri, String name, String raw, Attributes attr)
throws SAXException, IOException, ProcessingException {
if (getLogger().isDebugEnabled()) {
- getLogger().debug("BEGIN startTransformingElement uri=" + uri +
+ getLogger().debug("Start transforming element. uri=" + uri +
", name=" + name + ", raw=" + raw + ", attr=" + attr);
}
+
// Element: insert
if (this.state == STATE_OUTSIDE
&& (name.equals(INSERT_ELEMENT) || name.equals(WRITE_ELEMENT))) {
@@ -385,10 +394,6 @@
} else {
super.startTransformingElement(uri, name, raw, attr);
}
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("END startTransformingElement");
- }
}
@@ -406,10 +411,10 @@
public void endTransformingElement(String uri, String name, String raw)
throws SAXException, IOException, ProcessingException {
if (getLogger().isDebugEnabled()) {
- getLogger().debug("BEGIN endTransformingElement uri=" + uri +
- ", name=" + name +
- ", raw=" + raw);
+ getLogger().debug("End transforming element. uri=" + uri +
+ ", name=" + name + ", raw=" + raw);
}
+
if ((name.equals(INSERT_ELEMENT) && this.state == STATE_INSERT)
|| (name.equals(WRITE_ELEMENT) && this.state == STATE_WRITE)) {
@@ -502,10 +507,6 @@
} else {
super.endTransformingElement(uri, name, raw);
}
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("END endTransformingElement");
- }
}
/**
@@ -576,7 +577,7 @@
throws SAXException, IOException, ProcessingException {
// no sync req
if (getLogger().isDebugEnabled()) {
- getLogger().debug("BEGIN insertFragment systemID="+systemID+
+ getLogger().debug("Insert fragment. systemID=" + systemID +
", path="+path+
", replace="+replacePath+
", create="+create+
@@ -584,6 +585,7 @@
", reinsert="+reinsertPath+
", fragment="+(fragment == null ? "null" : XMLUtils.serializeNode(fragment, XMLUtils.createPropertiesForXML(false))));
}
+
// test parameter
if (systemID == null) {
throw new ProcessingException("insertFragment: systemID is required.");
@@ -765,10 +767,6 @@
if (!failed) { action = (exists) ? ACTION_OVER : ACTION_NEW; }
this.reportResult(localSerializer, tagname, message, target, result, action);
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("END insertFragment");
- }
}
private void reportResult(String localSerializer,
@@ -776,7 +774,8 @@
String message,
String target,
String result,
- String action) throws SAXException {
+ String action)
+ throws SAXException {
sendStartElementEvent(RESULT_ELEMENT);
sendStartElementEvent(EXECUTION_ELEMENT);
sendTextEvent(result);
@@ -803,7 +802,7 @@
/* (non-Javadoc)
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+ * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
*/
public void service(ServiceManager manager) throws ServiceException {
super.service(manager);
@@ -819,5 +818,4 @@
this.xpathProcessor = null;
}
}
-
}
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/TraxTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/TraxTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/TraxTransformer.java Mon Aug 16 03:08:39 2004
@@ -17,6 +17,7 @@
package org.apache.cocoon.transformation;
import java.io.IOException;
+import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.HashMap;
@@ -57,6 +58,18 @@
import org.xml.sax.SAXException;
/**
+ * @cocoon.sitemap.component.documentation
+ * The stylesheet processor
+ *
+ * @cocoon.sitemap.component.name xslt
+ * @cocoon.sitemap.component.logger sitemap.transformer.xslt
+ * @cocoon.sitemap.component.documentation.caching
+ * Uses the last modification date of the xslt document for validation
+ *
+ * @cocoon.sitemap.component.pooling.min 8
+ * @cocoon.sitemap.component.pooling.max 32
+ * @cocoon.sitemap.component.pooling.grow 4
+ *
* This Transformer is used to transform the incoming SAX stream using
* a TrAXProcessor. Use the following sitemap declarations to define, configure
* and parameterize it:
@@ -132,7 +145,7 @@
* @author <a href="mailto:ovidiu@cup.hp.com">Ovidiu Predescu</a>
* @author <a href="mailto:marbut@hplb.hpl.hp.com">Mark H. Butler</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Id: TraxTransformer.java,v 1.11 2004/03/05 13:02:59 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class TraxTransformer extends AbstractTransformer
implements Transformer, Serviceable, Configurable, CacheableProcessingComponent, Disposable {
@@ -314,7 +327,7 @@
*
* @return The generated key hashes the src
*/
- public java.io.Serializable getKey() {
+ public Serializable getKey() {
Map map = getLogicSheetParameters();
if (map == null) {
return this.inputSource.getURI();
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/WriteDOMSessionTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/WriteDOMSessionTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/WriteDOMSessionTransformer.java Mon Aug 16 03:08:39 2004
@@ -32,6 +32,13 @@
/**
+ * @cocoon.sitemap.component.documentation
+ * Make a DOM object from SAX events and write it to the session.
+ *
+ * @cocoon.sitemap.component.name writeDOMsession
+ * @cocoon.sitemap.component.logger sitemap.transformer.writeDOMsession
+ *
+ *
* Make a DOM object from SAX events and write it to the session.
*
* Usage in sitemap:
@@ -45,7 +52,7 @@
* dom-root-element is the trigger that will be the root element of the DOM
*
* @author <a href="mailto:sven.beauprez@the-ecorp.com">Sven Beauprez</a>
- * @version CVS $Id: WriteDOMSessionTransformer.java,v 1.3 2004/03/05 13:02:59 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class WriteDOMSessionTransformer
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java Mon Aug 16 03:08:39 2004
@@ -50,13 +50,23 @@
import org.xml.sax.ext.LexicalHandler;
/**
+ * @cocoon.sitemap.component.documentation
+ * Implementation of an XInclude transformer.
+ *
+ * @cocoon.sitemap.component.name xinclude
+ * @cocoon.sitemap.component.logger sitemap.transformer.xinclude
+ *
+ * @cocoon.sitemap.component.pooling.min 2
+ * @cocoon.sitemap.component.pooling.max 16
+ * @cocoon.sitemap.component.pooling.grow 2
+ *
* Implementation of an XInclude transformer. It supports xml:base attributes,
* XPointer fragment identifiers (see the xpointer package to see what exactly is
* supported), fallback elements, and does xinclude processing on the included content
* and on the content of fallback elements (with loop inclusion detection).
*
* @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a> (wrote the original version)
- * @version CVS $Id: XIncludeTransformer.java,v 1.19 2004/03/22 13:41:44 joerg Exp $
+ * @version CVS $Id$
*/
public class XIncludeTransformer extends AbstractTransformer implements Serviceable {
protected SourceResolver resolver;
@@ -397,7 +407,7 @@
xmlConsumer.setDocumentLocator(locator);
} catch (ResourceNotFoundException e) {
useFallback = true;
- fallBackException = new CascadingException("Resouce not found: " + url.getURI());
+ fallBackException = new CascadingException("Resource not found: " + url.getURI());
getLogger().error("xIncluded resource not found: " + url.getURI(), e);
} catch (ParseException e) {
// this exception is thrown in case of an invalid xpointer expression
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/pagination/Pagesheet.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/pagination/Pagesheet.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/pagination/Pagesheet.java Mon Aug 16 03:08:39 2004
@@ -23,7 +23,6 @@
import org.apache.cocoon.Modifiable;
import org.apache.cocoon.util.ResizableContainer;
-
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@@ -44,7 +43,7 @@
*
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:bhtek@yahoo.com">Boon Hian Tek</a>
- * @version CVS $Id: Pagesheet.java,v 1.6 2004/05/17 16:17:11 vgritsenko Exp $
+ * @version CVS $Id$
*/
/*
@@ -97,8 +96,7 @@
6) range link(s) will have an attribute 'range' to indicate the range size
*/
-public class Pagesheet extends DefaultHandler
- implements Cloneable, Modifiable {
+public class Pagesheet extends DefaultHandler implements Cloneable, Modifiable {
// Used only during parsing of pagesheet document
private int level = 0;