cziegeler 02/02/04 02:21:09
Modified: src/scratchpad/src/org/apache/cocoon/treeprocessor
AbstractParentProcessingNode.java
AbstractParentProcessingNodeBuilder.java
AbstractProcessingNode.java
AbstractProcessingNodeBuilder.java
CategoryNode.java CategoryNodeBuilder.java
ContainerNode.java ContainerNodeBuilder.java
EnvironmentSourceResolver.java InvokeContext.java
LinkedProcessingNodeBuilder.java
MapStackResolver.java NamedContainerNode.java
NamedContainerNodeBuilder.java
NamedProcessingNode.java NullNode.java
NullNodeBuilder.java
ParameterizableProcessingNode.java
ProcessingNode.java ProcessingNodeBuilder.java
SimpleParentProcessingNode.java
SimpleSelectorProcessingNode.java TreeBuilder.java
TreeProcessor.java
src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap
ActNodeBuilder.java ActSetNode.java
ActTypeNode.java ActionSetNode.java
ActionSetNodeBuilder.java AggregateNode.java
AggregateNodeBuilder.java CallNode.java
CallNodeBuilder.java ComponentsNodeBuilder.java
ComponentsSelector.java GenerateNode.java
GenerateNodeBuilder.java HandleErrorsNode.java
HandleErrorsNodeBuilder.java MatchNode.java
MatchNodeBuilder.java MountNode.java
MountNodeBuilder.java PipelineNode.java
PipelineNodeBuilder.java PipelinesNode.java
PipelinesNodeBuilder.java PreparableMatchNode.java
ReadNode.java ReadNodeBuilder.java
RedirectToNodeBuilder.java RedirectToURINode.java
SelectNode.java SelectNodeBuilder.java
SerializeNode.java SerializeNodeBuilder.java
SitemapLanguage.java SitemapNode.java
SitemapNodeBuilder.java TransformNode.java
TransformNodeBuilder.java ViewNodeBuilder.java
Log:
Long licence
Revision Changes Path
1.4 +60 -14
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/AbstractParentProcessingNode.java
Index: AbstractParentProcessingNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/AbstractParentProcessingNode.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractParentProcessingNode.java 30 Jan 2002 14:35:07 -0000 1.3
+++ AbstractParentProcessingNode.java 4 Feb 2002 10:21:06 -0000 1.4
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
import org.apache.cocoon.environment.Environment;
@@ -18,7 +64,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/01/30 14:35:07 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/02/04 10:21:06 $
*/
public abstract class AbstractParentProcessingNode extends
AbstractProcessingNode {
@@ -35,7 +81,7 @@
InvokeContext context,
Map currentMap)
throws Exception {
-
+
context.pushMap(currentMap);
for (int i = 0; i < nodes.length; i++) {
@@ -45,12 +91,12 @@
return true;
}
}
-
+
// No success
context.popMap();
return false;
}
-
+
/**
* Invoke all nodes of a node array in order, until one succeeds.
*/
@@ -59,13 +105,13 @@
Environment env,
InvokeContext context)
throws Exception {
-
+
for (int i = 0; i < nodes.length; i++) {
if (nodes[i].invoke(env, context)) {
return true;
}
}
-
+
return false;
}
}
1.3 +74 -28
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/AbstractParentProcessingNodeBuilder.java
Index: AbstractParentProcessingNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/AbstractParentProcessingNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractParentProcessingNodeBuilder.java 15 Jan 2002 11:10:52 -0000
1.2
+++ AbstractParentProcessingNodeBuilder.java 4 Feb 2002 10:21:06 -0000
1.3
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
import org.apache.avalon.framework.configuration.Configurable;
@@ -23,17 +69,17 @@
* children nodes.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public abstract class AbstractParentProcessingNodeBuilder extends
AbstractProcessingNodeBuilder implements Configurable {
-
+
protected Collection allowedChildren;
-
+
protected Collection forbiddenChildren;
-
+
protected Collection ignoredChildren;
-
+
/**
* Configure the sets of allowed, forbidden and ignored children nodes.
*/
@@ -52,16 +98,16 @@
* @throws ConfigurationException if this child isn't allowed.
*/
protected boolean isChild(Configuration child) throws
ConfigurationException {
-
+
checkNamespace(child);
-
+
String name = child.getName();
-
+
// Is this a parameter of a parameterizable node builder ?
if (isParameter(child)) {
return false;
}
-
+
// Is this element to be ignored ?
if (ignoredChildren != null && ignoredChildren.contains(name)) {
getLogger().debug("Element '" + name + "' is ignored for
building children of element '" +
@@ -69,7 +115,7 @@
return false;
}
-
+
// Is it allowed ?
if ( (allowedChildren != null && !allowedChildren.contains(name)) ||
(forbiddenChildren != null && forbiddenChildren.contains(name))
) {
@@ -77,10 +123,10 @@
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
return true;
}
-
+
protected boolean isParameter(Configuration config) throws
ConfigurationException {
String name = config.getName();
if (name.equals(this.treeBuilder.getParameterName())) {
@@ -100,12 +146,12 @@
* Child nodes are controlled to be actually allowed in this node.
*/
protected List buildChildNodesList(Configuration config) throws
Exception {
-
+
Configuration[] children = config.getChildren();
List result = new ArrayList();
-
+
for (int i = 0; i < children.length; i++) {
-
+
Configuration child = children[i];
try {
if (isChild(child)) {
@@ -113,7 +159,7 @@
ProcessingNodeBuilder childBuilder =
this.treeBuilder.createNodeBuilder(child);
result.add(childBuilder.buildNode(child));
}
-
+
} catch(ConfigurationException ce) {
throw ce;
} catch(Exception e) {
@@ -122,10 +168,10 @@
throw new ConfigurationException(msg, e);
}
}
-
+
return result;
}
-
+
protected ProcessingNode[] buildChildNodes(Configuration config) throws
Exception {
return toNodeArray(buildChildNodesList(config));
}
@@ -137,7 +183,7 @@
public static ProcessingNode[] toNodeArray(List list) {
return (ProcessingNode[])list.toArray(new
ProcessingNode[list.size()]);
}
-
+
/**
* Splits the value of a Configuration in a Collection of Strings.
Splitting
* occurs at space characters (incl. line breaks) and comma.
@@ -146,7 +192,7 @@
*/
private Collection getStringCollection(Configuration config) {
String s = config.getValue(null);
-
+
return (s == null) ? null : Arrays.asList(StringUtils.split(s, ",
\t\n\r"));
}
}
1.3 +58 -11
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/AbstractProcessingNode.java
Index: AbstractProcessingNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/AbstractProcessingNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractProcessingNode.java 15 Jan 2002 11:10:52 -0000 1.2
+++ AbstractProcessingNode.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -17,27 +64,27 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public abstract class AbstractProcessingNode extends AbstractLoggable
implements ProcessingNode {
protected String location = "unknown location";
-
+
/**
* Get the <code>SourceResolver</code> in an object model.
*/
protected static final SourceResolver getSourceResolver(Map objectModel)
{
return (SourceResolver)objectModel.get(OBJECT_SOURCE_RESOLVER);
}
-
+
/**
* Get the location of this node.
*/
public String getLocation() {
return this.location;
}
-
+
/**
* Set the location of this node.
*/
1.3 +59 -12
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/AbstractProcessingNodeBuilder.java
Index: AbstractProcessingNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/AbstractProcessingNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractProcessingNodeBuilder.java 15 Jan 2002 11:10:52 -0000
1.2
+++ AbstractProcessingNodeBuilder.java 4 Feb 2002 10:21:06 -0000
1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -26,7 +73,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
@@ -34,7 +81,7 @@
implements ProcessingNodeBuilder {
protected TreeBuilder treeBuilder;
-
+
public void setBuilder(TreeBuilder treeBuilder) {
this.treeBuilder = treeBuilder;
}
@@ -56,11 +103,11 @@
*/
protected Map getParameters(Configuration config) throws
ConfigurationException {
Configuration[] children = config.getChildren("parameter");
-
+
if (children.length == 0) {
return null;
}
-
+
Map params = new HashMap();
for (int i = 0; i < children.length; i++) {
Configuration child = children[i];
@@ -75,7 +122,7 @@
}
}
}
-
+
return params;
}
1.3 +61 -15
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/CategoryNode.java
Index: CategoryNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/CategoryNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CategoryNode.java 15 Jan 2002 11:10:52 -0000 1.2
+++ CategoryNode.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
import org.apache.cocoon.components.pipeline.EventPipeline;
@@ -19,7 +65,7 @@
* A generic container node that just invokes its children.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public final class CategoryNode extends AbstractParentProcessingNode {
@@ -29,18 +75,18 @@
/** The Map of named nodes in this category */
private Map nodes;
-
+
public void setCategory(String categoryName, Map nodes) {
this.categoryName = categoryName;
this.nodes = (nodes != null) ? nodes : new HashMap(0);
}
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
String msg = "Cannot invoke " + this.categoryName + " at " +
getLocation();
getLogger().error(msg);
throw new ProcessingException(msg);
}
-
+
public final ProcessingNode getNodeByName(String name) throws Exception {
ProcessingNode node = (ProcessingNode)nodes.get(name);
if (node == null) {
@@ -48,13 +94,13 @@
getLogger().error(msg);
throw new ProcessingException(msg);
}
-
+
return node;
}
-
+
public final boolean invokeByName(String name, Environment env,
InvokeContext context)
throws Exception {
-
+
return getNodeByName(name).invoke(env, context);
}
}
1.3 +65 -18
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/CategoryNodeBuilder.java
Index: CategoryNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/CategoryNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CategoryNodeBuilder.java 15 Jan 2002 11:10:52 -0000 1.2
+++ CategoryNodeBuilder.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -20,7 +67,7 @@
* Builds a generic container node.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public class CategoryNodeBuilder extends AbstractParentProcessingNodeBuilder
@@ -28,9 +75,9 @@
// Prefix used for registering as a TreeBuilder attribute
private static String PREFIX = CategoryNodeBuilder.class.getName() + "/";
-
+
protected String name;
-
+
/**
* The category name is the value of the "category-name" child, or if not
* present, the name of the configuration element.
@@ -46,28 +93,28 @@
}
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
CategoryNode node = new CategoryNode();
this.treeBuilder.setupNode(node, config);
-
+
// Get all children and associate them to their name
Map category = new HashMap();
-
+
List children = buildChildNodesList(config);
Iterator iter = children.iterator();
while(iter.hasNext()) {
NamedProcessingNode child = (NamedProcessingNode)iter.next();
category.put(child.getName(), child);
}
-
+
node.setCategory(this.name, category);
-
+
// Register node to allow lookup by other nodes
this.treeBuilder.registerNode(PREFIX + this.name, node);
-
+
return node;
}
-
+
public static CategoryNode getCategoryNode(TreeBuilder builder, String
categoryName) {
return (CategoryNode)builder.getRegisteredNode(PREFIX +
categoryName);
}
@@ -75,7 +122,7 @@
public static ProcessingNode getNamedNode(TreeBuilder builder, String
categoryName, String nodeName)
throws Exception {
CategoryNode category = getCategoryNode(builder, categoryName);
-
+
return category.getNodeByName(nodeName);
}
}
1.3 +56 -9
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/ContainerNode.java
Index: ContainerNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/ContainerNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ContainerNode.java 15 Jan 2002 11:10:52 -0000 1.2
+++ ContainerNode.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -18,13 +65,13 @@
* A generic container node that just invokes its children.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public class ContainerNode extends SimpleParentProcessingNode {
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
return invokeNodes(this.children, env, context);
}
}
1.3 +61 -14
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/ContainerNodeBuilder.java
Index: ContainerNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/ContainerNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ContainerNodeBuilder.java 15 Jan 2002 11:10:52 -0000 1.2
+++ ContainerNodeBuilder.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -18,7 +65,7 @@
* Builds a generic container node.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public class ContainerNodeBuilder extends
AbstractParentProcessingNodeBuilder implements ThreadSafe {
@@ -29,24 +76,24 @@
}
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
ContainerNode node = new ContainerNode();
setupNode(node, config);
-
+
return node;
}
-
+
protected void setupNode(ContainerNode node, Configuration config)throws
Exception {
-
+
this.treeBuilder.setupNode(node, config);
-
+
ProcessingNode[] children = buildChildNodes(config);
if (children.length == 0) {
String msg = "There must be at least one child at " +
config.getLocation();
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
node.setChildren(children);
}
}
1.3 +59 -12
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/EnvironmentSourceResolver.java
Index: EnvironmentSourceResolver.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/EnvironmentSourceResolver.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- EnvironmentSourceResolver.java 15 Jan 2002 11:10:52 -0000 1.2
+++ EnvironmentSourceResolver.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -26,15 +73,15 @@
* A <code>SourceResolver</code> that resolves URIs relative to an
<code>Environment</code>.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public class EnvironmentSourceResolver implements SourceResolver, Disposable
{
-
+
private ComponentManager manager;
-
+
private Source contextSource;
-
+
private SourceHandler sourceHandler;
public EnvironmentSourceResolver(ComponentManager manager, Environment
env) throws Exception {
@@ -42,7 +89,7 @@
this.contextSource = env.resolve("");
this.sourceHandler =
(SourceHandler)manager.lookup(SourceHandler.ROLE);
}
-
+
/**
* Resolve an entity.
*/
1.3 +73 -26
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/InvokeContext.java
Index: InvokeContext.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/InvokeContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InvokeContext.java 15 Jan 2002 11:10:52 -0000 1.2
+++ InvokeContext.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -31,25 +78,25 @@
* </ul>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public class InvokeContext implements Recomposable, Disposable {
-
+
private List mapStack = new ArrayList();
-
+
private StreamPipeline streamPipeline;
-
+
private EventPipeline eventPipeline;
-
+
private boolean isInternalRequest;
-
+
/** The current component manager, as set by the last call to compose()
or recompose() */
private ComponentManager currentManager;
-
+
/** The component manager that was used to get the pipelines */
private ComponentManager pipelinesManager;
-
+
/**
* Create an <code>InvokeContext</code> without existing pipelines. This
also means
* the current request is external.
@@ -57,7 +104,7 @@
public InvokeContext() {
this.isInternalRequest = false;
}
-
+
/**
* Create an <code>InvokeContext</code> with existing pipelines. This
also means
* the current request is internal.
@@ -67,7 +114,7 @@
this.streamPipeline = pipeline;
this.eventPipeline = eventPipeline;
}
-
+
public void compose(ComponentManager manager) throws ComponentException {
this.currentManager = manager;
}
@@ -75,7 +122,7 @@
public void recompose(ComponentManager manager) throws
ComponentException {
this.currentManager = manager;
-
+
// Recompose pipelines, if any.
if (this.streamPipeline != null) {
this.streamPipeline.recompose(manager);
@@ -93,7 +140,7 @@
}
return this.eventPipeline;
}
-
+
/**
* Get the <code>StreamPipeline</code>. If none already exists, a set of
new
* pipelines is looked up.
@@ -104,16 +151,16 @@
}
return this.streamPipeline;
}
-
+
private final void setupPipelines() throws Exception {
// Keep current manager for proper release
this.pipelinesManager = this.currentManager;
-
+
// Lookup pipelines
this.eventPipeline =
(EventPipeline)this.pipelinesManager.lookup(EventPipeline.ROLE);
this.streamPipeline =
(StreamPipeline)this.pipelinesManager.lookup(StreamPipeline.ROLE);
this.streamPipeline.setEventPipeline(this.eventPipeline);
-
+
// Immediately recompose them to the current manager : pipelines are
created
// by a parent of the current manager, but need to select component
in this one,
// and not its parent.
@@ -134,7 +181,7 @@
public final List getMapStack() {
return this.mapStack;
}
-
+
/**
* Push a Map on top of the current Map stack.
*/
@@ -142,7 +189,7 @@
mapStack.add(map);
// FIXME : dump map contents to logger
}
-
+
/**
* Pop the topmost element of the current Map stack.
*/
@@ -156,10 +203,10 @@
public void dispose() {
// Release pipelines, if any
if (!this.isInternalRequest && this.pipelinesManager != null) {
-
+
this.pipelinesManager.release(this.eventPipeline);
this.pipelinesManager.release(this.streamPipeline);
-
+
this.pipelinesManager = null;
}
}
1.3 +55 -9
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/LinkedProcessingNodeBuilder.java
Index: LinkedProcessingNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/LinkedProcessingNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LinkedProcessingNodeBuilder.java 15 Jan 2002 11:10:52 -0000 1.2
+++ LinkedProcessingNodeBuilder.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
/**
@@ -14,7 +60,7 @@
* into a directed graph.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public interface LinkedProcessingNodeBuilder extends ProcessingNodeBuilder {
1.8 +55 -9
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/MapStackResolver.java
Index: MapStackResolver.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/MapStackResolver.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- MapStackResolver.java 30 Jan 2002 14:35:07 -0000 1.7
+++ MapStackResolver.java 4 Feb 2002 10:21:06 -0000 1.8
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
import org.apache.avalon.framework.parameters.Parameters;
@@ -18,7 +64,7 @@
* Utility class for handling {...} pattern substitutions from a List of
Maps.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.7 $ $Date: 2002/01/30 14:35:07 $
+ * @version CVS $Revision: 1.8 $ $Date: 2002/02/04 10:21:06 $
*/
public abstract class MapStackResolver {
1.3 +56 -9
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/NamedContainerNode.java
Index: NamedContainerNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/NamedContainerNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NamedContainerNode.java 15 Jan 2002 11:10:52 -0000 1.2
+++ NamedContainerNode.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -16,7 +63,7 @@
* A named container node that just invokes its children.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public class NamedContainerNode extends ContainerNode implements
NamedProcessingNode {
@@ -26,7 +73,7 @@
public NamedContainerNode(String name) {
this.name = name;
}
-
+
public String getName() {
return this.name;
}
1.3 +56 -9
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/NamedContainerNodeBuilder.java
Index: NamedContainerNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/NamedContainerNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NamedContainerNodeBuilder.java 15 Jan 2002 11:10:52 -0000 1.2
+++ NamedContainerNodeBuilder.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -16,7 +63,7 @@
* Builds a generic named container node.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public class NamedContainerNodeBuilder extends ContainerNodeBuilder
implements Configurable {
@@ -29,7 +76,7 @@
}
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
NamedContainerNode node = new
NamedContainerNode(config.getAttribute(this.nameAttr));
this.setupNode(node, config);
return node;
1.3 +56 -9
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/NamedProcessingNode.java
Index: NamedProcessingNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/NamedProcessingNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NamedProcessingNode.java 15 Jan 2002 11:10:52 -0000 1.2
+++ NamedProcessingNode.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -13,10 +60,10 @@
* <code>CategoryNode</code> to access its children.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public interface NamedProcessingNode extends ProcessingNode {
- String getName();
+ String getName();
}
1.3 +59 -12
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/NullNode.java
Index: NullNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/NullNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NullNode.java 15 Jan 2002 11:10:52 -0000 1.2
+++ NullNode.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -14,15 +61,15 @@
* A no-op node to stub not yet implemented features.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public class NullNode extends AbstractProcessingNode {
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
getLogger().debug("Invoke on NullNode at " + getLocation());
return false;
-
- }
+
+ }
}
1.3 +55 -8
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/NullNodeBuilder.java
Index: NullNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/NullNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NullNodeBuilder.java 15 Jan 2002 11:10:52 -0000 1.2
+++ NullNodeBuilder.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -13,7 +60,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public class NullNodeBuilder extends AbstractProcessingNodeBuilder {
1.2 +56 -9
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/ParameterizableProcessingNode.java
Index: ParameterizableProcessingNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/ParameterizableProcessingNode.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ParameterizableProcessingNode.java 3 Jan 2002 12:31:36 -0000
1.1
+++ ParameterizableProcessingNode.java 4 Feb 2002 10:21:06 -0000
1.2
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -14,7 +61,7 @@
* A <code>ProcessingNode</code> that has parameters.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/01/03 12:31:36 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/02/04 10:21:06 $
*/
public interface ParameterizableProcessingNode extends ProcessingNode {
@@ -23,5 +70,5 @@
* Set the parameters of this node as a <code>Map</code> of
<code>MapStackResolver</code>s
* that will be resolved at process-time.
*/
- void setParameters(Map parameterMap);
+ void setParameters(Map parameterMap);
}
1.3 +58 -12
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/ProcessingNode.java
Index: ProcessingNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/ProcessingNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProcessingNode.java 15 Jan 2002 11:10:52 -0000 1.2
+++ ProcessingNode.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
import org.apache.avalon.framework.thread.ThreadSafe;
@@ -15,21 +61,21 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public interface ProcessingNode extends ThreadSafe {
-
+
/**
* The key of the <code>SourceResolver</code> in the object model.
*/
String OBJECT_SOURCE_RESOLVER = "source-resolver";
-
+
/**
* Process environment.
*/
boolean invoke(Environment env, InvokeContext context) throws Exception;
-
+
/**
* Get the location of this node.
*/
1.3 +56 -9
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/ProcessingNodeBuilder.java
Index: ProcessingNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/ProcessingNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProcessingNodeBuilder.java 15 Jan 2002 11:10:52 -0000 1.2
+++ ProcessingNodeBuilder.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -18,7 +65,7 @@
* A <code>ProcessingNode</code> builder.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public interface ProcessingNodeBuilder extends Component {
@@ -27,7 +74,7 @@
* Set the builder for which we are building.
*/
void setBuilder(TreeBuilder builder);
-
+
/**
* Build the [EMAIL PROTECTED] ProcessingNode} and its children from the
given
* <code>Configuration</code>, and optionnaly register it in the [EMAIL
PROTECTED] Builder}
1.3 +55 -8
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/SimpleParentProcessingNode.java
Index: SimpleParentProcessingNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/SimpleParentProcessingNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SimpleParentProcessingNode.java 15 Jan 2002 11:10:52 -0000 1.2
+++ SimpleParentProcessingNode.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -14,7 +61,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public abstract class SimpleParentProcessingNode extends
AbstractParentProcessingNode {
1.3 +58 -11
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/SimpleSelectorProcessingNode.java
Index: SimpleSelectorProcessingNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/SimpleSelectorProcessingNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SimpleSelectorProcessingNode.java 15 Jan 2002 11:10:52 -0000 1.2
+++ SimpleSelectorProcessingNode.java 4 Feb 2002 10:21:06 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -19,25 +66,25 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:52 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:06 $
*/
public abstract class SimpleSelectorProcessingNode extends
SimpleParentProcessingNode {
/** The node component name (e.g. action name, selector name, etc) */
protected String componentName;
-
+
/** Selector where to get components from */
protected ComponentSelector selector;
public SimpleSelectorProcessingNode(String componentName) {
this.componentName = componentName;
}
-
+
public void setSelector(ComponentSelector selector) throws
ComponentException {
this.selector = selector;
}
-
+
/**
* Tests is the component designated by this node using the selector and
component name
* is <code>ThreadSafe</code>, and return it if true.
1.4 +127 -80
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/TreeBuilder.java
Index: TreeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/TreeBuilder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TreeBuilder.java 30 Jan 2002 14:35:07 -0000 1.3
+++ TreeBuilder.java 4 Feb 2002 10:21:06 -0000 1.4
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
@@ -46,20 +93,20 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/01/30 14:35:07 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/02/04 10:21:06 $
*/
public class TreeBuilder extends AbstractLoggable implements
Composable, Configurable, Contextualizable, LogKitManageable,
RoleManageable, Disposable {
-
+
/**
* The tree processor that we're building.
*/
protected TreeProcessor processor;
-
+
//----- lifecycle-related objects ------
protected Context context;
-
+
protected LogKitManager logKit;
/**
@@ -67,52 +114,52 @@
* <code>Composable</code>).
*/
protected ComponentManager parentManager;
-
+
/**
- * The parent role manager, set using <code>setRoleManager</code>
(implementation of
+ * The parent role manager, set using <code>setRoleManager</code>
(implementation of
* <code>createRoleManager</code>).
*/
protected RoleManager parentRoleManager;
-
+
protected Configuration configuration;
// -------------------------------------
-
+
/**
* Component manager created by [EMAIL PROTECTED]
#createComponentManager()}.
*/
protected ComponentManager manager;
-
+
/**
* Role manager result created by [EMAIL PROTECTED]
#createRoleManager()}.
*/
protected RoleManager roleManager;
-
+
/** Selector for ProcessingNodeBuilders */
protected ComponentSelector builderSelector;
-
+
protected LifecycleHelper lifecycle;
-
+
protected String namespace;
-
+
protected String parameterElement;
-
+
protected String languageName;
-
+
/** Nodes gone through setupNode() that implement Initializable */
private List initializableNodes = new ArrayList();
-
+
/** Nodes gone through setupNode() that implement Disposable */
private List disposableNodes = new ArrayList();
-
+
/** NodeBuilders created by createNodeBuilder() that implement
LinkedProcessingNodeBuilder */
private List linkedBuilders = new ArrayList();
-
+
/** Are we in a state that allows to get registered nodes ? */
private boolean canGetNode = false;
/** Nodes registered using registerNode() */
private Map registeredNodes = new HashMap();
-
+
/** Attributes set using setAttribute() */
private Map attributes = new HashMap();
@@ -120,7 +167,7 @@
public void contextualize(Context context) throws ContextException {
this.context = context;
}
-
+
public void setLogKitManager(LogKitManager logKit) {
this.logKit = logKit;
}
@@ -135,15 +182,15 @@
public void configure(Configuration config) throws
ConfigurationException {
this.configuration = config;
-
+
this.languageName = config.getAttribute("name");
getLogger().debug("Configuring Builder for language : " +
this.languageName);
-
+
this.namespace = config.getChild("namespace").getAttribute("uri",
"");
-
+
this.parameterElement =
config.getChild("parameter").getAttribute("element", "parameter");
}
-
+
/**
* Create a role manager that will be used by all
<code>RoleManageable</code>
* components. The default here is to create a role manager with the
contents of
@@ -166,10 +213,10 @@
this.logKit,
this.configuration.getChild("roles")
);
-
+
return roles;
}
-
+
/**
* Create a component manager that will be used for all
<code>Composable</code>
* <code>ProcessingNodeBuilder</code>s and <code>ProcessingNode</code>s.
@@ -194,13 +241,13 @@
* @return a selector for node builders
*/
protected ComponentSelector createBuilderSelector() throws Exception {
-
+
// Create the NodeBuilder selector.
ExcaliburComponentSelector selector = new
ExtendedComponentSelector() {
protected String getComponentInstanceName() {
return "node";
}
-
+
protected String getClassAttributeName() {
return "builder";
}
@@ -215,32 +262,32 @@
this.logKit,
this.configuration.getChild("nodes")
);
-
- return selector;
+
+ return selector;
}
public void setProcessor(TreeProcessor processor) {
this.processor = processor;
}
-
+
public TreeProcessor getProcessor() {
return this.processor;
}
-
+
/**
* Returns the language that is being built (e.g. "sitemap").
*/
public String getLanguage() {
return this.languageName;
}
-
+
/**
* Returns the name of the parameter element.
*/
public String getParameterName() {
return this.parameterElement;
}
-
+
/**
* Register a <code>ProcessingNode</code> under a given name.
* For example, <code>ResourceNodeBuilder</code> stores here the
<code>ProcessingNode</code>s
@@ -249,7 +296,7 @@
public void registerNode(String name, ProcessingNode node) {
this.registeredNodes.put(name, node);
}
-
+
public ProcessingNode getRegisteredNode(String name) {
if (this.canGetNode) {
return (ProcessingNode)this.registeredNodes.get(name);
@@ -257,25 +304,25 @@
throw new IllegalArgumentException("Categories are only
available during buildNode()");
}
}
-
+
public void setAttribute(String name, Object value) {
this.attributes.put(name, value);
}
-
+
public Object getAttribute(String name) {
return this.attributes.get(name);
}
-
+
public ProcessingNodeBuilder createNodeBuilder(Configuration config)
throws Exception {
//FIXME : check namespace
String nodeName = config.getName();
-
+
getLogger().debug("Creating node builder for " + nodeName);
ProcessingNodeBuilder builder;
try {
builder =
(ProcessingNodeBuilder)this.builderSelector.select(nodeName);
-
+
} catch(ComponentException ce) {
// Is it because this element is unknown ?
if (this.builderSelector.hasComponent(nodeName)) {
@@ -288,16 +335,16 @@
throw new ConfigurationException(msg);
}
}
-
+
builder.setBuilder(this);
-
+
if (builder instanceof LinkedProcessingNodeBuilder) {
this.linkedBuilders.add(builder);
}
return builder;
}
-
+
/**
* Create the tree once component manager and node builders have been
set up.
* Can be overriden by subclasses to perform pre/post tree creation
operations.
@@ -305,11 +352,11 @@
protected ProcessingNode createTree(Configuration tree) throws Exception
{
// Create a node builder from the top-level element
ProcessingNodeBuilder rootBuilder = createNodeBuilder(tree);
-
+
// Build the whole tree (with an empty buildModel)
return rootBuilder.buildNode(tree);
}
-
+
/**
* Resolve links : call <code>linkNode()</code> on all
* <code>LinkedProcessingNodeBuilder</code>s.
@@ -322,23 +369,23 @@
((LinkedProcessingNodeBuilder)iter.next()).linkNode();
}
}
-
+
/**
* Get the namespace URI that builders should use to find their nodes.
*/
public String getNamespace() {
return this.namespace;
}
-
+
/**
* Build a processing tree from a <code>Configuration</code>.
*/
public ProcessingNode build(Configuration tree) throws Exception {
-
+
this.roleManager = createRoleManager();
-
+
this.manager = createComponentManager(tree);
-
+
// Create a helper object to setup components
this.lifecycle = new LifecycleHelper(getLogger(),
this.context,
@@ -349,15 +396,15 @@
);
this.builderSelector = createBuilderSelector();
-
+
// Calls to getRegisteredNode() are forbidden
this.canGetNode = false;
-
+
ProcessingNode result = createTree(tree);
-
+
// Calls to getRegisteredNode() are now allowed
this.canGetNode = true;
-
+
linkNodes();
// Initialize all Initializable nodes
@@ -365,11 +412,11 @@
while(iter.hasNext()) {
((Initializable)iter.next()).initialize();
}
-
+
// And that's all !
return result;
}
-
+
/**
* Return the list of <code>ProcessingNodes</code> part of this tree
that are
* <code>Disposable</code>. Care should be taken to properly dispose
them before
@@ -378,7 +425,7 @@
public List getDisposableNodes() {
return this.disposableNodes;
}
-
+
/**
* Setup a <code>ProcessingNode</code> by setting its location, calling
all
* the lifecycle interfaces it implements and giving it the parameter
map if
@@ -392,22 +439,22 @@
if (node instanceof AbstractProcessingNode) {
((AbstractProcessingNode)node).setLocation(config.getLocation());
}
-
+
this.lifecycle.setupComponent(node, false);
-
+
if (node instanceof ParameterizableProcessingNode) {
Map params = getParameters(config);
((ParameterizableProcessingNode)node).setParameters(params);
}
-
+
if (node instanceof Initializable) {
this.initializableNodes.add(node);
}
-
+
if (node instanceof Disposable) {
this.disposableNodes.add(node);
}
-
+
return node;
}
@@ -420,11 +467,11 @@
protected Map getParameters(Configuration config) throws
ConfigurationException {
Configuration[] children = config.getChildren(this.parameterElement);
-
+
if (children.length == 0) {
return null;
}
-
+
Map params = new HashMap();
for (int i = 0; i < children.length; i++) {
Configuration child = children[i];
@@ -439,7 +486,7 @@
}
}
}
-
+
return params;
}
@@ -451,11 +498,11 @@
* @throws ConfigurationException if the default type could not be found.
*/
public String getTypeForStatement(Configuration statement, String role)
throws ConfigurationException {
-
+
String type = statement.getAttribute("type", null);
-
+
ComponentSelector selector;
-
+
try {
selector = (ComponentSelector)this.manager.lookup(role);
} catch(ComponentException ce) {
@@ -464,7 +511,7 @@
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
if (type == null && selector instanceof ExtendedComponentSelector) {
type = ((ExtendedComponentSelector)selector).getDefaultHint();
}
@@ -475,22 +522,22 @@
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
if (!selector.hasComponent(type)) {
String msg = "Type '" + type + "' is not defined for '" +
statement.getName() + "' at " +
statement.getLocation();
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
this.manager.release(selector);
-
+
return type;
}
public void dispose() {
LifecycleHelper.dispose(this.builderSelector);
-
+
// Don't dispose manager or roles : they are used by the built tree
// and thus must live longer than the builder.
}
1.4 +110 -64
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/TreeProcessor.java
Index: TreeProcessor.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/TreeProcessor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TreeProcessor.java 30 Jan 2002 14:35:07 -0000 1.3
+++ TreeProcessor.java 4 Feb 2002 10:21:06 -0000 1.4
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor;
import org.apache.avalon.excalibur.component.RoleManageable;
@@ -54,60 +100,60 @@
* Interpreted tree-traversal implementation of a pipeline assembly language.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/01/30 14:35:07 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/02/04 10:21:06 $
*/
public class TreeProcessor extends AbstractLoggable implements ThreadSafe,
Processor,
Composable, Configurable, LogKitManageable, RoleManageable, Initializable,
Contextualizable, Disposable {
-
+
private static final String XCONF_URL =
"resource://org/apache/cocoon/treeprocessor/treeprocessor.xconf";
-
+
/** The parent TreeProcessor, if any */
protected TreeProcessor parent;
-
+
/** The context */
protected Context context;
-
+
/** The component manager */
protected ComponentManager manager;
-
+
/** The logkit manager to get Loggers */
protected LogKitManager logKit;
-
+
/** The role manager */
protected RoleManager roleManager;
-
+
/** The language used by this processor */
protected String language;
-
+
/** The configuration for each language */
protected Map languageConfigs;
-
+
/** The root node of the processing tree */
protected ProcessingNode rootNode;
-
+
/** The list of processing nodes that should be disposed when disposing
this processor */
protected List disposableNodes;
-
+
/** Last modification time */
protected long lastModified = 0;
-
+
/** The relative file name of the tree definition */
protected String sourceName;
-
+
/** The source of the tree definition */
protected Source source;
-
+
/** Delay for <code>sourceLastModified</code>. */
protected long lastModifiedDelay;
-
+
/** The current language configuration */
protected Configuration currentLanguage;
-
+
protected SourceHandler sourceHandler;
-
+
protected Class treeBuilderClass;
-
+
/**
* Create a TreeProcessor.
*/
@@ -115,25 +161,25 @@
// Language can be overriden in the configuration.
this.language = "sitemap";
}
-
+
/**
* Create a child processor for a given language
*/
protected TreeProcessor(TreeProcessor parent, ComponentManager manager,
String language) {
this.parent = parent;
this.language = (language == null) ? parent.language : language;
-
+
// Copy all that can be copied from the parent
this.context = parent.context;
this.logKit = parent.logKit;
this.languageConfigs = parent.languageConfigs;
-
+
// We have our own CM
this.manager = manager;
-
+
// Other fields are setup in initialize()
}
-
+
/**
* Create a new child of this processor (used for mounting submaps).
*
@@ -151,7 +197,7 @@
public void contextualize(Context context) throws ContextException {
this.context = context;
}
-
+
public void compose(ComponentManager manager) throws ComponentException {
this.manager = manager;
}
@@ -159,7 +205,7 @@
public void setLogKitManager(LogKitManager logKit) {
this.logKit = logKit;
}
-
+
public void setRoleManager(RoleManager rm) {
this.roleManager = rm;
}
@@ -173,18 +219,18 @@
</processor>
*/
public void configure(Configuration config) throws
ConfigurationException {
-
+
Configuration rootLangConfig = config.getChild("root-language",
false);
if (rootLangConfig != null) {
this.language = rootLangConfig.getAttribute("name");
}
-
+
// Reload check delay. Default is 1 second.
this.lastModifiedDelay =
config.getChild("reload").getAttributeAsLong("delay", 1000L);
-
+
// Read the builtin languages definition file
Configuration builtin;
-
+
try {
URLFactory factory =
(URLFactory)this.manager.lookup(URLFactory.ROLE);
URLSource source = new URLSource(factory.getURL(XCONF_URL),
this.manager);
@@ -203,23 +249,23 @@
getLogger().error(msg, e);
throw new ConfigurationException(msg, e);
}
-
+
this.languageConfigs = new HashMap();
// Add builtin languages
addLanguages("builtin", builtin.getChildren("language"));
-
+
// Add additional languages from the configuration
addLanguages("additional", config.getChildren("language"));
}
-
+
private void addLanguages(String type, Configuration[] languages)
throws ConfigurationException {
-
+
for (int i = 0; i < languages.length; i++) {
-
+
String name = languages[i].getAttribute("name");
-
+
if (this.languageConfigs.containsKey(name)) {
getLogger().info("Redefining language '" + name + "' in " +
type + " configuration.");
} else {
@@ -236,21 +282,21 @@
if (this.currentLanguage == null) {
throw new ConfigurationException("No configuration defined for
language '" + this.language + "'");
}
-
+
Configuration fileConfig = this.currentLanguage.getChild("file",
false);
if (fileConfig == null) {
throw new ConfigurationException("Missing 'file' configuration
for language '" + this.language + "', at " +
this.currentLanguage.getLocation());
}
-
+
this.sourceName = fileConfig.getAttribute("name");
// Get a new Source handler
this.sourceHandler =
(SourceHandler)this.manager.lookup(SourceHandler.ROLE);
-
+
// and add the special "cocoon:" source factory
this.sourceHandler.addFactory("cocoon", new
CocoonSourceFactory(this, this.manager));
-
+
// Get the TreeBuider class
String builderClassName =
this.currentLanguage.getAttribute("class",
TreeBuilder.class.getName());
@@ -264,7 +310,7 @@
throw new ConfigurationException(msg, e);
}
}
-
+
public boolean process(Environment environment) throws Exception {
InvokeContext context = new InvokeContext();
try {
@@ -299,36 +345,36 @@
environment.setSourceHandler(oldSourceHandler);
}
}
-
+
protected synchronized void setupRootNode(Environment env) throws
Exception {
-
+
// Now that we entered the synchronized area, recheck what's already
// been checked in process().
if (this.rootNode != null && source.getLastModified() <=
this.lastModified) {
// Nothing changed
return;
}
-
+
long startTime = System.currentTimeMillis();
-
+
if (this.rootNode == null) {
// First call : create source
// FIXME : make the delay configurable
this.source = new
DelayedRefreshSourceWrapper(env.resolve(this.sourceName), 1000L);
-
+
} else {
// Dispose existing tree, we will build a new one.
disposeTree();
}
-
+
// Read the tree definition file as a Configuration
getLogger().debug("Building " + this.language + " from " +
source.getSystemId());
-
+
// Build a namespace-aware configuration object
SAXConfigurationHandler handler = new
NamespacedSAXConfigurationHandler();
source.toSAX(handler);
Configuration treeConfig = handler.getConfiguration();
-
+
TreeBuilder treeBuilder =
(TreeBuilder)this.treeBuilderClass.newInstance();
LifecycleHelper.setupComponent(treeBuilder,
getLogger(),
@@ -339,7 +385,7 @@
this.currentLanguage);
treeBuilder.setProcessor(this);
-
+
// Build the tree
ProcessingNode root;
try {
@@ -348,26 +394,26 @@
getLogger().debug("Failed to build processing tree from " +
source.getSystemId(), e);
throw e;
}
-
+
LifecycleHelper.decommission(treeBuilder);
-
+
this.lastModified = System.currentTimeMillis();
-
+
if (getLogger().isDebugEnabled()) {
double time = (this.lastModified - startTime) / 1000.0;
getLogger().debug("TreeProcessor built in " + time + " secs from
" + source.getSystemId());
//System.out.println("TreeProcessor built in " + time + " secs
from " + source.getSystemId());
}
-
+
// Finished
this.rootNode = root;
}
public void dispose() {
- disposeTree();
+ disposeTree();
this.manager.release(this.sourceHandler);
}
-
+
/**
* Dispose all nodes in the tree that are disposable
*/
1.3 +66 -19
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ActNodeBuilder.java
Index: ActNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ActNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ActNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ ActNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -28,42 +75,42 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class ActNodeBuilder extends AbstractParentProcessingNodeBuilder
implements LinkedProcessingNodeBuilder {
private ComponentManager manager;
-
+
private ActSetNode actSetNode;
private String actSetName;
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
String source = config.getAttribute("src", null);
-
+
// Is it an action-set call ?
this.actSetName = config.getAttribute("set", null);
if (actSetName == null) {
-
+
String type = this.treeBuilder.getTypeForStatement(config,
Action.ROLE + "Selector");
-
+
ActTypeNode actTypeNode = new ActTypeNode(type, source);
this.treeBuilder.setupNode(actTypeNode, config);
-
+
actTypeNode.setChildren(buildChildNodes(config));
-
+
return actTypeNode;
-
+
} else {
-
+
// Action set call
this.actSetNode = new ActSetNode(source);
this.treeBuilder.setupNode(this.actSetNode, config);
-
+
this.actSetNode.setChildren(buildChildNodes(config));
-
+
return this.actSetNode;
}
}
1.3 +64 -17
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ActSetNode.java
Index: ActSetNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ActSetNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ActSetNode.java 15 Jan 2002 11:10:54 -0000 1.2
+++ ActSetNode.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -37,51 +84,51 @@
* Handles <map:act type="..."> (action-sets calls are handled by
[EMAIL PROTECTED] ActSetNode}).
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class ActSetNode extends SimpleParentProcessingNode
implements ParameterizableProcessingNode {
-
+
/** The parameters of this node */
private Map parameters;
/** The 'src' attribute */
protected MapStackResolver source;
-
+
/** The action set to call */
private ActionSetNode actionSet;
public ActSetNode(String source) throws PatternException {
this.source = MapStackResolver.getResolver(source);
}
-
+
public void setParameters(Map parameterMap) {
this.parameters = parameterMap;
}
-
+
public void setActionSet(ActionSetNode actionSet) {
this.actionSet = actionSet;
}
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
List mapStack = context.getMapStack();
String resolvedSource = source.resolve(mapStack);
Parameters resolvedParams =
MapStackResolver.buildParameters(this.parameters, mapStack);
Map result = this.actionSet.call(env, context, resolvedSource,
resolvedParams);
-
+
if (PipelinesNode.getRedirector(env).hasRedirected()) {
return true;
-
+
} else if (result == null) {
return false;
-
+
} else if (this.children == null) {
return true;
-
+
} else {
return this.invokeNodes(this.children, env, context, result);
}
1.3 +68 -21
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ActTypeNode.java
Index: ActTypeNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ActTypeNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ActTypeNode.java 15 Jan 2002 11:10:54 -0000 1.2
+++ ActTypeNode.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -33,12 +80,12 @@
* Handles <map:act type="..."> (action-sets calls are handled by
[EMAIL PROTECTED] ActSetNode}).
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class ActTypeNode extends SimpleSelectorProcessingNode
implements ParameterizableProcessingNode, Disposable, Composable {
-
+
/** The parameters of this node */
private Map parameters;
@@ -52,22 +99,22 @@
super(name);
this.source = MapStackResolver.getResolver(source);
}
-
+
public void setParameters(Map parameterMap) {
this.parameters = parameterMap;
}
public void compose(ComponentManager manager) throws ComponentException {
-
+
setSelector((ComponentSelector)manager.lookup(Action.ROLE +
"Selector"));
// Get the action, if it's thread safe
this.threadSafeAction = (Action)this.getThreadSafeComponent();
}
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
// Prepare data needed by the action
Map objectModel = env.getObjectModel();
SitemapRedirector redirector = PipelinesNode.getRedirector(env);
@@ -75,33 +122,33 @@
List mapStack = context.getMapStack();
String resolvedSource = source.resolve(mapStack);
Parameters resolvedParams =
MapStackResolver.buildParameters(this.parameters, mapStack);
-
+
Map actionResult;
-
+
// If action is ThreadSafe, avoid select() and try/catch block
(faster !)
if (this.threadSafeAction != null) {
actionResult = this.threadSafeAction.act(
redirector, resolver, objectModel, resolvedSource,
resolvedParams );
-
+
} else {
Action action = (Action)this.selector.select(this.componentName);
try {
actionResult = action.act(
redirector, resolver, objectModel, resolvedSource,
resolvedParams );
-
+
} finally {
this.selector.release(action);
}
}
-
+
if (redirector.hasRedirected()) {
return true;
}
-
+
if (actionResult == null) {
// Action failed
return false;
-
+
} else {
// Action succeeded : process children if there are some, with
the action result
if (this.children != null) {
@@ -113,7 +160,7 @@
}
}
}
-
+
public void dispose() {
if (this.threadSafeAction != null) {
this.selector.release(this.threadSafeAction);
1.3 +76 -30
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ActionSetNode.java
Index: ActionSetNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ActionSetNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ActionSetNode.java 15 Jan 2002 11:10:54 -0000 1.2
+++ ActionSetNode.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
import org.apache.avalon.framework.activity.Disposable;
@@ -32,21 +78,21 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class ActionSetNode extends SimpleSelectorProcessingNode
implements Disposable, NamedProcessingNode, Composable {
-
+
/** The action types */
private String[] types;
-
+
/** The 'action' attribute for each action */
private String[] actionNames;
-
+
/** The actions that are ThreadSafe, to avoid lookups */
private Action[] threadSafeActions;
-
+
public ActionSetNode(String name, String[] types, String[] actionNames) {
super(name);
this.types = types;
@@ -54,58 +100,58 @@
}
public void compose(ComponentManager manager) throws ComponentException {
-
+
setSelector((ComponentSelector)manager.lookup(Action.ROLE +
"Selector"));
// Get all actions that are thread safe
this.threadSafeActions = new Action[types.length];
-
+
for (int i = 0; i < this.types.length; i++) {
this.threadSafeActions[i] =
(Action)this.getThreadSafeComponent(this.types[i]);
}
}
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
String msg = "An action-set cannot be invoked, at " +
this.getLocation();
getLogger().error(msg);
throw new UnsupportedOperationException(msg);
}
-
+
/**
* Call the actions composing the action-set and return the combined
result of
* these actions.
*/
public final Map call(Environment env, InvokeContext context, String
source, Parameters params) throws Exception {
-
+
// Prepare data needed by the actions
Map objectModel = env.getObjectModel();
SitemapRedirector redirector = PipelinesNode.getRedirector(env);
SourceResolver resolver = getSourceResolver(objectModel);
-
+
String cocoonAction = env.getAction();
-
+
Map result = null;
-
+
// Call each action that either has no cocoonAction, or whose
cocoonAction equals
// the one from the environment.
-
+
for (int i = 0; i < types.length; i++) {
-
+
Map actionResult;
Action action;
-
+
String actionName = actionNames[i];
if (actionName == null || actionName.equals(cocoonAction)) {
-
+
// If action is ThreadSafe, avoid select() and try/catch
block (faster !)
if ((action = this.threadSafeActions[i]) != null) {
-
+
actionResult = action.act(
redirector, resolver, objectModel, source, params);
} else {
-
+
action =
(Action)this.selector.select(this.componentName);
try {
actionResult = action.act(
@@ -114,7 +160,7 @@
this.selector.release(action);
}
}
-
+
if (actionResult != null) {
// Merge the result in the global result, creating it if
necessary.
if (result == null) {
@@ -125,10 +171,10 @@
}
} // if (actionName...
} // for (int i...
-
+
return result;
}
-
+
public void dispose() {
// Dispose all ThreadSafe actions
for (int i = 0; i < this.threadSafeActions.length; i++) {
1.3 +64 -17
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ActionSetNodeBuilder.java
Index: ActionSetNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ActionSetNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ActionSetNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ ActionSetNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -26,7 +73,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class ActionSetNodeBuilder extends AbstractProcessingNodeBuilder
implements ThreadSafe {
@@ -34,27 +81,27 @@
private ComponentManager manager;
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
String actionSetName = config.getAttribute("name");
-
+
// Lists of action types and names for each map:act
List actionTypes = new ArrayList();
List actionNames = new ArrayList();
-
+
Configuration[] childrenConfig = config.getChildren();
for (int i = 0; i < childrenConfig.length; i++) {
-
+
Configuration childConfig = childrenConfig[i];
String name = childConfig.getName();
-
+
if ("act".equals(name)) {
checkNamespace(childConfig);
String type =
this.treeBuilder.getTypeForStatement(childConfig, Action.ROLE + "Selector");
-
+
actionTypes.add(type);
actionNames.add(childConfig.getAttribute("action", null));
-
+
} else {
// Unknown element
String msg = "Unknown element " + name + " in action-set at
" + childConfig.getLocation();
@@ -62,10 +109,10 @@
throw new ConfigurationException(msg);
}
}
-
+
String[] types = (String[])actionTypes.toArray(new
String[actionTypes.size()]);
String[] actions = (String[])actionNames.toArray(new
String[actionNames.size()]);
-
+
ActionSetNode node = new ActionSetNode(actionSetName, types,
actions);
this.treeBuilder.setupNode(node, config);
1.4 +70 -23
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/AggregateNode.java
Index: AggregateNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/AggregateNode.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AggregateNode.java 16 Jan 2002 10:54:12 -0000 1.3
+++ AggregateNode.java 4 Feb 2002 10:21:08 -0000 1.4
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -36,56 +83,56 @@
* </li>
* </ul>
* For more info on aggregation and view, see the mail archive
- * <a
href="http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=100525751417953">here</a>
or
+ * <a
href="http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=100525751417953">here</a>
or
* <a
href="http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=100517130418424">here</a>.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/01/16 10:54:12 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/02/04 10:21:08 $
*/
public class AggregateNode extends AbstractProcessingNode {
-
+
private Part[] parts;
private String element;
private String nsURI;
private String nsPrefix;
-
+
/** Views for each part */
private Map[]partViews;
-
+
/** View for map:aggregate */
private Map views;
-
+
public AggregateNode(String element, String nsURI, String nsPrefix) {
this.element = element;
this.nsURI = nsURI;
this.nsPrefix = nsPrefix;
}
-
+
public void setParts(Part[] parts) {
this.parts = parts;
}
-
+
public void setViews(Map views, Map[]partViews) {
this.views = views;
this.partViews = partViews;
}
-
+
public boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
boolean infoEnabled = getLogger().isInfoEnabled();
-
+
List mapStack = context.getMapStack();
// Setup aggregator
EventPipeline eventPipeline = context.getEventPipeline();
-
+
eventPipeline.setGenerator("!content-aggregator!", null,
Parameters.EMPTY_PARAMETERS);
ContentAggregator aggregator =
(ContentAggregator)eventPipeline.getGenerator();
aggregator.setRootElement(this.element, this.nsURI, this.nsPrefix);
-
+
// Get actual parts, potentially filtered by the view
Part[] actualParts;
String cocoonView = env.getView();
@@ -119,7 +166,7 @@
);
}
}
-
+
// Check aggregate-level view
if (cocoonView != null && this.views != null) {
ProcessingNode viewNode =
(ProcessingNode)this.views.get(cocoonView);
@@ -130,11 +177,11 @@
return viewNode.invoke(env, context);
}
}
-
+
// Return false to continue sitemap invocation
return false;
}
-
+
public static class Part {
public Part(String source, String element, String nsURI, String
nsPrefix, boolean stripRoot)
throws PatternException {
1.3 +76 -29
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/AggregateNodeBuilder.java
Index: AggregateNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/AggregateNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AggregateNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ AggregateNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -22,22 +69,22 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class AggregateNodeBuilder extends AbstractProcessingNodeBuilder
implements LinkedProcessingNodeBuilder {
-
+
/** The collection of views for each part */
private List partViews;
-
+
/** The views for the whole aggregate element */
private Collection views;
-
+
private AggregateNode node;
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
// Get root node data
this.node = new AggregateNode(
config.getAttribute("element"),
@@ -45,27 +92,27 @@
config.getAttribute("prefix", "")
);
this.treeBuilder.setupNode(this.node, config);
-
+
this.views =
((SitemapLanguage)this.treeBuilder).getViewsForStatement("", "", config);
-
+
// Build parts
List parts = new ArrayList();
-
+
this.partViews = new ArrayList();
-
+
Configuration[] childConfigs = config.getChildren();
for (int i = 0; i < childConfigs.length; i++) {
Configuration childConfig = childConfigs[i];
-
+
if (!"part".equals(childConfig.getName())) {
String msg = "Unknown element '" + childConfig.getName() + "
in aggregate ' at " +
childConfig.getLocation();
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
checkNamespace(childConfig);
-
+
parts.add(new AggregateNode.Part(
childConfig.getAttribute("src"),
childConfig.getAttribute("element", ""),
@@ -73,36 +120,36 @@
childConfig.getAttribute("prefix", ""),
childConfig.getAttributeAsBoolean("strip-root", false)
));
-
+
this.partViews.add(((SitemapLanguage)this.treeBuilder).getViewsForStatement("",
"", childConfig));
}
-
+
if (parts.size() == 0) {
String msg = "There must be at least one part in map:aggregate
at " + config.getLocation();
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
AggregateNode.Part[] partArray = (AggregateNode.Part[])parts.toArray(
new AggregateNode.Part[parts.size()]);
-
+
node.setParts(partArray);
-
+
return node;
-
+
}
public void linkNode() throws Exception {
-
+
SitemapLanguage sitemap = (SitemapLanguage)this.treeBuilder;
-
+
// Replace all contents of partViews by the map of views.
Map[] partViewNodes = new Map[this.partViews.size()];
-
+
for (int i = 0; i < partViewNodes.length; i++) {
partViewNodes[i] =
sitemap.getViewNodes((Collection)this.partViews.get(i));
}
-
+
this.node.setViews(sitemap.getViewNodes(this.views), partViewNodes);
}
}
1.3 +66 -19
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/CallNode.java
Index: CallNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/CallNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CallNode.java 15 Jan 2002 11:10:54 -0000 1.2
+++ CallNode.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -27,25 +74,25 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class CallNode extends AbstractProcessingNode
implements Initializable, ParameterizableProcessingNode {
-
+
/** The parameters of this node */
private Map parameters;
/** The 'resource' attribute */
private String resourceName;
-
+
private MapStackResolver resourceResolver;
-
+
/** The category node */
private CategoryNode resources;
-
+
private ProcessingNode resourceNode;
-
+
public void setParameters(Map parameterMap) {
this.parameters = parameterMap;
}
@@ -67,7 +114,7 @@
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
// Resolve parameters
if (this.parameters != null) {
// In redirect-to a level is added to the map stack *only* if the
@@ -75,24 +122,24 @@
Map params = MapStackResolver.resolveMap(this.parameters,
context.getMapStack());
context.pushMap(params);
}
-
+
boolean result;
if (this.resourceNode != null) {
// Static resource name
result = this.resourceNode.invoke(env, context);
-
+
} else {
// Resolved resource name
String name =
this.resourceResolver.resolve(context.getMapStack());
-
+
if (getLogger().isInfoEnabled()) {
getLogger().info("Calling resource " + name);
}
-
+
result = this.resources.invokeByName(name, env, context);
}
-
+
if (this.parameters != null) {
context.popMap();
}
1.3 +61 -14
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/CallNodeBuilder.java
Index: CallNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/CallNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CallNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ CallNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -23,7 +70,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class CallNodeBuilder extends AbstractProcessingNodeBuilder
@@ -31,25 +78,25 @@
private CallNode node;
private String resourceName;
-
+
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
this.resourceName = config.getAttribute("resource");
this.node = new CallNode();
this.treeBuilder.setupNode(this.node, config);
-
+
return this.node;
}
-
+
public void linkNode() throws Exception {
CategoryNode resources =
CategoryNodeBuilder.getCategoryNode(this.treeBuilder, "resources");
-
+
if (resources == null) {
String msg = "This sitemap contains no resources. Cannot call at
" + this.node.getLocation();
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
this.node.setResource(
resources,
this.resourceName
1.3 +56 -10
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ComponentsNodeBuilder.java
Index: ComponentsNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ComponentsNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ComponentsNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ ComponentsNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
import org.apache.avalon.framework.configuration.Configuration;
@@ -17,7 +63,7 @@
* Handles <map:components>. It doesn't actually create a
<code>ProcessingNode</code>.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class ComponentsNodeBuilder extends AbstractProcessingNodeBuilder {
@@ -28,7 +74,7 @@
}
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
// Nothing more here. To be removed ;)
return null;
}
1.2 +87 -40
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ComponentsSelector.java
Index: ComponentsSelector.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ComponentsSelector.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ComponentsSelector.java 15 Jan 2002 11:10:54 -0000 1.1
+++ ComponentsSelector.java 4 Feb 2002 10:21:08 -0000 1.2
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -32,11 +79,11 @@
* Component selector for sitemap components.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/02/04 10:21:08 $
*/
public class ComponentsSelector extends ExtendedComponentSelector implements
OutputComponentSelector {
-
+
public static final int UNKNOWN = -1;
public static final int GENERATOR = 0;
public static final int TRANSFORMER = 1;
@@ -45,7 +92,7 @@
public static final int MATCHER = 4;
public static final int SELECTOR = 5;
public static final int ACTION = 6;
-
+
public static final String[] SELECTOR_ROLES = {
Generator.ROLE + "Selector",
Transformer.ROLE + "Selector",
@@ -55,7 +102,7 @@
Selector.ROLE + "Selector",
Action.ROLE + "Selector"
};
-
+
public static final String[] COMPONENT_NAMES = {
"generator",
"transformer",
@@ -68,24 +115,24 @@
/** The role as an integer */
private int roleId;
-
+
/** The mime-type for hints */
private Map mimeTypes;
-
+
/** The set of known hints, used to add standard components (see
ensureExists) */
private Set knownHints = new HashSet();
-
+
/** The parent selector, if it's of the current class */
private ComponentsSelector parentComponentsSelector;
-
+
public void setParentSelector(ComponentSelector selector) {
super.setParentSelector(selector);
-
+
if (selector instanceof ComponentsSelector) {
this.parentComponentsSelector = (ComponentsSelector)selector;
}
}
-
+
/**
* Return the component instance name according to the selector role
* (e.g. "action" for "org.apache.cocoon.acting.Action").
@@ -101,10 +148,10 @@
protected String getClassAttributeName() {
return (this.roleId == UNKNOWN) ? "class" : "src";
}
-
+
public void configure(Configuration config) throws
ConfigurationException {
-
+
// How are we ?
String role = getRoleName(config);
this.roleId = UNKNOWN; // unknown
@@ -114,17 +161,17 @@
break;
}
}
-
+
if (getLogger().isDebugEnabled()) {
getLogger().debug("Setting up sitemap component selector for " +
role + " (role id = " + this.roleId + ")");
}
-
+
// Only matchers and serializers can have a MIME type
if (this.roleId == SERIALIZER || this.roleId == READER) {
this.mimeTypes = new HashMap();
}
-
+
super.configure(config);
}
@@ -132,12 +179,12 @@
* Add a component in this selector. If needed, also register it's MIME
type.
*/
public void addComponent(Object hint, Class clazz, Configuration config)
throws ComponentException {
-
+
super.addComponent(hint, clazz, config);
// Add to known hints
this.knownHints.add(hint);
-
+
if (this.roleId == SERIALIZER || this.roleId == READER) {
// Get mime-type
String mimeType = config.getAttribute("mime-type", null);
@@ -146,18 +193,18 @@
}
}
}
-
+
/**
* Ensure system-defined components exist (e.g. !content-aggregator!)
and initialize
* the selector.
*/
public void initialize() /*throws Exception*/ {
-
+
// FIXME : need to catch exceptions since ECS doesn't propagate the
throws clause of Initializable
try {
-
+
Configuration emptyConfig = new DefaultConfiguration("", "");
-
+
// Ensure all system-defined hints exist.
// NOTE : checking this here means they can be user-defined in the
sitemap
switch(this.roleId) {
@@ -168,31 +215,31 @@
ensureExists("!content-aggregator!",
org.apache.cocoon.sitemap.ContentAggregator.class,
emptyConfig);
break;
-
+
case TRANSFORMER :
ensureExists("!link-translator!",
org.apache.cocoon.sitemap.LinkTranslator.class,
emptyConfig);
break;
}
-
+
super.initialize();
-
+
// Don't keep known hints (they're no more needed)
this.knownHints = null;
-
+
} catch(Exception e) {
throw new CascadingRuntimeException("Cannot setup default
components", e);
}
-
+
}
-
+
/**
* Ensure a component exists or add it otherwhise. We cannot simply call
hasComponent()
* since it requires to be initialized, and we want to add components,
and this must
* be done before initialization.
*/
private void ensureExists(Object hint, Class clazz, Configuration
config) throws ComponentException {
-
+
if (! this.knownHints.contains(hint)) {
this.addComponent(hint, clazz, config);
}
@@ -202,19 +249,19 @@
* Get the MIME type for a given hint.
*/
public String getMimeTypeForHint(Object hint) {
-
+
if (this.mimeTypes == null) {
return null;
-
+
} else {
String mimeType = (String)this.mimeTypes.get(hint);
-
+
if (mimeType != null) {
return mimeType;
-
+
} else if (this.parentComponentsSelector != null) {
return
this.parentComponentsSelector.getMimeTypeForHint(hint);
-
+
} else {
return null;
}
1.4 +69 -23
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/GenerateNode.java
Index: GenerateNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/GenerateNode.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- GenerateNode.java 30 Jan 2002 14:35:07 -0000 1.3
+++ GenerateNode.java 4 Feb 2002 10:21:08 -0000 1.4
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
import org.apache.cocoon.components.pipeline.EventPipeline;
@@ -24,19 +70,19 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/01/30 14:35:07 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/02/04 10:21:08 $
*/
public class GenerateNode extends AbstractProcessingNode implements
ParameterizableProcessingNode {
private String generatorName;
-
+
private MapStackResolver source;
-
+
private Map parameters;
-
+
private Map views;
-
+
/** The category node */
private CategoryNode viewsNode;
@@ -44,35 +90,35 @@
this.generatorName = name;
this.source = MapStackResolver.getResolver(source);
}
-
+
public void setParameters(Map parameterMap) {
this.parameters = parameterMap;
}
-
+
public void setViews(Map views) {
this.views = views;
}
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
List mapStack = context.getMapStack();
-
+
context.getEventPipeline().setGenerator(
this.generatorName,
source.resolve(mapStack),
MapStackResolver.buildParameters(this.parameters, mapStack)
);
-
+
// Check view
if (this.views != null) {
-
+
String cocoonView = env.getView();
if (cocoonView != null) {
-
+
// Get view node
ProcessingNode viewNode =
(ProcessingNode)this.views.get(cocoonView);
-
+
if (viewNode != null) {
if (getLogger().isInfoEnabled()) {
getLogger().info("Jumping to view " + cocoonView + "
from generator at " + this.getLocation());
@@ -81,7 +127,7 @@
}
}
}
-
+
// Return false to contine sitemap invocation
return false;
}
1.3 +62 -16
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/GenerateNodeBuilder.java
Index: GenerateNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/GenerateNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GenerateNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ GenerateNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
import org.apache.avalon.framework.configuration.Configuration;
@@ -21,26 +67,26 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class GenerateNodeBuilder extends AbstractProcessingNodeBuilder
implements LinkedProcessingNodeBuilder {
private GenerateNode node;
-
+
private Collection views;
-
+
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
String type = this.treeBuilder.getTypeForStatement(config,
Generator.ROLE + "Selector");
-
+
this.views =
((SitemapLanguage)this.treeBuilder).getViewsForStatement(Generator.ROLE, type,
config);
-
- this.node = new GenerateNode(type, config.getAttribute("src",
null));
+
+ this.node = new GenerateNode(type, config.getAttribute("src", null));
return this.treeBuilder.setupNode(this.node, config);
}
-
+
public void linkNode() throws Exception {
this.node.setViews(
((SitemapLanguage)this.treeBuilder).getViewNodes(this.views)
1.3 +62 -16
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/HandleErrorsNode.java
Index: HandleErrorsNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/HandleErrorsNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HandleErrorsNode.java 15 Jan 2002 11:10:54 -0000 1.2
+++ HandleErrorsNode.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
import org.apache.avalon.framework.activity.Disposable;
@@ -26,36 +72,36 @@
* Handles <map:handle-errors>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public final class HandleErrorsNode extends AbstractParentProcessingNode {
private ProcessingNode[] children;
private int statusCode;
-
+
public HandleErrorsNode(int statusCode) {
this.statusCode = statusCode;
}
-
+
public int getStatusCode() {
return this.statusCode;
}
-
+
public void setChildren(ProcessingNode[] nodes)
{
this.children = nodes;
}
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
if (getLogger().isInfoEnabled()) {
getLogger().info("Processing handle-errors at " + getLocation());
}
-
+
context.getEventPipeline().setGenerator("!notifying-generator!", "",
Parameters.EMPTY_PARAMETERS);
-
+
return invokeNodes(this.children, env, context);
}
}
1.3 +60 -14
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/HandleErrorsNodeBuilder.java
Index: HandleErrorsNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/HandleErrorsNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HandleErrorsNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ HandleErrorsNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
import org.apache.avalon.framework.configuration.Configuration;
@@ -18,7 +64,7 @@
* Builds a <map:handle-errors>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class HandleErrorsNodeBuilder extends
AbstractParentProcessingNodeBuilder implements ThreadSafe {
@@ -27,15 +73,15 @@
protected boolean hasParameters() {
return false;
}
-
+
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
HandleErrorsNode node = new
HandleErrorsNode(config.getAttributeAsInteger("type", 500));
this.treeBuilder.setupNode(node, config);
-
+
// Get all children
node.setChildren(buildChildNodes(config));
-
- return node;
+
+ return node;
}
}
1.3 +72 -26
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/MatchNode.java
Index: MatchNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/MatchNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MatchNode.java 15 Jan 2002 11:10:54 -0000 1.2
+++ MatchNode.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
import org.apache.cocoon.environment.Environment;
@@ -29,71 +75,71 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class MatchNode extends SimpleSelectorProcessingNode implements
ParameterizableProcessingNode, Composable {
-
+
/** The 'pattern' attribute */
private MapStackResolver pattern;
-
+
/** The matcher, if it's ThreadSafe */
private Matcher threadSafeMatcher;
-
+
private Map parameters;
-
+
public MatchNode(String name, String pattern) throws PatternException {
super(name);
this.pattern = MapStackResolver.getResolver(pattern);
}
-
+
public void setParameters(Map parameterMap) {
this.parameters = parameterMap;
}
public void compose(ComponentManager manager) throws ComponentException {
-
+
super.setSelector((ComponentSelector)manager.lookup(Matcher.ROLE +
"Selector"));
-
+
// Get matcher if it's ThreadSafe
this.threadSafeMatcher = (Matcher)this.getThreadSafeComponent();
}
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
List mapStack = context.getMapStack();
-
+
String resolvedPattern = pattern.resolve(mapStack);
Map objectModel = env.getObjectModel();
Parameters resolvedParams =
MapStackResolver.buildParameters(this.parameters, mapStack);
-
+
Map result = null;
-
+
if (this.threadSafeMatcher != null) {
// Avoid select() and try/catch block (faster !)
result = this.threadSafeMatcher.match(resolvedPattern,
objectModel, resolvedParams);
-
+
} else {
// Get matcher from selector
Matcher matcher =
(Matcher)this.selector.select(this.componentName);
try {
result = matcher.match(resolvedPattern, objectModel,
resolvedParams);
-
+
} finally {
this.selector.release(matcher);
}
}
-
+
if (result != null) {
if (getLogger().isInfoEnabled()) {
getLogger().info("Matcher '" + this.componentName + "'
matched pattern '" + this.pattern +
"' at " + this.getLocation());
}
-
+
// Invoke children with the matcher results
return this.invokeNodes(children, env, context, result);
-
+
} else {
// Matcher failed
return false;
1.4 +65 -19
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/MatchNodeBuilder.java
Index: MatchNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/MatchNodeBuilder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MatchNodeBuilder.java 1 Feb 2002 14:57:27 -0000 1.3
+++ MatchNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.4
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
import org.apache.avalon.framework.component.ComponentManager;
@@ -27,7 +73,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/02/01 14:57:27 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/02/04 10:21:08 $
*/
public class MatchNodeBuilder extends AbstractParentProcessingNodeBuilder
@@ -42,40 +88,40 @@
}
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
String pattern = config.getAttribute("pattern", null);
-
+
String type = this.treeBuilder.getTypeForStatement(config,
SELECTOR_ROLE);
// Get the type and class for this matcher
ComponentsSelector selector =
(ComponentsSelector)this.manager.lookup(SELECTOR_ROLE);
-
+
// Find matcher class
Matcher matcher = (Matcher)selector.select(type);
Class clazz = matcher.getClass();
selector.release(matcher);
-
+
// PreparableMatcher are only prepared if pattern doesn't need
request-time resolution.
boolean preparable =
PreparableMatcher.class.isAssignableFrom(clazz) &&
!MapStackResolver.needsResolve(pattern);
-
+
// Instanciate appropriate node
SimpleSelectorProcessingNode node;
-
+
if (preparable) {
node = new PreparableMatchNode(type, pattern);
} else {
node = new MatchNode(type, pattern);
}
-
+
this.treeBuilder.setupNode(node, config);
-
+
// Get all children
ProcessingNode[] children = buildChildNodes(config);
-
+
node.setChildren(children);
-
+
return node;
}
}
1.2 +73 -26
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/MountNode.java
Index: MountNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/MountNode.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MountNode.java 3 Jan 2002 12:31:37 -0000 1.1
+++ MountNode.java 4 Feb 2002 10:21:08 -0000 1.2
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -28,29 +75,29 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/01/03 12:31:37 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/02/04 10:21:08 $
*/
public class MountNode extends AbstractProcessingNode implements Composable {
-
+
/** The 'uri-prefix' attribute */
private MapStackResolver prefix;
-
+
/** The 'src' attribute */
private MapStackResolver source;
-
+
/** Processors for sources */
private Map processors = new HashMap();
-
+
/** The processor for this node */
private TreeProcessor parentProcessor;
-
+
/** The language for the mounted processor */
private String language;
-
+
/** The component manager to be used by the mounted processor */
private ComponentManager manager;
-
+
public MountNode(String prefix, String source, String language,
TreeProcessor parentProcessor)
throws PatternException {
this.prefix = MapStackResolver.getResolver(prefix);
@@ -62,18 +109,18 @@
public void compose(ComponentManager manager) throws ComponentException {
this.manager = manager;
}
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
List mapStack = context.getMapStack();
-
+
String resolvedSource = this.source.resolve(mapStack);
TreeProcessor processor =
(TreeProcessor)processors.get(resolvedSource);
if (processor == null) {
processor = getProcessor(resolvedSource);
}
-
+
String resolvedPrefix = this.prefix.resolve(mapStack);
String oldPrefix = env.getURIPrefix();
@@ -88,29 +135,29 @@
// Processor will create its own pipelines
return processor.process(env);
}
-
+
} finally {
// Restore context
env.setContext(oldPrefix, oldURI);
-
+
// Recompose pipelines which may have been recomposed by
subsitemap
context.recompose(this.manager);
}
}
-
+
private synchronized TreeProcessor getProcessor(String source) throws
Exception {
TreeProcessor processor = (TreeProcessor)processors.get(source);
-
+
if (processor == null) {
-
+
processor =
this.parentProcessor.createChildProcessor(this.manager, this.language);
processors.put(source, processor);
}
-
+
return processor;
}
-
+
public void dispose() {
Iterator iter = this.processors.values().iterator();
while(iter.hasNext()) {
1.3 +56 -9
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/MountNodeBuilder.java
Index: MountNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/MountNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MountNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ MountNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -17,7 +64,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class MountNodeBuilder extends AbstractProcessingNodeBuilder
implements ThreadSafe {
@@ -28,7 +75,7 @@
}
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
MountNode node = new MountNode(
config.getAttribute("uri-prefix"),
config.getAttribute("src"),
1.4 +85 -38
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/PipelineNode.java
Index: PipelineNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/PipelineNode.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PipelineNode.java 15 Jan 2002 11:10:54 -0000 1.3
+++ PipelineNode.java 4 Feb 2002 10:21:08 -0000 1.4
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -31,70 +78,70 @@
import java.util.*;
/**
- *
+ *
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/02/04 10:21:08 $
*/
public class PipelineNode extends AbstractParentProcessingNode implements
Composable {
// TODO : handle a 'fail-hard' environment attribute
// can be useful to stop off-line generation when there's an error
-
+
private ProcessingNode[] children;
-
+
private ProcessingNode error404;
-
+
private ProcessingNode error500;
private ComponentManager manager;
-
+
private boolean internalOnly = false;
-
+
/** Is it the last <pipeline> in the enclosing <pipelines> ? */
private boolean isLast = false;
-
+
/**
* The component manager is used to create error pipelines
*/
public void compose(ComponentManager manager) {
this.manager = manager;
}
-
+
public void setChildren(ProcessingNode[] nodes)
{
this.children = nodes;
}
-
+
public void setLast(boolean isLast) {
this.isLast = isLast;
}
-
+
public void set404Handler(ProcessingNode node)
{
this.error404 = node;
}
-
+
public void set500Handler(ProcessingNode node)
{
this.error500 = node;
}
-
+
public void setInternalOnly(boolean internalOnly) {
this.internalOnly = internalOnly;
}
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
// Always fail on external resquests if internal only.
if (this.internalOnly && !context.isInternalRequest()) {
return false;
}
-
+
try {
-
+
if (invokeNodes(children, env, context)) {
return true;
} else if (this.isLast) {
@@ -104,70 +151,70 @@
} else {
return false;
}
-
+
} catch (ConnectionResetException cre) {
// Will be reported by CocoonServlet, rethrowing
throw cre;
} catch(ResourceNotFoundException rnfe) {
getLogger().warn("Resource not found in pipeline at " +
getLocation(), rnfe);
-
+
if (error404 != null) {
// There's a handler
return invokeErrorHandler(error404, rnfe, env);
-
+
} else {
// No handler : propagate
throw rnfe;
}
} catch(Exception e) {
-
+
// Rethrow exception for internal requests
if (error500 != null && !context.isInternalRequest()) {
-
+
getLogger().warn("Error while processing pipeline at " +
getLocation(), e);
-
+
return invokeErrorHandler(error500, e, env);
-
+
} else {
// No handler : propagate
-
+
getLogger().error("Error while processing pipeline at " +
getLocation(), e);
throw e;
}
}
}
-
+
private boolean invokeErrorHandler(ProcessingNode node, Exception ex,
Environment env)
throws Exception {
InvokeContext errorContext = null;
-
+
try {
// Try to reset the response to avoid mixing already produced
output
// and error page.
env.tryResetResponse();
-
+
// Build a new context
errorContext = new InvokeContext();
errorContext.compose(this.manager);
-
+
// Create a Notifying
NotifyingBuilder notifyingBuilder=
(NotifyingBuilder)this.manager.lookup(NotifyingBuilder.ROLE);
Notifying currentNotifying = notifyingBuilder.build(this, ex);
this.manager.release(notifyingBuilder);
-
+
// Add it to the object model
env.getObjectModel().put(Constants.NOTIFYING_OBJECT,
currentNotifying );
// notifying-generator is added in HandleErrorsNode
return node.invoke(env, errorContext);
-
+
} catch (Exception subEx) {
getLogger().error("error notifier barfs", subEx);
return false;
-
+
} finally {
if (errorContext != null) {
errorContext.dispose();
1.3 +65 -18
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/PipelineNodeBuilder.java
Index: PipelineNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/PipelineNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PipelineNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ PipelineNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -20,9 +67,9 @@
/**
* Builds a <map:pipeline>
-
+
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class PipelineNodeBuilder extends AbstractParentProcessingNodeBuilder
implements ThreadSafe {
@@ -33,7 +80,7 @@
}
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
PipelineNode node = new PipelineNode();
this.treeBuilder.setupNode(node, config);
@@ -41,30 +88,30 @@
ProcessingNode error404Handler = null;
ProcessingNode error500Handler = null;
-
+
Configuration[] childConfigs = config.getChildren();
List children = new ArrayList();
-
+
childLoop : for (int i = 0; i < childConfigs.length; i++) {
Configuration childConfig = childConfigs[i];
if (!isChild(childConfig)) {
continue childLoop;
}
-
+
ProcessingNodeBuilder builder =
this.treeBuilder.createNodeBuilder(childConfig);
-
+
if (builder instanceof HandleErrorsNodeBuilder) {
// Error handler : check type
HandleErrorsNode handler =
(HandleErrorsNode)builder.buildNode(childConfig);
int type = handler.getStatusCode();
-
+
if ( (type == 404 && error404Handler != null) ||
(type == 500 && error500Handler != null) ) {
String msg = "Duplicate handle-errors at " +
handler.getLocation();
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
if (type == 404) {
error404Handler = handler;
} else if (type == 500) {
@@ -80,11 +127,11 @@
children.add(builder.buildNode(childConfig));
}
}
-
+
node.setChildren(toNodeArray(children));
node.set404Handler(error404Handler);
node.set500Handler(error500Handler);
-
+
return node;
}
1.4 +68 -21
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/PipelinesNode.java
Index: PipelinesNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/PipelinesNode.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PipelinesNode.java 30 Jan 2002 14:35:07 -0000 1.3
+++ PipelinesNode.java 4 Feb 2002 10:21:08 -0000 1.4
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -31,16 +78,16 @@
* Handles <map:pipelines>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/01/30 14:35:07 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/02/04 10:21:08 $
*/
public final class PipelinesNode extends SimpleParentProcessingNode
implements Composable, Disposable {
private static final String REDIRECTOR_ATTR = "sitemap:redirector";
-
+
private ComponentManager manager;
-
+
/**
* Keep the component manager used everywhere in the tree so that we can
* cleanly dispose it.
@@ -53,14 +100,14 @@
{
// Mark the last pipeline so that it can throw a
ResourceNotFoundException
((PipelineNode)nodes[nodes.length - 1]).setLast(true);
-
+
super.setChildren(nodes);
}
public static SitemapRedirector getRedirector(Environment env) {
return (SitemapRedirector)env.getAttribute(REDIRECTOR_ATTR);
}
-
+
/**
* Process the environment. Also adds an
<code>EnvironmentSourceResolver</code>
* and a <code>Redirector</code> in the object model. The previous
resolver and
@@ -68,20 +115,20 @@
*/
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
// Recompose context (and pipelines) to the local component manager
context.recompose(this.manager);
// Create the source resolver relative to the environment.
-
+
// Design note : creating the SourceResolver could also have been
done
// in TreeProcessor.invoke(), but doing it here ensures we use the
local
// component manager used by all other nodes.
EnvironmentSourceResolver resolver = new
EnvironmentSourceResolver(this.manager, env);
SitemapRedirector redirector = new SitemapRedirector(env);
-
+
Map objectModel = env.getObjectModel();
-
+
Object oldResolver = objectModel.get(OBJECT_SOURCE_RESOLVER);
Object oldRedirector = env.getAttribute(REDIRECTOR_ATTR);
@@ -91,20 +138,20 @@
try {
// FIXME : is there any useful information that can be passed as
top-level parameters,
// such as the URI of the mount point ?
-
+
return invokeNodes(this.children, env, context);
-
+
} finally {
// Restore old redirector and resolver
env.setAttribute(REDIRECTOR_ATTR, oldRedirector);
objectModel.put(OBJECT_SOURCE_RESOLVER, oldResolver);
-
+
// Dispose the resolver
resolver.dispose();
}
}
-
+
/**
* Dispose the component manager.
*/
@@ -112,5 +159,5 @@
if (this.manager instanceof Disposable) {
((Disposable)this.manager).dispose();
}
- }
+ }
}
1.3 +58 -11
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/PipelinesNodeBuilder.java
Index: PipelinesNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/PipelinesNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PipelinesNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ PipelinesNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -19,7 +66,7 @@
* Builds a <map:pipelines>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class PipelinesNodeBuilder extends ContainerNodeBuilder implements
ThreadSafe {
@@ -27,16 +74,16 @@
public ProcessingNode buildNode(Configuration config) throws Exception {
PipelinesNode node = new PipelinesNode();
this.treeBuilder.setupNode(node, config);
-
+
ProcessingNode[] children = buildChildNodes(config);
if (children.length == 0) {
String msg = "There must be at least one pipeline at " +
config.getLocation();
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
node.setChildren(children);
-
+
return node;
}
}
1.3 +74 -27
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/PreparableMatchNode.java
Index: PreparableMatchNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/PreparableMatchNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PreparableMatchNode.java 15 Jan 2002 11:10:54 -0000 1.2
+++ PreparableMatchNode.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -30,26 +77,26 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class PreparableMatchNode extends SimpleSelectorProcessingNode
implements ParameterizableProcessingNode, Composable {
-
+
/** The 'pattern' attribute */
private String pattern;
-
+
private Object preparedPattern;
-
+
private Map parameters;
-
+
/** The matcher, if it's ThreadSafe */
private PreparableMatcher threadSafeMatcher;
-
+
public PreparableMatchNode(String name, String pattern) throws
PatternException {
super(name);
this.pattern = pattern;
}
-
+
public void setParameters(Map parameterMap) {
this.parameters = parameterMap;
}
@@ -58,17 +105,17 @@
public void compose(ComponentManager manager) throws ComponentException {
setSelector((ComponentSelector)manager.lookup(Matcher.ROLE +
"Selector"));
-
+
// Prepare the pattern, and keep matcher if ThreadSafe
PreparableMatcher matcher =
(PreparableMatcher)selector.select(componentName);
-
+
if (matcher instanceof ThreadSafe) {
this.threadSafeMatcher = matcher;
}
-
+
try {
this.preparedPattern =
matcher.preparePattern(MapStackResolver.unescape(this.pattern));
-
+
} catch(PatternException pe) {
String msg = "Invalid pattern '" + this.pattern + "' for matcher
at " + this.getLocation();
getLogger().error(msg, pe);
@@ -80,39 +127,39 @@
}
}
}
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
Map objectModel = env.getObjectModel();
Parameters resolvedParams =
MapStackResolver.buildParameters(this.parameters, context.getMapStack());
-
+
Map result = null;
-
+
if (this.threadSafeMatcher != null) {
// Avoid select() and try/catch block (faster !)
result = this.threadSafeMatcher.preparedMatch(preparedPattern,
objectModel, resolvedParams);
-
+
} else {
// Get matcher from selector
PreparableMatcher matcher =
(PreparableMatcher)this.selector.select(this.componentName);
try {
result = matcher.preparedMatch(preparedPattern, objectModel,
resolvedParams);
-
+
} finally {
this.selector.release(matcher);
}
}
-
+
if (result != null) {
if (getLogger().isInfoEnabled()) {
getLogger().info("Matcher '" + this.componentName + "'
matched prepared pattern '" +
this.pattern + "' at " + this.getLocation());
}
-
+
// Invoke children with the matcher results
return this.invokeNodes(children, env, context, result);
-
+
} else {
// Matcher failed
return false;
1.3 +68 -22
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ReadNode.java
Index: ReadNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ReadNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ReadNode.java 15 Jan 2002 11:10:54 -0000 1.2
+++ ReadNode.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
import org.apache.cocoon.components.pipeline.StreamPipeline;
@@ -23,21 +69,21 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class ReadNode extends AbstractProcessingNode implements
ParameterizableProcessingNode {
private String readerName;
-
+
private MapStackResolver source;
-
+
private String mimeType;
-
+
private int statusCode;
-
+
private Map parameters;
-
+
/**
* Build a <code>SerializerNode</code> having a name, a mime-type and a
status code (HTTP codes).
*
@@ -51,18 +97,18 @@
this.mimeType = mimeType;
this.statusCode = statusCode;
}
-
+
public void setParameters(Map parameterMap) {
this.parameters = parameterMap;
}
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
List mapStack = context.getMapStack();
-
+
StreamPipeline pipeline = context.getStreamPipeline();
-
+
if (this.mimeType == null) {
// No mime-type set on node
pipeline.setReader(
@@ -70,7 +116,7 @@
source.resolve(mapStack),
MapStackResolver.buildParameters(this.parameters, mapStack)
);
-
+
} else {
// mime-type set on node
pipeline.setReader(
@@ -80,16 +126,16 @@
this.mimeType
);
}
-
+
// Set status code if there is one
if (this.statusCode >= 0) {
env.setStatus(this.statusCode);
}
-
+
if (! context.isInternalRequest()) {
// Process pipeline
return pipeline.process(env);
-
+
} else {
// Return true : pipeline is finished.
return true;
1.3 +57 -10
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ReadNodeBuilder.java
Index: ReadNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ReadNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ReadNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ ReadNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -20,15 +67,15 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class ReadNodeBuilder extends AbstractProcessingNodeBuilder
implements ThreadSafe {
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
String type = this.treeBuilder.getTypeForStatement(config,
Reader.ROLE + "Selector");
-
+
ReadNode node = new ReadNode(
type,
config.getAttribute("src", null),
1.3 +64 -18
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/RedirectToNodeBuilder.java
Index: RedirectToNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/RedirectToNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RedirectToNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ RedirectToNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
import org.apache.avalon.framework.configuration.Configuration;
@@ -23,7 +69,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class RedirectToNodeBuilder extends AbstractProcessingNodeBuilder
@@ -31,25 +77,25 @@
private CallNode callNode;
private String resourceName;
-
+
/** This builder has no parameters -- return <code>false</code> */
protected boolean hasParameters() {
return false;
}
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
// Is it a redirect to resource ?
String uri = config.getAttribute("uri", null);
if (uri != null) {
- ProcessingNode URINode = new RedirectToURINode(uri,
config.getAttributeAsBoolean("session", false));
+ ProcessingNode URINode = new RedirectToURINode(uri,
config.getAttributeAsBoolean("session", false));
return this.treeBuilder.setupNode(URINode, config);
-
+
} else {
this.resourceName = config.getAttribute("resource");
this.callNode = new CallNode();
this.treeBuilder.setupNode(this.callNode, config);
-
+
String target = config.getAttribute("target", null);
if (target != null) {
Map params = new HashMap(1);
@@ -59,19 +105,19 @@
return this.callNode;
}
}
-
+
public void linkNode() throws Exception {
-
+
if (this.callNode != null) {
CategoryNode resources =
CategoryNodeBuilder.getCategoryNode(this.treeBuilder, "resources");
-
+
if (resources == null) {
String msg = "This sitemap contains no resources. Cannot
redirect at " +
this.callNode.getLocation();
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
this.callNode.setResource(
resources,
this.resourceName
1.3 +59 -12
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/RedirectToURINode.java
Index: RedirectToURINode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/RedirectToURINode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RedirectToURINode.java 15 Jan 2002 11:10:54 -0000 1.2
+++ RedirectToURINode.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -24,24 +71,24 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class RedirectToURINode extends AbstractProcessingNode {
-
+
/** The 'uri' attribute */
private MapStackResolver uri;
-
+
private boolean keepSession;
public RedirectToURINode(String uri, boolean keepSession) throws
PatternException {
this.uri = MapStackResolver.getResolver(uri);
}
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
String resolvedURI = uri.resolve(context.getMapStack());
-
+
if (getLogger().isInfoEnabled()) {
getLogger().info("Redirecting to '" + resolvedURI + "' at " +
this.getLocation());
}
1.3 +73 -26
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SelectNode.java
Index: SelectNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SelectNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SelectNode.java 15 Jan 2002 11:10:54 -0000 1.2
+++ SelectNode.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -35,31 +82,31 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class SelectNode extends SimpleSelectorProcessingNode
implements ParameterizableProcessingNode, Composable, Disposable {
-
+
/** The parameters of this node */
private Map parameters;
/** Selector where to get Actions from */
protected ComponentSelector componentSelector;
-
+
/** Pre-selected selector, if it's ThreadSafe */
protected Selector threadSafeSelector;
-
+
private ProcessingNode[][] whenNodes;
-
+
private MapStackResolver[] whenTests;
-
+
private ProcessingNode[] otherwhiseNodes;
public SelectNode(String name) throws PatternException {
super(name);
}
-
+
public void setParameters(Map parameterMap) {
this.parameters = parameterMap;
}
@@ -71,24 +118,24 @@
}
public void compose(ComponentManager manager) throws ComponentException {
-
+
setSelector((ComponentSelector)manager.lookup(Selector.ROLE));
-
+
// Get the selector, if it's ThreadSafe
this.threadSafeSelector = (Selector)this.getThreadSafeComponent();
}
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
// Prepare data needed by the action
Map objectModel = env.getObjectModel();
List mapStack = context.getMapStack();
Parameters resolvedParams =
MapStackResolver.buildParameters(this.parameters, mapStack);
-
+
// If selector is ThreadSafe, avoid select() and try/catch block
(faster !)
if (this.threadSafeSelector != null) {
-
+
for (int i = 0; i < this.whenTests.length; i++) {
if (this.threadSafeSelector.select(
whenTests[i].resolve(mapStack),
@@ -97,13 +144,13 @@
return invokeNodes(this.whenNodes[i], env, context);
}
}
-
+
if (this.otherwhiseNodes != null) {
return invokeNodes(this.otherwhiseNodes, env, context);
}
-
+
return false;
-
+
} else {
Selector selector =
(Selector)this.componentSelector.select(this.componentName);
try {
@@ -116,18 +163,18 @@
return invokeNodes(this.whenNodes[i], env, context);
}
}
-
+
if (this.otherwhiseNodes != null) {
return invokeNodes(this.otherwhiseNodes, env, context);
}
-
+
return false;
} finally {
this.componentSelector.release(selector);
}
}
}
-
+
public void dispose() {
if (this.threadSafeSelector != null) {
this.componentSelector.release(this.threadSafeSelector);
1.3 +70 -23
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SelectNodeBuilder.java
Index: SelectNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SelectNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SelectNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ SelectNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -27,7 +74,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class SelectNodeBuilder extends AbstractParentProcessingNodeBuilder
implements ThreadSafe {
@@ -36,46 +83,46 @@
private SelectNode node;
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
String type = this.treeBuilder.getTypeForStatement(config,
Selector.ROLE + "Selector");
-
+
this.node = new SelectNode(type);
this.treeBuilder.setupNode(this.node, config);
// Selector is set in linkNode() since it isn't visible now
-
+
// Lists of ProcessingNode[] and test resolvers for each "when"
List whenChildren = new ArrayList();
List whenTests = new ArrayList();
-
+
// Nodes for otherwhise (if any)
ProcessingNode[] otherwhiseNodes = null;
-
+
Configuration[] childrenConfig = config.getChildren();
for (int i = 0; i < childrenConfig.length; i++) {
-
+
Configuration childConfig = childrenConfig[i];
String name = childConfig.getName();
-
+
if ("when".equals(name)) {
-
+
checkNamespace(childConfig);
whenTests.add(MapStackResolver.getResolver(childConfig.getAttribute("test")));
whenChildren.add(buildChildNodes(childConfig));
-
+
} else if ("otherwhise".equals(name)) {
-
+
checkNamespace(childConfig);
if (otherwhiseNodes != null) {
String msg = "Duplicate " + name + " (only one is
allowed) at " + childConfig.getLocation();
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
otherwhiseNodes = buildChildNodes(childConfig);
-
+
} else if (isParameter(childConfig)) {
// ignore it. It is handled automatically in setupNode()
-
+
} else {
// Unknown element
String msg = "Unknown element '" + name + "' in select at "
+ childConfig.getLocation();
@@ -83,13 +130,13 @@
throw new ConfigurationException(msg);
}
}
-
+
this.node.setCases(
(ProcessingNode[][])whenChildren.toArray(new
ProcessingNode[0][0]),
(MapStackResolver[])whenTests.toArray(new
MapStackResolver[whenTests.size()]),
otherwhiseNodes
);
-
+
return this.node;
}
}
1.5 +69 -22
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SerializeNode.java
Index: SerializeNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SerializeNode.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SerializeNode.java 30 Jan 2002 14:35:07 -0000 1.4
+++ SerializeNode.java 4 Feb 2002 10:21:08 -0000 1.5
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -24,19 +71,19 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.4 $ $Date: 2002/01/30 14:35:07 $
+ * @version CVS $Revision: 1.5 $ $Date: 2002/02/04 10:21:08 $
*/
public class SerializeNode extends AbstractProcessingNode {
private String serializerName;
-
+
private String mimeType;
-
+
private int statusCode;
-
+
private Map views;
-
+
/**
* Build a <code>SerializerNode</code> having a name, a mime-type and a
status code (HTTP codes).
*
@@ -49,22 +96,22 @@
this.mimeType = mimeType;
this.statusCode = statusCode;
}
-
+
public void setViews(Map views) {
this.views = views;
}
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
// Check view
if (this.views != null) {
String cocoonView = env.getView();
if (cocoonView != null) {
-
+
// Get view node
ProcessingNode viewNode =
(ProcessingNode)this.views.get(cocoonView);
-
+
if (viewNode != null) {
if (getLogger().isInfoEnabled()) {
getLogger().info("Jumping to view " + cocoonView + "
from serializer at " + this.getLocation());
@@ -82,7 +129,7 @@
}
StreamPipeline pipeline = context.getStreamPipeline();
-
+
if (this.mimeType == null) {
// No mime-type set on node
pipeline.setSerializer(
@@ -90,7 +137,7 @@
null,
Parameters.EMPTY_PARAMETERS // No parameters on serializers
);
-
+
} else {
// mime-type set on node
pipeline.setSerializer(
@@ -100,16 +147,16 @@
this.mimeType
);
}
-
+
// Set status code if there is one
if (this.statusCode >= 0) {
env.setStatus(this.statusCode);
}
-
+
if (! context.isInternalRequest()) {
// Process pipeline
return pipeline.process(env);
-
+
} else {
// Return true : pipeline is finished.
return true;
1.3 +61 -14
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SerializeNodeBuilder.java
Index: SerializeNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SerializeNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SerializeNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ SerializeNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -23,27 +70,27 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class SerializeNodeBuilder extends AbstractProcessingNodeBuilder
implements LinkedProcessingNodeBuilder {
private SerializeNode node;
-
+
private Collection views;
-
+
/** This builder has no parameters -- return <code>false</code> */
protected boolean hasParameters() {
return false;
}
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
String type = this.treeBuilder.getTypeForStatement(config,
Serializer.ROLE + "Selector");
-
+
this.views =
((SitemapLanguage)this.treeBuilder).getViewsForStatement(Serializer.ROLE, type,
config);
-
+
this.node = new SerializeNode(
type,
config.getAttribute("mime-type", null),
@@ -51,7 +98,7 @@
);
return this.treeBuilder.setupNode(node, config);
}
-
+
public void linkNode() throws Exception {
this.node.setViews(
((SitemapLanguage)this.treeBuilder).getViewNodes(this.views)
1.2 +104 -57
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SitemapLanguage.java
Index: SitemapLanguage.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SitemapLanguage.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SitemapLanguage.java 15 Jan 2002 11:10:54 -0000 1.1
+++ SitemapLanguage.java 4 Feb 2002 10:21:08 -0000 1.2
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -39,7 +86,7 @@
* The tree builder for the sitemap language.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/02/04 10:21:08 $
*/
public class SitemapLanguage extends TreeBuilder {
@@ -51,22 +98,22 @@
* the tree.
*/
protected ComponentManager createComponentManager(Configuration tree)
throws Exception {
-
+
// Get the map:component node
// Don't check namespace here : this will be done by node builders
Configuration config = tree.getChild("components", false);
-
+
if (config == null) {
getLogger().debug("Sitemap has no components definition at " +
tree.getLocation());
config = new DefaultConfiguration("", "");
}
-
+
ComponentManager manager = new
ExcaliburComponentManager(this.parentManager) {
public void setRoleManager(RoleManager rm) {
super.setRoleManager(rm);
}
};
-
+
LifecycleHelper.setupComponent(manager,
getLogger(),
this.context,
@@ -75,27 +122,27 @@
this.logKit,
config
);
-
+
// Set parent of all selectors.
if (this.parentManager != null) {
-
+
for (int i = 0; i < ComponentsSelector.SELECTOR_ROLES.length;
i++) {
-
+
String role = ComponentsSelector.SELECTOR_ROLES[i];
-
+
ComponentSelector parentSelector = null;
try {
parentSelector =
(ComponentSelector)this.parentManager.lookup(role);
} catch(Exception e) {
// ignore and keep it null
}
-
+
if (parentSelector != null) {
-
+
ExtendedComponentSelector localSelector = null;
try {
localSelector =
(ExtendedComponentSelector)manager.lookup(role);
-
+
if (localSelector != parentSelector) {
// local selector wasn't given by chaining to
the parent manager
localSelector.setParentSelector(parentSelector);
@@ -105,18 +152,18 @@
} catch(Exception e) {
// ignore
}
-
+
parentManager.release(parentSelector);
}
}
}
-
+
// Parse generators and transformers labels
-
+
Configuration[] generators =
config.getChild("generators").getChildren();
// Note : we don't getChildren("generator") because there can be some
// shortcut declarations that have other names
-
+
for (int i = 0; i < generators.length; i++) {
this.setComponentLabels(
Generator.ROLE,
@@ -124,7 +171,7 @@
generators[i].getAttribute("label", null)
);
}
-
+
Configuration[] transformers =
config.getChild("transformers").getChildren();
for (int i = 0; i < transformers.length; i++) {
this.setComponentLabels(
@@ -136,45 +183,45 @@
return manager;
}
-
+
//---- Views management
-
+
/** Collection of view names for each label */
private Map labelViews = new HashMap();
-
+
/** Collection of labels for each component, represented by a
'role':'hint' key */
private Map componentLabels = new HashMap();
-
+
/** The views CategoryNode */
private CategoryNode viewsNode;
-
+
/** Are we currently building a view ? */
private boolean isBuildingView = false;
-
+
/**
* Pseudo-label for views <code>from-position="first"</code> (i.e.
generator).
*/
public static final String FIRST_POS_LABEL = "!first!";
-
+
/**
* Pseudo-label for views <code>from-position="last"</code> (i.e.
serializer).
*/
public static final String LAST_POS_LABEL = "!last!";
-
+
/**
* Set to <code>true</code> while building the internals of a
<map:view>
*/
public void setBuildingView(boolean building) {
this.isBuildingView = building;
}
-
+
/**
* Are we currently building a view ?
*/
public boolean isBuildingView() {
return this.isBuildingView;
}
-
+
/**
* Registers the view labels for a component. They're merged later on
with the
* ones defined on each statement.
@@ -199,10 +246,10 @@
views = new HashSet();
this.labelViews.put(label, views);
}
-
+
views.add(view);
}
-
+
/**
* Get the names of views for a given statement. If the cocoon view
exists in the returned
* collection, the statement can directly branch to the view-handling
node.
@@ -215,7 +262,7 @@
public Collection getViewsForStatement(String role, String hint,
Configuration statement) throws Exception {
String statementLabels = statement.getAttribute("label", null);
-
+
if (this.isBuildingView) {
// Labels are forbidden inside view definition
if (statementLabels != null) {
@@ -223,17 +270,17 @@
getLogger().error(msg);
throw new ConfigurationException(msg);
}
-
+
// We are currently building a view. Don't recurse !
return null;
}
-
+
// Compute the views attached to this component
Set views = null;
-
+
// Build the set for all labels for this statement
Set labels = new HashSet();
-
+
// 1 - labels defined on the component
Collection coll = (Collection)this.componentLabels.get(role + ":" +
hint);
if (coll != null) {
@@ -245,37 +292,37 @@
coll = splitLabels(statementLabels);
labels.addAll(coll);
}
-
+
// 3 - pseudo-label depending on the role
if (role.equals(Generator.ROLE)) {
labels.add("!first!");
} else if (role.equals(Serializer.ROLE)) {
labels.add("!last!");
}
-
+
// Build the set of views attached to these labels
views = new HashSet();
-
+
// Iterate on all labels for this statement
Iterator labelIter = labels.iterator();
while(labelIter.hasNext()) {
-
+
// Iterate on all views for this labek
coll = (Collection)this.labelViews.get(labelIter.next());
if (coll != null) {
Iterator viewIter = coll.iterator();
while(viewIter.hasNext()) {
String viewName = (String)viewIter.next();
-
+
views.add(viewName);
}
}
}
-
+
// Don't keep empty result
if (views.size() == 0) {
views = null;
-
+
getLogger().debug(statement.getName() + " has no views at " +
statement.getLocation());
} else {
if (getLogger().isDebugEnabled()) {
@@ -286,21 +333,21 @@
buf.append(iter.next()).append(" ");
}
buf.append("] at ").append(statement.getLocation());
-
+
getLogger().debug(buf.toString());
}
}
-
+
return views;
}
-
+
/**
* Before linking nodes, lookup the view category node used in [EMAIL
PROTECTED] #getViewNodes(Collection)}.
*/
protected void linkNodes() throws Exception {
// Get the views category node
this.viewsNode = CategoryNodeBuilder.getCategoryNode(this, "views");
-
+
super.linkNodes();
}
@@ -315,19 +362,19 @@
if (viewNames == null) {
return null;
}
-
+
if (this.viewsNode == null) {
return null;
}
-
+
Map result = new HashMap();
-
+
Iterator iter = viewNames.iterator();
while(iter.hasNext()) {
String viewName = (String)iter.next();
result.put(viewName, viewsNode.getNodeByName(viewName));
}
-
+
return result;
}
@@ -343,5 +390,5 @@
return Arrays.asList(StringUtils.split(labels, ", \t\n\r"));
}
}
-
+
}
1.2 +70 -24
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SitemapNode.java
Index: SitemapNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SitemapNode.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SitemapNode.java 3 Jan 2002 12:31:37 -0000 1.1
+++ SitemapNode.java 4 Feb 2002 10:21:08 -0000 1.2
@@ -1,11 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
import org.apache.avalon.framework.activity.Disposable;
@@ -31,23 +77,23 @@
* The root node of a sitemap.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/01/03 12:31:37 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/02/04 10:21:08 $
*/
public class SitemapNode extends AbstractParentProcessingNode implements
Composable {
private static final String REDIRECTOR_ATTR = "sitemap:redirector";
-
+
protected ComponentManager manager;
-
+
protected ProcessingNode pipelines;
-
+
protected ProcessingNode[] otherNodes;
-
+
public static SitemapRedirector getRedirector(Environment env) {
return (SitemapRedirector)env.getAttribute(REDIRECTOR_ATTR);
}
-
+
/**
* Keep the component manager used everywhere in the tree so that we can
* cleanly dispose it.
@@ -55,14 +101,14 @@
public void compose(ComponentManager manager) {
this.manager = manager;
}
-
+
/**
* Set the pipeline nodes that will process the environment.
*/
public void setPipelines(ProcessingNode pipelines) {
this.pipelines = pipelines;
}
-
+
/**
* Set the non-pipeline nodes (views & resources), which are held to
properly
* <code>dispose()</code> them.
@@ -78,20 +124,20 @@
*/
public boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
// Recompose context (and pipelines) to the local component manager
context.recompose(this.manager);
// Create the source resolver relative to the environment.
-
+
// Design note : creating the SourceResolver could also have been
done
// in TreeProcessor.invoke(), but doing it here ensures we use the
local
// component manager used by all other nodes.
EnvironmentSourceResolver resolver = new
EnvironmentSourceResolver(this.manager, env);
SitemapRedirector redirector = new SitemapRedirector(env);
-
+
Map objectModel = env.getObjectModel();
-
+
Object oldResolver = objectModel.get(OBJECT_SOURCE_RESOLVER);
Object oldRedirector = env.getAttribute(REDIRECTOR_ATTR);
@@ -101,20 +147,20 @@
try {
// FIXME : is there any useful information that can be passed as
top-level parameters,
// such as the URI of the mount point ?
-
+
return this.pipelines.invoke(env, context);
-
+
} finally {
// Restore old redirector and resolver
env.setAttribute(REDIRECTOR_ATTR, oldRedirector);
objectModel.put(OBJECT_SOURCE_RESOLVER, oldResolver);
-
+
// Dispose the resolver
resolver.dispose();
}
}
-
+
/**
* Dispose the component manager.
*/
1.3 +59 -12
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SitemapNodeBuilder.java
Index: SitemapNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/SitemapNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SitemapNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ SitemapNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -24,17 +71,17 @@
* occurs at this level.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class SitemapNodeBuilder extends AbstractParentProcessingNodeBuilder
implements ThreadSafe {
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
ProcessingNode[] children = this.buildChildNodes(config);
-
+
ProcessingNode pipelines = null;
-
+
for (int i = 0; i < children.length; i++) {
if (children[i] instanceof PipelinesNode) {
if (pipelines != null) {
@@ -45,7 +92,7 @@
pipelines = children[i];
}
}
-
+
if (pipelines == null) {
String msg = "Invalid sitemap : there must be a 'pipelines' at "
+ config.getLocation();
getLogger().error(msg);
1.4 +68 -21
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/TransformNode.java
Index: TransformNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/TransformNode.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TransformNode.java 30 Jan 2002 14:35:07 -0000 1.3
+++ TransformNode.java 4 Feb 2002 10:21:08 -0000 1.4
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -23,24 +70,24 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/01/30 14:35:07 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/02/04 10:21:08 $
*/
public class TransformNode extends AbstractProcessingNode implements
ParameterizableProcessingNode {
private String transformerName;
-
+
private MapStackResolver source;
-
+
private Map parameters;
-
+
private Map views;
-
+
public TransformNode(String name, String source) throws PatternException
{
this.transformerName = name;
this.source = MapStackResolver.getResolver(source);
}
-
+
public void setParameters(Map parameterMap) {
this.parameters = parameterMap;
}
@@ -48,26 +95,26 @@
public void setViews(Map views) {
this.views = views;
}
-
+
public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
-
+
List mapStack = context.getMapStack();
-
+
context.getEventPipeline().addTransformer(
this.transformerName,
source.resolve(mapStack),
MapStackResolver.buildParameters(this.parameters, mapStack)
);
-
+
// Check view
if (this.views != null) {
String cocoonView = env.getView();
if (cocoonView != null) {
-
+
// Get view node
ProcessingNode viewNode =
(ProcessingNode)this.views.get(cocoonView);
-
+
if (viewNode != null) {
if (getLogger().isInfoEnabled()) {
getLogger().info("Jumping to view " + cocoonView + "
from transformer at " + this.getLocation());
@@ -76,8 +123,8 @@
}
}
}
-
+
// Return false to contine sitemap invocation
return false;
- }
+ }
}
1.3 +61 -14
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/TransformNodeBuilder.java
Index: TransformNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/TransformNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TransformNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.2
+++ TransformNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.3
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -21,26 +68,26 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/04 10:21:08 $
*/
public class TransformNodeBuilder extends AbstractProcessingNodeBuilder
implements LinkedProcessingNodeBuilder {
private TransformNode node;
-
+
private Collection views;
-
+
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
String type = this.treeBuilder.getTypeForStatement(config,
Transformer.ROLE + "Selector");
-
+
this.views =
((SitemapLanguage)this.treeBuilder).getViewsForStatement(Transformer.ROLE,
type, config);
-
+
this.node = new TransformNode(type, config.getAttribute("src",
null));
return this.treeBuilder.setupNode(node, config);
}
-
+
public void linkNode() throws Exception {
this.node.setViews(
((SitemapLanguage)this.treeBuilder).getViewNodes(this.views)
1.2 +63 -16
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ViewNodeBuilder.java
Index: ViewNodeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/sitemap/ViewNodeBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ViewNodeBuilder.java 15 Jan 2002 11:10:54 -0000 1.1
+++ ViewNodeBuilder.java 4 Feb 2002 10:21:08 -0000 1.2
@@ -1,10 +1,57 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * -------------------------------------------------------------------------
*
- * This software is published under the terms of the Apache Software License
*
- * version 1.1, a copy of which has been included with this distribution in
*
- * the LICENSE file.
*
-
*****************************************************************************/
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 [EMAIL PROTECTED]
+ *
+ * 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.cocoon.treeprocessor.sitemap;
@@ -25,16 +72,16 @@
* Builds a <map:view>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/01/15 11:10:54 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/02/04 10:21:08 $
*/
public class ViewNodeBuilder extends NamedContainerNodeBuilder implements
ThreadSafe {
-
+
public ProcessingNode buildNode(Configuration config) throws Exception {
-
+
// Get the label or position (pseudo-label) of this view.
String label = config.getAttribute("from-label", null);
-
+
if (label == null) {
String position = config.getAttribute("from-position");
if ("first".equals(position)) {
@@ -47,20 +94,20 @@
throw new ConfigurationException(msg);
}
}
-
+
SitemapLanguage sitemapBuilder = (SitemapLanguage)this.treeBuilder;
- // Indicate to child builders that we're in a view (they won't
perform view branching)
+ // Indicate to child builders that we're in a view (they won't
perform view branching)
sitemapBuilder.setBuildingView(true);
-
+
// Build children
NamedProcessingNode result =
(NamedProcessingNode)super.buildNode(config);
-
+
sitemapBuilder.addViewForLabel(label, result.getName());
// Clear the flag
sitemapBuilder.setBuildingView(false);
-
+
return result;
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]