Return-Path: Delivered-To: apmail-xml-cocoon-cvs-archive@xml.apache.org Received: (qmail 36696 invoked by uid 500); 10 Mar 2003 18:13:45 -0000 Mailing-List: contact cocoon-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: cocoon-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cocoon-cvs@xml.apache.org Received: (qmail 36684 invoked by uid 500); 10 Mar 2003 18:13:44 -0000 Delivered-To: apmail-cocoon-2.1-cvs@apache.org Received: (qmail 36681 invoked from network); 10 Mar 2003 18:13:44 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 10 Mar 2003 18:13:44 -0000 Received: (qmail 91545 invoked by uid 1260); 10 Mar 2003 18:13:43 -0000 Date: 10 Mar 2003 18:13:43 -0000 Message-ID: <20030310181343.91540.qmail@icarus.apache.org> From: cziegeler@apache.org To: cocoon-2.1-cvs@apache.org Subject: cvs commit: cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/i18n LocaleTag.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N cziegeler 2003/03/10 10:13:43 Modified: . gump.xml blocks.properties Added: src/blocks/taglib/java/org/apache/cocoon/taglib/core SourceTag.java LoopTag.java ForEachSupport.java LoopTagSupport.java LoopTagStatus.java src/blocks/taglib/java/org/apache/cocoon/taglib TagSupport.java XMLProducerTag.java Tag.java XMLConsumerTagSupport.java VarTagSupport.java VarTransformerTagSupport.java IterationTag.java VarXMLProducerTagSupport.java TransformerTagSupport.java XMLConsumerTag.java TransformerTag.java XMLProducerTagSupport.java src/blocks/taglib/java/org/apache/cocoon/transformation TagTransformer.java src/blocks/taglib/java/org/apache/cocoon/taglib/datetime MonthsTag.java src/blocks/taglib/java/org/apache/cocoon/taglib/test/acting TagtestAction.java src/blocks/taglib/java/org/apache/cocoon/jxpath CocoonRequestHandler.java CocoonSessionHandler.java CocoonContextHandler.java JXPathCocoonContexts.java src/blocks/taglib/java/org/apache/cocoon/taglib/jxpath/core OutTag.java ForEachTag.java src/blocks/taglib/java/org/apache/cocoon/taglib/test HelloWorldTag.java IterationTestTag.java src/blocks/taglib/lib .cvsignore src/blocks/taglib/java/org/apache/cocoon/taglib/string UpperCaseTag.java TrimTag.java LowerCaseTag.java StringTagSupport.java TextRecordingTag.java src/blocks/taglib/conf jxpath.xconf tag.xconf src/blocks/taglib/java/org/apache/cocoon/taglib/i18n LocaleTag.java Removed: src/scratchpad/src/org/apache/cocoon/taglib/i18n LocaleTag.java src/scratchpad/src/org/apache/cocoon/jxpath CocoonSessionHandler.java CocoonContextHandler.java JXPathCocoonContexts.java jxpath.xconf CocoonRequestHandler.java src/scratchpad/src/org/apache/cocoon/taglib/string TrimTag.java StringTagSupport.java TextRecordingTag.java UpperCaseTag.java LowerCaseTag.java src/scratchpad/src/org/apache/cocoon/taglib XMLProducerTag.java XMLConsumerTagSupport.java TagSupport.java VarTagSupport.java TransformerTagSupport.java VarXMLProducerTagSupport.java IterationTag.java tag.xconf TransformerTag.java XMLProducerTagSupport.java Tag.java XMLConsumerTag.java VarTransformerTagSupport.java src/scratchpad/src/org/apache/cocoon/taglib/test HelloWorldTag.java IterationTestTag.java src/scratchpad/src/org/apache/cocoon/taglib/core SourceTag.java ForEachSupport.java LoopTag.java LoopTagSupport.java LoopTagStatus.java src/scratchpad/src/org/apache/cocoon/taglib/datetime MonthsTag.java src/scratchpad/src/org/apache/cocoon/taglib/jxpath/core OutTag.java ForEachTag.java src/scratchpad/src/org/apache/cocoon/transformation TagTransformer.java src/scratchpad/src/org/apache/cocoon/taglib/test/acting TagtestAction.java Log: Moving taglib implementation into own block Currently this also includes the jxpath component; this can be fixed later on. Revision Changes Path 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/core/SourceTag.java Index: SourceTag.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib.core; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.Composable; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.components.source.SourceUtil; import org.apache.cocoon.taglib.XMLProducerTagSupport; import org.apache.cocoon.xml.EmbeddedXMLPipe; import org.apache.excalibur.source.Source; import org.xml.sax.SAXException; /** * @author: Volker Schmitt */ public class SourceTag extends XMLProducerTagSupport implements Composable { private String src; private EmbeddedXMLPipe embeddedXMLPipe = new EmbeddedXMLPipe(null); /** The component manager instance */ private ComponentManager manager = null; /** * Set the current ComponentManager instance used by this * Composable. */ public void compose(ComponentManager manager) throws ComponentException { this.manager = manager; } public void setSrc(String src) { this.src = src; } /* * @see Tag#doEndTag(String, String, String) */ public int doEndTag(String namespaceURI, String localName, String qName) throws SAXException { Source source = null; try { embeddedXMLPipe.setConsumer(this.xmlConsumer); source = resolver.resolveURI(src); SourceUtil.toSAX(source, this.embeddedXMLPipe); } catch (Exception e) { if (e instanceof ProcessingException) { ProcessingException pe = (ProcessingException) e; Throwable t = pe.getCause(); if (t != null && t instanceof SAXException) throw (SAXException) t; } throw new SAXException(e.getMessage(), e); } finally { embeddedXMLPipe.setConsumer(null); if (source != null) resolver.release(source); } return EVAL_PAGE; } /* * @see Recyclable#recycle() */ public void recycle() { this.src = null; super.recycle(); } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/core/LoopTag.java Index: LoopTag.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib.core; import org.apache.cocoon.taglib.Tag; /** *

Allows developers to write custom iteration tags by implementing * the LoopTag interface. (This is not to be confused with * org.apache.cocoon.taglib.IterationTag) * LoopTag establishes a mechanism for iteration tags to be recognized * and for type-safe communication with custom subtags. * *

In most cases, it will not be necessary to implement this interface * manually, for a base support class (LoopTagSupport) is provided * to facilitate implementation.

* * Migration from JSTL1.0 * @see javax.servlet.jsp.jstl.core.LoopTag * * @author: Volker Schmitt */ public interface LoopTag extends Tag { /** * Retrieves the current item in the iteration. Behaves * idempotently; calling getCurrent() repeatedly should return the same * Object until the iteration is advanced. (Specifically, calling * getCurrent() does not advance the iteration.) * * @return the current item as an object */ public Object getCurrent(); /** * Retrieves a 'status' object to provide information about the * current round of the iteration. * * @return the LoopTagStatus for the current LoopTag */ public LoopTagStatus getIteratorStatus(); } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/core/ForEachSupport.java Index: ForEachSupport.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib.core; import java.sql.ResultSet; import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; import java.util.Iterator; import java.util.Map; import java.util.StringTokenizer; import org.xml.sax.SAXException; /** *

Support for tag handlers for <forEach>, the core iteration * tag in JSTL 1.0. This class extends LoopTagSupport and provides * ForEach-specific functionality. The rtexprvalue library and the * expression-evaluating library each have handlers that extend this * class.

* *

Localized here is the logic for handling the veritable smorgasbord * of types supported by <forEach>, including arrays, * Collections, and others. To see how the actual iteration is controlled, * review the org.apache.cocoon.taglib.core.LoopTagSupport class instead. *

* * @see org.apache.cocoon.taglib.core.LoopTagSupport * * Migration from JSTL1.0 * @see org.apache.taglibs.standard.tag.common.core * * @author: Volker Schmitt */ public abstract class ForEachSupport extends LoopTagSupport { //********************************************************************* // Implementation overview /* * This particular handler is essentially a large switching mechanism * to support the various types that the tag handles. The * class is organized around the private ForEachIterator interface, * which serves as the basis for relaying information to the iteration * implementation we inherit from LoopTagSupport. * * We expect to receive our 'items' from one of our subclasses * (presumably from the rtexprvalue or expression-evaluating libraries). * If 'items' is missing, we construct an Integer[] array representing * iteration indices, in line with the spec draft. From doStartTag(), * we analyze and 'digest' the data we're passed. Then, we simply * relay items as necessary to the iteration implementation that * we inherit from LoopTagSupport. */ //********************************************************************* // Internal, supporting classes and interfaces /* * Acts as a focal point for converting the various types we support. * It would have been ideal to use Iterator here except for one problem: * Iterator.hasNext() and Iterator.next() can't throw the JspTagException * we want to throw. So instead, we'll encapsulate the hasNext() and * next() methods we want to provide inside this local class. * (Other implementations are more than welcome to implement hasNext() * and next() explicitly, not in terms of a back-end supporting class. * For the forEach tag handler, however, this class acts as a convenient * organizational mechanism, for we support so many different classes. * This encapsulation makes it easier to localize implementations * in support of particular types -- e.g., changing the implementation * of primitive-array iteration to wrap primitives only on request, * instead of in advance, would involve changing only those methods that * handle primitive arrays. */ protected static interface ForEachIterator { public boolean hasNext() throws SAXException; public Object next() throws SAXException; } /* * Simple implementation of ForEachIterator that adapts from * an Iterator. This is appropriate for cases where hasNext() and * next() don't need to throw SAXException. Such cases are common.core. */ protected class SimpleForEachIterator implements ForEachIterator { private Iterator i; public SimpleForEachIterator(Iterator i) { this.i = i; } public boolean hasNext() { return i.hasNext(); } public Object next() { return i.next(); } } //********************************************************************* // ForEach-specifc state (protected) protected ForEachIterator items; // our 'digested' items protected Object rawItems; // our 'raw' items //********************************************************************* // Iteration control methods (based on processed 'items' object) // (We inherit semantics and Javadoc from LoopTagSupport.) protected boolean hasNext() throws SAXException { return items.hasNext(); } protected Object next() throws SAXException { return items.next(); } protected void prepare() throws SAXException { // produce the right sort of ForEachIterator if (rawItems != null) { // extract an iterator over the 'items' we've got items = supportedTypeForEachIterator(rawItems); } else { // no 'items', so use 'begin' and 'end' items = beginEndForEachIterator(); } // step must be 1 when ResultSet is passed in if (rawItems instanceof ResultSet && step != 1) throw new SAXException("FOREACH_STEP_NO_RESULTSET"); } //********************************************************************* // Tag logic and lifecycle management // Releases any resources we may have (or inherit) public void recycle() { super.recycle(); items = null; rawItems = null; } //********************************************************************* // Private generation methods for the ForEachIterators we produce /* Extracts a ForEachIterator given an object of a supported type. */ protected ForEachIterator supportedTypeForEachIterator(Object o) throws SAXException { /* * This is, of necessity, just a big, simple chain, matching in * order. Since we are passed on Object because of all the * various types we support, we cannot rely on the language's * mechanism for resolving overloaded methods. (Method overloading * resolves via early binding, so the type of the 'o' reference, * not the type of the eventual value that 'o' references, is * all that's available.) * * Currently, we 'match' on the object we have through an * if/else chain that picks the first interface (or class match) * found for an Object. */ ForEachIterator items; if (o instanceof Object[]) items = toForEachIterator((Object[]) o); else if (o instanceof boolean[]) items = toForEachIterator((boolean[]) o); else if (o instanceof byte[]) items = toForEachIterator((byte[]) o); else if (o instanceof char[]) items = toForEachIterator((char[]) o); else if (o instanceof short[]) items = toForEachIterator((short[]) o); else if (o instanceof int[]) items = toForEachIterator((int[]) o); else if (o instanceof long[]) items = toForEachIterator((long[]) o); else if (o instanceof float[]) items = toForEachIterator((float[]) o); else if (o instanceof double[]) items = toForEachIterator((double[]) o); else if (o instanceof Collection) items = toForEachIterator((Collection) o); else if (o instanceof Iterator) items = toForEachIterator((Iterator) o); else if (o instanceof Enumeration) items = toForEachIterator((Enumeration) o); else if (o instanceof Map) items = toForEachIterator((Map) o); else if (o instanceof ResultSet) items = toForEachIterator((ResultSet) o); else if (o instanceof String) items = toForEachIterator((String) o); else items = toForEachIterator(o); return (items); } /* * Creates a ForEachIterator of Integers from 'begin' to 'end' * in support of cases where our tag handler isn't passed an * explicit collection over which to iterate. */ private ForEachIterator beginEndForEachIterator() { /* * To plug into existing support, we need to keep 'begin', 'end', * and 'step' as they are. So we'll simply create an Integer[] * from 0 to 'end', inclusive, and let the existing implementation * handle the subsetting and stepping operations. (Other than * localizing the cost of creating this Integer[] to the start * of the operation instead of spreading it out over the lifetime * of the iteration, this implementation isn't worse than one that * created new Integers() as needed from next(). Such an adapter * to ForEachIterator could easily be written but, like I said, * wouldn't provide much benefit.) */ Integer[] ia = new Integer[end + 1]; for (int i = 0; i <= end; i++) ia[i] = new Integer(i); return new SimpleForEachIterator(Arrays.asList(ia).iterator()); } //********************************************************************* // Private conversion methods to handle the various types we support // catch-all method whose invocation currently signals a 'matching error' protected ForEachIterator toForEachIterator(Object o) throws SAXException { throw new SAXException("FOREACH_BAD_ITEMS"); } // returns an iterator over an Object array (via List) protected ForEachIterator toForEachIterator(Object[] a) { return new SimpleForEachIterator(Arrays.asList(a).iterator()); } // returns an iterator over a boolean[] array, wrapping items in Boolean protected ForEachIterator toForEachIterator(boolean[] a) { Boolean[] wrapped = new Boolean[a.length]; for (int i = 0; i < a.length; i++) wrapped[i] = new Boolean(a[i]); return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); } // returns an iterator over a byte[] array, wrapping items in Byte protected ForEachIterator toForEachIterator(byte[] a) { Byte[] wrapped = new Byte[a.length]; for (int i = 0; i < a.length; i++) wrapped[i] = new Byte(a[i]); return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); } // returns an iterator over a char[] array, wrapping items in Character protected ForEachIterator toForEachIterator(char[] a) { Character[] wrapped = new Character[a.length]; for (int i = 0; i < a.length; i++) wrapped[i] = new Character(a[i]); return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); } // returns an iterator over a short[] array, wrapping items in Short protected ForEachIterator toForEachIterator(short[] a) { Short[] wrapped = new Short[a.length]; for (int i = 0; i < a.length; i++) wrapped[i] = new Short(a[i]); return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); } // returns an iterator over an int[] array, wrapping items in Integer protected ForEachIterator toForEachIterator(int[] a) { Integer[] wrapped = new Integer[a.length]; for (int i = 0; i < a.length; i++) wrapped[i] = new Integer(a[i]); return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); } // returns an iterator over a long[] array, wrapping items in Long protected ForEachIterator toForEachIterator(long[] a) { Long[] wrapped = new Long[a.length]; for (int i = 0; i < a.length; i++) wrapped[i] = new Long(a[i]); return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); } // returns an iterator over a float[] array, wrapping items in Float protected ForEachIterator toForEachIterator(float[] a) { Float[] wrapped = new Float[a.length]; for (int i = 0; i < a.length; i++) wrapped[i] = new Float(a[i]); return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); } // returns an iterator over a double[] array, wrapping items in Double protected ForEachIterator toForEachIterator(double[] a) { Double[] wrapped = new Double[a.length]; for (int i = 0; i < a.length; i++) wrapped[i] = new Double(a[i]); return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); } // retrieves an iterator from a Collection protected ForEachIterator toForEachIterator(Collection c) { return new SimpleForEachIterator(c.iterator()); } // simply passes an Iterator through... protected ForEachIterator toForEachIterator(Iterator i) { return new SimpleForEachIterator(i); } // converts an Enumeration to an Iterator via a local adapter protected ForEachIterator toForEachIterator(Enumeration e) { // local adapter class EnumerationAdapter implements ForEachIterator { private Enumeration e; public EnumerationAdapter(Enumeration e) { this.e = e; } public boolean hasNext() { return e.hasMoreElements(); } public Object next() { return e.nextElement(); } } return new EnumerationAdapter(e); } // retrieves an iterator over the Map.Entry items in a Map protected ForEachIterator toForEachIterator(Map m) { return new SimpleForEachIterator(m.entrySet().iterator()); } // thinly wraps a ResultSet in an appropriate Iterator protected ForEachIterator toForEachIterator(ResultSet rs) throws SAXException { // local adapter class ResultSetAdapter implements ForEachIterator { private ResultSet rs; public ResultSetAdapter(ResultSet rs) { this.rs = rs; } public boolean hasNext() throws SAXException { try { return !(rs.isLast()); // dependent on JDBC 2.0 } catch (java.sql.SQLException ex) { throw new SAXException(ex.getMessage()); } } public Object next() throws SAXException { try { rs.next(); return rs; } catch (java.sql.SQLException ex) { throw new SAXException(ex.getMessage()); } } } return new ResultSetAdapter(rs); } // tokenizes a String as a CSV and returns an iterator over it protected ForEachIterator toForEachIterator(String s) { StringTokenizer st = new StringTokenizer(s, ","); return toForEachIterator(st); // convert from Enumeration } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/core/LoopTagSupport.java Index: LoopTagSupport.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib.core; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Request; import org.apache.cocoon.taglib.IterationTag; import org.apache.cocoon.taglib.VarTagSupport; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** *

Cocoon taglib allows developers to write custom iteration tags by * implementing the LoopTag interface. (This is not to be confused with * org.apache.cocoon.taglib.IterationTag) * LoopTag establishes a mechanism for iteration tags to be recognized * and for type-safe communication with custom subtags. *

* *

Since most iteration tags will behave identically with respect to * actual iterative behavior, however, Cocoon taglib provides this * base support class to facilitate implementation. Many iteration tags * will extend this and merely implement the hasNext() and next() methods * to provide contents for the handler to iterate over.

* *

In particular, this base class provides support for:

* *
    *
  • iteration control, based on protected next() and hasNext() methods *
  • subsetting (begin, end, step functionality, including validation * of subset parameters for sensibility) *
  • item retrieval (getCurrent()) *
  • status retrieval (LoopTagStatus) *
  • exposing attributes (set by 'var' and 'varStatus' attributes) *
* *

In providing support for these tasks, LoopTagSupport contains * certain control variables that act to modify the iteration. Accessors * are provided for these control variables when the variables represent * information needed or wanted at translation time (e.g., var, status). For * other variables, accessors cannot be provided here since subclasses * may differ on their implementations of how those accessors are received. * For instance, one subclass might accept a String and convert it into * an object of a specific type by using an expression evaluator; others * might accept objects directly. Still others might not want to expose * such information to outside control.

* * Migration from JSTL1.0 * @see javax.servlet.jsp.jstl.core.LoopTagSupport * * @author: Volker Schmitt */ public abstract class LoopTagSupport extends VarTagSupport implements LoopTag, IterationTag //, TryCatchFinally { //********************************************************************* // 'Protected' state /* * JavaBean-style properties and other state slaved to them. These * properties can be set directly by accessors; they will not be * modified by the LoopTagSupport implementation -- and should * not be modified by subclasses outside accessors unless those * subclasses are perfectly aware of what they're doing. * (An example where such non-accessor modification might be sensible * is in the doStartTag() method of an EL-aware subclass.) */ /** Starting index ('begin' attribute) */ protected int begin; /** * Ending index ('end' attribute). -1 internally indicates 'no end * specified', although accessors for the core JSTL tags do not * allow this value to be supplied directly by the user. */ protected int end; /** Iteration step ('step' attribute) */ protected int step; /** Boolean flag indicating whether 'begin' was specified. */ protected boolean beginSpecified; /** Boolean flag indicating whether 'end' was specified. */ protected boolean endSpecified; /** Boolean flag indicating whether 'step' was specified. */ protected boolean stepSpecified; /** Attribute-exposing control */ protected String statusId; //********************************************************************* // 'Private' state (implementation details) /* * State exclusively internal to the default, reference implementation. * (While this state is kept private to ensure consistency, 'status' * and 'item' happen to have one-for-one, read-only, accesor methods * as part of the LoopTag interface.) * * 'last' is kept separately for two reasons: (a) to avoid * running a computation every time it's requested, and (b) to * let LoopTagStatus.isLast() avoid throwing any exceptions, * which would complicate subtag and scripting-variable use. * * Our 'internal index' begins at 0 and increases by 'step' each * round; this is arbitrary, but it seemed a simple way of keeping * track of the information we need. To avoid computing * getIteratorStatus().getCount() by dividing index / step, we keep * a separate 'count' and increment it by 1 each round (as a minor * performance improvement). */ private LoopTagStatus status; // our LoopTagStatus private Object item; // the current item private int index; // the current internal index private int count; // the iteration count private boolean last; // current round == last one? //********************************************************************* // Constructor /** * Constructs a new LoopTagSupport. As with TagSupport, subclasses * should not provide other constructors and are expected to call * the superclass constructor */ public LoopTagSupport() { super(); init(); } //********************************************************************* // Abstract methods /** *

Returns the next object over which the tag should iterate. This * method must be provided by concrete subclasses of LoopTagSupport * to inform the base logic about what objects it should iterate over.

* *

It is expected that this method will generally be backed by an * Iterator, but this will not always be the case. In particular, if * retrieving the next object raises the possibility of an exception * being thrown, this method allows that exception to propagate back * to the container as a SAXException; a standalone Iterator * would not be able to do this. (This explains why LoopTagSupport * does not simply call for an Iterator from its subtags.)

* * @return the java.lang.Object to use in the next round of iteration * @exception NoSuchElementException * if next() is called but no new elements are available * @exception org.xml.sax.SAXException * for other, unexpected exceptions */ protected abstract Object next() throws SAXException; /** *

Returns information concerning the availability of more items * over which to iterate. This method must be provided by concrete * subclasses of LoopTagSupport to assist the iterative logic * provided by the supporting base class.

* *

See next for more information about the * purpose and expectations behind this tag.

* * @return true if there is at least one more item to iterate * over, false otherwise * @exception org.xml.sax.SAXException * @see #next */ protected abstract boolean hasNext() throws SAXException; /** *

Prepares for a single tag invocation. Specifically, allows * subclasses to prepare for calls to hasNext() and next(). * Subclasses can assume that prepare() will be called once for * each invocation of doStartTag() in the superclass.

* * @exception org.xml.sax.SAXException */ protected abstract void prepare() throws SAXException; //********************************************************************* // Lifecycle management and implementation of iterative behavior // Releases any resources we may have (or inherit) public void recycle() { unExposeVariables(); // XXX if doFinally is supported this can removed init(); super.recycle(); } // Begins iterating by processing the first item. public int doStartTag(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { // make sure 'begin' isn't greater than 'end' if (end != -1 && begin > end) throw new SAXException("begin (" + begin + ") > end (" + end + ")"); // we're beginning a new iteration, so reset our counts (etc.) index = 0; count = 1; last = false; // let the subclass conduct any necessary preparation prepare(); // throw away the first 'begin' items (if they exist) discardIgnoreSubset(begin); // get the item we're interested in if (hasNext()) // index is 0-based, so we don't update it for the first item item = next(); else return SKIP_BODY; /* * now discard anything we have to "step" over. * (we do this in advance to support LoopTagStatus.isLast()) */ discard(step - 1); // prepare to include our body... exposeVariables(); calibrateLast(); return EVAL_BODY; } /* * Continues the iteration when appropriate -- that is, if we (a) have * more items and (b) don't run over our 'end' (given our 'step'). */ public int doAfterBody() throws SAXException { // re-sync the index, given our prior behind-the-scenes 'step' index += step - 1; // increment the count by 1 for each round count++; // everything's been prepared for us, so just get the next item if (hasNext() && !atEnd()) { index++; item = next(); } else return SKIP_BODY; /* * now discard anything we have to "step" over. * (we do this in advance to support LoopTagStatus.isLast()) */ discard(step - 1); // prepare to re-iterate... exposeVariables(); calibrateLast(); return EVAL_BODY_AGAIN; } /* * Removes attributes that our tag set; these attributes are intended * to support scripting variables with NESTED scope, so we don't want * to pollute attribute space by leaving them lying around. */ public void doFinally() { /* * Make sure to un-expose variables, restoring them to their * prior values, if applicable. */ unExposeVariables(); } /* * Be transparent with respect to exceptions: rethrow anything we get. */ public void doCatch(Throwable t) throws Throwable { throw t; } //********************************************************************* // Accessor methods /* * Overview: The getXXX() methods we provide implement the Tag * contract. setXXX() accessors are provided only for those * properties (attributes) that must be known at translation time, * on the premise that these accessors will vary less than the * others in terms of their interface with the page author. */ /* * (Purposely inherit JavaDoc and semantics from LoopTag. * Subclasses can override this if necessary, but such a need is * expected to be rare.) */ public Object getCurrent() { return item; } /* * (Purposely inherit JavaDoc and semantics from LoopTag. * Subclasses can override this method for more fine-grained control * over LoopTagStatus, but an effort has been made to simplify * implementation of subclasses that are happy with reasonable default * behavior.) */ public LoopTagStatus getIteratorStatus() { // local implementation with reasonable default behavior class Status implements LoopTagStatus { /* * All our methods are straightforward. We inherit * our JavaDoc from LoopTagSupport; see that class * for more information. */ public Object getCurrent() { /* * Access the item through getCurrent() instead of just * returning the item our containing class stores. This * should allow a subclass of LoopTagSupport to override * getCurrent() without having to rewrite getIteratorStatus() too. */ return (LoopTagSupport.this.getCurrent()); } public int getIndex() { return (index + begin); // our 'index' isn't getIndex() } public int getCount() { return (count); } public boolean isFirst() { return (index == 0); // our 'index' isn't getIndex() } public boolean isLast() { return (last); // use cached value } public Integer getBegin() { if (beginSpecified) return (new Integer(begin)); else return null; } public Integer getEnd() { if (endSpecified) return (new Integer(end)); else return null; } public Integer getStep() { if (stepSpecified) return (new Integer(step)); else return null; } } /* * We just need one per invocation... Actually, for the current * implementation, we just need one per instance, but I'd rather * not keep the reference around once release() has been called. */ if (status == null) status = new Status(); return status; } /* * We only support setter methods for attributes that need to be * offered as Strings or other literals; other attributes will be * handled directly by implementing classes, since there might be * both rtexprvalue- and EL-based varieties, which will have * different signatures. (We can't pollute child classes by having * base implementations of those setters here; child classes that * have attributes with different signatures would end up having * two incompatible setters, which is illegal for a JavaBean. */ // for tag attribute public void setVarStatus(String statusId) { this.statusId = statusId; } //********************************************************************* // Protected utility methods /* * These methods validate attributes common to iteration tags. * Call them if your own subclassing implementation modifies them * -- e.g., if you set them through an expression language. */ /** * Ensures the "begin" property is sensible, throwing an exception * expected to propagate up if it isn't */ protected void validateBegin() throws SAXException { if (begin < 0) throw new SAXException("'begin' < 0"); } /** * Ensures the "end" property is sensible, throwing an exception * expected to propagate up if it isn't */ protected void validateEnd() throws SAXException { if (end < 0) throw new SAXException("'end' < 0"); } /** * Ensures the "step" property is sensible, throwing an exception * expected to propagate up if it isn't */ protected void validateStep() throws SAXException { if (step < 1) throw new SAXException("'step' <= 0"); } //********************************************************************* // Private utility methods /** (Re)initializes state (during release() or construction) */ private void init() { // defaults for internal bookkeeping index = 0; // internal index always starts at 0 count = 1; // internal count always starts at 1 status = null; // we clear status on release() item = null; // item will be retrieved for each round last = false; // last must be set explicitly beginSpecified = false; // not specified until it's specified :-) endSpecified = false; // (as above) stepSpecified = false; // (as above) // defaults for interface with page author begin = 0; // when not specified, 'begin' is 0 by spec. end = -1; // when not specified, 'end' is not used step = 1; // when not specified, 'step' is 1 statusId = null; // when not specified, no variable exported } /** Sets 'last' appropriately. */ private void calibrateLast() throws SAXException { /* * the current round is the last one if (a) there are no remaining * elements, or (b) the next one is beyond the 'end'. */ last = !hasNext() || atEnd() || (end != -1 && (begin + index + step > end)); } /** * Exposes attributes (formerly scripting variables, but no longer!) * if appropriate. Note that we don't really care, here, whether they're * scripting variables or not. */ private void exposeVariables() throws SAXException { /* * We need to support null items returned from next(); we * do this simply by passing such non-items through to the * scoped variable as effectively 'null' (that is, by calling * removeAttribute()). * * Also, just to be defensive, we handle the case of a null * 'status' object as well. * * We call getCurrent() and getIteratorStatus() (instead of just using * 'item' and 'status') to bridge to subclasses correctly. * A subclass can override getCurrent() or getIteratorStatus() but still * depend on our doStartTag() and doAfterBody(), which call this * method (exposeVariables()), to expose 'item' and 'status' * correctly. */ if (var != null) { if (getCurrent() == null) removeVariable(var); else setVariable(var, getCurrent()); } if (statusId != null) { if (getIteratorStatus() == null) removeVariable(statusId); else setVariable(statusId, getIteratorStatus()); } } /** * Removes page attributes that we have exposed and, if applicable, * restores them to their prior values (and scopes). */ private void unExposeVariables() { // "nested" variables are now simply removed Request request = ObjectModelHelper.getRequest(objectModel); if (var != null) request.removeAttribute(var); if (statusId != null) request.removeAttribute(statusId); } /** * Cycles through and discards up to 'n' items from the iteration. * We only know "up to 'n'", not "exactly n," since we stop cycling * if hasNext() returns false or if we hit the 'end' of the iteration. * Note: this does not update the iteration index, since this method * is intended as a behind-the-scenes operation. The index must be * updated separately. (I don't really like this, but it's the simplest * way to support isLast() without storing two separate inconsistent * indices. We need to (a) make sure hasNext() refers to the next * item we actually *want* and (b) make sure the index refers to the * item associated with the *current* round, not the next one. * C'est la vie.) */ private void discard(int n) throws SAXException { /* * copy index so we can restore it, but we need to update it * as we work so that atEnd() works */ int oldIndex = index; while (n-- > 0 && !atEnd() && hasNext()) { index++; next(); } index = oldIndex; } /** * Discards items ignoring subsetting rules. Useful for discarding * items from the beginning (i.e., to implement 'begin') where we * don't want factor in the 'begin' value already. */ private void discardIgnoreSubset(int n) throws SAXException { while (n-- > 0 && hasNext()) next(); } /** * Returns true if the iteration has past the 'end' index (with * respect to subsetting), false otherwise. ('end' must be set * for atEnd() to return true; if 'end' is not set, atEnd() * always returns false.) */ private boolean atEnd() { return ((end != -1) && (begin + index >= end)); } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/core/LoopTagStatus.java Index: LoopTagStatus.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib.core; /** *

Provides an interface for objects representing the current status of * an iteration. Cocoon taglibrary provides a mechanism for LoopTags to * return information about the current index of the iteration and * convenience methods to determine whether or not the current round is * either the first or last in the iteration. It also lets authors * use the status object to obtain information about the iteration range, * step, and current object.

* *

Environments that require more status can extend this interface.

* * This Interface is a copy from JSTL1.0 * @see javax.servlet.jsp.jstl.core.LoopTagStatus * * @author: Volker Schmitt */ public interface LoopTagStatus { /** * Retrieves the current item in the iteration. Behaves * idempotently; calling getCurrent() repeatedly should return the same * Object until the iteration is advanced. (Specifically, calling * getCurrent() does not advance the iteration.) * * @return the current item as an object */ public Object getCurrent(); /** * Retrieves the index of the current round of the iteration. If * iteration is being performed over a subset of an underlying * array, java.lang.Collection, or other type, the index returned * is absolute with respect to the underlying collection. Indices * are 0-based. * * @return the 0-based index of the current round of the iteration */ public int getIndex(); /** *

Retrieves the "count" of the current round of the iteration. The * count is a relative, 1-based sequence number identifying the * current "round" of iteration (in context with all rounds the * current iteration will perform).

* *

As an example, an iteration with begin = 5, end = 15, and step = * 5 produces the counts 1, 2, and 3 in that order.

* * @return the 1-based count of the current round of the iteration */ public int getCount(); /** * Returns information about whether the current round of the * iteration is the first one. This current round may be the 'first' * even when getIndex() != 0, for 'index' refers to the absolute * index of the current 'item' in the context of its underlying * collection. It is always that case that a true result from * isFirst() implies getCount() == 1. * * @return true if the current round is the first in the * iteration, false otherwise. */ public boolean isFirst(); /** * Returns information about whether the current round of the * iteration is the last one. As with isFirst(), subsetting is * taken into account. isLast() doesn't necessarily refer to the * status of the underlying Iterator; it refers to whether or not * the current round will be the final round of iteration for the * tag associated with this LoopTagStatus. * * @return true if the current round is the last in the * iteration, false otherwise. */ public boolean isLast(); /** * Returns the value of the 'begin' attribute for the associated tag, * or null if no 'begin' attribute was specified. * * @return the 'begin' value for the associated tag, or null * if no 'begin' attribute was specified */ public Integer getBegin(); /** * Returns the value of the 'end' attribute for the associated tag, * or null if no 'end' attribute was specified. * * @return the 'end' value for the associated tag, or null * if no 'end' attribute was specified */ public Integer getEnd(); /** * Returns the value of the 'step' attribute for the associated tag, * or null if no 'step' attribute was specified. * * @return the 'step' value for the associated tag, or null * if no 'step' attribute was specified */ public Integer getStep(); } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/TagSupport.java Index: TagSupport.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib; import java.util.Map; import org.apache.avalon.excalibur.pool.Recyclable; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.parameters.Parameters; import org.apache.cocoon.environment.Context; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.Session; import org.apache.cocoon.environment.SourceResolver; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** * Abstract implementation for all Tags * * @author: Volker Schmitt */ public abstract class TagSupport extends AbstractLogEnabled implements Tag, Recyclable { protected String var; protected Tag parent; protected SourceResolver resolver; protected Map objectModel; protected Parameters parameters; private Request request; /** * Find the instance of a given class type that is closest to a given * instance. * This method uses the getParent method from the Tag * interface. * This method is used for coordination among cooperating tags. * * @param from The instance from where to start looking. * @param klass The subclass of Tag or interface to be matched * @returns the nearest ancestor that implements the interface * or is an instance of the class specified */ public static final Tag findAncestorWithClass(Tag from, Class klass) { boolean isInterface = false; if (from == null || klass == null || (!Tag.class.isAssignableFrom(klass) && !(isInterface = klass.isInterface()))) { return null; } for (;;) { Tag tag = from.getParent(); if (tag == null) { return null; } if ((isInterface && klass.isInstance(tag)) || klass.isAssignableFrom(tag.getClass())) return tag; else from = tag; } } /** * Process the end tag for this instance. * * @returns EVAL_PAGE. * @throws SAXException. */ public int doEndTag(String namespaceURI, String localName, String qName) throws SAXException { return EVAL_PAGE; } /** * Process the start tag for this instance. *

* The doStartTag method assumes that pageContext and * parent have been set. It also assumes that any properties exposed as * attributes have been set too. When this method is invoked, the body * has not yet been evaluated. * * @returns EVAL_BODY or SKIP_BODY. */ public int doStartTag(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { return EVAL_BODY; } /** * Searches for the named attribute in request, session (if valid), * and application scope(s) in order and returns the value associated or * null. * * @return the value associated or null */ public final Object findAttribute(String name) { if (request == null) request = ObjectModelHelper.getRequest(objectModel); Object o = request.getAttribute(name); if (o != null) return o; Session session = request.getSession(false); if (session != null) { o = session.getAttribute(name); if (o != null) return o; } Context context = ObjectModelHelper.getContext(objectModel); return context.getAttribute(name); } /** * Get the parent (closest enclosing tag handler) for this tag handler. * * @returns the current parent, or null if none. */ public final Tag getParent() { return parent; } public void recycle() { getLogger().debug("recycle"); this.var = null; this.parent = null; this.resolver = null; this.objectModel = null; this.parameters = null; this.request = null; } /** * Set the parent (closest enclosing tag handler) of this tag handler. * Invoked by the TagTransformer prior to doStartTag(). *

* This value is *not* reset by doEndTag() and must be explicitly reset * by a Tag implementation. * * @param parent, the parent tag, or null. */ public final void setParent(Tag parent) { this.parent = parent; } /** * Set the SourceResolver, objectModel Map * and sitemap Parameters used to process the request. */ public void setup(SourceResolver resolver, Map objectModel, Parameters parameters) { this.resolver = resolver; this.objectModel = objectModel; this.parameters = parameters; } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLProducerTag.java Index: XMLProducerTag.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib; import org.apache.cocoon.xml.XMLProducer; /** * @author: Volker Schmitt */ public interface XMLProducerTag extends Tag, XMLProducer { } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/Tag.java Index: Tag.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib; import java.io.IOException; import java.util.Map; import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.parameters.Parameters; import org.apache.cocoon.environment.SourceResolver; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** * The Tag implementation works like a JSP Tag but generate SAX output * instead of writing to a OutputStream. The equivalent to the JSPEngine * is implemented as a Transformer. * * @see TagTransformer * * @author: Volker Schmitt */ public interface Tag extends Component { String ROLE = Tag.class.getName(); /** * Evaluate body content * Valid return value for doStartTag. */ int EVAL_BODY = 0; /** * Skip body evaluation. * Valid return value for doStartTag. */ int SKIP_BODY = 1; /** * Continue evaluating the page. * Valid return value for doEndTag(). */ int EVAL_PAGE = 2; /** * Process the end tag for this instance. * * @returns EVAL_PAGE. * @throws SAXException. */ int doEndTag(String namespaceURI, String localName, String qName) throws SAXException; /** * Process the start tag for this instance. *

* The doStartTag method assumes that parent have been set. * It also assumes that any properties exposed as * attributes have been set too. When this method is invoked, the body * has not yet been evaluated. * * @returns EVAL_BODY or SKIP_BODY. */ int doStartTag(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException; /** * Get the parent (closest enclosing tag handler) for this tag handler. * * @returns the current parent or null if none. */ Tag getParent(); /** * Set the SourceResolver, objectModel Map * and sitemap Parameters used to process the request. */ void setup(SourceResolver resolver, Map objectModel, Parameters parameters) throws SAXException, IOException; /** * Set the parent (closest enclosing tag handler) of this tag handler. * Invoked by the implementation object prior to doStartTag(). * * @param parent The parent tag or null. */ void setParent(Tag parent); } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLConsumerTagSupport.java Index: XMLConsumerTagSupport.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib; import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXException; /** * @author: Volker Schmitt */ public abstract class XMLConsumerTagSupport extends VarTagSupport implements XMLConsumerTag { /* * @see ContentHandler#characters(char[], int, int) */ public void characters(char[] ch, int start, int length) throws SAXException { } /* * @see ContentHandler#endDocument() */ public void endDocument() throws SAXException { } /* * @see ContentHandler#endElement(String, String, String) */ public void endElement(String namespaceURI, String localName, String qName) throws SAXException { } /* * @see ContentHandler#endPrefixMapping(String) */ public void endPrefixMapping(String prefix) throws SAXException { } /* * @see ContentHandler#ignorableWhitespace(char[], int, int) */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { } /* * @see ContentHandler#processingInstruction(String, String) */ public void processingInstruction(String target, String data) throws SAXException { } /* * @see ContentHandler#setDocumentLocator(Locator) */ public void setDocumentLocator(Locator locator) { } /* * @see ContentHandler#skippedEntity(String) */ public void skippedEntity(String name) throws SAXException { } /* * @see ContentHandler#startDocument() */ public void startDocument() throws SAXException { } /* * @see ContentHandler#startElement(String, String, String, Attributes) */ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { } /* * @see ContentHandler#startPrefixMapping(String, String) */ public void startPrefixMapping(String prefix, String uri) throws SAXException { } /* * @see LexicalHandler#comment(char[], int, int) */ public void comment(char[] ch, int start, int length) throws SAXException { } /* * @see LexicalHandler#endCDATA() */ public void endCDATA() throws SAXException { } /* * @see LexicalHandler#endDTD() */ public void endDTD() throws SAXException { } /* * @see LexicalHandler#endEntity(String) */ public void endEntity(String name) throws SAXException { } /* * @see LexicalHandler#startCDATA() */ public void startCDATA() throws SAXException { } /* * @see LexicalHandler#startDTD(String, String, String) */ public void startDTD(String name, String publicId, String systemId) throws SAXException { } /* * @see LexicalHandler#startEntity(String) */ public void startEntity(String name) throws SAXException { } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/VarTagSupport.java Index: VarTagSupport.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.Composable; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Request; import org.apache.cocoon.jxpath.JXPathCocoonContexts; import org.apache.commons.jxpath.JXPathContext; /** * Add support for setting and getting variables * * @author: Volker Schmitt */ public abstract class VarTagSupport extends TagSupport implements Composable { protected String var; protected ComponentManager componentManager; private JXPathCocoonContexts jxpathContexts; private Request request; /** * Get the attribute to store the result in. */ public final String getVar() { return this.var; } /** * Set the attribute to store the result in. */ public final void setVar(String var) { this.var = var; } protected final Request getRequest() { if (request == null) request = ObjectModelHelper.getRequest(objectModel); return request; } protected final Object getVariable(String name) { JXPathContext context = getVariableContext(); if (name.charAt(0) == '$') return context.getValue(name); else return context.getVariables().getVariable(name); //getRequest().getAttribute(name); } /** * Register the name and object specified. * * @param name the name of the attribute to set * @param attribute the object to associate with the name */ protected final void setVariable(String name, Object value) { JXPathContext context = getVariableContext(); if (name.charAt(0) == '$') context.setValue(name, value); else context.getVariables().declareVariable(name, value); //getRequest().setAttribute(name, value); } protected final void removeVariable(String name) { JXPathContext context = getVariableContext(); if (name.charAt(0) == '$') context.setValue(name, null); else context.getVariables().declareVariable(name, null); //getRequest().removeAttribute(name); } private final JXPathContext getVariableContext() { if (jxpathContexts == null) { try { jxpathContexts = (JXPathCocoonContexts) componentManager.lookup(JXPathCocoonContexts.ROLE); } catch (ComponentException e) { //XXX } } return jxpathContexts.getVariableContext(); //return JXPathCocoonContexts.getVariableContext(objectModel); } /* * @see Composable#compose(ComponentManager) */ public void compose(ComponentManager componentManager) throws ComponentException { this.componentManager = componentManager; } public void recycle() { this.var = null; this.jxpathContexts = null; this.request = null; super.recycle(); } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/VarTransformerTagSupport.java Index: VarTransformerTagSupport.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib; import org.apache.cocoon.xml.XMLConsumer; import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXException; /** * @author: Volker Schmitt */ public class VarTransformerTagSupport extends VarTagSupport implements TransformerTag { protected XMLConsumer xmlConsumer; /* * @see ContentHandler#setDocumentLocator(Locator) */ public void setDocumentLocator(Locator locator) { xmlConsumer.setDocumentLocator(locator); } /* * @see ContentHandler#startDocument() */ public void startDocument() throws SAXException { } /* * @see ContentHandler#endDocument() */ public void endDocument() throws SAXException { } /* * @see ContentHandler#startPrefixMapping(String, String) */ public void startPrefixMapping(String prefix, String uri) throws SAXException { xmlConsumer.startPrefixMapping(prefix, uri); } /* * @see ContentHandler#endPrefixMapping(String) */ public void endPrefixMapping(String prefix) throws SAXException { xmlConsumer.endPrefixMapping(prefix); } /* * @see ContentHandler#startElement(String, String, String, Attributes) */ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { xmlConsumer.startElement(namespaceURI, localName, qName, atts); } /* * @see ContentHandler#endElement(String, String, String) */ public void endElement(String namespaceURI, String localName, String qName) throws SAXException { xmlConsumer.endElement(namespaceURI, localName, qName); } /* * @see ContentHandler#characters(char[], int, int) */ public void characters(char[] ch, int start, int length) throws SAXException { xmlConsumer.characters(ch, start, length); } /* * @see ContentHandler#ignorableWhitespace(char[], int, int) */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { xmlConsumer.ignorableWhitespace(ch, start, length); } /* * @see ContentHandler#processingInstruction(String, String) */ public void processingInstruction(String target, String data) throws SAXException { xmlConsumer.processingInstruction(target, data); } /* * @see ContentHandler#skippedEntity(String) */ public void skippedEntity(String name) throws SAXException { xmlConsumer.skippedEntity(name); } /* * @see LexicalHandler#startDTD(String, String, String) */ public void startDTD(String name, String publicId, String systemId) throws SAXException { xmlConsumer.startDTD(name, publicId, systemId); } /* * @see LexicalHandler#endDTD() */ public void endDTD() throws SAXException { xmlConsumer.endDTD(); } /* * @see LexicalHandler#startEntity(String) */ public void startEntity(String name) throws SAXException { xmlConsumer.startEntity(name); } /* * @see LexicalHandler#endEntity(String) */ public void endEntity(String name) throws SAXException { xmlConsumer.endEntity(name); } /* * @see LexicalHandler#startCDATA() */ public void startCDATA() throws SAXException { xmlConsumer.startCDATA(); } /* * @see LexicalHandler#endCDATA() */ public void endCDATA() throws SAXException { xmlConsumer.endCDATA(); } /* * @see LexicalHandler#comment(char[], int, int) */ public void comment(char[] ch, int start, int length) throws SAXException { xmlConsumer.comment(ch, start, length); } /* * @see XMLProducer#setConsumer(XMLConsumer) */ public void setConsumer(XMLConsumer consumer) { this.xmlConsumer = consumer; } /* * @see Recyclable#recycle() */ public void recycle() { this.xmlConsumer = null; super.recycle(); } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/IterationTag.java Index: IterationTag.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib; import org.xml.sax.SAXException; /** * The IterationTag interface extends Tag by defining one additional * method that controls the reevaluation of its body. * *

A tag handler that implements IterationTag is treated as one that * implements Tag regarding the doStartTag() and doEndTag() methods. * IterationTag provides a new method: doAfterBody(). * *

The doAfterBody() method is invoked after every body evaluation * to control whether the body will be reevaluated or not. If doAfterBody() * returns IterationTag.EVAL_BODY_AGAIN, then the body will be reevaluated. * If doAfterBody() returns Tag.SKIP_BODY, then the body will be skipped * and doEndTag() will be evaluated instead. * * @author: Volker Schmitt */ public interface IterationTag extends Tag { /** * Request the reevaluation of some body. * Returned from doAfterBody. */ public final static int EVAL_BODY_AGAIN = 2; /** * Process body (re)evaluation. This method is invoked by the * Taglib implementation object after every evaluation of * the body into the BodyEvaluation object. The method is * not invoked if there is no body evaluation. * *

* If doAfterBody returns EVAL_BODY_AGAIN, a new evaluation of the * body will happen (followed by another invocation of doAfterBody). * If doAfterBody returns SKIP_BODY no more body evaluations will * occur and then doEndTag will be invoked. * *

* The method re-invocations may be lead to different actions because * there might have been some changes to shared state, or because * of external computation. * * @return whether additional evaluations of the body are desired * @throws SAXException */ int doAfterBody() throws SAXException; } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/VarXMLProducerTagSupport.java Index: VarXMLProducerTagSupport.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib; import org.apache.cocoon.xml.XMLConsumer; /** * @author: Volker Schmitt */ public abstract class VarXMLProducerTagSupport extends VarTagSupport implements XMLProducerTag { protected XMLConsumer xmlConsumer; /* * @see XMLProducer#setConsumer(XMLConsumer) */ public void setConsumer(XMLConsumer xmlConsumer) { this.xmlConsumer = xmlConsumer; } /* * @see Recyclable#recycle() */ public void recycle() { xmlConsumer = null; super.recycle(); } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/TransformerTagSupport.java Index: TransformerTagSupport.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib; import org.apache.cocoon.xml.XMLConsumer; import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXException; /** * @author: Volker Schmitt */ public class TransformerTagSupport extends TagSupport implements TransformerTag { protected XMLConsumer xmlConsumer; /* * @see ContentHandler#setDocumentLocator(Locator) */ public void setDocumentLocator(Locator locator) { xmlConsumer.setDocumentLocator(locator); } /* * @see ContentHandler#startDocument() */ public void startDocument() throws SAXException { } /* * @see ContentHandler#endDocument() */ public void endDocument() throws SAXException { } /* * @see ContentHandler#startPrefixMapping(String, String) */ public void startPrefixMapping(String prefix, String uri) throws SAXException { xmlConsumer.startPrefixMapping(prefix, uri); } /* * @see ContentHandler#endPrefixMapping(String) */ public void endPrefixMapping(String prefix) throws SAXException { xmlConsumer.endPrefixMapping(prefix); } /* * @see ContentHandler#startElement(String, String, String, Attributes) */ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { xmlConsumer.startElement(namespaceURI, localName, qName, atts); } /* * @see ContentHandler#endElement(String, String, String) */ public void endElement(String namespaceURI, String localName, String qName) throws SAXException { xmlConsumer.endElement(namespaceURI, localName, qName); } /* * @see ContentHandler#characters(char[], int, int) */ public void characters(char[] ch, int start, int length) throws SAXException { xmlConsumer.characters(ch, start, length); } /* * @see ContentHandler#ignorableWhitespace(char[], int, int) */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { xmlConsumer.ignorableWhitespace(ch, start, length); } /* * @see ContentHandler#processingInstruction(String, String) */ public void processingInstruction(String target, String data) throws SAXException { xmlConsumer.processingInstruction(target, data); } /* * @see ContentHandler#skippedEntity(String) */ public void skippedEntity(String name) throws SAXException { xmlConsumer.skippedEntity(name); } /* * @see LexicalHandler#startDTD(String, String, String) */ public void startDTD(String name, String publicId, String systemId) throws SAXException { xmlConsumer.startDTD(name, publicId, systemId); } /* * @see LexicalHandler#endDTD() */ public void endDTD() throws SAXException { xmlConsumer.endDTD(); } /* * @see LexicalHandler#startEntity(String) */ public void startEntity(String name) throws SAXException { xmlConsumer.startEntity(name); } /* * @see LexicalHandler#endEntity(String) */ public void endEntity(String name) throws SAXException { xmlConsumer.endEntity(name); } /* * @see LexicalHandler#startCDATA() */ public void startCDATA() throws SAXException { xmlConsumer.startCDATA(); } /* * @see LexicalHandler#endCDATA() */ public void endCDATA() throws SAXException { xmlConsumer.endCDATA(); } /* * @see LexicalHandler#comment(char[], int, int) */ public void comment(char[] ch, int start, int length) throws SAXException { xmlConsumer.comment(ch, start, length); } /* * @see XMLProducer#setConsumer(XMLConsumer) */ public void setConsumer(XMLConsumer consumer) { this.xmlConsumer = consumer; } /* * @see Recyclable#recycle() */ public void recycle() { this.xmlConsumer = null; super.recycle(); } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLConsumerTag.java Index: XMLConsumerTag.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib; import org.apache.cocoon.xml.XMLConsumer; /** * @author: Volker Schmitt */ public interface XMLConsumerTag extends Tag, XMLConsumer { } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/TransformerTag.java Index: TransformerTag.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib; import org.apache.cocoon.xml.XMLConsumer; /** * @author: Volker Schmitt */ public interface TransformerTag extends XMLConsumer, XMLProducerTag { } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLProducerTagSupport.java Index: XMLProducerTagSupport.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib; import org.apache.cocoon.xml.XMLConsumer; /** * @author: Volker Schmitt */ public abstract class XMLProducerTagSupport extends TagSupport implements XMLProducerTag { protected XMLConsumer xmlConsumer; /* * @see XMLProducer#setConsumer(XMLConsumer) */ public void setConsumer(XMLConsumer xmlConsumer) { this.xmlConsumer = xmlConsumer; } /* * @see Recyclable#recycle() */ public void recycle() { xmlConsumer = null; super.recycle(); } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/transformation/TagTransformer.java Index: TagTransformer.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.transformation; import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.io.IOException; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; import org.apache.commons.collections.ArrayStack; import org.apache.commons.collections.StaticBucketMap; import org.apache.avalon.excalibur.pool.Recyclable; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.ComponentSelector; import org.apache.avalon.framework.component.Composable; 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.framework.parameters.Parameters; import org.apache.cocoon.components.sax.XMLDeserializer; import org.apache.cocoon.components.sax.XMLSerializer; import org.apache.cocoon.environment.SourceResolver; import org.apache.cocoon.taglib.IterationTag; import org.apache.cocoon.taglib.Tag; import org.apache.cocoon.xml.AbstractXMLProducer; import org.apache.cocoon.xml.XMLConsumer; import org.apache.cocoon.xml.XMLProducer; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** * Transformer which implements the dynamic Tag functionalty. * * @author Volker Schmitt */ public class TagTransformer extends AbstractXMLProducer implements Transformer, Composable, Configurable, Disposable, Recyclable { private int recordingLevel = 0; private int skipLevel = 0; private String transformerHint; private ArrayStack tagStack = new ArrayStack(); private ArrayStack tagSelectorStack = new ArrayStack(); private ArrayStack tagTransformerStack = new ArrayStack(); private ComponentSelector tagNamespaceSelector; private ComponentSelector transformerSelector; private Tag currentTag; /** current SAX Event Consumer */ private XMLConsumer currentConsumer; /** backup of currentConsumer while recording */ private XMLConsumer currentConsumerBackup; private XMLSerializer xmlSerializer; /** The SourceResolver for this request */ private SourceResolver resolver; /** The current objectModel of the environment */ private Map objectModel; /** The source attribute specified in the sitemap */ private String source; /** The parameters specified in the sitemap */ private Parameters parameters; /** The Avalon ComponentManager */ private ComponentManager manager; /** Array for dynamic calling of Tag set property methods */ private String[] paramArray = new String[1]; /** Map for caching Tag Introspection */ private static Map writeMethodMap = new StaticBucketMap(); /** * SAX Event handling */ public void characters(char[] ch, int start, int length) throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.characters(ch, start, length); } /** * SAX Event handling */ public void comment(char[] ch, int start, int length) throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.comment(ch, start, length); } /** * Avalon Composable Interface * @param manager The Avalon Component Manager */ public void compose(ComponentManager manager) throws ComponentException { this.manager = manager; tagNamespaceSelector = (ComponentSelector) manager.lookup(Tag.ROLE + "Selector"); } /** * Avalon Configurable Interface */ public void configure(Configuration conf) throws ConfigurationException { transformerHint = conf.getChild("transformer-hint").getValue(null); if (transformerHint != null) { try { transformerSelector = (ComponentSelector) manager.lookup(Transformer.ROLE + "Selector"); } catch (ComponentException e) { String message = "can't lookup transformer"; getLogger().error(message, e); throw new ConfigurationException(message, e); } } } /** * SAX Event handling */ public void endCDATA() throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.endCDATA(); } /** * SAX Event handling */ public void endDocument() throws SAXException { currentConsumer.endDocument(); getLogger().debug("endDocument"); } /** * SAX Event handling */ public void endDTD() throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.endDTD(); } /** * SAX Event handling */ public void endElement(String namespaceURI, String localName, String qName) throws SAXException { Object saxFragment = null; // recording for iteration ? if (recordingLevel > 0) { if (--recordingLevel > 0) { currentConsumer.endElement(namespaceURI, localName, qName); return; } //recording finished currentConsumer = currentConsumerBackup; saxFragment = xmlSerializer.getSAXFragment(); manager.release(xmlSerializer); xmlSerializer = null; } if (skipLevel > 0) { --skipLevel; if (skipLevel > 0) { return; } } Tag tag = (Tag) tagStack.pop(); if (tag != null) { ComponentSelector tagSelector = (ComponentSelector) tagSelectorStack.pop(); try { if (saxFragment != null) { //start Iteration IterationTag iterTag = (IterationTag) tag; XMLDeserializer xmlDeserializer = null; try { xmlDeserializer = (XMLDeserializer) manager.lookup(XMLDeserializer.ROLE); xmlDeserializer.setConsumer(this); do { xmlDeserializer.deserialize(saxFragment); } while (iterTag.doAfterBody() != Tag.SKIP_BODY); } catch (ComponentException e) { throw new SAXException("lookup XMLDeserializer failed", e); } finally { if (xmlDeserializer != null) manager.release(xmlDeserializer); } } tag.doEndTag(namespaceURI, localName, qName); currentTag = tag.getParent(); if (tag == currentConsumer) { // search next XMLConsumer Tag loop = currentTag; for (; loop != null; loop = loop.getParent()) { if (loop instanceof XMLConsumer) break; } if (loop != null) { currentConsumer = (XMLConsumer) loop; } else { currentConsumer = this.xmlConsumer; } } } finally { getLogger().debug("endElement: release Tag"); tagSelector.release(tag); tagNamespaceSelector.release(tagSelector); if (transformerSelector != null && tag instanceof XMLProducer) { getLogger().debug("endElement: release transformer"); Transformer transformer = (Transformer) tagTransformerStack.pop(); transformerSelector.release(transformer); } } } else { currentConsumer.endElement(namespaceURI, localName, qName); } } /** * SAX Event handling */ public void endEntity(String name) throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.endEntity(name); } /** * SAX Event handling */ public void endPrefixMapping(String prefix) throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.endPrefixMapping(prefix); } /** * SAX Event handling */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.ignorableWhitespace(ch, start, length); } /** * SAX Event handling */ public void processingInstruction(String target, String data) throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.processingInstruction(target, data); } /** * Recycle this component. */ public void recycle() { recordingLevel = 0; skipLevel = 0; resolver = null; objectModel = null; source = null; parameters = null; currentTag = null; currentConsumer = null; currentConsumerBackup = null; // can happen if there was a error in the pipeline if (xmlSerializer != null) { manager.release(xmlSerializer); xmlSerializer = null; } while (!tagStack.isEmpty()) { Tag tag = (Tag) tagStack.pop(); if (tag == null) continue; ComponentSelector tagSelector = (ComponentSelector) tagSelectorStack.pop(); tagSelector.release(tag); tagNamespaceSelector.release(tagSelector); } while (!tagTransformerStack.isEmpty()) { Transformer transformer = (Transformer) tagTransformerStack.pop(); transformerSelector.release(transformer); } if (!tagSelectorStack.isEmpty()) { getLogger().fatalError("recycle: internal Error, tagSelectorStack not empty"); tagSelectorStack.clear(); } super.recycle(); } /* * @see XMLProducer#setConsumer(XMLConsumer) */ public void setConsumer(XMLConsumer consumer) { this.currentConsumer = consumer; super.setConsumer(consumer); } /** * SAX Event handling */ public void setDocumentLocator(org.xml.sax.Locator locator) { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.setDocumentLocator(locator); } /** * Set the EntityResolver, objectModel Map, * the source and sitemap Parameters used to process the request. */ public void setup(SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws IOException, SAXException { this.resolver = resolver; this.objectModel = objectModel; this.source = source; this.parameters = parameters; } /** * SAX Event handling */ public void skippedEntity(String name) throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.skippedEntity(name); } /** * SAX Event handling */ public void startCDATA() throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.startCDATA(); } /** * SAX Event handling */ public void startDocument() throws SAXException { currentConsumer.startDocument(); } /** * SAX Event handling */ public void startDTD(String name, String publicId, String systemId) throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.startDTD(name, publicId, systemId); } /** * SAX Event handling */ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { // recording for iteration ? if (recordingLevel > 0) { ++recordingLevel; currentConsumer.startElement(namespaceURI, localName, qName, atts); return; } // If we are skipping the body of a Tag if (skipLevel > 0) { // Remember to skip one more end element skipLevel++; // and ignore this start element return; } Tag tag = null; if (namespaceURI != null && namespaceURI.length() > 0) { ComponentSelector tagSelector = null; Transformer tagTransformer = null; try { tagSelector = (ComponentSelector) tagNamespaceSelector.select(namespaceURI); tagSelectorStack.push(tagSelector); // namespace matches tag library, lookup tag now. tag = (Tag) tagSelector.select(localName); // tag found, setup Tag and connect it to pipeline tag.setParent(currentTag); tag.setup(this.resolver, this.objectModel, this.parameters); if (tag instanceof XMLProducer) { if (transformerSelector != null) { // add additional (Tag)Transformer to the output of the Tag tagTransformer = (Transformer) transformerSelector.select(transformerHint); tagTransformerStack.push(tagTransformer); tagTransformer.setup(this.resolver, this.objectModel, null, this.parameters); ((XMLProducer) tag).setConsumer(tagTransformer); tagTransformer.setConsumer(currentConsumer); } } if (tag instanceof XMLConsumer) { currentConsumer = (XMLConsumer) tag; } currentTag = tag; // Set Tag-Attributes, Attributes are mapped to the coresponding Tag method for (int i = 0; i < atts.getLength(); i++) { String attributeName = atts.getLocalName(i); String attributeValue = atts.getValue(i); paramArray[0] = attributeValue; try { Method method = getWriteMethod(tag.getClass(), attributeName); method.invoke(tag, paramArray); } catch (Throwable e) { if (getLogger().isInfoEnabled()) getLogger().info("startElement(" + localName + "): Attribute " + attributeName + " not set", e); } } } catch (Exception ignore) { // No namespace or tag found, process it as normal element (tag == null) } } tagStack.push(tag); if (tag == null) { currentConsumer.startElement(namespaceURI, localName, qName, atts); } else { int eval = tag.doStartTag(namespaceURI, localName, qName, atts); switch (eval) { case Tag.EVAL_BODY : skipLevel = 0; if (tag instanceof IterationTag) { // start recording for IterationTag try { xmlSerializer = (XMLSerializer) manager.lookup(XMLSerializer.ROLE); currentConsumerBackup = currentConsumer; currentConsumer = xmlSerializer; recordingLevel = 1; } catch (ComponentException e) { throw new SAXException("lookup XMLSerializer failed", e); } } break; case Tag.SKIP_BODY : skipLevel = 1; break; default : String tagName = tag.getClass().getName(); getLogger().warn("Bad return value from doStartTag(" + tagName + "): " + eval); break; } } } /** * SAX Event handling */ public void startEntity(String name) throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.startEntity(name); } /** * SAX Event handling */ public void startPrefixMapping(String prefix, String uri) throws SAXException { // If we are skipping the body of a tag, ignore this... if (skipLevel > 0) return; currentConsumer.startPrefixMapping(prefix, uri); } /** * Dispose this component. */ public void dispose() { this.manager.release(tagNamespaceSelector); tagNamespaceSelector = null; if (transformerSelector != null) { this.manager.release(transformerSelector); transformerSelector = null; } } private static Method getWriteMethod(Class type, String propertyName) throws IntrospectionException { Map map = getWriteMethodMap(type); Method method = (Method) map.get(propertyName); if (method == null) throw new IntrospectionException("No such property: " + propertyName); return method; } private static Map getWriteMethodMap(Class beanClass) throws IntrospectionException { Map map = (Map) writeMethodMap.get(beanClass); if (map != null) return map; BeanInfo info = Introspector.getBeanInfo(beanClass); if (info != null) { PropertyDescriptor pds[] = info.getPropertyDescriptors(); map = new HashMap(pds.length * 4 / 3, 1); for (int i = 0; i < pds.length; i++) { PropertyDescriptor pd = pds[i]; String name = pd.getName(); Method method = pd.getWriteMethod(); Class type = pd.getPropertyType(); if (type != String.class) // only String properties continue; map.put(name, method); } } writeMethodMap.put(beanClass, map); return map; } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/datetime/MonthsTag.java Index: MonthsTag.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib.datetime; import java.text.DateFormatSymbols; import java.util.Locale; import org.apache.cocoon.taglib.IterationTag; import org.apache.cocoon.taglib.TagSupport; import org.apache.cocoon.taglib.VarTagSupport; import org.apache.cocoon.taglib.i18n.LocaleTag; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** * Tag months, used to loop through all the months of the year. *

* The script variable of name var is availble only within the * body of the months tag. * * @author: Volker Schmitt */ public class MonthsTag extends VarTagSupport implements IterationTag { private String[] short_months = null; private String[] long_months = null; private int month; private int month_num; /** * Initializes tag so it can loop through the months of the year. * * @return EVAL_BODY */ public final int doStartTag(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { // Initialize variables month = 0; month_num = 1; Locale locale = null; LocaleTag localeTag = (LocaleTag) TagSupport.findAncestorWithClass(this, LocaleTag.class); if (localeTag != null) { locale = localeTag.getLocale(); } else { locale = Locale.getDefault(); } DateFormatSymbols dfs = new DateFormatSymbols(locale); short_months = dfs.getShortMonths(); long_months = dfs.getMonths(); // Make sure we skip any blank array elements while (month < long_months.length && (long_months[month] == null || long_months[month].length() == 0)) { month++; } if (month >= short_months.length) return SKIP_BODY; setVariable(var, this); return EVAL_BODY; } /* * @see Tag#doEndTag(String, String, String) */ public int doEndTag(String namespaceURI, String localName, String qName) throws SAXException { removeVariable(var); return EVAL_PAGE; } /** * Method called at end of each months tag. * * @return EVAL_BODY_TAG if there is another month, or SKIP_BODY if there are no more months */ public final int doAfterBody() throws SAXException { // See if we are done looping through months month++; month_num++; if (month >= short_months.length) return SKIP_BODY; // Make sure we skip any blank array elements while (month < long_months.length && (long_months[month] == null || long_months[month].length() == 0)) { month++; } if (month >= short_months.length) return SKIP_BODY; // There is another month, so loop again return EVAL_BODY_AGAIN; } /** * Returns the short name of the month. * * @return String - short name of the month */ public final String getShortMonth() { return short_months[month]; } /** * Returns the long name of the month. * * @return String - long name of the month */ public final String getMonth() { return long_months[month]; } /** * Returns the number of the month. * * @return String - number of the month */ public final String getMonthOfYear() { if (month_num < 10) return "0" + month_num; return "" + month_num; } /* * @see Recyclable#recycle() */ public void recycle() { this.short_months = null; this.long_months = null; super.recycle(); } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/test/acting/TagtestAction.java Index: TagtestAction.java =================================================================== /* * (c) Copyright 2001 MyCorporation. * All Rights Reserved. */ package org.apache.cocoon.taglib.test.acting; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.Map; import org.apache.avalon.framework.parameters.Parameters; import org.apache.cocoon.acting.ComposerAction; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Redirector; import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.Session; import org.apache.cocoon.environment.SourceResolver; /** * @version 1.0 * @author */ public class TagtestAction extends ComposerAction { /* * @see Action#act(Redirector, SourceResolver, Map, String, Parameters) */ public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters par) throws Exception { Request request = (Request) ObjectModelHelper.getRequest(objectModel); Session session = request.getSession(); Enumeration locales = request.getLocales(); List info = new ArrayList(); request.setAttribute("BrowserLocales", locales); info.add(request.getRemoteAddr()); info.add(request.getRemoteHost()); info.add(request.getRemoteUser()); info.add(request.getContentType()); info.add(request.getLocale()); session.setAttribute("RequestInfo", info); return null; } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/jxpath/CocoonRequestHandler.java Index: CocoonRequestHandler.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.jxpath; import java.util.Enumeration; import org.apache.cocoon.environment.Request; import org.apache.commons.jxpath.DynamicPropertyHandler; import org.apache.commons.jxpath.servlet.Util; /** * Implementation of the DynamicPropertyHandler interface that provides * access to attributes of a Cocoon Request. * * @author: Volker Schmitt */ public class CocoonRequestHandler implements DynamicPropertyHandler { public String[] getPropertyNames(Object request){ Enumeration e = ((Request)request).getAttributeNames(); return Util.toStrings(e); } public Object getProperty(Object request, String property){ return ((Request)request).getAttribute(property); } public void setProperty(Object request, String property, Object value){ ((Request)request).setAttribute(property, value); } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/jxpath/CocoonSessionHandler.java Index: CocoonSessionHandler.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.jxpath; import java.util.Enumeration; import org.apache.cocoon.environment.Session; import org.apache.commons.jxpath.DynamicPropertyHandler; import org.apache.commons.jxpath.servlet.Util; /** * Implementation of the DynamicPropertyHandler interface that provides * access to attributes of a Cocoon Session. * * @author: Volker Schmitt */ public class CocoonSessionHandler implements DynamicPropertyHandler { public String[] getPropertyNames(Object session){ Enumeration e = ((Session)session).getAttributeNames(); return Util.toStrings(e); } public Object getProperty(Object session, String property){ return ((Session)session).getAttribute(property); } public void setProperty(Object session, String property, Object value){ ((Session)session).setAttribute(property, value); } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/jxpath/CocoonContextHandler.java Index: CocoonContextHandler.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.jxpath; import java.util.Enumeration; import org.apache.cocoon.environment.Context; import org.apache.commons.jxpath.DynamicPropertyHandler; import org.apache.commons.jxpath.servlet.Util; /** * Implementation of the DynamicPropertyHandler interface that provides * access to attributes of a Cocoon Context. * * @author: Volker Schmitt */ public class CocoonContextHandler implements DynamicPropertyHandler { public String[] getPropertyNames(Object context){ Enumeration e = ((Context)context).getAttributeNames(); return Util.toStrings(e); } public Object getProperty(Object context, String property){ return ((Context)context).getAttribute(property); } public void setProperty(Object context, String property, Object value){ ((Context)context).setAttribute(property, value); } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/jxpath/JXPathCocoonContexts.java Index: JXPathCocoonContexts.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.jxpath; import java.util.Map; import org.apache.avalon.excalibur.pool.Recyclable; import org.apache.cocoon.components.RequestLifecycleComponent; import org.apache.cocoon.environment.Context; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.Session; import org.apache.cocoon.environment.SourceResolver; import org.apache.cocoon.environment.http.HttpContext; import org.apache.cocoon.environment.http.HttpRequest; import org.apache.cocoon.environment.http.HttpSession; import org.apache.commons.jxpath.JXPathContext; import org.apache.commons.jxpath.JXPathContextFactory; import org.apache.commons.jxpath.JXPathIntrospector; import org.apache.commons.jxpath.servlet.Constants; import org.apache.commons.jxpath.servlet.KeywordVariables; /** * Component that allocate and cache JXPathContexts bound to VariableContext, * Cocoon Request, Cocoon Session and Cocoon Context. *

* If you need to limit the attibute lookup to just one scope, you can use the * pre-definded variables "request", "session" and "application". * For example, the expression "$session/foo" extracts the value of the * session attribute named "foo". *

* Following are some implementation details. * There is a separate JXPathContext for each of the four scopes. These contexts are chained * according to the nesting of the scopes. So, the parent of the "variable" * JXPathContext is a "request" JXPathContext, whose parent is a "session" * JXPathContext (that is if there is a session), whose parent is an "application" * context. *

* Since JXPath chains lookups for variables and extension functions, variables * and extension function declared in the outer scopes are also available in * the inner scopes. *

* The "session" variable will be undefined if there is no session for this servlet. * JXPath does not automatically create sessions. * * @author: Volker Schmitt */ public final class JXPathCocoonContexts implements RequestLifecycleComponent, Recyclable { public static final String ROLE = JXPathCocoonContexts.class.getName(); private static JXPathContextFactory factory; private Map objectModel; private JXPathContext variableContext; static { factory = JXPathContextFactory.newInstance(); JXPathIntrospector.registerDynamicClass(HttpRequest.class, CocoonRequestHandler.class); JXPathIntrospector.registerDynamicClass(HttpSession.class, CocoonSessionHandler.class); JXPathIntrospector.registerDynamicClass(HttpContext.class, CocoonContextHandler.class); } public final JXPathContext getVariableContext() { if (variableContext == null) { JXPathContext parentContext = getRequestContext(); variableContext = factory.newContext(parentContext, null); } return variableContext; } /** * Returns a JXPathContext bound to the "request" scope. Caches that context * within the request itself. */ public final JXPathContext getRequestContext() { Request request = ObjectModelHelper.getRequest(objectModel); JXPathContext context = (JXPathContext) request.getAttribute(Constants.JXPATH_CONTEXT); if (context == null) { Context cocoonContext = ObjectModelHelper.getContext(objectModel); JXPathContext parentContext = null; Session session = request.getSession(false); if (session != null) { parentContext = getSessionContext(session, cocoonContext); } else { parentContext = getApplicationContext(cocoonContext); } if (request.getClass() != HttpRequest.class) JXPathIntrospector.registerDynamicClass(request.getClass(), CocoonRequestHandler.class); context = factory.newContext(parentContext, request); context.setVariables(new KeywordVariables(Constants.REQUEST_SCOPE, request)); request.setAttribute(Constants.JXPATH_CONTEXT, context); } return context; } /** * Returns a JXPathContext bound to the "session" scope. Caches that context * within the session itself. */ public final JXPathContext getSessionContext(Session session, Context cocoonContext) { JXPathContext context = (JXPathContext) session.getAttribute(Constants.JXPATH_CONTEXT); if (context == null) { if (session.getClass() != HttpSession.class) JXPathIntrospector.registerDynamicClass(session.getClass(), CocoonSessionHandler.class); JXPathContext parentContext = getApplicationContext(cocoonContext); context = factory.newContext(parentContext, session); context.setVariables(new KeywordVariables(Constants.SESSION_SCOPE, session)); session.setAttribute(Constants.JXPATH_CONTEXT, context); } return context; } /** * Returns a JXPathContext bound to the "application" scope. Caches that context * within the servlet context itself. */ public final JXPathContext getApplicationContext(Context cocoonContext) { JXPathContext context = (JXPathContext) cocoonContext.getAttribute(Constants.JXPATH_CONTEXT); if (context == null) { if (cocoonContext.getClass() != HttpContext.class) JXPathIntrospector.registerDynamicClass(cocoonContext.getClass(), CocoonContextHandler.class); context = factory.newContext(null, cocoonContext); context.setVariables(new KeywordVariables(Constants.APPLICATION_SCOPE, cocoonContext)); cocoonContext.setAttribute(Constants.JXPATH_CONTEXT, context); } return context; } /* * @see RequestLifecycleComponent#setup(SourceResolver, Map) */ public void setup(SourceResolver resolver, Map objectModel) { this.objectModel = objectModel; } /* * @see Recyclable#recycle() */ public void recycle() { this.objectModel = null; this.variableContext = null; } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/jxpath/core/OutTag.java Index: OutTag.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib.jxpath.core; import org.apache.cocoon.taglib.VarXMLProducerTagSupport; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** * @author: Volker Schmitt */ public class OutTag extends VarXMLProducerTagSupport { private String value; /* * @see Tag#doStartTag(String, String, String, Attributes) */ public int doStartTag(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { if (value != null) { //JXPathContext context = JXPathCocoonContexts.getRequestContext(objectModel); Object retValue = getVariable(value); if (retValue != null) { if (var != null) { setVariable(var, retValue); //context.setValue(var, retValue); //setAttribute(var, retValue); } else { char[] charArray = retValue.toString().toCharArray(); this.xmlConsumer.characters(charArray, 0, charArray.length); } } } return EVAL_BODY; } public void setValue(String value) { this.value = value; } /* * @see Recyclable#recycle() */ public void recycle() { this.value = null; super.recycle(); } } 1.1 cocoon-2.1/src/blocks/taglib/java/org/apache/cocoon/taglib/jxpath/core/ForEachTag.java Index: ForEachTag.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.taglib.jxpath.core; import org.apache.cocoon.taglib.IterationTag; import org.apache.cocoon.taglib.core.ForEachSupport; import org.apache.cocoon.taglib.core.LoopTag; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** *

A handler for <forEach> that accepts attributes as Strings * and evaluates them as expressions at runtime.

* * Migration from JSTL1.0 * @see org.apache.taglibs.standard.tag.el.core.ForEachTag * * @author: Volker Schmitt */ public class ForEachTag extends ForEachSupport implements LoopTag, IterationTag { //********************************************************************* // 'Private' state (implementation details) private String begin_; // stores EL-based property private String end_; // stores EL-based property private String step_; // stores EL-based property private String items_; // stores EL-based property //********************************************************************* // Constructor public ForEachTag() { super(); init(); } //********************************************************************* // Tag logic /* Begins iterating by processing the first item. */ public int doStartTag(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { // evaluate any expressions we were passed, once per invocation evaluateExpressions(); // chain to the parent implementation return super.doStartTag(namespaceURI, localName, qName, atts); } // Releases any resources we may have (or inherit) public void recycle() { init(); super.recycle(); } //********************************************************************* // Accessor methods // for EL-based attribute public void setBegin(String begin_) { this.begin_ = begin_; this.beginSpecified = true; } // for EL-based attribute public void setEnd(String end_) { this.end_ = end_; this.endSpecified = true; } // for EL-based attribute public void setStep(String step_) { this.step_ = step_; this.stepSpecified = true; } public void setItems(String items_) { this.items_ = items_; } //********************************************************************* // Private (utility) methods // (re)initializes state (during release() or construction) private void init() { // defaults for interface with page author begin_ = null; // (no expression) end_ = null; // (no expression) step_ = null; // (no expression) items_ = null; // (no expression) } /* Evaluates expressions as necessary */ private void evaluateExpressions() throws SAXException { if (begin_ != null) { begin = Integer.parseInt(begin_); } if (end_ != null) { end = Integer.parseInt(end_); } if (step_ != null) { step = Integer.parseInt(step_); } if (items_ != null) { rawItems = getVariable(items_); } /* * Note: we don't check for type mismatches here; we assume * the expression evaluator will return the expected type * (by virtue of knowledge we give it about what that type is). * A ClassCastException here is truly unexpected, so we let it * propagate up. */ /* if (begin_ != null) { Object r = ExpressionEvaluatorManager.evaluate("begin", begin_, Integer.class, this, pageContext); if (r == null) throw new NullAttributeException("forEach", "begin"); begin = ((Integer) r).intValue(); validateBegin(); } if (end_ != null) { Object r = ExpressionEvaluatorManager.evaluate("end", end_, Integer.class, this, pageContext); if (r == null) throw new NullAttributeException("forEach", "end"); end = ((Integer) r).intValue(); validateEnd(); } if (step_ != null) { Object r = ExpressionEvaluatorManager.evaluate("step", step_, Integer.class, this, pageContext); if (r == null) throw new NullAttributeException("forEach", "step"); step = ((Integer) r).intValue(); validateStep(); } if (items_ != null) { rawItems = ExpressionEvaluatorManager.evaluate("items", items_, Object.class, this, pageContext); // use an empty list to indicate "no iteration", if relevant if (rawItems == null) rawItems = new ArrayList(); } */ } } 1.6 +17 -0 cocoon-2.1/gump.xml Index: gump.xml =================================================================== RCS file: /home/cvs/cocoon-2.1/gump.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- gump.xml 9 Mar 2003 03:05:16 -0000 1.5 +++ gump.xml 10 Mar 2003 18:13:40 -0000 1.6 @@ -642,6 +642,23 @@ + + org.apache.cocoon + + + + + + + + + + + + + + +