[jboss-svn-commits] JBL Code SVN: r11358 - in labs/jbossesb/trunk/product/samples/quickstarts: conf/jms and 5 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Apr 26 11:06:35 EDT 2007
Author: beve
Date: 2007-04-26 11:06:34 -0400 (Thu, 26 Apr 2007)
New Revision: 11358
Added:
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/SampleOrder.csv
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbm-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbossesb-properties.xml
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/juddi.properties
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/log4j.xml
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-cdr.lst
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/src/
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/src/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/src/quickstart/helloworld/
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/src/quickstart/helloworld/test/
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/src/quickstart/helloworld/test/SendJMSMessage.java
Modified:
labs/jbossesb/trunk/product/samples/quickstarts/conf/jms/esb-quickstart-jbm-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/conf/jms/esb-quickstart-jbmq-service.xml
Log:
Added a quickstart that transforms a CVS file to an xml file.
This will run in the new JBossESB server configuration only if one comments out
the following lines in jbossesb-properties:
<!--
<properties name="filters">
<property name="org.jboss.soa.esb.courier.filter.1" value="org.jboss.internal.soa.esb.message.metadata.MetaDataFilter"/>
</properties>
-->
This is documented in the readme file and I will ask about this in the forum if anyone else seen this before
Modified: labs/jbossesb/trunk/product/samples/quickstarts/conf/jms/esb-quickstart-jbm-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/conf/jms/esb-quickstart-jbm-service.xml 2007-04-26 14:13:43 UTC (rev 11357)
+++ labs/jbossesb/trunk/product/samples/quickstarts/conf/jms/esb-quickstart-jbm-service.xml 2007-04-26 15:06:34 UTC (rev 11358)
@@ -324,4 +324,19 @@
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
</mbean>
+
+ <!-- transform_CSV2XML quickstart queues -->
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=quickstart_transform_CSV2XML_gw"
+ 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_transform_CSV2XML_esb"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+
</server>
Modified: labs/jbossesb/trunk/product/samples/quickstarts/conf/jms/esb-quickstart-jbmq-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/conf/jms/esb-quickstart-jbmq-service.xml 2007-04-26 14:13:43 UTC (rev 11357)
+++ labs/jbossesb/trunk/product/samples/quickstarts/conf/jms/esb-quickstart-jbmq-service.xml 2007-04-26 15:06:34 UTC (rev 11358)
@@ -282,4 +282,18 @@
name="jboss.mq.destination:service=Queue,name=quickstart_Aggregator_Green_Alert">
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
</mbean>
+
+ <!-- transform_CSV2XML quickstart queues -->
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.mq.destination:service=Queue,name=quickstart_transform_CSV2XML_gw">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.mq.destination:service=Queue,name=quickstart_transform_CSV2XML_esb">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
</server>
Added: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/SampleOrder.csv
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/SampleOrder.csv (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/SampleOrder.csv 2007-04-26 15:06:34 UTC (rev 11358)
@@ -0,0 +1 @@
+1,Wed Nov 15 13:45:28 EST 2006,0,59.97,64.92,4.95,user1,Harry,Fletcher,SD,1,1,364,The 40-Year-Old Virgin,29.98,2,1,299,Pulp Fiction,29.99
Added: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/build.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/build.xml 2007-04-26 15:06:34 UTC (rev 11358)
@@ -0,0 +1,26 @@
+<project name="transformation-CSV2XML-quickstart" default="deploy" basedir=".">
+
+ <description>
+ ${ant.project.name}
+ ${line.separator}
+ </description>
+
+ <property name="additional.deploys" value="smooks-cdr.lst,smooks-res.xml" />
+
+ <!-- Import the base Ant build script... -->
+ <import file="../conf/base-build.xml"/>
+
+
+ <!-- The ESB itself is started by the default "run" target - defined in base-build.xml -->
+
+ <!-- Target for injecting the sample order message for transformation... -->
+ <target name="runtest" depends="compile"
+ description="runs Test JMS Sender">
+ <echo>Runs Test JMS Sender</echo>
+ <java fork="yes" classname="quickstart.helloworld.test.SendJMSMessage" failonerror="true">
+ <arg value="SampleOrder.csv" />
+ <classpath refid="exec-classpath" />
+ </java>
+ </target>
+
+</project>
Added: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbm-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbm-queue-service.xml 2007-04-26 15:06:34 UTC (rev 11358)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=quickstart_transform_CSV2XML_gw"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=quickstart_transform_CSV2XML_esb"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ </mbean>
+</server>
Added: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jboss-esb.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jboss-esb.xml 2007-04-26 15:06:34 UTC (rev 11358)
@@ -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"
+ jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-URL="localhost">
+
+ <jms-bus busid="quickstartCSVGwChannel">
+ <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_transform_CSV2XML_gw" />
+ </jms-bus>
+ <jms-bus busid="quickstartCSVEsbChannel">
+ <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_transform_CSV2XML_esb" />
+ </jms-bus>
+
+ </jms-provider>
+ </providers>
+
+ <services>
+
+ <service category="QuickstartTransformCSV" name="SimpleListener"
+ description="Hello World">
+ <listeners>
+ <jms-listener name="CSVJMS-Gateway" busidref="quickstartCSVGwChannel" maxThreads="1" is-gateway="true"/>
+ <jms-listener name="CSVquickstart" busidref="quickstartCSVEsbChannel" maxThreads="1" />
+ </listeners>
+
+ <actions>
+
+ <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="message" value="[transform_CSV2Smooks_Intermediate_format] Message before transformation" />
+ </action>
+
+ <action name="transform-from-csv" class="org.jboss.soa.esb.actions.converters.SmooksTransformer">
+ <property name="from" value="order-list" />
+ <property name="from-type" value="text/csv:order-list" />
+ <property name="to" value="smooks-order-xml" />
+ <property name="to-type" value="text/xml:smooks-order-xml" />
+ </action>
+
+ <action name="print-after-csv-tranform" class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="message" value="[transform_CSV2Smooks_Intermediate_format] Message after transformation" />
+ </action>
+
+ <action name="transform-smooksXml-to-canonicalXml" class="org.jboss.soa.esb.actions.converters.SmooksTransformer">
+ <property name="from" value="smooks-order-list" />
+ <property name="from-type" value="text/xml:smooks-order-xml" />
+ <property name="to" value="canonical-order-xml" />
+ <property name="to-type" value="text/xml:canonical-order-xml" />
+ </action>
+
+ <action name="print-after-xml-transform" class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="message" value=">>>> Message after Smooks intermediate xml -> target xml : " />
+ </action>
+ </actions>
+
+ </service>
+ </services>
+
+</jbossesb>
Added: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbossesb-properties.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbossesb-properties.xml 2007-04-26 15:06:34 UTC (rev 11358)
@@ -0,0 +1,87 @@
+<?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>
+ <properties name="transformation">
+ <property name="java.naming.provider.url" value="localhost"/>
+ </properties>
+</esb>
Added: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jndi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jndi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jndi.properties 2007-04-26 15:06:34 UTC (rev 11358)
@@ -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/transform_CSV2XML/juddi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/juddi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/juddi.properties 2007-04-26 15:06:34 UTC (rev 11358)
@@ -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/transform_CSV2XML/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/log4j.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/log4j.xml 2007-04-26 15:06:34 UTC (rev 11358)
@@ -0,0 +1,66 @@
+<?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>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.jboss.soa.esb">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.milyn">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.jboss.soa.esb.actions.converters.SmooksTransformer">
+ <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"/>
+ </root>
+
+</log4j:configuration>
Added: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/readme.txt (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/readme.txt 2007-04-26 15:06:34 UTC (rev 11358)
@@ -0,0 +1,79 @@
+Overview:
+=========
+ This quickstart demonstrates how to transform a comma separated value (CSV) file to an xml.
+ The tranformation is done by configuring Smooks and performing two transformation, one
+ transformation from CSV to an intermediate xml format, and a second transformation from
+ the intermediate xml format to the target xml.
+
+ This Quickstart does not use the JBoss ESB Administration Console to manage the
+ message Transformation configurations to the ESB.
+ to manage this Quickstart's transformations via the Console.
+
+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.
+
+ It would be a great idea to read MessageTransformation.pdf to fully understand this Quickstart.
+ It is located in the docs/services folder.
+
+
+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
+
+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
+ Note: that there is currently a problem when running in this mode. I had to comment out
+ the following in jbossesb-properties that is located in the jbossesb.sar:
+ <!--
+ <properties name="filters">
+ <property name="org.jboss.soa.esb.courier.filter.1" value="org.jboss.internal.soa.esb.message.metadata.MetaDataFilter"/>
+ </properties>
+ -->
+
+ 'run' target description:
+ Will start a StandeAlone ESB. This window will display the CVS message before it is
+ transformed into the intermediate xml format, and the display the taget xml
+ transformation.
+ To shutdown the ESB simply use Ctrl-C.
+
+ 'runtest' target description:
+ This target will shoot a JMS message containing the contents of the SampleOrder.csv
+ file located in this folder.
+
+
+What to look at in this Quickstart:
+===================================
+ As stated above, a read of MessageTransformation.pdf would be of great benefit in understanding
+ JBoss ESB Transformations.
+
+ jbossesb.xml: The ESB configuration file in this Quickstart simply defines a JMS Listener for receiving
+ the contents of the SampleOrder.csv file located in this folder.
+
+ smooks-cdr.lst: This file is used by the JBoss ESB Transformation Service to list the Transformation
+ resource configuration URIs. Out of the box, the smoooks-cdr.lst file in this Quickstart
+ refers to 2 resource URIs, both of which are classpath based.
+
+ smooks-res.xml: This file defines the Transformations for the Quickstart. In this case it defines
+ two transformations.
+ 1. The first transformation uses smooks CSVParser to parse the CVS file and create an
+ intermediate xml format that looks like this:
+ <cvs-set>
+ <cvs-record>
+ <orderId>1</orderId>
+ <orderDate>Wed Nov 15 13:45:28 EST 2006</orderDate>
+ <statusCode>0</statusCode>
+ ...
+ </cvs-record>
+ </cvs-set>
+ 2. The second tranformation transforms the intermediate smooks format to the
+ target xml format. This is the second section in smooks-res.xml. It is here you
+ can map the values to you're target xml format.
Added: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-cdr.lst
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-cdr.lst (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-cdr.lst 2007-04-26 15:06:34 UTC (rev 11358)
@@ -0,0 +1,16 @@
+########################################################################################################
+# Uncomment out to load config from local XML file
+########################################################################################################
+/smooks-res.xml
+/org/milyn/templating/templating-cdu-creators-0.1.cdrl
+
+########################################################################################################
+# Uncomment out to load config from the
+# ESB Administration Console.
+#
+# You must "import" smooks-res.xml into the console in order to view and manipulate the
+# transformations in this sample. You will also need to register the "Message Exchange Participants"
+# "A" and "B" as well as their supported message contracts "text/xml:messageAtA" and
+# "text/xml:messageAtB" respectively.
+########################################################################################################
+#http://localhost:8080/jboss-esb-console/transform/smooks-config.jsp
Added: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml 2007-04-26 15:06:34 UTC (rev 11358)
@@ -0,0 +1,62 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!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 useragent="from-type:text/csv:order-list AND to-type:text/xml:smooks-order-xml" selector="org.xml.sax.driver" path="org.milyn.csv.CSVParser" >
+ <param name="fields" type="string-list">
+ orderId,
+ orderDate,
+ statusCode,
+ netAmount,
+ totalAmount,
+ tax,
+ userName,
+ firstName,
+ lastName,
+ state,
+ orderLine1Position,
+ orderLine1Quantity,
+ orderLine1ProductId,
+ orderLine1ProductTitle,
+ orderLine1ProductPrice,
+ orderLine2Position,
+ orderLine2Quantity,
+ orderLine2ProductId,
+ orderLine2ProductTitle,
+ orderLine2ProductPrice
+ </param>
+ </smooks-resource>
+
+ <smooks-resource useragent="from-type:text/xml:smooks-order-xml AND to-type:text/xml:canonical-order-xml" selector="csv-set" path="See 'resdata' parameter value" >
+ <!--param name="RESERVED:RESOURCE_NAME_PARAM"><![CDATA[XSLT (Templatelet)]]></param-->
+ <param name="encoding">UTF-8</param>
+ <param name="visitBefore">false</param>
+ <param name="is-xslt-templatelet">true</param>
+ <param name="restype">xsl</param>
+ <param name="action">replace</param>
+ <param name="encoding">UTF-8</param>
+ <param name="resdata">
+ <![CDATA[
+ <xsl:for-each select="csv-record">
+ <Order orderId="{orderId}"
+ orderDate="{orderDate}"
+ statusCode="{statusCode}"
+ netAmount="{netAmount}"
+ totalAmount="{totalAmount}"
+ tax="{tax}" >
+ <Customer userName="{userName}" firstName="{firstName}" lastName="{lastName}" state="{state}" />
+ <OrderLines>
+ <OrderLine posistion="{orderLine1Position}" quantity="{orderLine1Quantity}">
+ <Product productId="{orderLine1ProductId}" title="{orderLine1Title}" price="{orderLine1Price}"/>
+ </OrderLine>
+ <OrderLine posistion="{orderLine1Position}" quantity="{orderLine1Quantity}">
+ <Product productId="{orderLine1ProductId}" title="{orderLine1Title}" price="{orderLine1Price}"/>
+ </OrderLine>
+ </OrderLines>
+ </Order>
+ </xsl:for-each>
+ ]]>
+ </param>
+ </smooks-resource>
+
+</smooks-resource-list>
Added: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/src/quickstart/helloworld/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/src/quickstart/helloworld/test/SendJMSMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/src/quickstart/helloworld/test/SendJMSMessage.java 2007-04-26 15:06:34 UTC (rev 11358)
@@ -0,0 +1,93 @@
+/*
+ * 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 quickstart.helloworld.test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+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;
+
+import org.milyn.io.StreamUtils;
+
+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_transform_CSV2XML_gw");
+ 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 fileName) throws JMSException, FileNotFoundException, IOException {
+
+ QueueSender send = session.createSender(que);
+ ObjectMessage tm;
+ File file = new File(fileName);
+
+ if(!file.exists()) {
+ throw new IllegalArgumentException("Input message file [" + file.getAbsolutePath() + "] not found.");
+ }
+
+ String message = new String(StreamUtils.readStream(new FileInputStream(file)));
+
+ tm = session.createObjectMessage(message);
+ send.send(tm);
+ send.close();
+
+ System.out.println("*** Switch back to the ESB Java console now to see '" + fileName + "' before and after the transformation...");
+ }
+
+
+ public static void main(String args[]) throws Exception
+ {
+ SendJMSMessage sm = new SendJMSMessage();
+ sm.setupConnection();
+ sm.sendAMessage(args[0]);
+ sm.stop();
+ }
+
+}
More information about the jboss-svn-commits
mailing list