[jboss-svn-commits] JBL Code SVN: r7920 - in labs/jbossesb/trunk/product/samples/quickstarts: . simple_transformation simple_transformation/lib simple_transformation/src simple_transformation/src/org simple_transformation/src/org/jboss simple_transformation/src/org/jboss/soa simple_transformation/src/org/jboss/soa/esb simple_transformation/src/org/jboss/soa/esb/dvdstore simple_transformation/src/quickstart simple_transformation/src/quickstart/test
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Nov 28 22:47:15 EST 2006
Author: burrsutter
Date: 2006-11-28 22:46:53 -0500 (Tue, 28 Nov 2006)
New Revision: 7920
Added:
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/SampleOrder.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/esb-config-gateway.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/esb-config.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/jbossesb-properties.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/juddi.properties
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/lib/
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/lib/mysql-connector-java-3.1.12-bin.jar
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/log4j.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/smooks-cdr.lst
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/smooks-res.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/Customer.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/OrderHeader.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/OrderItem.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/orderitem.st
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/Launcher.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/MyJMSListenerAction.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/ReturnJMSMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/test/
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/test/ReceiveJMSMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/test/SendJMSMessage.java
Log:
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/SampleOrder.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/SampleOrder.xml 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/SampleOrder.xml 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,11 @@
+<Order orderId="1" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="0" netAmount="59.97" totalAmount="64.92" tax="4.95">
+ <Customer userName="user1" firstName="Harry" lastName="Fletcher" state="SD"/>
+ <OrderLines>
+ <OrderLine position="1" quantity="1">
+ <Product productId="364" title="The 40-Year-Old Virgin " price="29.98"/>
+ </OrderLine>
+ <OrderLine position="2" quantity="1">
+ <Product productId="299" title="Pulp Fiction" price="29.99"/>
+ </OrderLine>
+ </OrderLines>
+</Order>
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/build.xml 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/build.xml 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,89 @@
+<project name="Quickstart_simple_transformation" default="run" basedir=".">
+ <property name="jbossesbhome.dir"
+ value="/labs/ESBWorkspace/ESBTrunk/product" />
+ <property name="jbosshome.dir"
+ value="/jBoss/jboss-4.0.4.GA_EJB3a"/>
+ <property name="jbossesbdist.dir" value="${jbossesbhome.dir}/build/dist/lib"/>
+ <property name="build.dir"
+ value="${basedir}/build"/>
+ <property name="src.dir"
+ value="${basedir}/src"/>
+
+ <property name="quickstart.dir" value="${jbossesbhome.dir}/samples/quickstarts"/>
+ <property name="esb-config"
+ value="${quickstart.dir}/simple_transformation/esb-config.xml"/>
+ <property name="esb-config-gateway"
+ value="${quickstart.dir}/simple_transformation/esb-config-gateway.xml"/>
+
+ <path id="classpath">
+ <fileset dir="${basedir}" includes="jbossesb-properties.xml"/>
+ <fileset dir="${basedir}" includes="juddi.properties"/>
+ <fileset dir="${basedir}" includes="smooks-cdr.lst"/>
+ <fileset dir="${basedir}" includes="smooks-res.xml"/>
+ <fileset dir="${basedir}/src" includes="*st"/>
+ <fileset dir="${basedir}/lib" includes="*jar"/>
+ <fileset dir="${jbossesbdist.dir}" includes="*jar"/>
+ <fileset dir="${jbossesbdist.dir}" includes="*xml"/>
+ <fileset dir="${jbossesbhome.dir}/lib/ext" includes="*jar"/>
+ <fileset dir="${jbosshome.dir}/client" includes="*jar"/>
+ <fileset dir="${jbosshome.dir}/server/default/lib">
+ <include name="jboss-j2ee.jar"/> <!-- added this for the JMS client -->
+ </fileset>
+
+ <fileset dir="${basedir}" includes="build/**/*.jar"/>
+ <fileset dir="${basedir}" includes="build/**/*.xml"/>
+ <pathelement location="." />
+ </path>
+
+ <property name="cp" refid="classpath"/>
+
+ <target name="echoCP">
+ <echo message="Classpath is ${cp}"/>
+ </target>
+
+ <target name="prepare">
+ <mkdir dir="${build.dir}" />
+ </target>
+
+ <target name="clean">
+ <delete dir="${build.dir}" />
+ </target>
+
+ <target name="compile" depends="prepare">
+ <javac srcdir="${src.dir}"
+ destdir="${build.dir}">
+ <classpath refid="classpath"/>
+ </javac>
+ </target>
+
+ <target name="jars" depends="compile">
+ <delete file="${build.dir}/${ant.project.name}.jar"/>
+ <jar destfile="${build.dir}/${ant.project.name}.jar"
+ basedir="${build.dir}"
+ includes="**/*.class"/>
+ </target>
+
+ <target name="run" depends="jars">
+ <echo>Basic JMS Gateway and Listener</echo>
+ <java fork="yes" classname="quickstart.Launcher" failonerror="true">
+ <arg value="0"/>
+ <arg value="${esb-config}"/>
+ <arg value="${esb-config-gateway}"/>
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+
+ <target name="runtest">
+ <echo>Runs Test JMS Sender</echo>
+ <java fork="yes" classname="quickstart.test.SendJMSMessage" failonerror="true">
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+
+ <target name="receive">
+ <echo>Runs Test JMS Receiver</echo>
+ <java fork="yes" classname="quickstart.test.ReceiveJMSMessage" failonerror="true">
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+</project>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/esb-config-gateway.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/esb-config-gateway.xml 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/esb-config-gateway.xml 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,14 @@
+<esb-config-gateway parameterReloadSecs="180">
+ <esb-jms-gateway
+ target-service-category="MyTransformationServices"
+ target-service-name="MyFirstTransformationService"
+ gatewayClass="org.jboss.soa.esb.listeners.gateway.JmsGatewayListener"
+ connection-factory="ConnectionFactory"
+ destination-type="queue"
+ destination-name="queue/quickstart_simple_transformation_Request"
+ jndi-type="jboss"
+ jndi-URL="localhost"
+ >
+ <!-- Listen for DVDStore_Orders or quickstart_simple_transformation_Request -->
+ </esb-jms-gateway>
+</esb-config-gateway>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/esb-config.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/esb-config.xml 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/esb-config.xml 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,31 @@
+<esb-config parameterReloadSecs="180">
+ <esb-listener
+ service-category="MyTransformationServices"
+ service-name="MyFirstTransformationService"
+ service-description="Simply listens for ESB Messages and applys a Smooks transformation"
+ epr-description="Hello World Transformation"
+ listenerClass="org.jboss.soa.esb.listeners.message.JmsQueueListener"
+ connection-factory="ConnectionFactory"
+ destination-type="queue"
+ destination-name="queue/B"
+ jndi-type="jboss"
+ jndi-URL="localhost"
+ >
+ <action class="quickstart.MyJMSListenerAction" process="displayMessage" />
+
+ <action class="org.jboss.soa.esb.actions.converters.SmooksTransformer"
+
+ from-type="text/xml:fullFillOrder"
+ from="DVDStore:OrderDispatchService"
+
+ to-type="text/xml:shipOrder"
+ to="DVDWarehouse_1:OrderHandlingService"
+
+ />
+
+ <action class="org.jboss.soa.esb.dvdstore.DVDStoreAction" />
+
+ <action class="quickstart.MyJMSListenerAction" process="displayMessage" />
+ <action class="quickstart.MyJMSListenerAction" process="noOperation" okMethod="sendResponse" />
+ </esb-listener>
+</esb-config>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/jbossesb-properties.xml 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/jbossesb-properties.xml 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,77 @@
+<?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="org.apache.juddi.registry.local.InquiryService#inquire"/>
+ <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI" value="org.apache.juddi.registry.local.PublishService#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.LocalTransport"/>
+ </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/simple_transformation/jndi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/jndi.properties 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/jndi.properties 2006-11-29 03:46:53 UTC (rev 7920)
@@ -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/simple_transformation/juddi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/juddi.properties 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/juddi.properties 2006-11-29 03:46:53 UTC (rev 7920)
@@ -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/simple_transformation/lib/mysql-connector-java-3.1.12-bin.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/lib/mysql-connector-java-3.1.12-bin.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/log4j.xml 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/log4j.xml 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,84 @@
+<?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"/>
+
+ <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"/>
+
+ <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="WARN"/>
+ </category>
+ <category name="org.jboss.internal.soa.esb">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.apache">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.milyn">
+ <priority value="ERROR"/>
+ </category>
+
+ <category name="howto">
+ <priority value="ERROR"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/readme.txt 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/readme.txt 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,32 @@
+XML to POJO
+
+The purpose of the simple_transformation quickstart sample is to illustrate the use of Smooks performing
+a simple transformation by converting a XML file into Java POJOs.
+
+You will need three command windows to execute this demonstration. In the three windows execute the following
+commands in the order listed:
+ant
+ant receive
+ant runtest
+
+The listener executes by simply typing "ant" at the command line and it waits. Shut it down via Ctrl-C.
+The message sender executes by typing in "ant runtest". This executes the SendJMSMessage.java class that
+picks up the SampleOrder.xml file from the root of the project and shoots it over to the "quickstart_simple_transformation_Request"
+queue. The gateway listener is looking for messages in that particular queue.
+The message receive executes by typing in "ant receive". This executes the ReceiveJMSMessage.java class
+that waits until a message is received (polls every 2 seconds) and displays it to the console. You can
+shut it down via Ctrl-C.
+
+For more information on the Smooks Transformation engine please consult the MessagesTransformation.pdf
+in the docs directory.
+
+Files to review:
+* esb-config.xml - uses the SmooksTransformerAction which is shipped with the JBoss ESB
+* smooks-res.xml - handles the mappings of the from/to combinations and determines which transformer to apply
+* SampleOrder.xml - is the inbound test order. Feel free to modify the data (not the structure) and send
+it into the transformer multiple times (ant runtest) to see the results.
+* src\org\jboss\soa\esb\dvdstore\DVDStoreAction.java - converts the beans into a concatenated string
+* src\org\jboss\soa\esb\dvdstore\OrderHeader.java - holds the header portion of the Order
+* src\org\jboss\soa\esb\dvdstore\OrderItem.java - holds a line item for the Order
+* src\org\jboss\soa\esb\dvdstore\Customer.java - holds the Customer associated with the Order.
+* src\org\jboss\soa\esb\dvdstore\orderitem.st - is the string transformation template
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/smooks-cdr.lst
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/smooks-cdr.lst 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/smooks-cdr.lst 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,10 @@
+####################################################
+# Uncomment out to load config from database
+####################################################
+# http://localhost:8080/jboss-esb-console/transform/smooks-config.jsf
+
+####################################################
+# Uncomment out to load config from local XML file
+####################################################
+/smooks-res.xml
+/org/milyn/templating/templating-cdu-creators-0.1.cdrl
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/smooks-res.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/smooks-res.xml 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/smooks-res.xml 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<!DOCTYPE smooks-resource-list PUBLIC "-//MILYN//DTD SMOOKS 1.0//EN" "http://www.milyn.org/dtd/smooksres-list-1.0.dtd" >
+<smooks-resource-list>
+ <smooks-resource selector="cdu-creator" useragent="*" path="org.milyn.templating.xslt.XslContentDeliveryUnitCreator" >
+ <param name="restype"><![CDATA[xsl]]></param>
+ </smooks-resource>
+ <smooks-resource selector="cdu-creator" useragent="*" path="org.milyn.templating.stringtemplate.StringTemplateContentDeliveryUnitCreator" >
+ <param name="restype"><![CDATA[st]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+
+ <param name="beanId"><![CDATA[orderHeader]]></param>
+ <param name="beanClass"><![CDATA[org.jboss.soa.esb.dvdstore.OrderHeader]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[orderHeader]]></param>
+ <param name="attributeName"><![CDATA[orderId]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[orderHeader]]></param>
+
+ <param name="attributeName"><![CDATA[orderDate]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[orderHeader]]></param>
+ <param name="attributeName"><![CDATA[statusCode]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[orderHeader]]></param>
+ <param name="attributeName"><![CDATA[netAmount]]></param>
+
+ </smooks-resource>
+ <smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[orderHeader]]></param>
+ <param name="attributeName"><![CDATA[totalAmount]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[orderHeader]]></param>
+ <param name="attributeName"><![CDATA[tax]]></param>
+ </smooks-resource>
+
+ <smooks-resource selector="order customer" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[customer]]></param>
+ <param name="beanClass"><![CDATA[org.jboss.soa.esb.dvdstore.Customer]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order customer" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[customer]]></param>
+ <param name="attributeName"><![CDATA[userName]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order customer" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+
+ <param name="beanId"><![CDATA[customer]]></param>
+ <param name="attributeName"><![CDATA[firstName]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order customer" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[customer]]></param>
+ <param name="attributeName"><![CDATA[lastName]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order customer" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[customer]]></param>
+
+ <param name="attributeName"><![CDATA[state]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order orderlines orderline" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[orderItem]]></param>
+ <param name="beanClass"><![CDATA[org.jboss.soa.esb.dvdstore.OrderItem]]></param>
+ <param name="addToList"><![CDATA[true]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order orderlines orderline" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[orderItem]]></param>
+
+ <param name="attributeName"><![CDATA[position]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order orderlines orderline" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[orderItem]]></param>
+ <param name="attributeName"><![CDATA[quantity]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order orderlines orderline product" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[orderItem]]></param>
+ <param name="attributeName"><![CDATA[productId]]></param>
+
+ </smooks-resource>
+ <smooks-resource selector="order orderlines orderline product" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[orderItem]]></param>
+ <param name="attributeName"><![CDATA[title]]></param>
+ </smooks-resource>
+ <smooks-resource selector="order orderlines orderline product" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+ <param name="beanId"><![CDATA[orderItem]]></param>
+ <param name="attributeName"><![CDATA[price]]></param>
+ </smooks-resource>
+
+ <smooks-resource selector="order orderlines orderline" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice and to-type:text/xml:shiporder and to:dvdwarehouse_1:orderhandlingservice" path="/org/jboss/soa/esb/dvdstore/orderitem.st" >
+ <param name="encoding"><![CDATA[UTF-8]]></param>
+ <param name="visitBefore"><![CDATA[false]]></param>
+ <param name="action"><![CDATA[replace]]></param>
+ </smooks-resource>
+
+</smooks-resource-list>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/Customer.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/Customer.java 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/Customer.java 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,94 @@
+/*
+ * 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.dvdstore;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class Customer {
+
+ // <Customer userName="user1" firstName="Harry" lastName="Potter" state="SD"/>
+ private String userName;
+ private String firstName;
+ private String lastName;
+ private String state;
+
+ /**
+ * @return Returns the firstName.
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+ /**
+ * @param firstName The firstName to set.
+ */
+ public void setFirstName(String firstName) {
+ //System.out.println("**** firstName: " + firstName);
+ this.firstName = firstName;
+ }
+ /**
+ * @return Returns the lastName.
+ */
+ public String getLastName() {
+ return lastName;
+ }
+ /**
+ * @param lastName The lastName to set.
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+ /**
+ * @return Returns the state.
+ */
+ public String getState() {
+ return state;
+ }
+ /**
+ * @param state The state to set.
+ */
+ public void setState(String state) {
+ this.state = state;
+ }
+ /**
+ * @return Returns the userName.
+ */
+ public String getUserName() {
+ return userName;
+ }
+ /**
+ * @param userName The userName to set.
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return userName + "," + firstName + "," + lastName + "," + state;
+ }
+
+
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,86 @@
+/*
+ * 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.dvdstore;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.ActionProcessor;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * DVD Store action.
+ * <p/>
+ * This action uses bean value objects that were prepopulated by Smooks in an earlier action on the pipline.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class DVDStoreAction implements ActionProcessor {
+
+ public DVDStoreAction(ConfigTree configTree) {
+
+ }
+
+ public Message process(Message message) throws ActionProcessingException {
+ HashMap beanHash = (HashMap) message.getBody().get("EXTRACTED_BEANS_HASH");
+
+ StringBuffer results = new StringBuffer();
+ if(beanHash != null) {
+ OrderHeader header = (OrderHeader) beanHash.get("orderHeader");
+ Customer customer = (Customer) beanHash.get("customer");
+ List orderItems = (List) beanHash.get("orderItemList");
+ results.append("Demonstrates Smooks ability to rip the XML into Objects\n");
+ results.append("********* DVDStoreAction - Order Value Objects Populated *********\n");
+ results.append("Header: " + header + "\n");
+ results.append("Customer: " + customer + "\n");
+ if(orderItems != null) {
+ results.append("Order Items (" + orderItems.size() + "):\n");
+ for(int i = 0; i < orderItems.size(); i++) {
+ results.append("\t" + i + ": " + orderItems.get(i) + "\n");
+ }
+ }
+ results.append("\n****************************************************************** ");
+ } else {
+ results.append("\n*** No beanhash found!");
+ }
+
+ // Take this "parsed" output and make it a new message
+ message.getBody().setContents(results.toString().getBytes());
+ return message;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.soa.esb.actions.ActionProcessor#getOkNotification(org.jboss.soa.esb.message.Message)
+ */
+ public Serializable getOkNotification(Message message) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.soa.esb.actions.ActionProcessor#getErrorNotification(org.jboss.soa.esb.message.Message)
+ */
+ public Serializable getErrorNotification(Message message) {
+ return null;
+ }
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/OrderHeader.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/OrderHeader.java 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/OrderHeader.java 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,118 @@
+/*
+ * 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.dvdstore;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class OrderHeader {
+
+ // <Order orderId="1" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="0" netAmount="59.97" totalAmount="64.92" tax="4.95">
+ private String orderId;
+ private String orderDate;
+ private String statusCode;
+ private String netAmount;
+ private String totalAmount;
+ private String tax;
+
+ /**
+ * @return Returns the netAmount.
+ */
+ public String getNetAmount() {
+ return netAmount;
+ }
+ /**
+ * @param netAmount The netAmount to set.
+ */
+ public void setNetAmount(String netAmount) {
+ // System.out.println("**** netAmount: " + netAmount);
+ this.netAmount = netAmount;
+ }
+ /**
+ * @return Returns the orderDate.
+ */
+ public String getOrderDate() {
+ return orderDate;
+ }
+ /**
+ * @param orderDate The orderDate to set.
+ */
+ public void setOrderDate(String orderDate) {
+ this.orderDate = orderDate;
+ }
+ /**
+ * @return Returns the orderId.
+ */
+ public String getOrderId() {
+ return orderId;
+ }
+ /**
+ * @param orderId The orderId to set.
+ */
+ public void setOrderId(String orderId) {
+ this.orderId = orderId;
+ }
+ /**
+ * @return Returns the statusCode.
+ */
+ public String getStatusCode() {
+ return statusCode;
+ }
+ /**
+ * @param statusCode The statusCode to set.
+ */
+ public void setStatusCode(String statusCode) {
+ this.statusCode = statusCode;
+ }
+ /**
+ * @return Returns the tax.
+ */
+ public String getTax() {
+ return tax;
+ }
+ /**
+ * @param tax The tax to set.
+ */
+ public void setTax(String tax) {
+ this.tax = tax;
+ }
+ /**
+ * @return Returns the totalAmount.
+ */
+ public String getTotalAmount() {
+ return totalAmount;
+ }
+ /**
+ * @param totalAmount The totalAmount to set.
+ */
+ public void setTotalAmount(String totalAmount) {
+ this.totalAmount = totalAmount;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return orderId + ", " + orderDate + ", " + statusCode + ", " + netAmount + ", " + totalAmount + ", " + tax + ", ";
+ }
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/OrderItem.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/OrderItem.java 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/OrderItem.java 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,109 @@
+/*
+ * 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.dvdstore;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class OrderItem {
+
+ // <OrderLine position="1" quantity="1">
+ // <Product productId="364" title="The 40-Year-Old Virgin " price="29.98"/>
+ // </OrderLine>
+ private String position;
+ private String quantity;
+ private String productId;
+ private String title;
+ private String price;
+
+ /**
+ * @return Returns the position.
+ */
+ public String getPosition() {
+ return position;
+ }
+ /**
+ * @param position The position to set.
+ */
+ public void setPosition(String position) {
+ //System.out.println("**** position: " + position);
+ this.position = position;
+ }
+ /**
+ * @return Returns the price.
+ */
+ public String getPrice() {
+ return price;
+ }
+ /**
+ * @param price The price to set.
+ */
+ public void setPrice(String price) {
+ //System.out.println("**** price: " + price);
+ this.price = price;
+ }
+ /**
+ * @return Returns the productId.
+ */
+ public String getProductId() {
+ return productId;
+ }
+ /**
+ * @param productId The productId to set.
+ */
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+ /**
+ * @return Returns the quantity.
+ */
+ public String getQuantity() {
+ return quantity;
+ }
+ /**
+ * @param quantity The quantity to set.
+ */
+ public void setQuantity(String quantity) {
+ this.quantity = quantity;
+ }
+ /**
+ * @return Returns the title.
+ */
+ public String getTitle() {
+ return title;
+ }
+ /**
+ * @param title The title to set.
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return position + "," + quantity + "," + productId + "," + title + "," + price;
+
+ }
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/orderitem.st
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/orderitem.st 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/org/jboss/soa/esb/dvdstore/orderitem.st 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,7 @@
+ <order-item>
+ <index>$orderItem.position$</index>
+ <quantity>$orderItem.quantity$</quantity>
+ <product>$orderItem.productId$</product>
+ <title>$orderItem.title$</title>
+ <price>$orderItem.price$</price>
+ </order-item>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/Launcher.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/Launcher.java 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/Launcher.java 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,84 @@
+package quickstart;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.listeners.gateway.GatewayListenerController;
+import org.jboss.soa.esb.listeners.message.EsbListenerController;
+
+
+public class Launcher {
+ private static Log log = LogFactory.getLog(Launcher.class);
+
+ private EsbListenerController _esbListController;
+ private GatewayListenerController _gatewayController;
+
+
+
+ private Logger _logger = Logger.getLogger(Launcher.class);
+
+ public static void main (String args[]) throws Exception {
+
+ log.info("args passed into Launcher: " + args.length);
+ for (int x=0; x<args.length; x++)
+ log.info("arg[" + x + "]=" + args[x]);
+
+
+ Launcher launcher = new Launcher();
+
+ launcher.triggerListener(Long.valueOf(args[0]).longValue(), args[1], args[2]);
+
+ }
+
+ private void triggerListener(long runTime, String messageAwareConfigFile,
+ String gatewayConfigFile) throws Exception{
+ try
+ {
+
+ if (null != messageAwareConfigFile) {
+ _logger.info("starting message aware listener with config file - " +
+ messageAwareConfigFile);
+ _esbListController = new EsbListenerController(messageAwareConfigFile);
+
+ new Thread(_esbListController).start();
+ Thread.sleep(2000);
+
+ }
+ if (null != gatewayConfigFile) {
+ _logger.info("starting gateway listener with config file - " +
+ gatewayConfigFile);
+ _gatewayController = new GatewayListenerController(gatewayConfigFile);
+ new Thread(_gatewayController).start();
+
+ Thread.sleep(2000);
+ }
+
+ System.out.println("**Listener Ready**");
+
+// This code is used to automatically shutdown the listeners which
+// might be useful for automated testing purposes. It is not needed
+// in the quickstart samples.
+// _logger.info("going to sleep now for " + runTime + " milliseconds...");
+// Thread.sleep(runTime);
+// if (null != messageAwareConfigFile) {
+// _logger.info("shutting down message aware listener...");
+// _esbListController.requestEnd();
+// }
+//
+// if (null != gatewayConfigFile) {
+// _logger.info("shutting down gateway listener...");
+// _gatewayController.requestEnd();
+// }
+
+
+ }
+ catch (Exception e) {
+ _logger.error(e);
+ throw(e);
+ }
+
+
+ }
+
+
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/MyJMSListenerAction.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/MyJMSListenerAction.java 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/MyJMSListenerAction.java 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,72 @@
+package quickstart;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.Header;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.EPR;
+import org.apache.log4j.Logger;
+
+public class MyJMSListenerAction
+{
+
+ protected ConfigTree _config;
+
+ public MyJMSListenerAction(ConfigTree config) { _config = config; }
+
+ public Message noOperation(Message message) { return message; }
+
+ public Message displayMessage(Message message) throws Exception{
+ logHeader();
+ System.out.println("Body: " + new String(message.getBody().getContents()));
+ logFooter();
+ return message;
+ }
+
+ public Message playWithMessage(Message message) throws Exception {
+ Header msgHeader = message.getHeader();
+ Body msgBody = message.getBody();
+ Call theCall = msgHeader.getCall();
+ EPR theEpr = theCall.getFrom();
+ String contents = new String(msgBody.getContents());
+ StringBuffer sb = new StringBuffer();
+ sb.append("BEFORE\n");
+ sb.append(contents);
+ sb.append("\nAFTER");
+ msgBody.setContents(sb.toString().getBytes());
+ return message;
+ }
+
+ public void exceptionHandler(Message message, Throwable exception) {
+ logHeader();
+ System.out.println("!ERROR!");
+ System.out.println(exception.getMessage());
+ System.out.println("For Message: ");
+ System.out.println(message.getBody().getContents());
+ logFooter();
+ }
+
+ public void sendResponse(Message message) {
+ try {
+ logHeader();
+ System.out.println(new String(message.getBody().getContents()));
+ logFooter();
+ ReturnJMSMessage.sendMessage(message,"quickstart_simple_transformation_Response");
+ } catch (Exception e) {
+ logHeader();
+ System.out.println(e.getMessage());
+ logFooter();
+ }
+ }
+ // This makes it easier to read on the console
+ private void logHeader() {
+ System.out.println("\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+ }
+ private void logFooter() {
+ System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n");
+ }
+
+
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/ReturnJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/ReturnJMSMessage.java 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/ReturnJMSMessage.java 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,49 @@
+package quickstart;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.jms.JMSException;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.QueueSender;
+import javax.jms.ObjectMessage;
+import javax.jms.TextMessage;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import org.jboss.soa.esb.message.Message;
+
+public class ReturnJMSMessage {
+
+ public static void sendMessage(Message esbMessage,String newDestination) throws JMSException, NamingException, Exception {
+ if (esbMessage == null || newDestination == null)
+ throw new Exception("Message and JMS Destination are required");
+
+ QueueConnection conn;
+ QueueSession session;
+ Queue que;
+
+ InitialContext iniCtx = new InitialContext();
+ Object tmp = iniCtx.lookup("ConnectionFactory");
+ QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+ conn = qcf.createQueueConnection();
+ que = (Queue) iniCtx.lookup("queue/" + newDestination);
+ session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ conn.start();
+
+
+ String newMsg = new String(esbMessage.getBody().getContents());
+
+
+ QueueSender send = session.createSender(que);
+ TextMessage tm = session.createTextMessage(newMsg);
+ send.send(tm);
+
+
+ conn.stop();
+ }
+
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/test/ReceiveJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/test/ReceiveJMSMessage.java 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/test/ReceiveJMSMessage.java 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,49 @@
+package quickstart.test;
+
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSession;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+public class ReceiveJMSMessage {
+ QueueConnection conn = null;
+ QueueSession receiverSession = null;
+ Queue receiverQueue = null;
+ QueueReceiver queueReceiver = null;
+ InitialContext iniCtx = null;
+ QueueConnectionFactory qcf = null;
+ public ReceiveJMSMessage() {
+
+ }
+ public void receiveOne() {
+ try {
+ if (iniCtx == null) iniCtx = new InitialContext();
+ if (qcf == null) qcf = (QueueConnectionFactory) iniCtx.lookup("ConnectionFactory");
+ if (conn == null) {
+ conn = qcf.createQueueConnection();
+ conn.start();
+ }
+ String responseQueueName = "queue/quickstart_simple_transformation_Response";
+ receiverQueue = (Queue) iniCtx.lookup(responseQueueName);
+ receiverSession = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ queueReceiver = receiverSession.createReceiver(receiverQueue);
+ TextMessage msg = (TextMessage) queueReceiver.receive(2000);
+ if (msg != null) {
+ System.out.println("*********************************************************");
+ System.out.println(msg);
+ System.out.println("*********************************************************");
+ }
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+ public static void main(String[] args) {
+ ReceiveJMSMessage receiver = new ReceiveJMSMessage();
+ while (true) { // loop until I'm killed
+ receiver.receiveOne();
+ }
+ }
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/test/SendJMSMessage.java 2006-11-29 03:36:30 UTC (rev 7919)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_transformation/src/quickstart/test/SendJMSMessage.java 2006-11-29 03:46:53 UTC (rev 7920)
@@ -0,0 +1,90 @@
+package quickstart.test;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.jms.JMSException;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.QueueSender;
+import javax.jms.ObjectMessage;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class SendJMSMessage {
+ QueueConnection conn;
+ QueueSession session;
+ 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_simple_transformation_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 String readAsciiFile(String fileName) throws IOException {
+ FileReader fr = null;
+ char[] thechars = null;
+
+ try {
+ File thefile = new File( fileName );
+ fr = new FileReader( thefile );
+ int size = (int) thefile.length();
+ thechars = new char[size];
+
+ int count, index = 0;
+
+ // read in the bytes from the input stream
+ while( ( count = fr.read( thechars, index, size ) ) > 0 ) {
+ size -= count;
+ index += count;
+ }
+ } catch(Exception e) {
+ System.out.println(e);
+ }
+ finally {
+ if( fr != null )
+ fr.close();
+ }
+ return new String(thechars);
+
+ } // readAsciiFile
+
+ public static void main(String args[]) throws Exception
+ {
+ SendJMSMessage sm = new SendJMSMessage();
+ sm.setupConnection();
+ String fileContent = sm.readAsciiFile("SampleOrder.xml");
+ System.out.println("---------------------------------------------");
+ System.out.println(fileContent);
+ System.out.println("---------------------------------------------");
+ sm.sendAMessage(fileContent);
+ sm.stop();
+
+ }
+
+}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list