You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2008/03/21 14:55:20 UTC

svn commit: r639645 [3/7] - in /cocoon/whiteboard/corona/trunk: ./ corona-core/ corona-core/src/ corona-core/src/main/ corona-core/src/main/java/ corona-core/src/main/java/org/ corona-core/src/main/java/org/apache/ corona-core/src/main/java/org/apache/...

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+public class CallNode extends AbstractSitemapNode {
+
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+
+public class ErrorNode extends AbstractSitemapNode {
+
+    @Override
+    public InvocationResult invoke(Invocation invocation) {
+        if (!invocation.isErrorInvocation()) {
+            // we're not responsible for non-error-invocations
+            return InvocationResult.NONE;
+        }
+
+        if (super.invoke(invocation).isProcessed()) {
+            return InvocationResult.COMPLETED;
+        }
+        return InvocationResult.NONE;
+    }
+
+    @Override
+    public String toString() {
+        return "ErrorNode(" + this.getParent() + ")";
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/FlowNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/FlowNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/FlowNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/FlowNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
+
+public class FlowNode extends AbstractSitemapNode {
+
+    @Parameter
+    private String language;
+
+    @Override
+    public String toString() {
+        return "FlowNode(" + this.language + ")";
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/FlowNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/FlowNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/FlowNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
+
+public class GenerateNode extends AbstractSitemapNode {
+
+    private static final String GENERATOR_CATEGORY = "generator:";
+
+    @Parameter
+    private String type = "file"; // "file" is the default type
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
+     */
+    @Override
+    public InvocationResult invoke(Invocation invocation) {
+        // install the component
+        invocation.installComponent(GENERATOR_CATEGORY + this.type, this.getParameters());
+
+        // signal that we did some processing
+        return InvocationResult.PROCESSED;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
+     */
+    @Override
+    public String toString() {
+        return "GenerateNode(src=" + this.getParameters().get("src") + ", type=" + this.type + ")";
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/InvocationResult.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/InvocationResult.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/InvocationResult.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/InvocationResult.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+public enum InvocationResult {
+    NONE(false, false), PROCESSED(true, false), COMPLETED(true, true);
+
+    private boolean isCompleted;
+
+    private boolean isProcessed;
+
+    InvocationResult(boolean isProcessed, boolean isCompleted) {
+        this.isCompleted = isCompleted;
+        this.isProcessed = isProcessed;
+    }
+
+    public boolean isCompleted() {
+        return this.isCompleted;
+    }
+
+    public boolean isProcessed() {
+        return this.isProcessed;
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/InvocationResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/InvocationResult.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/InvocationResult.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import java.util.Map;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
+import org.apache.cocoon.corona.sitemap.util.WildcardMatcherHelper;
+
+public class MatchNode extends AbstractSitemapNode {
+
+    @Parameter
+    private String pattern;
+
+    @Parameter
+    private String name;
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
+     */
+    @Override
+    public InvocationResult invoke(Invocation invocation) {
+        if (invocation.isErrorInvocation()) {
+            // we're not responsible for errors
+            return InvocationResult.NONE;
+        }
+
+        Map<String, String> matches = this.getMatches(invocation.getRequest());
+        if (matches == null) {
+            // do not ask our children, there was no match
+            return InvocationResult.NONE;
+        }
+
+        invocation.pushSitemapParameters(this.name, matches);
+        InvocationResult invocationResult = super.invoke(invocation);
+        invocation.popSitemapParameters();
+
+        if (invocationResult.isProcessed()) {
+            return InvocationResult.COMPLETED;
+        }
+
+        return InvocationResult.NONE;
+    }
+
+    private Map<String, String> getMatches(String request) {
+        if (request == null) {
+            return null;
+        }
+
+        if (request.startsWith("/")) {
+            return WildcardMatcherHelper.match(this.pattern, request.substring(1));
+        }
+
+        return WildcardMatcherHelper.match(this.pattern, request);
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
+     */
+    @Override
+    public String toString() {
+        return "MatchNode(" + this.pattern + ")";
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/OtherwiseNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/OtherwiseNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/OtherwiseNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/OtherwiseNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+public class OtherwiseNode extends AbstractSitemapNode {
+
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/OtherwiseNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/OtherwiseNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/OtherwiseNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ParameterNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ParameterNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ParameterNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ParameterNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
+
+public class ParameterNode extends AbstractSitemapNode {
+
+    @Parameter
+    private String name;
+
+    @Parameter
+    private String value;
+
+    public String getName() {
+        return this.name;
+    }
+
+    public String getValue() {
+        return this.value;
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ParameterNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ParameterNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ParameterNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+import org.apache.cocoon.corona.sitemap.InvocationException;
+import org.apache.cocoon.corona.sitemap.node.annotations.NodeChild;
+import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
+import org.apache.cocoon.corona.sitemap.util.ExceptionHandler;
+
+public class PipelineNode extends AbstractSitemapNode {
+
+    private static final String PIPELINE_CATEGORY = "pipeline:";
+
+    @NodeChild
+    private ErrorNode errorNode;
+
+    @Parameter
+    private String id;
+
+    @Parameter
+    private String type = "caching"; // "caching" is the default type
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
+     */
+    @Override
+    public InvocationResult invoke(Invocation invocation) {
+        this.installPipeline(invocation);
+
+        try {
+            // now proceed as usual (invoking our children)
+            if (!super.invoke(invocation).isProcessed()) {
+                // indicate that we couldn't handle this
+                return InvocationResult.NONE;
+            }
+
+            // one of our children was responsible for handling this invocation
+            // assume the invocation is properly prepared and execute it
+            invocation.execute();
+
+            // indicate that we handled this successfully
+            return InvocationResult.COMPLETED;
+        } catch (Exception ex) {
+            return this.handleException(invocation, ex);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
+     */
+    @Override
+    public String toString() {
+        return "PipelineNode(" + this.id + ")";
+    }
+
+    private InvocationResult handleException(Invocation invocation, Exception ex) {
+        if (this.errorNode == null) {
+            // don't have an error node -> let the parent handle this
+            throw ExceptionHandler.getInvocationException(ex);
+        }
+
+        // re-install pipeline
+        this.installPipeline(invocation);
+
+        // try to recover from the exception, using our error node
+        invocation.setThrowable(ExceptionHandler.getCause(ex, InvocationException.class));
+        if (this.errorNode.invoke(invocation).isCompleted()) {
+            // one of our children was responsible for handling this invocation:
+            // assume the invocation is properly prepared and execute it
+            try {
+                invocation.execute();
+                // indicate that we handled this successfully
+                return InvocationResult.COMPLETED;
+            } catch (Exception e) {
+                // error node failed to process -> let the parent handle this
+                throw ExceptionHandler.getInvocationException(e);
+            }
+        }
+
+        // error node was not responsible -> let the parent handle this
+        throw ExceptionHandler.getInvocationException(ex);
+    }
+
+    private void installPipeline(Invocation invocation) {
+        invocation.installPipeline(PIPELINE_CATEGORY + this.type);
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+import org.apache.cocoon.corona.sitemap.InvocationException;
+import org.apache.cocoon.corona.sitemap.NoMatchingPipelineException;
+import org.apache.cocoon.corona.sitemap.node.annotations.NodeChild;
+import org.apache.cocoon.corona.sitemap.util.ExceptionHandler;
+
+public class PipelinesNode extends AbstractSitemapNode {
+
+    @NodeChild
+    private ErrorNode errorNode;
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
+     */
+    @Override
+    public InvocationResult invoke(Invocation invocation) {
+        try {
+            if (super.invoke(invocation).isProcessed()) {
+                // signal that we handled this successfully
+                return InvocationResult.COMPLETED;
+            }
+
+            // none of our children was responsible
+            throw new NoMatchingPipelineException("No pipeline matched the request '" + invocation.getRequest() + "'");
+        } catch (NoMatchingPipelineException nmpex) {
+            // no error handling when no pipeline matched
+            throw nmpex;
+        } catch (Exception ex) {
+            return this.handleException(invocation, ex);
+        }
+    }
+
+    private InvocationResult handleException(Invocation invocation, Exception ex) {
+        if (this.errorNode != null) {
+            invocation.setThrowable(ExceptionHandler.getCause(ex, InvocationException.class));
+            if (this.errorNode.invoke(invocation).isCompleted()) {
+                // signal that we handled this successfully
+                return InvocationResult.COMPLETED;
+            }
+        }
+
+        // no error-handling configured or error-handling itself failed
+        // -> let the parent handle this
+        throw ExceptionHandler.getInvocationException(ex);
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
+
+public class ReadNode extends AbstractSitemapNode {
+
+    private static final String READER_CATEGORY = "reader:";
+
+    @Parameter
+    private String type = "file"; // "file" is default
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
+     */
+    @Override
+    public InvocationResult invoke(Invocation invocation) {
+        // install the component
+        invocation.installComponent(READER_CATEGORY + this.type, this.getParameters());
+
+        // signal that we did some processing
+        return InvocationResult.PROCESSED;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
+     */
+    @Override
+    public String toString() {
+        return "ReadNode(" + this.getParameters().get("src") + ")";
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+
+public class RedirectNode extends AbstractSitemapNode {
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
+     */
+    @Override
+    public InvocationResult invoke(Invocation invocation) {
+        // install the component
+        invocation.installComponent("redirector", this.getParameters());
+
+        // signal that we did some processing
+        return InvocationResult.PROCESSED;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
+     */
+    @Override
+    public String toString() {
+        return "RedirectNode(" + this.getParameters().get("uri") + ")";
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SelectNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SelectNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SelectNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SelectNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+public class SelectNode extends AbstractSitemapNode {
+
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SelectNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SelectNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SelectNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
+import org.apache.cocoon.corona.sitemap.util.HttpContextHelper;
+
+public class SerializeNode extends AbstractSitemapNode {
+
+    private static final String SERIALIZER_CATEGORY = "serializer:";
+
+    @Parameter
+    private String statusCode;
+
+    @Parameter
+    private String type;
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
+     */
+    @Override
+    public InvocationResult invoke(final Invocation invocation) {
+        // install the component
+        invocation.installComponent(SERIALIZER_CATEGORY + this.type, this.getParameters());
+
+        if (this.statusCode != null) {
+            HttpServletResponse response = HttpContextHelper.getResponse(invocation);
+            if (response != null) {
+                response.setStatus(Integer.parseInt(this.statusCode));
+            }
+        }
+
+        // signal that we did some processing
+        return InvocationResult.PROCESSED;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
+     */
+    @Override
+    public String toString() {
+        return "SerializeNode(type=" + this.type + ", status-code=" + this.statusCode + ")";
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+
+public class Sitemap extends AbstractSitemapNode {
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
+     */
+    @Override
+    public InvocationResult invoke(Invocation invocation) {
+        System.out.println("========================================");
+        System.out.println("Sitemap.invoke(" + invocation.getRequest() + ")");
+        long start = System.nanoTime();
+        try {
+            return super.invoke(invocation);
+        } finally {
+            long duration = System.nanoTime() - start;
+            System.out.println("Finished in " + duration / 1000000d + " ms");
+            System.out.println("========================================");
+        }
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import java.util.Map;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+
+public interface SitemapNode {
+
+    void addChild(SitemapNode child);
+
+    SitemapNode getParent();
+
+    void setParent(SitemapNode parent);
+
+    void setParameters(Map<String, String> parameters);
+
+    InvocationResult invoke(Invocation invocation);
+
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNodeFactory.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNodeFactory.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNodeFactory.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNodeFactory.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+public class SitemapNodeFactory {
+
+    private Map<String, Class<? extends SitemapNode>> types = new HashMap<String, Class<? extends SitemapNode>>();
+
+    @SuppressWarnings("unchecked")
+    public void setTypes(Map<String, String> types) {
+        for (Entry<String, String> entry : types.entrySet()) {
+            try {
+                Class<? extends SitemapNode> nodeClass = (Class<? extends SitemapNode>) Class.forName(entry.getValue());
+                this.types.put(entry.getKey(), nodeClass);
+            } catch (ClassCastException ccex) {
+                throw new IllegalArgumentException("Could not register class " + entry.getValue() + " as type "
+                        + entry.getKey(), ccex);
+            } catch (ClassNotFoundException cnfex) {
+                throw new IllegalArgumentException("Could not register class " + entry.getValue() + " as type "
+                        + entry.getKey(), cnfex);
+            }
+        }
+    }
+
+    public SitemapNode createNode(String type, Map<String, String> parameters) {
+        Class<? extends SitemapNode> sitemapNodeClass = this.types.get(type);
+
+        if (sitemapNodeClass == null) {
+            throw new IllegalArgumentException("Node type '" + type + "' is not supported.");
+        }
+
+        try {
+            SitemapNode sitemapNode = sitemapNodeClass.newInstance();
+            sitemapNode.setParameters(parameters);
+            return sitemapNode;
+        } catch (Exception e) {
+            throw new IllegalArgumentException("A node of type '" + type + "' could not be created.", e);
+        }
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNodeFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNodeFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNodeFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/TransformNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/TransformNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/TransformNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/TransformNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
+
+public class TransformNode extends AbstractSitemapNode {
+
+    private static final String TRANSFORMER_CATEGORY = "transformer:";
+
+    @Parameter
+    private String type = "xslt"; // "xslt" is default
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
+     */
+    @Override
+    public InvocationResult invoke(final Invocation invocation) {
+        // install the component
+        invocation.installComponent(TRANSFORMER_CATEGORY + this.type, this.getParameters());
+
+        // signal that we did some processing
+        return InvocationResult.PROCESSED;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
+     */
+    @Override
+    public String toString() {
+        return "TransformNode(src=" + this.getParameters().get("src") + ", type=" + this.type + ")";
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/TransformNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/TransformNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/TransformNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/WhenNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/WhenNode.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/WhenNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/WhenNode.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node;
+
+public class WhenNode extends AbstractSitemapNode {
+
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/WhenNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/WhenNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/WhenNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/NodeChild.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/NodeChild.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/NodeChild.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/NodeChild.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface NodeChild {
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/NodeChild.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/NodeChild.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/NodeChild.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/Parameter.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/Parameter.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/Parameter.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/Parameter.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.node.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Parameter {
+
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/Parameter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/Parameter.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/annotations/Parameter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ClassPathResourceResolver.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ClassPathResourceResolver.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ClassPathResourceResolver.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ClassPathResourceResolver.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.resource;
+
+import java.net.URL;
+
+public class ClassPathResourceResolver implements ResourceResolver {
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.sitemap.resource.ResourceResolver#resolve(java.lang.String)
+     */
+    public URL resolve(String resource) {
+        URL url = this.getClass().getResource(resource);
+
+        if (url == null && resource.charAt(0) != '/') {
+            url = this.getClass().getResource("/" + resource);
+        }
+
+        return url;
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ClassPathResourceResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ClassPathResourceResolver.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ClassPathResourceResolver.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ResourceResolver.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ResourceResolver.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ResourceResolver.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ResourceResolver.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.resource;
+
+import java.net.URL;
+
+public interface ResourceResolver {
+
+    URL resolve(String resource);
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ResourceResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ResourceResolver.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ResourceResolver.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/ExceptionHandler.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/ExceptionHandler.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/ExceptionHandler.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/ExceptionHandler.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.util;
+
+import org.apache.cocoon.corona.sitemap.InvocationException;
+
+public class ExceptionHandler {
+
+    /**
+     * Wraps the given <code>throwable</code> into an
+     * {@link InvocationException}, if that is necessary.<br>
+     * <br>
+     * If the given <code>throwable</code> is already an instance of
+     * {@link InvocationException}, the given <code>throwable</code> is
+     * returned.
+     * 
+     * @param throwable
+     *            The throwable to wrap inside an {@link InvocationException}.
+     * @return The (possibly) wrapped <code>throwable</code>.
+     */
+    public static InvocationException getInvocationException(Throwable throwable) {
+        if (throwable instanceof InvocationException) {
+            return (InvocationException) throwable;
+        }
+
+        return new InvocationException(throwable);
+    }
+
+    /**
+     * Get the underlying cause of the given <code>exception</code>.<br>
+     * <br>
+     * Technically this unwraps the given <code>exception</code> until one of
+     * the following happens
+     * <ul>
+     * <li>there is no more underlying cause</li>
+     * <li>an Exception other than {@link InvocationException} or one of its
+     * subclasses is encountered
+     * </ul>
+     * <br>
+     * This method will return <code>null</code> if and only if the given
+     * <code>exception</code> is <code>null</code>.
+     * 
+     * @param exception
+     *            The {@link Exception} to get the cause for.
+     * @return The underlying cause.
+     */
+    public static Throwable getCause(Exception exception, Class<? extends Exception> ignorableException) {
+        if (exception == null) {
+            return null;
+        }
+
+        Throwable cause = exception;
+
+        while (true) {
+            if (ignorableException.isInstance(cause) && cause.getCause() != null) {
+                cause = cause.getCause();
+            } else {
+                break;
+            }
+        }
+
+        return cause;
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/ExceptionHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/ExceptionHandler.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/ExceptionHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/HttpContextHelper.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/HttpContextHelper.java?rev=639645&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/HttpContextHelper.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/HttpContextHelper.java Fri Mar 21 06:54:32 2008
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.corona.sitemap.util;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+
+public class HttpContextHelper {
+
+    private static final String HTTP_SERVLET_REQUEST_KEY = HttpServletRequest.class.getName();
+
+    private static final String HTTP_SERVLET_RESPONSE_KEY = HttpServletResponse.class.getName();
+
+    public static HttpServletRequest getRequest(Invocation invocation) {
+        Object parameter = invocation.getParameter(HTTP_SERVLET_REQUEST_KEY);
+        if (parameter instanceof HttpServletRequest) {
+            return (HttpServletRequest) parameter;
+        }
+
+        throw new IllegalStateException(
+                "A HttpServletRequest is not available. This might indicate an invocation outside a servlet.");
+    }
+
+    public static HttpServletResponse getResponse(Invocation invocation) {
+        Object parameter = invocation.getParameter(HTTP_SERVLET_RESPONSE_KEY);
+        if (parameter instanceof HttpServletResponse) {
+            return (HttpServletResponse) parameter;
+        }
+
+        throw new IllegalStateException(
+                "A HttpServletResponse is not available. This might indicate an invocation outside a servlet.");
+    }
+
+    public static void storeRequest(HttpServletRequest httpServletRequest, Invocation invocation) {
+        invocation.addParameter(HTTP_SERVLET_REQUEST_KEY, httpServletRequest);
+    }
+
+    public static void storeResponse(HttpServletResponse httpServletResponse, Invocation invocation) {
+        invocation.addParameter(HTTP_SERVLET_RESPONSE_KEY, httpServletResponse);
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/HttpContextHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/HttpContextHelper.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/HttpContextHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain