You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/04/29 13:54:22 UTC

svn commit: r165297 - in /cocoon/blocks/spring-app/trunk: java/org/apache/cocoon/spring/samples/SpringTest.java samples/conf/applicationContext.xml samples/flow.js samples/test.xml

Author: cziegeler
Date: Fri Apr 29 04:54:21 2005
New Revision: 165297

URL: http://svn.apache.org/viewcvs?rev=165297&view=rev
Log:
Add sample for injecting Cocoon components into spring beans

Modified:
    cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/SpringTest.java
    cocoon/blocks/spring-app/trunk/samples/conf/applicationContext.xml
    cocoon/blocks/spring-app/trunk/samples/flow.js
    cocoon/blocks/spring-app/trunk/samples/test.xml

Modified: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/SpringTest.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/SpringTest.java?rev=165297&r1=165296&r2=165297&view=diff
==============================================================================
--- cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/SpringTest.java (original)
+++ cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/samples/SpringTest.java Fri Apr 29 04:54:21 2005
@@ -17,6 +17,8 @@
 
 import java.util.Date;
 
+import org.apache.cocoon.core.Core;
+
 /** Simple Bean for testing the use of a Spring container
  *
  * @version $Id$
@@ -25,6 +27,8 @@
 
     protected String message;
 
+    protected Core core;
+    
     public SpringTest() {
         this.message = "Hello World from Spring! Bean created "
                 + new Date() + " (should be recreated if sitemap is touched).";
@@ -32,5 +36,13 @@
 
     public String getMessage() {
         return this.message;
+    }
+    
+    public void setCore(Core core) {
+        this.core = core;
+    }
+    
+    public Core getCore() {
+        return this.core;
     }
 }

Modified: cocoon/blocks/spring-app/trunk/samples/conf/applicationContext.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/samples/conf/applicationContext.xml?rev=165297&r1=165296&r2=165297&view=diff
==============================================================================
--- cocoon/blocks/spring-app/trunk/samples/conf/applicationContext.xml (original)
+++ cocoon/blocks/spring-app/trunk/samples/conf/applicationContext.xml Fri Apr 29 04:54:21 2005
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<!-- @version $Id:$ -->
+<!-- @version $Id$ -->
 <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
 
 <beans>
@@ -23,6 +23,8 @@
 	      class="org.apache.cocoon.spring.samples.SpringTest"
 	      abstract="false"
 	      singleton="true"
-	      lazy-init="default"/>
+	      lazy-init="default">
+      <property name="core"><ref bean="cocoon-core"/></property>
+	</bean>
 
 </beans>

Modified: cocoon/blocks/spring-app/trunk/samples/flow.js
URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/samples/flow.js?rev=165297&r1=165296&r2=165297&view=diff
==============================================================================
--- cocoon/blocks/spring-app/trunk/samples/flow.js (original)
+++ cocoon/blocks/spring-app/trunk/samples/flow.js Fri Apr 29 04:54:21 2005
@@ -23,5 +23,6 @@
     var core = cocoon.getComponent("cocoon-core");
     
     cocoon.sendPage("test", { "message" : component.getMessage(),
-                              "configuration" : core.getSettings().getConfiguration()});
+                              "configuration" : core.getSettings().getConfiguration(),
+                              "coreinjection" : component.getCore().getSettings().getWorkDirectory()});
 }

Modified: cocoon/blocks/spring-app/trunk/samples/test.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/samples/test.xml?rev=165297&r1=165296&r2=165297&view=diff
==============================================================================
--- cocoon/blocks/spring-app/trunk/samples/test.xml (original)
+++ cocoon/blocks/spring-app/trunk/samples/test.xml Fri Apr 29 04:54:21 2005
@@ -21,4 +21,6 @@
   <p>#{message}</p>
   <p>Using the Cocoon core through Spring: This is the main configuration file location:</p>
   <p>#{configuration}</p>
+  <p>Testing the injection of the core into a bean. This is the working directory:</p>
+  <p>#{coreinjection}</p>
 </document>