[jboss-svn-commits] JBL Code SVN: r12389 - in labs/jbossesb/trunk/product: core/listeners/src/org/jboss/soa/esb/actions and 29 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jun 7 15:42:20 EDT 2007


Author: kurt.stam at jboss.com
Date: 2007-06-07 15:42:18 -0400 (Thu, 07 Jun 2007)
New Revision: 12389

Added:
   labs/jbossesb/trunk/product/services/spring/
   labs/jbossesb/trunk/product/services/spring/lib/
   labs/jbossesb/trunk/product/services/spring/lib/ext/
   labs/jbossesb/trunk/product/services/spring/lib/ext/aspectjrt.jar
   labs/jbossesb/trunk/product/services/spring/lib/ext/aspectjweaver.jar
   labs/jbossesb/trunk/product/services/spring/lib/ext/commons-dbcp-1.2.1.jar
   labs/jbossesb/trunk/product/services/spring/lib/ext/commons-pool.jar
   labs/jbossesb/trunk/product/services/spring/lib/ext/ibatis-2.3.0.677.jar
   labs/jbossesb/trunk/product/services/spring/lib/ext/spring-aspects.jar
   labs/jbossesb/trunk/product/services/spring/lib/ext/spring-mock.jar
   labs/jbossesb/trunk/product/services/spring/lib/ext/spring.jar
   labs/jbossesb/trunk/product/services/spring/src/
   labs/jbossesb/trunk/product/services/spring/src/main/
   labs/jbossesb/trunk/product/services/spring/src/main/java/
   labs/jbossesb/trunk/product/services/spring/src/main/java/org/
   labs/jbossesb/trunk/product/services/spring/src/main/java/org/jboss/
   labs/jbossesb/trunk/product/services/spring/src/main/java/org/jboss/soa/
   labs/jbossesb/trunk/product/services/spring/src/main/java/org/jboss/soa/esb/
   labs/jbossesb/trunk/product/services/spring/src/main/java/org/jboss/soa/esb/actions/
   labs/jbossesb/trunk/product/services/spring/src/main/java/org/jboss/soa/esb/actions/AbstractSpringAction.java
   labs/jbossesb/trunk/product/services/spring/src/main/resources/
   labs/jbossesb/trunk/product/services/spring/src/main/resources/META-INF/
   labs/jbossesb/trunk/product/services/spring/src/main/resources/META-INF/jboss-esb.xml
   labs/jbossesb/trunk/product/services/spring/src/test/
   labs/jbossesb/trunk/product/services/spring/src/test/java/
   labs/jbossesb/trunk/product/services/spring/src/test/java/org/
   labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/
   labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/
   labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/
   labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/
   labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/
   labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/AbstractSpringActionUnitTest.java
   labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/MockSpringAction.java
   labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/MyInterceptor.java
   labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/SaySomething.java
   labs/jbossesb/trunk/product/services/spring/src/test/resources/
   labs/jbossesb/trunk/product/services/spring/src/test/resources/spring-context-1.xml
   labs/jbossesb/trunk/product/services/spring/src/test/resources/spring-context-2.xml
Removed:
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/AbstractSpringAction.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/
   labs/jbossesb/trunk/product/lib/ext/aspectjrt.jar
   labs/jbossesb/trunk/product/lib/ext/aspectjweaver.jar
   labs/jbossesb/trunk/product/lib/ext/commons-dbcp-1.2.1.jar
   labs/jbossesb/trunk/product/lib/ext/commons-pool.jar
   labs/jbossesb/trunk/product/lib/ext/ibatis-2.3.0.677.jar
   labs/jbossesb/trunk/product/lib/ext/spring-aspects.jar
   labs/jbossesb/trunk/product/lib/ext/spring-mock.jar
   labs/jbossesb/trunk/product/lib/ext/spring.jar
Modified:
   labs/jbossesb/trunk/product/build-distr.xml
   labs/jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/spring_aop/deployment.xml
   labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/deployment.xml
   labs/jbossesb/trunk/product/samples/quickstarts/spring_jpetstore/deployment.xml
   labs/jbossesb/trunk/product/services/build.xml
Log:
JBESB-500, moving spring to it's own spring.esb services package

Modified: labs/jbossesb/trunk/product/build-distr.xml
===================================================================
--- labs/jbossesb/trunk/product/build-distr.xml	2007-06-07 19:27:31 UTC (rev 12388)
+++ labs/jbossesb/trunk/product/build-distr.xml	2007-06-07 19:42:18 UTC (rev 12389)
@@ -99,7 +99,6 @@
             <fileset dir="${installation.files.dir}/conf">
                 <include name="jbossesb-properties.xml"/>
                 <include name="esb.juddi.properties"/>
-                <include name="smooks-cdr.lst"/>
                 <include name="repository.xml"/>
             </fileset>
             <fileset dir="${installation.files.dir}/jUDDI-registry">
@@ -127,23 +126,15 @@
             <fileset dir="${lib.ext.dir}" includes="xbean.jar,stax-api-1.0.1.jar,xmlpublic.jar"/>
             <!-- jUDDI Registry -->
             <fileset dir="${lib.ext.dir}" includes="juddi-1.0-SNAPSHOT.jar,juddi-client-1.0-SNAPSHOT.jar"/>
-            <!-- jboss rules for CBR -->
-            <fileset dir="${lib.ext.dir}" includes="antlr-3.0ea8.jar,antlr-2.7.6.jar,
-            drools-compiler-3.0.4.jar,drools-core-3.0.4.jar,stringtemplate-2.3b6.jar,
-            commons-jci-core-1.0-406301.jar, commons-jci-janino-2.4.3.jar, janino-2.4.3.jar"/>
             <!-- smooks for transformation -->
             <fileset dir="${lib.ext.dir}"
-                     includes="milyn-*.jar,opencsv-*.jar,ognl-*.jar,groovy-*.jar,commons-lang-2.1.jar"/>
+                     includes="opencsv-*.jar,ognl-*.jar,groovy-*.jar,commons-lang-2.1.jar"/>
             <!-- ftp -->
             <fileset dir="${lib.ext.dir}" includes="edtftpj-*.jar"/>
-            <!-- connection pooling -->
-            <fileset dir="${lib.ext.dir}" includes="c3p0-*.jar"/>
             <!-- JCR repository -->
             <fileset dir="${lib.ext.dir}" includes="jcr-*.jar,jackrabbit-*.jar,commons-io-*.jar,lucene-*.jar"/>
             <!-- XStream jars - including woodstox for the StaxDriver -->
             <fileset dir="${lib.ext.dir}" includes="xstream-*.jar,wstx-lgpl-*.jar"/>
-            <!-- spring -->
-            <fileset dir="${lib.ext.dir}" includes="aspectjrt.jar aspectjweaver.jar spring-aspects.jar spring.jar spring-mock.jar ibatis-2.3.0.677.jar commons-dbcp-1.2.1.jar commons-pool.jar"/>
         </copy>
 
     </target>
@@ -151,10 +142,11 @@
     <target name="services">
         <mkdir dir="${build.dir}/services"/>
         <copy todir="${build.dir}/services">
-            <fileset dir="${services.dir}/jbpm/build" includes="jbpm.esb/**/*"/>
             <fileset dir="${services.dir}/jbossesb/build" includes="jbossesb.esb/**/*" excludes="jbossesb.esb/jbmq-queue-service.xml jbossesb.esb/jbm-queue-service-scoped.xml"/>
+        	<fileset dir="${services.dir}/jbpm/build" includes="jbpm.esb/**/*"/>
         	<fileset dir="${services.dir}/jbrules/build" includes="jbrules.esb/**/*"/>
         	<fileset dir="${services.dir}/smooks/build" includes="smooks.esb/**/*" excludes="smooks.esb/jbmq-queue-service.xml smooks.esb/jbm-queue-service-scoped.xml"/>
+        	<fileset dir="${services.dir}/spring/build" includes="spring.esb/**/*"/>
         </copy>
     </target>
 

Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/AbstractSpringAction.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/AbstractSpringAction.java	2007-06-07 19:27:31 UTC (rev 12388)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/AbstractSpringAction.java	2007-06-07 19:42:18 UTC (rev 12389)
@@ -1,194 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.soa.esb.actions;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- * Abstract class for Actions that make calls to Spring beans. 
- * 
- * <p>This class creates a Spring IoC from a jboss-esb.xml element named "springContextXml". 
- * A comma separated list of spring context files may be used.
- * 
- * @author <a href="mailto:james.williams at redhat.com">James Williams</a>.
- * 
- */
-public abstract class AbstractSpringAction extends AbstractActionLifecycle
-      implements ActionLifecycle
-{
-   private static Logger logger = Logger.getLogger(AbstractSpringAction.class);
-
-   private static final String SPRING_CONTEXT_XML_ATTR = "springContextXml";
-
-   private String springContextXml;
-
-   protected ConfigTree configTree;
-
-   private BeanFactory factory;
-
-   /*
-    * (non-Javadoc)
-    * 
-    * @see org.jboss.soa.esb.actions.AbstractActionLifecycle#initialise()
-    */
-   public void initialise() throws ActionLifecycleException
-   {
-      springContextXml = configTree.getAttribute(SPRING_CONTEXT_XML_ATTR);
-
-      if (springContextXml == null)
-      {
-         logger.error("No Spring context specified on action config "
-               + configTree.getAttribute("name")
-               + ". Expecting Spring context name.");
-         throw new ActionLifecycleException(
-               "No Spring context specified on action config: "
-                     + SPRING_CONTEXT_XML_ATTR + ".");
-      } else
-      {
-         initializeSpring();
-      }
-   }
-
-   /**
-    * Initialize Spring IoC
-    * 
-    * @throws ActionLifecycleException
-    */
-   protected void initializeSpring() throws ActionLifecycleException
-   {
-      if (isBeanFactoryNull())
-      {
-         loadSpringIoc();
-      }
-   }
-
-   /**
-    * Request a BeanFactory instance from the action. If no Spring IoC container
-    * exists, create one.
-    * 
-    * @return Spring Bean Factory
-    * @throws ActionLifecycleException
-    */
-   protected BeanFactory getBeanFactory() throws ActionLifecycleException
-   {
-      return this.factory;
-   }
-
-   /**
-    * Check to see if Spring Bean factory is null. Mostly used for unit tests,
-    * but could provide use in other situations.
-    * 
-    * @return
-    */
-   public boolean isBeanFactoryNull()
-   {
-      if (factory == null)
-      {
-         return true;
-      } else
-      {
-         return false;
-      }
-   }
-
-   /**
-    * Create a spring IoC container.
-    * 
-    * @throws ActionLifecycleException
-    */
-   private void loadSpringIoc() throws ActionLifecycleException
-   {
-      String springContextXml = configTree
-            .getAttribute(SPRING_CONTEXT_XML_ATTR);
-      try
-      {
-         ApplicationContext springContext;
-
-         if (springContextXml.contains(","))
-         {
-            String[] springContextXmls = springContextXml.split(",");
-            springContext = new ClassPathXmlApplicationContext(
-                  springContextXmls);
-         } else
-         {
-            springContext = new ClassPathXmlApplicationContext(springContextXml);
-         }
-
-         factory = (BeanFactory) springContext;
-      } catch (Exception e)
-      {
-         throw new ActionLifecycleException(e);
-      }
-   }
-
-   /**
-    * Generic Exception handler for Spring Actions. Displays the root cause
-    * message and full stack trace.
-    * 
-    * @param message
-    * @param exception
-    */
-   public void exceptionHandler(Message message, Throwable exception)
-   {
-      Throwable rootCause = exception.getCause();
-      StackTraceElement[] traceElms = rootCause.getStackTrace();
-
-      StringBuffer stackTrace = new StringBuffer("Exception Root Cause is: \n");
-      stackTrace.append(rootCause.getMessage());
-      stackTrace.append("\n Full Stack Trace is: \n");
-      for (StackTraceElement elm : traceElms)
-      {
-         stackTrace.append(elm);
-         stackTrace.append("\n");
-      }
-
-      logger.error(stackTrace.toString());
-   }
-
-   /**
-    * Conviencence method for printing a console log header
-    */
-   protected void logHeader()
-   {
-      System.out.println("\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
-   }
-
-   /**
-    * Conviencence method for printing a console log footer
-    */
-   protected void logFooter()
-   {
-      System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n");
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.soa.esb.actions.AbstractActionLifecycle#destroy()
-    */
-   public void destroy() throws ActionLifecycleException
-   {
-   }
-}

Deleted: labs/jbossesb/trunk/product/lib/ext/aspectjrt.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/aspectjweaver.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/commons-dbcp-1.2.1.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/commons-pool.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/ibatis-2.3.0.677.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/spring-aspects.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/spring-mock.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/spring.jar
===================================================================
(Binary files differ)

Modified: labs/jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml	2007-06-07 19:27:31 UTC (rev 12388)
+++ labs/jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml	2007-06-07 19:42:18 UTC (rev 12389)
@@ -160,7 +160,10 @@
 
 		<path id="deployment-classpath">
 			<fileset dir="${base.jbossesb}/lib" includes="*.jar"/>
-			<fileset dir="${base.jbossesb}/lib/ext" includes="*.jar"/>
+			<fileset dir="${base.jbossesb}/lib/ext" includes="*.jar"/>
+			<!-- jbossesb config -->
+			<fileset dir="${base.jbossesb}/lib/jbossesb.esb" includes="*.jar"/>
+			<pathelement location="${base.jbossesb}/lib/jbossesb.esb"/>
 			<!-- jbpm config -->
 			<fileset dir="${base.jbossesb}/lib/jbpm.esb" includes="*.jar"/>
 			<pathelement location="${base.jbossesb}/lib/jbpm.esb"/>
@@ -169,7 +172,10 @@
 			<pathelement location="${base.jbossesb}/lib/smooks.esb"/>
 			<!-- jbrules config -->
 			<fileset dir="${base.jbossesb}/lib/jbrules.esb" includes="*.jar"/>
-			<pathelement location="${base.jbossesb}/lib/jbrules.esb"/>
+			<pathelement location="${base.jbossesb}/lib/jbrules.esb"/>
+			<!-- spring config -->
+			<fileset dir="${base.jbossesb}/lib/spring.esb" includes="*.jar"/>
+			<pathelement location="${base.jbossesb}/lib/spring.esb"/>
 		</path>
 	</target>
 
@@ -179,7 +185,10 @@
 		<property name="org.jboss.esb.server.config" value="default"/>
 
 		<path id="deployment-classpath">
-			<fileset dir="${product.dir}/server/default/deploy/jbossesb.sar/lib" includes="*.jar"/>
+			<fileset dir="${product.dir}/server/default/deploy/jbossesb.sar/lib" includes="*.jar"/>
+			<!-- jbossesb config -->
+			<fileset dir="${product.dir}/server/default/deploy/jbossesb.esb" includes="*.jar"/>
+			<pathelement location="${product.dir}/server/default/deploy/jbossesb.esb"/>
 			<!-- jbpm config -->
 			<fileset dir="${product.dir}/server/default/deploy/jbpm.esb" includes="*.jar"/>
 			<pathelement location="${product.dir}/server/default/deploy/jbpm.esb"/>
@@ -189,7 +198,10 @@
 			<pathelement location="${product.dir}/server/default/deploy/smooks.esb"/>
 			<!-- jbrules config -->
 			<fileset dir="${product.dir}/server/default/deploy/jbrules.esb" includes="*.jar"/>
-			<pathelement location="${product.dir}/server/default/deploy/jbrules.esb"/>
+			<pathelement location="${product.dir}/server/default/deploy/jbrules.esb"/>
+			<!-- spring config -->
+			<fileset dir="${product.dir}/server/default/deploy/spring.esb" includes="*.jar"/>
+			<pathelement location="${product.dir}/server/default/deploy/spring.esb"/>
 		</path>
 	</target>
 	

Modified: labs/jbossesb/trunk/product/samples/quickstarts/spring_aop/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_aop/deployment.xml	2007-06-07 19:27:31 UTC (rev 12388)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_aop/deployment.xml	2007-06-07 19:42:18 UTC (rev 12389)
@@ -1,4 +1,5 @@
 <jbossesb-deployment>
+  <depends>jboss.esb:deployment=spring.esb</depends>
   <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_spring_aop_Request</depends>
   <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_spring_aop_Response</depends>
 </jbossesb-deployment>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/deployment.xml	2007-06-07 19:27:31 UTC (rev 12388)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/deployment.xml	2007-06-07 19:42:18 UTC (rev 12389)
@@ -1,4 +1,5 @@
 <jbossesb-deployment>
+  <depends>jboss.esb:deployment=spring.esb</depends>
   <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_spring_helloworld_Request</depends>
   <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_spring_helloworld_Response</depends>
 </jbossesb-deployment>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/spring_jpetstore/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_jpetstore/deployment.xml	2007-06-07 19:27:31 UTC (rev 12388)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_jpetstore/deployment.xml	2007-06-07 19:42:18 UTC (rev 12389)
@@ -1,4 +1,5 @@
 <jbossesb-deployment>
+  <depends>jboss.esb:deployment=spring.esb</depends>
   <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_spring_jpetstore_Request</depends>
   <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_spring_jpetstore_Response</depends>
 </jbossesb-deployment>

Modified: labs/jbossesb/trunk/product/services/build.xml
===================================================================
--- labs/jbossesb/trunk/product/services/build.xml	2007-06-07 19:27:31 UTC (rev 12388)
+++ labs/jbossesb/trunk/product/services/build.xml	2007-06-07 19:42:18 UTC (rev 12389)
@@ -8,6 +8,7 @@
 		<ant dir="jbrules" target="dist"/>
 		<ant dir="smooks" target="dist"/>
         <ant dir="soapui-client" target="sar"/>
+        <ant dir="spring" target="dist"/>
     </target>
 
     <target name="clean">
@@ -16,6 +17,7 @@
 		<ant dir="jbrules" target="clean"/>
 		<ant dir="smooks" target="clean"/>
         <ant dir="soapui-client" target="clean"/>
+        <ant dir="spring" target="clean"/>
     </target>
 
     <target name="test">
@@ -24,6 +26,7 @@
 		<ant dir="jbrules" target="test"/>
 		<ant dir="smooks" target="test"/>
 		<ant dir="soapui-client" target="test"/>
+		<ant dir="spring" target="test"/>
     </target>
     
     <target name="copy-buildfiles">
@@ -37,6 +40,8 @@
         <copy todir="smooks" file="build.properties"/>
         <copy todir="soapui-client" file="base-project-build.xml"/>
         <copy todir="soapui-client" file="build.properties"/>
+        <copy todir="spring" file="base-project-build.xml"/>
+        <copy todir="spring" file="build.properties"/>
     </target>
 	
 </project>


Property changes on: labs/jbossesb/trunk/product/services/spring
___________________________________________________________________
Name: svn:ignore
   + build


Copied: labs/jbossesb/trunk/product/services/spring/lib/ext/aspectjrt.jar (from rev 12387, labs/jbossesb/trunk/product/lib/ext/aspectjrt.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/spring/lib/ext/aspectjweaver.jar (from rev 12387, labs/jbossesb/trunk/product/lib/ext/aspectjweaver.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/spring/lib/ext/commons-dbcp-1.2.1.jar (from rev 12387, labs/jbossesb/trunk/product/lib/ext/commons-dbcp-1.2.1.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/spring/lib/ext/commons-pool.jar (from rev 12387, labs/jbossesb/trunk/product/lib/ext/commons-pool.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/spring/lib/ext/ibatis-2.3.0.677.jar (from rev 12387, labs/jbossesb/trunk/product/lib/ext/ibatis-2.3.0.677.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/spring/lib/ext/spring-aspects.jar (from rev 12387, labs/jbossesb/trunk/product/lib/ext/spring-aspects.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/spring/lib/ext/spring-mock.jar (from rev 12387, labs/jbossesb/trunk/product/lib/ext/spring-mock.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/spring/lib/ext/spring.jar (from rev 12387, labs/jbossesb/trunk/product/lib/ext/spring.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/spring/src/main/java/org/jboss/soa/esb/actions/AbstractSpringAction.java (from rev 12387, labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/AbstractSpringAction.java)
===================================================================
--- labs/jbossesb/trunk/product/services/spring/src/main/java/org/jboss/soa/esb/actions/AbstractSpringAction.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/spring/src/main/java/org/jboss/soa/esb/actions/AbstractSpringAction.java	2007-06-07 19:42:18 UTC (rev 12389)
@@ -0,0 +1,194 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.actions;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Abstract class for Actions that make calls to Spring beans. 
+ * 
+ * <p>This class creates a Spring IoC from a jboss-esb.xml element named "springContextXml". 
+ * A comma separated list of spring context files may be used.
+ * 
+ * @author <a href="mailto:james.williams at redhat.com">James Williams</a>.
+ * 
+ */
+public abstract class AbstractSpringAction extends AbstractActionLifecycle
+      implements ActionLifecycle
+{
+   private static Logger logger = Logger.getLogger(AbstractSpringAction.class);
+
+   private static final String SPRING_CONTEXT_XML_ATTR = "springContextXml";
+
+   private String springContextXml;
+
+   protected ConfigTree configTree;
+
+   private BeanFactory factory;
+
+   /*
+    * (non-Javadoc)
+    * 
+    * @see org.jboss.soa.esb.actions.AbstractActionLifecycle#initialise()
+    */
+   public void initialise() throws ActionLifecycleException
+   {
+      springContextXml = configTree.getAttribute(SPRING_CONTEXT_XML_ATTR);
+
+      if (springContextXml == null)
+      {
+         logger.error("No Spring context specified on action config "
+               + configTree.getAttribute("name")
+               + ". Expecting Spring context name.");
+         throw new ActionLifecycleException(
+               "No Spring context specified on action config: "
+                     + SPRING_CONTEXT_XML_ATTR + ".");
+      } else
+      {
+         initializeSpring();
+      }
+   }
+
+   /**
+    * Initialize Spring IoC
+    * 
+    * @throws ActionLifecycleException
+    */
+   protected void initializeSpring() throws ActionLifecycleException
+   {
+      if (isBeanFactoryNull())
+      {
+         loadSpringIoc();
+      }
+   }
+
+   /**
+    * Request a BeanFactory instance from the action. If no Spring IoC container
+    * exists, create one.
+    * 
+    * @return Spring Bean Factory
+    * @throws ActionLifecycleException
+    */
+   protected BeanFactory getBeanFactory() throws ActionLifecycleException
+   {
+      return this.factory;
+   }
+
+   /**
+    * Check to see if Spring Bean factory is null. Mostly used for unit tests,
+    * but could provide use in other situations.
+    * 
+    * @return
+    */
+   public boolean isBeanFactoryNull()
+   {
+      if (factory == null)
+      {
+         return true;
+      } else
+      {
+         return false;
+      }
+   }
+
+   /**
+    * Create a spring IoC container.
+    * 
+    * @throws ActionLifecycleException
+    */
+   private void loadSpringIoc() throws ActionLifecycleException
+   {
+      String springContextXml = configTree
+            .getAttribute(SPRING_CONTEXT_XML_ATTR);
+      try
+      {
+         ApplicationContext springContext;
+
+         if (springContextXml.contains(","))
+         {
+            String[] springContextXmls = springContextXml.split(",");
+            springContext = new ClassPathXmlApplicationContext(
+                  springContextXmls);
+         } else
+         {
+            springContext = new ClassPathXmlApplicationContext(springContextXml);
+         }
+
+         factory = (BeanFactory) springContext;
+      } catch (Exception e)
+      {
+         throw new ActionLifecycleException(e);
+      }
+   }
+
+   /**
+    * Generic Exception handler for Spring Actions. Displays the root cause
+    * message and full stack trace.
+    * 
+    * @param message
+    * @param exception
+    */
+   public void exceptionHandler(Message message, Throwable exception)
+   {
+      Throwable rootCause = exception.getCause();
+      StackTraceElement[] traceElms = rootCause.getStackTrace();
+
+      StringBuffer stackTrace = new StringBuffer("Exception Root Cause is: \n");
+      stackTrace.append(rootCause.getMessage());
+      stackTrace.append("\n Full Stack Trace is: \n");
+      for (StackTraceElement elm : traceElms)
+      {
+         stackTrace.append(elm);
+         stackTrace.append("\n");
+      }
+
+      logger.error(stackTrace.toString());
+   }
+
+   /**
+    * Conviencence method for printing a console log header
+    */
+   protected void logHeader()
+   {
+      System.out.println("\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+   }
+
+   /**
+    * Conviencence method for printing a console log footer
+    */
+   protected void logFooter()
+   {
+      System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.soa.esb.actions.AbstractActionLifecycle#destroy()
+    */
+   public void destroy() throws ActionLifecycleException
+   {
+   }
+}

Added: labs/jbossesb/trunk/product/services/spring/src/main/resources/META-INF/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/services/spring/src/main/resources/META-INF/jboss-esb.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/spring/src/main/resources/META-INF/jboss-esb.xml	2007-06-07 19:42:18 UTC (rev 12389)
@@ -0,0 +1,6 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
+     <!--  
+     		jbossesb spring integration
+     -->
+</jbossesb>


Property changes on: labs/jbossesb/trunk/product/services/spring/src/main/resources/META-INF/jboss-esb.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Copied: labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/AbstractSpringActionUnitTest.java (from rev 12387, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/AbstractSpringActionUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/AbstractSpringActionUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/AbstractSpringActionUnitTest.java	2007-06-07 19:42:18 UTC (rev 12389)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.actions.spring;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+
+/**
+ * Unit tests for org.jboss.soa.esb.actions.AbstractSpringAction
+ * 
+ * @author <a href="mailto:james.williams at redhat.com">james.williams at redhat.com</a>
+ */
+public class AbstractSpringActionUnitTest extends TestCase
+{
+
+   public void test_bean_factory_load_single() throws Exception
+   {
+      ConfigTree config = new ConfigTree("<config/>");
+
+      config.setAttribute("springContextXml", "/spring-context-1.xml");
+
+      MockSpringAction mockAction = new MockSpringAction(config);
+      assertEquals("hello from Spring", mockAction.sayHelloSpring());
+      assertEquals(false, mockAction.isBeanFactoryNull());
+   }
+
+   public void test_bean_factory_load_multiple() throws Exception
+   {
+      ConfigTree config = new ConfigTree("<config/>");
+
+    
+      String configPath1 = "/spring-context-1.xml";
+      String configPath2 = "/spring-context-2.xml";
+
+      config.setAttribute("springContextXml", configPath1 + "," + configPath2);
+
+      MockSpringAction mockAction = new MockSpringAction(config);
+      assertEquals("hello from Spring", mockAction.sayHelloSpring());
+      assertEquals("goodbye from Spring", mockAction.sayGoodbyeSpring());
+      assertEquals(false, mockAction.isBeanFactoryNull());
+   }
+
+   public void test_spring_aop() throws Exception
+   {
+      ConfigTree config = new ConfigTree("<config/>");
+
+      String pathToConfigFile = "/spring-context-1.xml";
+
+      config.setAttribute("springContextXml", pathToConfigFile);
+
+      MockSpringAction mockAction = new MockSpringAction(config);
+      assertEquals("Greeting Changed", mockAction.sayHelloAopStyle());
+      assertEquals(false, mockAction.isBeanFactoryNull());
+   }
+}

Copied: labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/MockSpringAction.java (from rev 12387, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/MockSpringAction.java)
===================================================================
--- labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/MockSpringAction.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/MockSpringAction.java	2007-06-07 19:42:18 UTC (rev 12389)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.actions.spring;
+
+import org.jboss.soa.esb.actions.AbstractSpringAction;
+import org.jboss.soa.esb.helpers.ConfigTree;
+
+/**
+ * Used to test Spring integration.
+ * 
+ * @author James Williams(james.williams at redhat.com)
+ * 
+ */
+public class MockSpringAction extends AbstractSpringAction
+{
+
+   public MockSpringAction(ConfigTree config) throws Exception
+   {
+      configTree = config;
+      initialise();
+   }
+
+   public String sayHelloSpring() throws Exception
+   {
+      SaySomething hello = (SaySomething) getBeanFactory().getBean(
+            "helloObject");
+
+      return hello.getGreeting();
+   }
+
+   public String sayGoodbyeSpring() throws Exception
+   {
+      SaySomething goodbye = (SaySomething) getBeanFactory().getBean(
+            "goodbyeObject");
+      return goodbye.getGreeting();
+   }
+
+   public String sayHelloAopStyle() throws Exception
+   {
+      SaySomething hello = (SaySomething) getBeanFactory().getBean(
+            "helloObject");
+      hello.setGreeting("trying to trigger interceptor");
+
+      return hello.getGreeting();
+   }
+}
\ No newline at end of file

Copied: labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/MyInterceptor.java (from rev 12387, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/MyInterceptor.java)
===================================================================
--- labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/MyInterceptor.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/MyInterceptor.java	2007-06-07 19:42:18 UTC (rev 12389)
@@ -0,0 +1,21 @@
+package org.jboss.soa.esb.actions.spring;
+
+import java.lang.reflect.Method;
+
+import org.springframework.aop.AfterReturningAdvice;
+
+/**
+ * Spring interceptor implementation used to test Spring AOP integration.
+ * 
+ * @author James Williams(james.williams at redhat.com)
+ * 
+ */
+public class MyInterceptor implements AfterReturningAdvice
+{
+   public void afterReturning(Object returnValue, Method m, Object[] args,
+         Object target) throws Exception
+   {
+      SaySomething something = (SaySomething) target;
+      something.setGreeting("Greeting Changed");
+   }
+}

Copied: labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/SaySomething.java (from rev 12387, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/SaySomething.java)
===================================================================
--- labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/SaySomething.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/spring/src/test/java/org/jboss/soa/esb/actions/spring/SaySomething.java	2007-06-07 19:42:18 UTC (rev 12389)
@@ -0,0 +1,22 @@
+package org.jboss.soa.esb.actions.spring;
+
+/**
+ * Simple pojo used to test Spring AOP integration.
+ * 
+ * @author James Williams(james.williams at redhat.com)
+ * 
+ */
+public class SaySomething
+{
+   private String greeting;
+
+   public String getGreeting()
+   {
+      return greeting;
+   }
+
+   public void setGreeting(String greeting)
+   {
+      this.greeting = greeting;
+   }
+}

Added: labs/jbossesb/trunk/product/services/spring/src/test/resources/spring-context-1.xml
===================================================================
--- labs/jbossesb/trunk/product/services/spring/src/test/resources/spring-context-1.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/spring/src/test/resources/spring-context-1.xml	2007-06-07 19:42:18 UTC (rev 12389)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Spring AOP and simple spring beans definitions to test AbstractSpringAction -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:aop="http://www.springframework.org/schema/aop"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
+
+	<!-- ========================= BUSINESS OBJECT DEFINITIONS ======================== -->
+
+	<bean id="helloObject" class="org.jboss.soa.esb.actions.spring.SaySomething">
+		<property name="greeting" value="hello from Spring"/>
+	</bean>
+	
+	<aop:config proxy-target-class="true">
+		<aop:advisor pointcut="execution(* setGreeting*(..))" advice-ref="myInterceptor" />
+	</aop:config>
+
+	<bean id="myInterceptor"
+		class="org.jboss.soa.esb.actions.spring.MyInterceptor"/>
+	
+
+</beans>


Property changes on: labs/jbossesb/trunk/product/services/spring/src/test/resources/spring-context-1.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/services/spring/src/test/resources/spring-context-2.xml
===================================================================
--- labs/jbossesb/trunk/product/services/spring/src/test/resources/spring-context-2.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/spring/src/test/resources/spring-context-2.xml	2007-06-07 19:42:18 UTC (rev 12389)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Second spring context to test loading multiple spring contexts using AbstractSpringAction -->
+
+<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.0.xsd">
+
+	<!-- ========================= BUSINESS OBJECT DEFINITIONS ======================== -->
+
+	<bean id="goodbyeObject" class="org.jboss.soa.esb.actions.spring.SaySomething">
+		<property name="greeting" value="goodbye from Spring"/>
+	</bean>
+	
+
+</beans>


Property changes on: labs/jbossesb/trunk/product/services/spring/src/test/resources/spring-context-2.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native




More information about the jboss-svn-commits mailing list