[jboss-svn-commits] JBL Code SVN: r12302 - in labs/jbossesb/trunk/product/samples/quickstarts: spring_helloworld and 9 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Jun 3 15:17:00 EDT 2007
Author: james.williams at jboss.com
Date: 2007-06-03 15:17:00 -0400 (Sun, 03 Jun 2007)
New Revision: 12302
Added:
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbm-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbossesb-gateway.xml
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbossesb-listener.xml
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbossesb-properties.xml
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/juddi.properties
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/log4j.xml
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/spring-context-goodbye.xml
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/spring-context-hello.xml
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/MySpringEnabledAction.java
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/SaySomething.java
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/test/
labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/test/SendJMSMessage.java
Log:
initial commit of spring quickstart code for jira ticket:
http://jira.jboss.com/jira/browse/JBESB-367
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/build.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/build.xml 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,20 @@
+<project name="spring_helloworld" default="runtest" basedir=".">
+
+ <description>
+ ${ant.project.name}
+ ${line.separator}
+ </description>
+
+ <!-- Import the base Ant build script... -->
+ <import file="../conf/base-build.xml"/>
+
+ <target name="runtest" depends="compile"
+ description="sends a JMS message to the ESB">
+ <echo>Runs Test JMS Sender</echo>
+ <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.spring.test.SendJMSMessage" failonerror="true">
+ <arg value="Hello World From JMS"/>
+ <classpath refid="exec-classpath"/>
+ </java>
+ </target>
+
+</project>
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbm-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbm-queue-service.xml 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=quickstart_helloworld_action_Request"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=quickstart_helloworld_action_Response"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jboss-esb.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jboss-esb.xml 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,62 @@
+<?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">
+
+ <providers>
+ <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
+
+ <jms-bus busid="quickstartGwChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_helloworld_action_Request"
+ />
+ </jms-bus>
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/B"
+ />
+ </jms-bus>
+
+ </jms-provider>
+ </providers>
+
+ <services>
+
+ <service category="HelloWorld_ActionESB"
+ name="SimpleListener"
+ description="Hello World" >
+ <listeners>
+ <jms-listener name="JMS-Gateway"
+ busidref="quickstartGwChannel"
+ maxThreads="1"
+ is-gateway="true"
+ />
+ <jms-listener name="JMS-ESBListener"
+ busidref="quickstartEsbChannel"
+ maxThreads="1"
+ />
+ </listeners>
+ <actions>
+ <action name="sayHello"
+ class="org.jboss.soa.esb.samples.quickstart.spring.MySpringEnabledAction"
+ process="sayHelloSpring,displayMessage">
+ <property name="exceptionMethod" value="exceptionHandler"/>
+ <property name="springContextXml" value="spring-context-hello.xml"/>
+ </action>
+ <action name="addGoodbye"
+ class="org.jboss.soa.esb.samples.quickstart.spring.MySpringEnabledAction"
+ process="sayGoodbyeSpring,displayMessage">
+ <property name="exceptionMethod" value="exceptionHandler"/>
+ <property name="springContextXml" value="spring-context-goodbye.xml"/>
+ </action>
+ <action name="addHelloGoodbye"
+ class="org.jboss.soa.esb.samples.quickstart.spring.MySpringEnabledAction"
+ process="sayHelloSpring,sayGoodbyeSpring,displayMessage">
+ <property name="exceptionMethod" value="exceptionHandler"/>
+ <property name="springContextXml" value="spring-context-goodbye.xml,spring-context-hello.xml"/>
+ </action>
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbossesb-gateway.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbossesb-gateway.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbossesb-gateway.xml 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ NOTE: DO NOT MODIFY
+ This file was auto-generated.
+-->
+<jbossesb-gateways parameterReloadSecs="5">
+<JMS-Gateway connection-factory="ConnectionFactory" destination-name="queue/quickstart_helloworld_action_Request" destination-type="queue" gatewayClass="org.jboss.soa.esb.listeners.gateway.JmsGatewayListener" maxThreads="1" service-description="Hello World" target-service-category="HelloWorld_ActionESB" target-service-name="SimpleListener"/>
+</jbossesb-gateways>
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbossesb-listener.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbossesb-listener.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbossesb-listener.xml 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ NOTE: DO NOT MODIFY
+ This file was auto-generated.
+-->
+<jbossesb-listeners parameterReloadSecs="5">
+<JMS-ESBListener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" service-category="HelloWorld_ActionESB" service-description="Hello World" service-name="SimpleListener">
+<EPR connection-factory="ConnectionFactory" destination-name="queue/B" destination-type="queue" protocol="jms"/>
+<action action="sayHello" class="org.jboss.soa.esb.samples.quickstart.spring.MySpringEnabledAction" exceptionMethod="exceptionHandler" process="sayHelloSpring,displayMessage" springContextXml="spring-context-hello.xml"/>
+<action action="addGoodbye" class="org.jboss.soa.esb.samples.quickstart.spring.MySpringEnabledAction" exceptionMethod="exceptionHandler" process="sayGoodbyeSpring,displayMessage" springContextXml="spring-context-goodbye.xml"/>
+<action action="addHelloGoodbye" class="org.jboss.soa.esb.samples.quickstart.spring.MySpringEnabledAction" exceptionMethod="exceptionHandler" process="sayHelloSpring,sayGoodbyeSpring,displayMessage" springContextXml="spring-context-goodbye.xml,spring-context-hello.xml"/>
+</JMS-ESBListener>
+</jbossesb-listeners>
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbossesb-properties.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jbossesb-properties.xml 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+ These options are described in the JBossESB manual.
+ Defaults are provided here for convenience only.
+
+ Please read through this file prior to using the system, and consider
+ updating the specified entries.
+-->
+<esb
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+ <properties name="core">
+ <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
+ <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+ <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+ </properties>
+ <properties name="registry">
+ <property name="org.jboss.soa.esb.registry.queryManagerURI"
+ value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
+ <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
+ value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
+ <property name="org.jboss.soa.esb.registry.implementationClass"
+ value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+ <property name="org.jboss.soa.esb.registry.factoryClass"
+ value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+ <property name="org.jboss.soa.esb.registry.user"
+ value="jbossesb"/>
+ <property name="org.jboss.soa.esb.registry.password"
+ value="password"/>
+ <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+ <property name="org.jboss.soa.esb.scout.proxy.transportClass"
+ value="org.apache.ws.scout.transport.RMITransport"/>
+ </properties>
+ <properties name="transports" depends="core">
+ <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+ <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+ <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+ <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+ </properties>
+ <properties name="connection">
+ <property name="min-pool-size" value="5"/>
+ <property name="max-pool=size" value="10"/>
+ <property name="blocking-timeout-millis" value="5000"/>
+ <property name="abandoned-connection-timeout" value="10000"/>
+ <property name="abandoned-connection-time-interval" value="30000"/>
+ </properties>
+ <properties name="dbstore">
+ <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/jbossesb"/>
+ <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
+ <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
+ <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
+ <!--table managed by pool to test for valid connections - created by pool automatically -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
+ <!-- # of milliseconds to timeout waiting for a connection from pool -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
+ </properties>
+ <properties name="messagerouting">
+ <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+ </properties>
+</esb>
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jndi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jndi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/jndi.properties 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,5 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+java.naming.factory.url.pkgs=org.jnp.interfaces
+
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/juddi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/juddi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/juddi.properties 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=com.mysql.jdbc.Driver
+juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
+juddi.jdbcUsername=root
+juddi.jdbcPassword=admin
+# jUDDI DataSource to use
+# juddi.dataSource=java:comp/env/jdbc/MySqlDS
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/log4j.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/log4j.xml 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A size based file rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="./listener.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss">
+ <priority value="WARN"/>
+ </category>
+ <category name="org.jboss.soa.esb">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.jboss.internal.soa.esb">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.apache">
+ <priority value="ERROR"/>
+ </category>
+ <category name="quickstart">
+ <priority value="INFO"/>
+ </category>
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/readme.txt (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/readme.txt 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,105 @@
+Overview:
+=========
+ The purpose of the spring_helloworld quickstart sample is to show the use of
+ Spring based action invocations. You can use a single Action class and make
+ multiple method calls or use multiple Action classes.
+ You can specify Spring bean XML definitions in jboss-esb.xml and lookup the beans
+ in your Action class. Each Action loads a single Spring IoC container upon first spring bean
+ invocation. Subsequent invocations will not load a new IoC container. Also, none of the Spring
+ dependencies are included. You must manually add additional Spring dependency JARs to the classpath
+ to create Spring beans that have special dependencies, like a DB connection pool.
+
+Running this quickstart:
+========================
+ Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts and a
+ more detailed descripton of the different ways to run the quickstarts.
+
+To Run standalone mode:
+=======================
+ 1. In a command terminal window in the quickstart folder type 'ant deploy-jms-dests'.
+ 2. In a command terminal window in this folder ("Window1"), type 'ant run'.
+ 3. Open another command terminal window in this folder ("Window2"), type 'ant runtest'.
+ 4. Switch back to "Window1" to see the output from the ESB
+ 5. Shutdown the listener by simply using Ctrl-C in that window.
+
+To Run '.esb' archive mode:
+===========================
+ 1. In a command terminal window in this folder ("Window1"), type 'ant undeploy-jms-dests'.
+ 1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
+ 2. Open another command terminal window in this folder ("Window2"), type 'ant runtest'.
+ 3. Switch back to Application Server console to see the output from the ESB
+
+To Run '.esb' archive mode:
+===========================
+ 1. In a command terminal window in this folder ("Window1"), type 'ant undeploy-jms-dests'.
+ 1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
+ 2. Open another command terminal window in this folder ("Window2"), type 'ant runtest'.
+ 3. Switch back to Application Server console to see the output from the ESB
+
+ 'run' target description:
+ In a command prompt window, start the listeners by simply running "ant"
+ in this directory. You might review the build.xml file to see how it is setup.
+ More details on the build.xml can be found later in this document. Shutdown
+ the listener by simply using Ctrl-C in that window.
+
+ 'runtest' target description:
+ In a separate command prompt window, run "ant runtest" to shoot a JMS message
+ into the listener which will then invoke the MyJMSListenerAction and display
+ it to the console. You can modify the build.xml to change the phrase
+ "Hello World" to something else and re-run "ant runtest". You can modify
+ spring-context-hello.xml and/or spring-context-goodbye.xml and change the greeting
+ value of the Spring beans.
+
+ After you have run the test and seen the activity on the console also use the a queue viewer
+ like the one found in the JBoss JMX Console (if you are using JBossMQ) to
+ see the modified message in the outbound queue: quickstart_helloworld_action_Response
+
+Project file descriptions:
+==========================
+ Review the helloworld quickstart as the majority of this is similiar to
+ that example
+
+ MySpringEnabledAction.java:
+ Has methods to display the inbound message, modify the message and to handle an
+ exceptions which might be thrown in the action processing. MySpringEnabledAction will also
+ lookup 2 different Spring beans located in 2 different Spring config files and append the
+ "greeting" to the message. Lastly, this action extends AbstractSpringAction. If you
+ extend AbstractSpringAction, you can define spring configuration files in jboss-esb.xml
+ and lookup Spring beans with "getSpringBeanFactory().getBean("someObject")".
+
+ jbossesb.xml:
+ There are 3 different actions. The first loads up a spring context, does a Spring bean lookup
+ for "helloObject" and displays the JMS message payload plus the "helloObject.getGreeting()"
+ value that is set in spring-context-hello.xml.
+
+ The second action will Spring lookup the "goodbyeObject" and append the
+ "goodbyeObject.getGreeting()" value to the message.
+
+ The third action will Spring lookup the "helloObject" and "goodbyeObject" and append the
+ "helloObject.getGreeting()" and "goodbyeObject.getGreeting()" value to the message. This
+ last action demonstrates that a single action can lookup Spring beans that are in differnt
+ Spring config files, so long as both config files are a comma separated list value for
+ "springContextXml".
+ <action name="sayHello"
+ class="org.jboss.soa.esb.samples.quickstart.helloworldaction.MyJMSListenerAction"
+ process="sayHelloSpring,displayMessage">
+ <property name="exceptionMethod" value="exceptionHandler"/>
+ <property name="springContextXml" value="spring-context-hello.xml"/>
+ </action>
+ <action name="addGoodbye"
+ class="org.jboss.soa.esb.samples.quickstart.helloworldaction.MyJMSListenerAction"
+ process="sayGoodbyeSpring,displayMessage">
+ <property name="exceptionMethod" value="exceptionHandler"/>
+ <property name="springContextXml" value="spring-context-goodbye.xml"/>
+ </action>
+ <action name="addHelloGoodbye"
+ class="org.jboss.soa.esb.samples.quickstart.helloworldaction.MyJMSListenerAction"
+ process="sayHelloSpring,sayGoodbyeSpring,displayMessage">
+ <property name="exceptionMethod" value="exceptionHandler"/>
+ <property name="springContextXml" value="spring-context-goodbye.xml,spring-context-hello.xml"/>
+ </action>
+
+ An ESB action class must have a constructor that accepts a ConfigTree argument like the following:
+ public MySpringEnabledAction(ConfigTree config) { _config = config; }
+
+ A ConfigTree is an object holding any attributes associated with the action declaration in the jbossesb.xml
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/spring-context-goodbye.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/spring-context-goodbye.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/spring-context-goodbye.xml 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<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.samples.quickstart.spring.SaySomething">
+ <property name="greeting" value="goodbye from Spring"/>
+ </bean>
+
+
+</beans>
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/spring-context-hello.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/spring-context-hello.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/spring-context-hello.xml 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<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="helloObject" class="org.jboss.soa.esb.samples.quickstart.spring.SaySomething">
+ <property name="greeting" value="hello from Spring"/>
+ </bean>
+
+
+</beans>
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/MySpringEnabledAction.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/MySpringEnabledAction.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/MySpringEnabledAction.java 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,92 @@
+/*
+ * 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.samples.quickstart.spring;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.AbstractSpringAction;
+import org.jboss.soa.esb.actions.ActionLifecycleException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * Spring enabled action that makes a hello world call.
+ *
+ * @see org.jboss.soa.esb.actions.AbstractSpringAction
+ * @see spring-context-hello.xml
+ * @see spring-context-goodbye.xml
+ *
+ * @author <a href="mailto:james.williams at redhat.com">James Williams</a>.
+ *
+ */
+public class MySpringEnabledAction extends AbstractSpringAction
+{
+
+ public MySpringEnabledAction(ConfigTree config) throws Exception
+ {
+ configTree = config;
+ }
+
+ public Message displayMessage(Message message) throws Exception
+ {
+ logHeader();
+ System.out.println("Body: "
+ + new String(message.getBody().getByteArray()));
+ logFooter();
+
+ return message;
+ }
+
+ public Message sayHelloSpring(Message message) throws Exception
+ {
+
+ SaySomething hello = (SaySomething) getBeanFactory().getBean(
+ "helloObject");
+
+ Body msgBody = message.getBody();
+ String contents = new String(msgBody.getByteArray());
+ StringBuffer sb = new StringBuffer();
+ sb.append(contents);
+ sb.append("\n");
+ sb.append(hello.getGreeting());
+
+ msgBody.setByteArray(sb.toString().getBytes());
+
+ return message;
+ }
+
+ public Message sayGoodbyeSpring(Message message) throws Exception
+ {
+ SaySomething goodbye = (SaySomething) getBeanFactory().getBean(
+ "goodbyeObject");
+
+ Body msgBody = message.getBody();
+ String contents = new String(msgBody.getByteArray());
+ StringBuffer sb = new StringBuffer();
+ sb.append(contents);
+ sb.append("\n");
+ sb.append(goodbye.getGreeting());
+
+ msgBody.setByteArray(sb.toString().getBytes());
+
+ return message;
+ }
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/SaySomething.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/SaySomething.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/SaySomething.java 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,44 @@
+/*
+ * 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.samples.quickstart.spring;
+
+/**
+ * Simple POJO with a single String getter/setter.
+ *
+ * @see spring-context.xml
+ *
+ * @author <a href="mailto:james.williams at redhat.com">James Williams</a>.
+ *
+ */
+public class SaySomething
+{
+ private String greeting;
+
+ public String getGreeting()
+ {
+ return greeting;
+ }
+
+ public void setGreeting(String greeting)
+ {
+ this.greeting = greeting;
+ }
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/test/SendJMSMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/spring_helloworld/src/org/jboss/soa/esb/samples/quickstart/spring/test/SendJMSMessage.java 2007-06-03 19:17:00 UTC (rev 12302)
@@ -0,0 +1,80 @@
+/*
+ * 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.samples.quickstart.spring.test;
+
+import javax.jms.JMSException;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * Send a JMS message that the ESB will listen for.
+ *
+ * @author <a href="mailto:james.williams at redhat.com">James Williams</a>.
+ *
+ */
+public class SendJMSMessage
+{
+ private QueueConnection conn;
+ private QueueSession session;
+ private Queue que;
+
+ public void setupConnection() throws JMSException, NamingException
+ {
+ InitialContext iniCtx = new InitialContext();
+ Object tmp = iniCtx.lookup("ConnectionFactory");
+ QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+ conn = qcf.createQueueConnection();
+ que = (Queue) iniCtx.lookup("queue/quickstart_helloworld_action_Request");
+ session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ conn.start();
+ System.out.println("Connection Started");
+ }
+
+ public void stop() throws JMSException
+ {
+ conn.stop();
+ session.close();
+ conn.close();
+ }
+
+ public void sendAMessage(String msg) throws JMSException
+ {
+
+ QueueSender send = session.createSender(que);
+ ObjectMessage tm = session.createObjectMessage(msg);
+ send.send(tm);
+ send.close();
+ }
+
+ public static void main(String args[]) throws Exception
+ {
+ SendJMSMessage sm = new SendJMSMessage();
+ sm.setupConnection();
+ sm.sendAMessage(args[0]);
+ sm.stop();
+ }
+}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list