cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r643468 - in /cocoon/whiteboard/corona/trunk/corona-sitemap/src/main: java/org/apache/cocoon/corona/sitemap/node/ java/org/apache/cocoon/corona/sitemap/spring/ resources/META-INF/cocoon/spring/
Date Tue, 01 Apr 2008 16:14:40 GMT
Author: reinhard
Date: Tue Apr  1 09:14:36 2008
New Revision: 643468

URL: http://svn.apache.org/viewvc?rev=643468&view=rev
Log:
. Sitemap nodes are auto-detected by Spring
. Introduce @Node annotation (for selection and name generation)

Added:
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Node.java
  (with props)
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeNameGenerator.java
  (with props)
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeScopeResolver.java
  (with props)
Modified:
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ActNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/FlowNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/OtherwiseNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ParameterNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SelectNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNodeFactory.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/TransformNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/WhenNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-sitemap-node.xml

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ActNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ActNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ActNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ActNode.java
Tue Apr  1 09:14:36 2008
@@ -21,6 +21,7 @@
 import org.apache.cocoon.corona.sitemap.Invocation;
 import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
 
+@Node(name="act")
 public class ActNode extends AbstractSitemapNode {
 
     private static final String ACTION_CATEGORY = "action:";

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java
Tue Apr  1 09:14:36 2008
@@ -18,6 +18,7 @@
  */
 package org.apache.cocoon.corona.sitemap.node;
 
+@Node(name="call")
 public class CallNode extends AbstractSitemapNode {
 
 }

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java
Tue Apr  1 09:14:36 2008
@@ -20,6 +20,7 @@
 
 import org.apache.cocoon.corona.sitemap.Invocation;
 
+@Node(name="handle-errors")
 public class ErrorNode extends AbstractSitemapNode {
 
     @Override

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/FlowNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/FlowNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/FlowNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/FlowNode.java
Tue Apr  1 09:14:36 2008
@@ -20,6 +20,7 @@
 
 import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
 
+@Node(name="flow")
 public class FlowNode extends AbstractSitemapNode {
 
     @Parameter

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java
Tue Apr  1 09:14:36 2008
@@ -21,6 +21,7 @@
 import org.apache.cocoon.corona.sitemap.Invocation;
 import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
 
+@Node(name="generate")
 public class GenerateNode extends AbstractSitemapNode {
 
     private static final String GENERATOR_CATEGORY = "generator:";
@@ -30,7 +31,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
      */
     @Override
@@ -44,7 +45,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
      */
     @Override

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java
Tue Apr  1 09:14:36 2008
@@ -24,6 +24,7 @@
 import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
 import org.apache.cocoon.corona.sitemap.util.WildcardMatcherHelper;
 
+@Node(name="match")
 public class MatchNode extends AbstractSitemapNode {
 
     @Parameter
@@ -34,7 +35,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
      */
     @Override
@@ -75,7 +76,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
      */
     @Override

Added: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Node.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Node.java?rev=643468&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Node.java
(added)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Node.java
Tue Apr  1 09:14:36 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;
+
+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.TYPE)
+public @interface Node {
+    String name();
+}

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

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

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

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/OtherwiseNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/OtherwiseNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/OtherwiseNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/OtherwiseNode.java
Tue Apr  1 09:14:36 2008
@@ -18,6 +18,7 @@
  */
 package org.apache.cocoon.corona.sitemap.node;
 
+@Node(name="otherwise")
 public class OtherwiseNode extends AbstractSitemapNode {
 
 }

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ParameterNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ParameterNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ParameterNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ParameterNode.java
Tue Apr  1 09:14:36 2008
@@ -20,6 +20,7 @@
 
 import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
 
+@Node(name="parameter")
 public class ParameterNode extends AbstractSitemapNode {
 
     @Parameter

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
Tue Apr  1 09:14:36 2008
@@ -24,6 +24,7 @@
 import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
 import org.apache.cocoon.corona.sitemap.util.ExceptionHandler;
 
+@Node(name="pipeline")
 public class PipelineNode extends AbstractSitemapNode {
 
     private static final String PIPELINE_CATEGORY = "pipeline:";
@@ -39,7 +40,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
      */
     @Override
@@ -66,7 +67,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
      */
     @Override

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java
Tue Apr  1 09:14:36 2008
@@ -24,6 +24,7 @@
 import org.apache.cocoon.corona.sitemap.node.annotations.NodeChild;
 import org.apache.cocoon.corona.sitemap.util.ExceptionHandler;
 
+@Node(name="pipelines")
 public class PipelinesNode extends AbstractSitemapNode {
 
     @NodeChild
@@ -31,7 +32,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
      */
     @Override

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java
Tue Apr  1 09:14:36 2008
@@ -21,6 +21,7 @@
 import org.apache.cocoon.corona.sitemap.Invocation;
 import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
 
+@Node(name="read")
 public class ReadNode extends AbstractSitemapNode {
 
     private static final String READER_CATEGORY = "reader:";
@@ -30,7 +31,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
      */
     @Override
@@ -44,7 +45,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
      */
     @Override

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java
Tue Apr  1 09:14:36 2008
@@ -20,11 +20,12 @@
 
 import org.apache.cocoon.corona.sitemap.Invocation;
 
+@Node(name="redirect-to")
 public class RedirectNode extends AbstractSitemapNode {
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
      */
     @Override
@@ -38,7 +39,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
      */
     @Override

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SelectNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SelectNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SelectNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SelectNode.java
Tue Apr  1 09:14:36 2008
@@ -18,6 +18,7 @@
  */
 package org.apache.cocoon.corona.sitemap.node;
 
+@Node(name="select")
 public class SelectNode extends AbstractSitemapNode {
 
 }

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java
Tue Apr  1 09:14:36 2008
@@ -21,6 +21,7 @@
 import org.apache.cocoon.corona.sitemap.Invocation;
 import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
 
+@Node(name="serialize")
 public class SerializeNode extends AbstractSitemapNode {
 
     private static final String SERIALIZER_CATEGORY = "serializer:";

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java
Tue Apr  1 09:14:36 2008
@@ -20,11 +20,12 @@
 
 import org.apache.cocoon.corona.sitemap.Invocation;
 
+@Node(name="sitemap")
 public class Sitemap extends AbstractSitemapNode {
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
      */
     @Override

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNodeFactory.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNodeFactory.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNodeFactory.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/SitemapNodeFactory.java
Tue Apr  1 09:14:36 2008
@@ -18,43 +18,28 @@
  */
 package org.apache.cocoon.corona.sitemap.node;
 
-import java.util.HashMap;
 import java.util.Map;
-import java.util.Map.Entry;
 
-public class SitemapNodeFactory {
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
 
-    private Map<String, Class<? extends SitemapNode>> types = new HashMap<String,
Class<? extends SitemapNode>>();
+public class SitemapNodeFactory implements ApplicationContextAware {
 
-    @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);
-            }
-        }
-    }
+    private ApplicationContext applicationContext;
 
     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();
+            String beanName = SitemapNode.class.getName() + "/" + type;
+            SitemapNode sitemapNode = (SitemapNode) this.applicationContext.getBean(beanName,
SitemapNode.class);
             sitemapNode.setParameters(parameters);
             return sitemapNode;
         } catch (Exception e) {
             throw new IllegalArgumentException("A node of type '" + type + "' could not be
created.", e);
         }
+    }
+
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
+        this.applicationContext = applicationContext;
     }
 }

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/TransformNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/TransformNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/TransformNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/TransformNode.java
Tue Apr  1 09:14:36 2008
@@ -21,6 +21,7 @@
 import org.apache.cocoon.corona.sitemap.Invocation;
 import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
 
+@Node(name="transform")
 public class TransformNode extends AbstractSitemapNode {
 
     private static final String TRANSFORMER_CATEGORY = "transformer:";
@@ -30,7 +31,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
      */
     @Override
@@ -44,7 +45,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
      */
     @Override

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/WhenNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/WhenNode.java?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/WhenNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/WhenNode.java
Tue Apr  1 09:14:36 2008
@@ -18,6 +18,7 @@
  */
 package org.apache.cocoon.corona.sitemap.node;
 
+@Node(name="when")
 public class WhenNode extends AbstractSitemapNode {
 
 }

Added: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeNameGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeNameGenerator.java?rev=643468&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeNameGenerator.java
(added)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeNameGenerator.java
Tue Apr  1 09:14:36 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.spring;
+
+import java.util.Map;
+
+import org.apache.cocoon.corona.sitemap.node.Node;
+import org.apache.cocoon.corona.sitemap.node.SitemapNode;
+import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.BeanNameGenerator;
+
+public class SitemapNodeNameGenerator implements BeanNameGenerator{
+
+    public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry)
{
+        if (definition instanceof AnnotatedBeanDefinition) {
+            AnnotatedBeanDefinition annotatedBeanDefinition = (AnnotatedBeanDefinition) definition;
+            Map<String, Object> annotationAttributes = annotatedBeanDefinition.getMetadata().getAnnotationAttributes(Node.class.getName());
+
+            return SitemapNode.class.getName() + "/" + annotationAttributes.get("name");
+        }
+
+        return null;
+    }
+}

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

Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeNameGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Id

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

Added: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeScopeResolver.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeScopeResolver.java?rev=643468&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeScopeResolver.java
(added)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeScopeResolver.java
Tue Apr  1 09:14:36 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.spring;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.context.annotation.ScopeMetadata;
+import org.springframework.context.annotation.ScopeMetadataResolver;
+
+public class SitemapNodeScopeResolver implements ScopeMetadataResolver {
+
+    /**
+     * {@inheritDoc}
+     *
+     * @see org.springframework.context.annotation.ScopeMetadataResolver#resolveScopeMetadata(org.springframework.beans.factory.config.BeanDefinition)
+     */
+    public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
+        ScopeMetadata scopeMetadata = new ScopeMetadata();
+        scopeMetadata.setScopeName(BeanDefinition.SCOPE_PROTOTYPE);
+        return scopeMetadata;
+    }
+}

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

Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeScopeResolver.java
------------------------------------------------------------------------------
    svn:keywords = Id

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

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-sitemap-node.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-sitemap-node.xml?rev=643468&r1=643467&r2=643468&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-sitemap-node.xml
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-sitemap-node.xml
Tue Apr  1 09:14:36 2008
@@ -18,34 +18,24 @@
   under the License.
  -->
 <!-- $Id$ -->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="
+    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+  ">
 
   <bean name="org.apache.cocoon.corona.sitemap.SitemapBuilder" class="org.apache.cocoon.corona.sitemap.SitemapBuilder">
     <property name="sitemapNodeFactory" ref="org.apache.cocoon.corona.sitemap.node.SitemapNodeFactory"
/>
   </bean>
 
-  <bean name="org.apache.cocoon.corona.sitemap.node.SitemapNodeFactory" class="org.apache.cocoon.corona.sitemap.node.SitemapNodeFactory">
-    <property name="types">
-      <map>
-        <entry key="sitemap" value="org.apache.cocoon.corona.sitemap.node.Sitemap" />
-        <entry key="flow" value="org.apache.cocoon.corona.sitemap.node.FlowNode" />
-        <entry key="pipelines" value="org.apache.cocoon.corona.sitemap.node.PipelinesNode"
/>
-        <entry key="pipeline" value="org.apache.cocoon.corona.sitemap.node.PipelineNode"
/>
-        <entry key="match" value="org.apache.cocoon.corona.sitemap.node.MatchNode" />
-        <entry key="read" value="org.apache.cocoon.corona.sitemap.node.ReadNode" />
-        <entry key="generate" value="org.apache.cocoon.corona.sitemap.node.GenerateNode"
/>
-        <entry key="transform" value="org.apache.cocoon.corona.sitemap.node.TransformNode"
/>
-        <entry key="parameter" value="org.apache.cocoon.corona.sitemap.node.ParameterNode"
/>
-        <entry key="serialize" value="org.apache.cocoon.corona.sitemap.node.SerializeNode"
/>
-        <entry key="call" value="org.apache.cocoon.corona.sitemap.node.CallNode" />
-        <entry key="redirect-to" value="org.apache.cocoon.corona.sitemap.node.RedirectNode"
/>
-        <entry key="act" value="org.apache.cocoon.corona.sitemap.node.ActNode" />
-        <entry key="handle-errors" value="org.apache.cocoon.corona.sitemap.node.ErrorNode"
/>
-        <entry key="select" value="org.apache.cocoon.corona.sitemap.node.SelectNode" />
-        <entry key="when" value="org.apache.cocoon.corona.sitemap.node.WhenNode" />
-        <entry key="otherwise" value="org.apache.cocoon.corona.sitemap.node.OtherwiseNode"
/>
-      </map>
-    </property>
-  </bean>
+  <bean name="org.apache.cocoon.corona.sitemap.node.SitemapNodeFactory" class="org.apache.cocoon.corona.sitemap.node.SitemapNodeFactory"/>
+
+  <context:component-scan base-package="org.apache.cocoon.corona.sitemap.node" use-default-filters="false"
+    scope-resolver="org.apache.cocoon.corona.sitemap.spring.SitemapNodeScopeResolver"
+    name-generator="org.apache.cocoon.corona.sitemap.spring.SitemapNodeNameGenerator">
+    <context:include-filter type="annotation" expression="org.apache.cocoon.corona.sitemap.node.Node"
/>
+  </context:component-scan>
+
 </beans>



Mime
View raw message