cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r647853 - in /cocoon/whiteboard/corona/trunk/corona-controller: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/cocoon/ src/main/java/org/apache/cocoon/corona/ src/main/java/org/apache/...
Date Mon, 14 Apr 2008 15:35:31 GMT
Author: reinhard
Date: Mon Apr 14 08:35:27 2008
New Revision: 647853

URL: http://svn.apache.org/viewvc?rev=647853&view=rev
Log:
. move controller implementation into a separate module

Added:
    cocoon/whiteboard/corona/trunk/corona-controller/   (with props)
    cocoon/whiteboard/corona/trunk/corona-controller/pom.xml   (with props)
    cocoon/whiteboard/corona/trunk/corona-controller/src/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/Controller.java
  (with props)
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/DemoControllerDispatcher.java
  (with props)
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/SpringControllerComponent.java
  (with props)
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/node/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/node/CallNode.java
      - copied, changed from r644238, cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/META-INF/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/META-INF/cocoon/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/META-INF/cocoon/spring/
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/META-INF/cocoon/spring/corona-controller.xml
  (with props)
    cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/corona-controller-1.0.xsd
  (with props)
    cocoon/whiteboard/corona/trunk/corona-controller/src/test/
    cocoon/whiteboard/corona/trunk/corona-controller/src/test/java/
    cocoon/whiteboard/corona/trunk/corona-controller/src/test/resources/

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Apr 14 08:35:27 2008
@@ -0,0 +1,4 @@
+.settings
+target
+.classpath
+.project

Added: cocoon/whiteboard/corona/trunk/corona-controller/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-controller/pom.xml?rev=647853&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-controller/pom.xml (added)
+++ cocoon/whiteboard/corona/trunk/corona-controller/pom.xml Mon Apr 14 08:35:27 2008
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+ -->
+<!-- $Id$ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>jar</packaging>
+
+  <parent>
+    <groupId>org.apache.cocoon</groupId>
+    <artifactId>corona-parent</artifactId>
+    <version>1-SNAPSHOT</version>
+    <relativePath>../parent/pom.xml</relativePath>
+  </parent>
+
+  <artifactId>corona-controller</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <name>Cocoon Corona: Controller [jar]</name>
+  <description>Controller for Corona sitemaps.</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>corona-sitemap</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+</project>

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/Controller.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/Controller.java?rev=647853&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/Controller.java
(added)
+++ cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/Controller.java
Mon Apr 14 08:35:27 2008
@@ -0,0 +1,28 @@
+/*
+ * 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.controller;
+
+import java.io.OutputStream;
+import java.util.Map;
+
+public interface Controller {
+
+    void invoke(OutputStream outputStream, String string, Map<String, ? extends Object>
parameters);
+
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/Controller.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/Controller.java
------------------------------------------------------------------------------
    svn:keywords = Id

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

Added: cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/DemoControllerDispatcher.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/DemoControllerDispatcher.java?rev=647853&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/DemoControllerDispatcher.java
(added)
+++ cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/DemoControllerDispatcher.java
Mon Apr 14 08:35:27 2008
@@ -0,0 +1,62 @@
+/*
+ * 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.controller;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.Map;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+public class DemoControllerDispatcher implements Controller, ApplicationContextAware {
+
+    private ApplicationContext applicationContext;
+
+    public void invoke(OutputStream outputStream, String select, Map<String, ? extends
Object> parameters) {
+        try {
+//            URL url = new URL("servlet:/read/javascript-resource-explicit");
+            URL url = new URL("http://www.springframework.org/schema/context/spring-context-2.5.xsd");
+            InputStream inputStream = url.openStream();
+
+            byte[] data = new byte[10240];
+            while (true) {
+                int bytesRead = inputStream.read(data);
+
+                if (bytesRead == -1) {
+                    break;
+                }
+
+                outputStream.write(data, 0, bytesRead);
+            }
+
+            inputStream.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+    }
+
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
+        this.applicationContext = applicationContext;
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/DemoControllerDispatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/DemoControllerDispatcher.java
------------------------------------------------------------------------------
    svn:keywords = Id

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

Added: cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/SpringControllerComponent.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/SpringControllerComponent.java?rev=647853&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/SpringControllerComponent.java
(added)
+++ cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/SpringControllerComponent.java
Mon Apr 14 08:35:27 2008
@@ -0,0 +1,65 @@
+/*
+ * 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.controller;
+
+import java.io.OutputStream;
+import java.util.Map;
+
+import org.apache.cocoon.corona.pipeline.component.Finisher;
+import org.apache.cocoon.corona.pipeline.component.Starter;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+public class SpringControllerComponent implements Starter, Finisher, ApplicationContextAware
{
+
+    private ApplicationContext applicationContext;
+    private OutputStream outputStream;
+    private Map<String, Object> parameters;
+    private String beanName;
+    private String selector;
+
+    public void execute() {
+        Controller controller = (Controller) this.applicationContext.getBean(Controller.class.getName()
+ "/"
+                + this.beanName, Controller.class);
+        controller.invoke(this.outputStream, this.selector, this.parameters);
+    }
+
+    public String getContentType() {
+        return null;
+    }
+
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
+        this.applicationContext = applicationContext;
+    }
+
+    public void setConfiguration(Map<String, ? extends Object> configuration) {
+        this.beanName = (String) configuration.get("controller");
+        this.selector = (String) configuration.get("select");
+    }
+
+    public void setInputParameters(Map<String, Object> parameters) {
+        this.parameters = parameters;
+    }
+
+    public void setOutputStream(OutputStream outputStream) {
+        this.outputStream = outputStream;
+    }
+}
+

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/SpringControllerComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/SpringControllerComponent.java
------------------------------------------------------------------------------
    svn:keywords = Id

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

Copied: cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/node/CallNode.java
(from r644238, 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-controller/src/main/java/org/apache/cocoon/corona/controller/node/CallNode.java?p2=cocoon/whiteboard/corona/trunk/corona-controller/src/main/java/org/apache/cocoon/corona/controller/node/CallNode.java&p1=cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/CallNode.java&r1=644238&r2=647853&rev=647853&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-controller/src/main/java/org/apache/cocoon/corona/controller/node/CallNode.java
Mon Apr 14 08:35:27 2008
@@ -16,9 +16,27 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cocoon.corona.sitemap.node;
+package org.apache.cocoon.corona.controller.node;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+import org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode;
+import org.apache.cocoon.corona.sitemap.node.InvocationResult;
+import org.apache.cocoon.corona.sitemap.node.Node;
+import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
 
 @Node(name="call")
 public class CallNode extends AbstractSitemapNode {
 
+    @Parameter
+    private String wrapperType = "default";
+
+    @Override
+    public InvocationResult invoke(Invocation invocation) {
+        Map<String, Object> parameters = new HashMap<String, Object>(this.getParameters());
+        invocation.installComponent("controller:" + this.wrapperType, parameters);
+        return InvocationResult.COMPLETED;
+    }
 }

Added: cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/META-INF/cocoon/spring/corona-controller.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/META-INF/cocoon/spring/corona-controller.xml?rev=647853&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/META-INF/cocoon/spring/corona-controller.xml
(added)
+++ cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/META-INF/cocoon/spring/corona-controller.xml
Mon Apr 14 08:35:27 2008
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+ -->
+<!-- $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">
+
+  <bean name="controller:default" class="org.apache.cocoon.corona.controller.SpringControllerComponent"
scope="prototype" />
+
+  <bean name="org.apache.cocoon.corona.controller.Controller/rest" class="org.apache.cocoon.corona.controller.DemoControllerDispatcher"
scope="prototype" />
+
+</beans>

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/META-INF/cocoon/spring/corona-controller.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/META-INF/cocoon/spring/corona-controller.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/META-INF/cocoon/spring/corona-controller.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/corona-controller-1.0.xsd
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/corona-controller-1.0.xsd?rev=647853&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/corona-controller-1.0.xsd
(added)
+++ cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/corona-controller-1.0.xsd
Mon Apr 14 08:35:27 2008
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<!-- $Id$ -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://apache.org/cocoon/corona/controller"
+  xmlns="http://apache.org/cocoon/corona/controller" xmlns:map="http://apache.org/cocoon/corona/sitemap"
elementFormDefault="qualified">
+
+  <xsd:import namespace="http://apache.org/cocoon/corona/sitemap"/>
+
+  <xsd:element name="call">
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element ref="map:parameter" minOccurs="0" maxOccurs="unbounded" />
+      </xsd:sequence>
+      <xsd:attribute name="controller" type="xsd:string" />
+      <xsd:attribute name="select" type="xsd:string" />
+      <xsd:attribute name="wrapper-type" type="xsd:string" use="optional" />
+    </xsd:complexType>
+  </xsd:element>
+
+</xsd:schema>

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/corona-controller-1.0.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/corona-controller-1.0.xsd
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-controller/src/main/resources/corona-controller-1.0.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message