Author: DartPeng
Date: 2009-04-22 04:39:17 -0400 (Wed, 22 Apr 2009)
New Revision: 14846
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/edi-to-sax-order-mapping.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/sj-testimonial-edi-mapping.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/java-basic.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/java-to-xml.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/profiling.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/bindings.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/csv-xml.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/datasources.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/db-extract-transform-load.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-orders-parser.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-to-java.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-to-xml.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/file-router.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/freemarker-huge-transform.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/groovy.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/java-to-java.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/json-to-java.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/model-driven-basic-virtual.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/model-driven-basic.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/sj-testimonial-sax.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/sj-testimonial.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/splitter-router.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xml-to-java-virtual.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xml-to-java.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-basic.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-groovy.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-namespaces.xml
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/AbstractSmooks11ModelTestCase.java
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/ParseConfigFileTestCase.java
Log:
JBIDE-4217
1.collect smooks config file for smooks1.1.2 and smooks1.0
2.write a test case to load them.
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/edi-to-sax-order-mapping.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/edi-to-sax-order-mapping.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/edi-to-sax-order-mapping.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<medi:edimap
xmlns:medi="http://www.milyn.org/schema/edi-message-mapping-1.0.xsd&...
+
+ <medi:description name="DVD Order" version="1.0"/>
+
+ <medi:delimiters segment=" " field="*"
component="^" sub-component="~"/>
+
+ <medi:segments xmltag="orders">
+
+ <medi:segment segcode="MLS" xmltag="message-header">
+ <medi:field xmltag="date"/>
+ </medi:segment>
+
+ <medi:segment segcode="HDR" xmltag="order"
minOccurs="1" maxOccurs="-1">
+ <medi:field xmltag="order-id"/>
+ <medi:field xmltag="status-code"/>
+ <medi:field xmltag="net-amount"/>
+ <medi:field xmltag="total-amount"/>
+ <medi:field xmltag="tax"/>
+
+ <medi:segment segcode="CUS" xmltag="customer-details"
minOccurs="1" maxOccurs="1">
+ <medi:field xmltag="username"/>
+ <medi:field xmltag="name">
+ <medi:component xmltag="firstname"/>
+ <medi:component xmltag="lastname"/>
+ </medi:field>
+ <medi:field xmltag="state"/>
+ </medi:segment>
+
+ <medi:segment segcode="ORD" xmltag="order-item"
minOccurs="1" maxOccurs="-1">
+ <medi:field xmltag="position"/>
+ <medi:field xmltag="quantity"/>
+ <medi:field xmltag="productId"/>
+ <medi:field xmltag="title"/>
+ <medi:field xmltag="price"/>
+ </medi:segment>
+
+ </medi:segment>
+
+ </medi:segments>
+
+</medi:edimap>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/edi-to-sax-order-mapping.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/sj-testimonial-edi-mapping.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/sj-testimonial-edi-mapping.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/sj-testimonial-edi-mapping.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,63 @@
+<medi:edimap
xmlns:medi="http://www.milyn.org/schema/edi-message-mapping-1.0.xsd&...
+
+ <medi:description name="rollingstock_edi" version="1.0" />
+
+ <medi:delimiters segment=" " field=","
component="*" sub-component="-"/>
+
+ <medi:segments xmltag="rollingstocks">
+
+ <medi:segment segcode="Ta" xmltag="rollingstock"
minOccurs="0" maxOccurs="-1">
+ <medi:field xmltag="departureDate"/>
+ <medi:field xmltag="departureTime"/>
+ <medi:field xmltag="rollingstockId"/>
+ <medi:field xmltag="departureSignature"/>
+ <medi:field xmltag="destinationSignature"/>
+ <medi:field xmltag="dayLimit"/>
+
+ <medi:segment segcode="Tr" xmltag="route"
minOccurs="0" maxOccurs="1">
+ <medi:field xmltag="route"/>
+ </medi:segment>
+
+ <medi:segment segcode="Fo" xmltag="vehicle"
minOccurs="0" maxOccurs="-1">
+ <medi:field xmltag="litt"/>
+ <medi:field xmltag="vehicleId"/>
+ <medi:field xmltag="originalLitt"/>
+ <medi:field xmltag="ticketId"/>
+ <medi:field xmltag="vehicleType"/>
+ <medi:field xmltag="weight"/>
+ <medi:field xmltag="dynamicWeight"/>
+ <medi:field xmltag="brakeWeight"/>
+ <medi:field xmltag="length"/>
+ <medi:field xmltag="nrOfAxles"/>
+ <medi:field xmltag="speed"/>
+ <medi:field xmltag="serviceType"/>
+ <medi:field xmltag="canDoorsBeLocked"/>
+ <medi:field xmltag="class1"/>
+ <medi:field xmltag="class2"/>
+ <medi:field xmltag="couchette"/>
+ <medi:field xmltag="nrOfCompartments"/>
+ <medi:field xmltag="nrOfPlacesPerCompartment"/>
+ <medi:field xmltag="departureStation"/>
+ <medi:field xmltag="departureDate"/>
+ <medi:field xmltag="departureTime"/>
+ <medi:field xmltag="destination"/>
+
+
+ <medi:segment segcode="Fx" xmltag="comments"
minOccurs="0" maxOccurs="1">
+ <medi:field xmltag="comment"/>
+ </medi:segment>
+
+ <medi:segment segcode="Ft" xmltag="phoneNumber"
minOccurs="0" maxOccurs="-1">
+ <medi:field xmltag="litt"/>
+ <medi:field xmltag="vehicleId"/>
+ <medi:field xmltag="phoneNumber"/>
+ <medi:field xmltag="function"/>
+ <medi:field xmltag="location"/>
+ </medi:segment>
+ </medi:segment>
+
+ </medi:segment>
+
+ </medi:segments>
+
+</medi:edimap>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/sj-testimonial-edi-mapping.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/java-basic.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/java-basic.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/java-basic.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
+
+ <resource-config selector="c b">
+ <resource>example.BasicJavaTransformer</resource>
+ <param name="newName">xxx</param>
+ </resource-config>
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/java-basic.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/java-to-xml.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/java-to-xml.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/java-to-xml.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
+
+ <resource-config selector="global-parameters">
+ <param name="stream.filter.type">SAX</param>
+ </resource-config>
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/java-to-xml.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/profiling.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/profiling.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/profiling.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
+
+ <profiles>
+ <profile base-profile="message-exchange-1"
sub-profiles="from-a,to-b" />
+ <profile base-profile="message-exchange-2"
sub-profiles="from-a,to-c" />
+ <profile base-profile="message-exchange-3"
sub-profiles="from-a,to-d" />
+
+ <profile base-profile="message-exchange-4"
sub-profiles="from-c,to-b" />
+ <profile base-profile="message-exchange-5"
sub-profiles="from-d,to-b" />
+ </profiles>
+
+ <resource-config selector="a" target-profile="from-a">
+ <resource>example.BasicJavaTransformer</resource>
+ <param name="newName">from-a</param>
+ </resource-config>
+
+ <resource-config selector="a b" target-profile="to-b">
+ <resource>example.BasicJavaTransformer</resource>
+ <param name="newName">to-b</param>
+ </resource-config>
+
+ <resource-config selector="c b" target-profile="to-c">
+ <resource>example.BasicJavaTransformer</resource>
+ <param name="newName">to-c</param>
+ </resource-config>
+
+ <resource-config selector="c" target-profile="to-d">
+ <resource>example.BasicJavaTransformer</resource>
+ <param name="newName">to-d</param>
+ </resource-config>
+
+ <resource-config selector="b c"
target-profile="message-exchange-5">
+ <resource>example.BasicJavaTransformer</resource>
+ <param name="newName">message-exchange-5</param>
+ </resource-config>
+
+ <resource-config selector="c b" target-profile="to-b AND
from-d">
+ <resource>example.BasicJavaTransformer</resource>
+ <param name="newName">d-to-b</param>
+ </resource-config>
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks10/profiling.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/bindings.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/bindings.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/bindings.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<smooks-resource-list
+
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd">
+
+ <!--
+ Virtual Model Binding Configurations for the order message elements...
+
+ Just capturing the order and order-item element details into 2
+ Maps, overwriting each as we iterate through the message i.e. not
+ accumulating them in memory => low memory footprint because we only
+ have details of the current order + current order-item in memory
+ at any given time (i.e. we never even have a full order in memory)...
+
+ The Database Schema (need to capture enough from the message to populate this):
+ ORDERS (ORDERNUMBER INTEGER, USERNAME VARCHAR(50), STATUS INTEGER, NET DOUBLE,
TOTAL DOUBLE, ORDDATE DATE)
+ ORDERITEMS (ORDERNUMBER INTEGER, QUANTITY INTEGER, PRODUCT INTEGER, TITLE
VARCHAR(50), PRICE DOUBLE)
+ -->
+
+ <jb:bindings beanId="message" class="java.util.HashMap"
createOnElement="message-header">
+ <jb:value property="date" data="message-header/date"
decoder="Date">
+ <jb:decodeParam name="format">EEE MMM dd HH:mm:ss z
yyyy</jb:decodeParam>
+ </jb:value>
+ </jb:bindings>
+
+ <jb:bindings beanId="order" class="java.util.HashMap"
createOnElement="order">
+ <jb:value property="orderNum" data="order/order-id"
decoder="Integer" />
+ <jb:value property="customerUname"
data="order/customer-details/username" />
+ <jb:value property="status"
data="order/status-code" decoder="Integer" />
+ <jb:value property="net" data="order/net-amount"
decoder="BigDecimal" />
+ <jb:value property="total"
data="order/total-amount" decoder="BigDecimal" />
+ </jb:bindings>
+
+ <jb:bindings beanId="orderItem" class="java.util.HashMap"
createOnElement="order-item">
+ <!-- Just bind in all elements of the orderItem into the orderItem map.
Property name is
+ taken from the element name... -->
+ <jb:value data="order-item/*" />
+ </jb:bindings>
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/bindings.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/csv-xml.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/csv-xml.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/csv-xml.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<smooks-resource-list
+
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.1.xsd">
+
+ <!--
+ Configure the CSV Reader to read the message and change it into a stream of SAX
events.
+ -->
+ <csv:reader fields="firstname,lastname,gender,age,country" />
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/csv-xml.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/datasources.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/datasources.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/datasources.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<smooks-resource-list
+
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:ds="http://www.milyn.org/xsd/smooks/datasource-1.1.xsd">
+
+ <ds:direct
+ bindOnElement="$document"
+ datasource="DBExtractTransformLoadDS"
+ driver="org.hsqldb.jdbcDriver"
+ url="jdbc:hsqldb:hsql://localhost:9201/milyn-hsql-9201"
+ username="sa"
+ password=""
+ autoCommit="false" />
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/datasources.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/db-extract-transform-load.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/db-extract-transform-load.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/db-extract-transform-load.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<smooks-resource-list
+
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:db="http://www.milyn.org/xsd/smooks/db-routing-1.1.xsd">
+
+ <!--
+ Filter the message using the SAX Filter (i.e. not DOM, so no
+ intermediate DOM, so we can process huge messages...
+ -->
+ <params>
+ <param name="stream.filter.type">SAX</param>
+ </params>
+
+ <!--
+ Define the EDI stream parser for the orders message...
+ -->
+ <import file="edi-orders-parser.xml" />
+
+ <!--
+ Define the Database Datasource(s)...
+ -->
+ <import file="datasources.xml"/>
+
+ <!--
+ Define the Data Bindings. This is to bind the order and orderItem data into the
ExecutionContext so it
+ can be used by the SQLExecutor for performing the inserts...
+ -->
+ <import file="bindings.xml"/>
+
+ <!--
==================================================================================
+ Now define the DB Executor resource that will use the data bound from the EDI
message
+ into the virtual data model defined in bindings.xml...
+ ===================================================================================
-->
+
+ <!-- Assert whether it's an insert or update. Need to do this just before we
do the
+ insert/update, which is triggered to happen just after the customer-details are
processed... -->
+ <db:executor executeOnElement="customer-details"
datasource="DBExtractTransformLoadDS" executeBefore="true">
+ <db:statement>select ORDERNUMBER from ORDERS where ORDERNUMBER =
${order.orderNum}</db:statement>
+ <db:resultSet name="orderExistsRS"/>
+ </db:executor>
+
+ <!-- If it's an insert (orderExistsRS.isEmpty()), insert the order at the end
of the customer-details i.e. just before we process the order items... -->
+ <db:executor executeOnElement="customer-details"
datasource="DBExtractTransformLoadDS" executeBefore="false">
+ <condition>orderExistsRS.isEmpty()</condition>
+ <db:statement>INSERT INTO ORDERS VALUES(${order.orderNum},
${order.customerUname}, ${order.status}, ${order.net}, ${order.total},
${message.date})</db:statement>
+ </db:executor>
+
+ <!-- And insert each orderItem... -->
+ <db:executor executeOnElement="order-item"
datasource="DBExtractTransformLoadDS" executeBefore="false">
+ <condition>orderExistsRS.isEmpty()</condition>
+ <db:statement>INSERT INTO ORDERITEMS VALUES (${order.orderNum},
${orderItem.quantity}, ${orderItem.productId}, ${orderItem.title},
${orderItem.price})</db:statement>
+ </db:executor>
+
+ <!-- Ignoring updates for now!! -->
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/db-extract-transform-load.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-orders-parser.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-orders-parser.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-orders-parser.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<smooks-resource-list
+
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:edi="http://www.milyn.org/xsd/smooks/edi-1.1.xsd">
+
+ <!--
+ Configure the EDI Reader to parse the message stream into a stream of SAX events.
+ -->
+ <edi:reader mappingModel="/edi-to-sax-order-mapping.xml" />
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-orders-parser.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-to-java.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-to-java.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-to-java.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<smooks-resource-list
+
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:edi="http://www.milyn.org/xsd/smooks/edi-1.1.xsd"
+
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd">
+
+ <!--
+ Configure the EDI Reader to parse the message stream into a stream of SAX events.
+ -->
+ <edi:reader mappingModel="/example/edi-to-xml-order-mapping.xml" />
+
+ <!--
+ Create an "example.beans.Order" bean instance when we visit the start of
the <order> element.
+ Assign the new bean instance to the beanId of "order".
+ The "header" and "orderItemList" beans are wired in.
+ -->
+ <jb:bindings beanId="order" class="example.model.Order"
createOnElement="order">
+ <jb:wiring property="header" beanIdRef="header" />
+ <jb:wiring property="orderItems" beanIdRef="orderItemList"
/>
+ </jb:bindings>
+
+ <!--
+ Create an "example.beans.Header" bean instance when we visit the start of
the <order> element.
+ Note, we're creating this bean instance before we encounter the actual
<header> element.
+ This bean is wired into the "order" bean.
+ -->
+ <jb:bindings beanId="header" class="example.model.Header"
createOnElement="order">
+ <jb:wiring property="customer" beanIdRef="customer" />
+ <jb:value property="orderId" data="header/order-id" />
+ <jb:value property="orderStatus" decoder="Long"
data="header/status-code" />
+ <jb:value property="netAmount" decoder="BigDecimal"
data="header/net-amount" />
+ <jb:value property="totalAmount" decoder="BigDecimal"
data="header/total-amount" />
+ <jb:value property="tax" decoder="BigDecimal"
data="header/tax" />
+ <jb:value property="date" decoder="Date"
data="header/date">
+ <jb:decodeParam name="format">EEE MMM dd HH:mm:ss z
yyyy</jb:decodeParam>
+ </jb:value>
+ </jb:bindings>
+
+ <!--
+ Create an "example.beans.Customer" bean instance when we visit the start of
the
+ <customer-details> element.
+ This bean is wired into the "header" bean.
+ -->
+ <jb:bindings beanId="customer" class="example.model.Customer"
createOnElement="customer-details">
+ <!-- Customer bindings... -->
+ <jb:value property="userName"
data="customer-details/username" />
+ <jb:value property="firstName"
data="customer-details/name/firstname" />
+ <jb:value property="lastName"
data="customer-details/name/lastname" />
+ <jb:value property="state" data="customer-details/state"
/>
+ </jb:bindings>
+
+ <!--
+ Create an ArrayList when we visit the start of the <order> element.
+ The "orderItem" beans are wired into this list and this list is wired into the
"order" bean.
+ -->
+ <jb:bindings beanId="orderItemList"
class="java.util.ArrayList" createOnElement="order">
+ <jb:wiring beanIdRef="orderItem" />
+ </jb:bindings>
+
+ <!--
+ Create an "example.beans.OrderItem" bean instance when we visit the start
of the <order-item> element.
+ This bean is wired into the "orderItemList" ArrayList.
+ -->
+ <jb:bindings beanId="orderItem"
class="example.model.OrderItem" createOnElement="order-item">
+ <!-- OrderItem bindings... -->
+ <jb:value property="quantity" decoder="Integer"
data="order-item/quantity" />
+ <jb:value property="productId" decoder="String"
data="order-item/product-id" />
+ <jb:value property="price" decoder="BigDecimal"
data="order-item/price" />
+ <jb:value property="title" data="order-item/title" />
+ </jb:bindings>
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-to-java.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-to-xml.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-to-xml.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-to-xml.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<smooks-resource-list
+
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:edi="http://www.milyn.org/xsd/smooks/edi-1.1.xsd">
+
+ <!--
+ Configure the EDI Reader to process the message stream into a stream of SAX events.
+ -->
+ <edi:reader mappingModel="/example/edi-to-xml-order-mapping.xml" />
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/edi-to-xml.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/file-router.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/file-router.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/file-router.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd"
+
xmlns:file="http://www.milyn.org/xsd/smooks/file-routing-1.1.xsd"
+
xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
+
+ <!--
+ Filter the message using the SAX Filter (i.e. not DOM, so no
+ intermediate DOM, so we can process huge messages...
+ -->
+ <params>
+ <param name="stream.filter.type">SAX</param>
+ </params>
+
+ <!-- Extract and decode data from the message. Used in the freemarker template
(below).
+ Note that we could also use a NodeModel here... -->
+ <jb:bindings beanId="order" class="java.util.Hashtable"
createOnElement="order">
+ <jb:value property="orderId" decoder="Integer"
data="order/@id"/>
+ <jb:value property="customerNumber" decoder="Long"
data="header/customer/@number"/>
+ <jb:value property="customerName"
data="header/customer"/>
+ <jb:wiring property="orderItem"
beanIdRef="orderItem"/>
+ </jb:bindings>
+ <jb:bindings beanId="orderItem" class="java.util.Hashtable"
createOnElement="order-item">
+ <jb:value property="itemId" decoder="Integer"
data="order-item/@id"/>
+ <jb:value property="productId" decoder="Long"
data="order-item/product"/>
+ <jb:value property="quantity" decoder="Integer"
data="order-item/quantity"/>
+ <jb:value property="price" decoder="Double"
data="order-item/price"/>
+ </jb:bindings>
+
+ <!-- Create/open a file output stream. This is writen to by the freemarker
template (below).. -->
+ <file:outputStream openOnElement="order-item"
resourceName="orderItemSplitStream">
+
<file:fileNamePattern>order-${order.orderId}-${order.orderItem.itemId}.xml</file:fileNamePattern>
+
<file:destinationDirectoryPattern>target/orders</file:destinationDirectoryPattern>
+
<file:listFileNamePattern>order-${order.orderId}.lst</file:listFileNamePattern>
+
+ <file:highWaterMark mark="3"/>
+ </file:outputStream>
+
+ <!--
+ Every time we hit the end of an <order-item> element, apply this freemarker
template,
+ outputting the result to the "orderItemSplitStream" OutputStream, which is
the file
+ output stream configured above.
+ -->
+ <ftl:freemarker applyOnElement="order-item">
+ <ftl:template>target/classes/orderitem-split.ftl</ftl:template>
+ <ftl:use>
+ <!-- Output the templating result to the "orderItemSplitStream"
file output stream... -->
+ <ftl:outputTo outputStreamResource="orderItemSplitStream"/>
+ </ftl:use>
+ </ftl:freemarker>
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/file-router.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/freemarker-huge-transform.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/freemarker-huge-transform.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/freemarker-huge-transform.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
+
+ <!--
+ Filter the message using the SAX Filter (i.e. not DOM, so no
+ intermediate DOM for the "complete" message - there are "mini"
DOMs
+ for the NodeModels below)....
+ -->
+ <params>
+ <param name="stream.filter.type">SAX</param>
+ <param name="default.serialization.on">false</param>
+ </params>
+
+ <!--
+ Create 2 NodeModels. One high level model for the "order"
+ (header etc) and then one per "order-item".
+
+ These models are used in the FreeMarker templating resources
+ defined below. You need to make sure you set the selector such
+ that the total memory footprint is as low as possible. In this
+ example, the "order" model will contain everything accept the
+ <order-item> data (the main bulk of data in the message). The
+ "order-item" model only contains the current <order-item> data
+ (i.e. there's max 1 order-item in memory at any one time).
+ -->
+ <resource-config selector="order,order-item">
+ <resource>org.milyn.delivery.DomModelCreator</resource>
+ </resource-config>
+
+ <!--
+ Apply the first part of the template when we reach the start
+ of the <order-items> element. Apply the second part when we
+ reach the end.
+
+ Note the <?TEMPLATE-SPLIT-PI?> Processing Instruction in the
+ template. This tells Smooks where to split the template,
+ resulting in the order-items being inserted at this point.
+ -->
+ <ftl:freemarker applyOnElement="order-items">
+ <ftl:template><!--<salesorder>
+ <details>
+ <orderid>${order.@id}</orderid>
+ <customer>
+ <id>${order.header.customer.@number}</id>
+ <name>${order.header.customer}</name>
+ </customer>
+ </details>
+ <itemList>
+ <?TEMPLATE-SPLIT-PI?>
+ </itemList>
+</salesorder>--></ftl:template>
+ </ftl:freemarker>
+
+ <!--
+ Output the <order-items> elements. This will appear in the
+ output message where the <?TEMPLATE-SPLIT-PI?> token appears in the
+ order-items template.
+ -->
+<ftl:freemarker applyOnElement="order-item">
+ <ftl:template><!-- <item>
+ <id>${.vars["order-item"].@id}</id>
+ <productId>${.vars["order-item"].product}</productId>
+ <quantity>${.vars["order-item"].quantity}</quantity>
+ <price>${.vars["order-item"].price}</price>
+ </item>
+ --></ftl:template>
+</ftl:freemarker>
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/freemarker-huge-transform.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/groovy.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/groovy.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/groovy.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:g="http://www.milyn.org/xsd/smooks/groovy-1.1.xsd">
+
+ <params>
+ <param name="stream.filter.type">SAX</param>
+ </params>
+
+ <g:groovy executeOnElement="category">
+ <g:script>
+ <!--
+ use(DOMCategory) {
+
+ // Modify "supplies": we need an extra 2 pens...
+ if (element.'@type' == 'supplies') {
+ element.item.each { item ->
+ if (item.text() == 'Pens') {
+ item['@quantity'] =
item.'(a)quantity'.toInteger() + 2;
+ }
+ }
+ }
+ }
+
+ // When using the SAX filter, we need to explicitly write the fragment
+ // to the result stream...
+ writeFragment(element);
+ -->
+ </g:script>
+ </g:groovy>
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/groovy.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/java-to-java.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/java-to-java.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/java-to-java.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd">
+
+ <params>
+ <param name="stream.filter.type">SAX</param>
+ </params>
+
+ <jb:bindings beanId="lineOrder"
class="example.trgmodel.LineOrder"
createOnElement="example.srcmodel.Order">
+ <jb:wiring property="lineItems" beanIdRef="lineItems"
/>
+ <jb:value property="customerId"
data="header/customerNumber" />
+ <jb:value property="customerName"
data="header/customerName" />
+ <jb:value property="priority" data="header/priority"
decoder="Enum">
+ <jb:decodeParam
name="enumType">example.trgmodel.LineOrderPriority</jb:decodeParam>
+ <jb:decodeParam name="LOW">NOT_IMPORTANT</jb:decodeParam>
+ <jb:decodeParam name="MEDIUM">IMPORTANT</jb:decodeParam>
+ <jb:decodeParam
name="HIGH">VERY_IMPORTANT</jb:decodeParam>
+ </jb:value>
+ </jb:bindings>
+
+ <jb:bindings beanId="lineItems"
class="example.trgmodel.LineItem[]" createOnElement="orderItems">
+ <jb:wiring beanIdRef="lineItem" />
+ </jb:bindings>
+
+
+ <jb:bindings beanId="lineItem"
class="example.trgmodel.LineItem"
createOnElement="example.srcmodel.OrderItem">
+ <jb:value property="productCode"
data="example.srcmodel.OrderItem/productId" />
+ <jb:value property="unitQuantity" decoder="Integer"
data="example.srcmodel.OrderItem/quantity" />
+ <jb:value property="unitPrice" decoder="BigDecimal"
data="example.srcmodel.OrderItem/price" />
+ </jb:bindings>
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/java-to-java.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/json-to-java.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/json-to-java.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/json-to-java.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,101 @@
+<?xml version="1.0"?>
+<smooks-resource-list
+
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:json="http://www.milyn.org/xsd/smooks/json-1.1.xsd"
+
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd">
+
+ <!--
+ Configure the JSON Reader to read the message stream into a stream of SAX events.
+
+ The input message contains whitespaces in the key names. Whitespaces aren't
allowed in
+ element names of the SAX event stream. To solve this we replace the whitespaces with
dashes (-).
+
+ Another special case is that the is a key called date&time. The ampersand
isn't allowed in a
+ element name of the SAX event stream. We can solve this in two ways. Configure the
reader, with
+ the illegalElementNameCharReplacement parameter, to replace all illegal characters
with
+ a character that is allowed. In this example however we solve it by mapping the
"date&time" key
+ to the "date-and-time" name.
+
+ There are more settings to for the org.milyn.json.JSONReader.
+ Take a look at the Javadoc of the class for alle the possible parameters.
+ -->
+ <json:reader rootName="order" keyWhitspaceReplacement="-">
+ <json:keyMap>
+ <json:key from="date&time" to="date-and-time" />
+ </json:keyMap>
+ </json:reader>
+
+
+ <!--
+ Create an "example.beans.Order" bean instance when we visit the start of
the <order> element.
+ Assign the new bean instance to the beanId of "order".
+ Target the to be created Header bean under the beanId "header" via the
${header} bean binding.
+ As soon as this bean is created it will be set on this bean instance.
+ Target the to be created ArrayList instance under the beanId "orderItems"
via the ${orderItems} bean binding.
+ As soon as this list is created it will be set on this bean instance.
+ -->
+ <jb:bindings class="example.model.Order" beanId="order"
createOnElement="order">
+ <jb:wiring property="header" beanIdRef="header"/>
+ <jb:wiring property="orderItems" beanIdRef="orderItems"/>
+ </jb:bindings>
+
+ <!--
+ Create an "example.beans.Header" bean instance when we visit the start of
the <order> element.
+ Note, we're creating this bean instance before we encounter the actual
<header> element.
+ This bean is set on the on the previous declared Order bean as soon as it is created,
because
+ it is target by that bean via a bean binding.
+ Target the to be created Customer instance under the beanId "customer" via
the ${customer} bean binding.
+ As soon as this bean is created it will be set on this bean instance.
+ -->
+ <jb:bindings class="example.model.Header" beanId="header"
createOnElement="order">
+ <jb:wiring property="customer" beanIdRef="customer"/>
+
+ <jb:value property="orderId" data="header order-id" />
+ <jb:value property="orderStatus" data="header status-code"
decoder="Long" />
+ <jb:value property="netAmount" data="header net-amount"
decoder="BigDecimal"/>
+ <jb:value property="totalAmount" data="header total-amount"
decoder="BigDecimal"/>
+ <jb:value property="tax" data="header tax"
decoder="BigDecimal"/>
+ <jb:value property="date" data="header date-and-time"
decoder="Date">
+ <jb:decodeParam name="format">EEE MMM dd HH:mm:ss z
yyyy</jb:decodeParam>
+ <jb:decodeParam
name="locale-language">en</jb:decodeParam>
+ <jb:decodeParam
name="locale-country">IE</jb:decodeParam>
+ </jb:value>
+ </jb:bindings>
+
+ <!--
+ Create an "example.beans.Customer" bean instance when we visit the start of
the
+ <customer-details> element.
+ This bean is set on the on the previous declared Header bean as soon as it is created,
because
+ it is target by that bean via a bean binding.
+ -->
+ <jb:bindings class="example.model.Customer" beanId="customer"
createOnElement="customer-details">
+ <jb:value property="userName" data="customer-details
username" />
+ <jb:value property="firstName" data="customer-details
firstname" />
+ <jb:value property="lastName" data="customer-details
lastname"/>
+ <jb:value property="state" data="customer-details
state"/>
+ </jb:bindings>
+
+ <!--
+ Create an ArrayList when we visit the start of the <order> element.
+ This list is set on the on the previous declared Order bean as soon as it is created,
because
+ it is target by that bean via a bean binding.
+ Target the to be created OrderItem beans under the beanId "orderItem" via the
${orderItem} bean binding.
+ As soon as these beans are created they will be added to this list.
+ -->
+ <jb:bindings class="java.util.ArrayList" beanId="orderItems"
createOnElement="order">
+ <jb:wiring beanIdRef="orderItem"/>
+ </jb:bindings>
+
+ <!--
+ Create an "example.beans.OrderItem" bean instance when we visit the start
of the <order-item> element.
+ This bean is add to the on the previous declared ArrayList as soon as it is created,
because
+ it is target by that ArrayList via a bean binding.
+ -->
+ <jb:bindings class="example.model.OrderItem"
beanId="orderItem" createOnElement="order-item element">
+ <jb:value property="quantity" data="order-item element
quantity" decoder="Integer"/>
+ <jb:value property="productId" data="order-item element
product-id" />
+ <jb:value property="price" data="order-item element price"
decoder="BigDecimal" />
+ <jb:value property="title" data="order-item element title"
/>
+ </jb:bindings>
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/json-to-java.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/model-driven-basic-virtual.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/model-driven-basic-virtual.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/model-driven-basic-virtual.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd"
+
xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
+
+ <!--
+ Use a FreeMarker template to perform the model driven transformation. You can also
inline the template here.
+ -->
+ <ftl:freemarker applyOnElement="$document">
+ <ftl:template>/example/templates/HistoryTrans.ftl</ftl:template>
+ </ftl:freemarker>
+
+ <!--
+ Configure the virtual "history" bean creation and population. Wires in the
"warehouse" bean.
+ -->
+ <jb:bindings beanId="history" class="java.util.HashMap"
createOnElement="history">
+ <jb:wiring property="warehouse"
beanIdRef="warehouse"/>
+ <!-- Note the date decoder is not configured with a format. Will therefore
use the default (SOAP). See DateDecoder class. -->
+ <jb:value property="creationDate" decoder="Date"
data="header/date" />
+ <!-- Note the "special" decoder for the trackingNumbers. -->
+ <jb:value property="trackingNumbers"
decoder="example.decoders.TrackingNumberDecoder"
data="history/trackingNumbers" />
+ </jb:bindings>
+
+ <!--
+ Configure the virtual "warehouse" bean creation and population.
+ Note how we create it on visiting the history. Is wired into the "history"
bean.
+ -->
+ <jb:bindings beanId="warehouse" class="java.util.HashMap"
createOnElement="history">
+ <jb:value property="id" decoder="Integer"
data="history/@warehouse" />
+ <!-- Note the "special" decoder for mapping the warehouse id.
-->
+ <jb:value property="name" decoder="Mapping"
data="history/@warehouse">
+ <jb:decodeParam name="1">Dublin</jb:decodeParam>
+ <jb:decodeParam name="2">Belfast</jb:decodeParam>
+ <jb:decodeParam name="3">Cork</jb:decodeParam>
+ </jb:value>
+ </jb:bindings>
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/model-driven-basic-virtual.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/model-driven-basic.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/model-driven-basic.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/model-driven-basic.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd"
+
xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
+
+ <!--
+ Use a FreeMarker template to perform the model driven transformation. You can also
inline the template here.
+ -->
+ <ftl:freemarker applyOnElement="$document">
+ <ftl:template>/example/templates/HistoryTrans.ftl</ftl:template>
+ </ftl:freemarker>
+
+ <!--
+ Configure the History bean creation and population. Wires in the
"warehouse" bean.
+ -->
+ <jb:bindings beanId="history"
class="example.model.ShippingHistory" createOnElement="history">
+ <jb:wiring property="warehouse"
beanIdRef="warehouse"/>
+ <!-- Note the date decoder is not configured with a format. Will therefore
use the default (SOAP). See DateDecoder class. -->
+ <jb:value property="creationDate" decoder="Date"
data="header/date" />
+ <!-- Note the "special" decoder for the trackingNumbers. -->
+ <jb:value property="trackingNumbers"
decoder="example.model.TrackingNumberDecoder"
data="history/trackingNumbers" />
+ </jb:bindings>
+
+ <!--
+ Configure the Warehouse bean creation and population.
+ Note how we create it on visiting the history. Is wired into the "history"
bean.
+ -->
+ <jb:bindings beanId="warehouse"
class="example.model.Warehouse" createOnElement="history">
+ <jb:value property="id" decoder="Integer"
data="history/@warehouse" />
+ <!-- Note the "special" decoder for mapping the warehouse id.
-->
+ <jb:value property="name" decoder="Mapping"
data="history/@warehouse">
+ <jb:decodeParam name="1">Dublin</jb:decodeParam>
+ <jb:decodeParam name="2">Belfast</jb:decodeParam>
+ <jb:decodeParam name="3">Cork</jb:decodeParam>
+ </jb:value>
+ </jb:bindings>
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/model-driven-basic.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/sj-testimonial-sax.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/sj-testimonial-sax.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/sj-testimonial-sax.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd">
+
+ <params>
+ <param name="stream.filter.type">SAX</param>
+ </params>
+
+ <import file="smooks-config.xml" />
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/sj-testimonial-sax.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/sj-testimonial.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/sj-testimonial.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/sj-testimonial.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:edi="http://www.milyn.org/xsd/smooks/edi-1.1.xsd"
+
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd">
+
+ <edi:reader mappingModel="edi-mapping.xml" />
+
+ <jb:bindings beanId="rollingstocks"
class="se.sj.ipl.rollingstock.domain.RollingStockList"
createOnElement="rollingstocks">
+ <jb:wiring setterMethod="add" beanIdRef="rollingstock"/>
+ </jb:bindings>
+
+ <jb:bindings beanId="rollingstock"
class="se.sj.ipl.rollingstock.domain.Rollingstock"
createOnElement="rollingstocks/rollingstock">
+ <jb:wiring property="schedule" beanIdRef="rollingstock_schedule"
/>
+ <jb:wiring property="vehicles" beanIdRef="vehicles" />
+
+ <jb:value property="rollingstockId"
data="rollingstock/rollingstockId" />
+ <jb:value property="route" data="rollingstock/route/route"
/>
+ </jb:bindings>
+
+ <jb:bindings beanId="rollingstock_schedule"
class="se.sj.ipl.rollingstock.domain.Schedule"
createOnElement="rollingstocks/rollingstock">
+
+ <jb:value property="departureStation" data="rollingstock
departureSignature" />
+ <jb:value property="departureDate" decoder="Date"
data="rollingstock departureDate" />
+ <jb:value property="departureTime" decoder="Time"
data="rollingstock departureTime" />
+ <jb:value property="destination" data="rollingstock
destinationSignature" />
+ </jb:bindings>
+
+ <jb:bindings beanId="vehicles" class="java.util.ArrayList"
createOnElement="rollingstocks/rollingstock">
+ <jb:wiring beanIdRef="vehicle" />
+ </jb:bindings>
+
+
+ <jb:bindings beanId="vehicle"
class="se.sj.ipl.rollingstock.domain.Vehicle"
createOnElement="rollingstock/vehicle">
+ <jb:wiring property="schedule"
beanIdRef="vehicle_schedule"/>
+ <jb:wiring property="weight" beanIdRef="vehicle_weight"/>
+ <jb:wiring property="dynamicWeight"
beanIdRef="vehicle_dynamic_weight"/>
+ <jb:wiring property="dynamicBrakeWeight"
beanIdRef="vehicle_dynamic_brake_weight"/>
+ <jb:wiring property="length" beanIdRef="vehicle_length"/>
+ <jb:wiring property="speed" beanIdRef="vehicle_speed"/>
+ <jb:wiring property="comments"
beanIdRef="vehicle_comments"/>
+ <jb:wiring property="phoneNumbers"
beanIdRef="vehicle_phonenumbers"/>
+ <jb:wiring property="passengerCarConfiguration"
beanIdRef="passenger_car_configuration" />
+
+ <jb:value property="litt" data="vehicle litt" />
+ <jb:value property="originalLitt" data="vehicle
originalLitt" />
+ <jb:value property="ticketId" data="vehicle ticketId"
/>
+ <jb:value property="vehicleId" data="vehicle vehicleId"
/>
+ <jb:value property="vehicleType" data="vehicle
vehicleType" />
+ <jb:value property="nrOfAxles" decoder="Integer"
data="vehicle nrOfAxles" />
+ <jb:value property="serviceType" data="vehicle
serviceType" />
+ <jb:value property="canDoorsBeLocked" decoder="Boolean"
data="vehicle canDoorsBeLocked" />
+ <jb:value property="positionInTrainAssembly"
decoder="Boolean" data="vehicle positionInTrainAssembly" />
+ </jb:bindings>
+
+
+ <jb:bindings beanId="vehicle_schedule"
class="se.sj.ipl.rollingstock.domain.Schedule"
createOnElement="rollingstock/vehicle">
+ <jb:value property="departureStation" data="vehicle
departureStation" />
+ <jb:value property="departureDate" decoder="Date"
data="vehicle departureDate" />
+ <jb:value property="departureTime" decoder="Time"
data="vehicle departureTime" />
+ <jb:value property="destination" data="vehicle
destination" />
+ </jb:bindings>
+
+ <jb:bindings beanId="vehicle_weight"
class="se.sj.ipl.rollingstock.domain.types.Weight"
createOnElement="rollingstock/vehicle">
+ <jb:value property="weight" decoder="Double" data="vehicle
weight" default="0" />
+ </jb:bindings>
+
+ <jb:bindings beanId="vehicle_dynamic_weight"
class="se.sj.ipl.rollingstock.domain.types.Weight"
createOnElement="rollingstock/vehicle">
+ <jb:value property="weight" decoder="Double" data="vehicle
dynamicWeight" default="0" />
+ </jb:bindings>
+
+ <jb:bindings beanId="vehicle_dynamic_brake_weight"
class="se.sj.ipl.rollingstock.domain.types.Weight"
createOnElement="rollingstock/vehicle">
+ <jb:value property="weight" decoder="Double" data="vehicle
brakeWeight" default="0" />
+ </jb:bindings>
+
+ <jb:bindings beanId="vehicle_length"
class="se.sj.ipl.rollingstock.domain.types.Length"
createOnElement="rollingstock/vehicle">
+ <jb:value property="length" decoder="Double" data="vehicle
length" default="0" />
+ </jb:bindings>
+
+ <jb:bindings beanId="vehicle_speed"
class="se.sj.ipl.rollingstock.domain.types.Speed"
createOnElement="rollingstock/vehicle">
+ <jb:value property="speed" decoder="Double" data="vehicle
speed" default="0" />
+ </jb:bindings>
+
+ <jb:bindings beanId="vehicle_comments"
class="java.util.ArrayList"
createOnElement="rollingstock/vehicle">
+ <jb:wiring beanIdRef="vehicle_comment" />
+ </jb:bindings>
+
+ <jb:bindings beanId="vehicle_comments"
class="se.sj.ipl.rollingstock.domain.Comment"
createOnElement="rollingstock/vehicle/comments">
+ <jb:value property="comment" data="comment" />
+ </jb:bindings>
+
+ <jb:bindings beanId="vehicle_phonenumbers"
class="java.util.ArrayList"
createOnElement="rollingstock/vehicle">
+ <jb:wiring beanIdRef="vehicle_phonenumber" />
+ </jb:bindings>
+
+ <jb:bindings beanId="vehicle_phonenumber"
class="se.sj.ipl.rollingstock.domain.PhoneNumber"
createOnElement="rollingstock/vehicle/phoneNumber">
+ <jb:value property="function" data="phoneNumber/function" />
+ <jb:value property="location" data="phoneNumber/location"
/>
+ <jb:value property="number" data="phoneNumber/phoneNumber"
/>
+ </jb:bindings>
+
+ <jb:bindings beanId="passenger_car_configuration"
class="se.sj.ipl.rollingstock.domain.PassengerCarConfiguration"
createOnElement="rollingstock/vehicle">
+ <jb:value property="class1" decoder="Integer" data="vehicle
class1" default="0" />
+ <jb:value property="class2" decoder="Integer"
data="vehicle class2" default="0" />
+ <jb:value property="couchette" decoder="Integer"
data="vehicle couchette" default="0" />
+ <jb:value property="compartments" decoder="Integer"
data="vehicle compartments" default="0" />
+ </jb:bindings>
+
+ <resource-config selector="decoder:Time">
+ <resource>org.milyn.javabean.decoders.SqlTimeDecoder</resource>
+ <param name="format">HH:mm:ss</param>
+ </resource-config>
+
+ <resource-config selector="decoder:Date">
+ <resource>org.milyn.javabean.decoders.SqlDateDecoder</resource>
+ <param name="format">yyyy-MM-dd</param>
+ </resource-config>
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/sj-testimonial.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/splitter-router.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/splitter-router.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/splitter-router.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:jms="http://www.milyn.org/xsd/smooks/jms-routing-1.1.xsd"
+
xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
+
+ <!--
+ Filter the message using the SAX Filter (i.e. not DOM, so no
+ intermediate DOM, so we can process huge messages...
+ -->
+ <params>
+ <param name="stream.filter.type">SAX</param>
+ </params>
+
+ <resource-config selector="order,order-item">
+ <resource>org.milyn.delivery.DomModelCreator</resource>
+ </resource-config>
+
+ <jms:router routeOnElement="order-item" beanId="orderItem_xml"
destination="smooks.exampleQueue">
+ <jms:message>
+ <!-- Need to use special FreeMarker variable ".vars" -->
+
<jms:correlationIdPattern>${order.@id}-${.vars["order-item"].@id}</jms:correlationIdPattern>
+ </jms:message>
+ <jms:highWaterMark mark="3"/>
+ </jms:router>
+
+ <ftl:freemarker applyOnElement="order-item">
+ <!--
+ Note in the template that we need to use the special FreeMarker variable
".vars"
+ because of the hyphenated variable names ("order-item"). See
http://freemarker.org/docs/ref_specvar.html.
+ -->
+ <ftl:template>/orderitem-split.ftl</ftl:template>
+ <ftl:use>
+ <!-- Bind the templating result into the bean context, from where
+ it can be accessed by the JMSRouter (configured above). -->
+ <ftl:bindTo id="orderItem_xml"/>
+ </ftl:use>
+ </ftl:freemarker>
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/splitter-router.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xml-to-java-virtual.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xml-to-java-virtual.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xml-to-java-virtual.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd">
+
+ <!--
+ The "xml-to-java-virtual" sample config is the same as that of the
"xml-to-java" sample accept for the fact that
+ xml-to-java-virtual uses HashMaps (virtual) in place of a fully defined
(physical) object model.
+ -->
+
+ <!--
+ Create an "java.util.HashMap" bean instance when we visit the start of the
<order> element.
+ Assign the new bean instance to the beanId of "order".
+ Wire in the "header" and "orderItems" beans.
+ -->
+ <jb:bindings beanId="order" class="java.util.HashMap"
createOnElement="order">
+ <jb:wiring property="header" beanIdRef="header" />
+ <jb:wiring property="orderItems" beanIdRef="orderItems"
/>
+ </jb:bindings>
+
+ <!--
+ Create an ArrayList bean instance when we visit the start of the <order>
element.
+ This bean is wired into the "order" bean.
+ -->
+ <jb:bindings beanId="orderItems" class="java.util.ArrayList"
createOnElement="order">
+ <jb:wiring beanIdRef="orderItem" />
+ </jb:bindings>
+
+ <!--
+ Create an "java.util.HashMap" bean instance when we visit the start of the
<header> element.
+ This bean is wired into the "order" bean.
+ -->
+ <jb:bindings beanId="header" class="java.util.HashMap"
createOnElement="header">
+ <jb:value property="date" decoder="Date"
data="header/date">
+ <jb:decodeParam name="format">EEE MMM dd HH:mm:ss z
yyyy</jb:decodeParam>
+ <jb:decodeParam
name="locale-language">en</jb:decodeParam>
+ <jb:decodeParam
name="locale-country">IE</jb:decodeParam>
+ </jb:value>
+ <jb:value property="customerNumber" decoder="Long"
data="header/customer/@number" />
+ <jb:value property="customerName" data="header/customer"
/>
+ </jb:bindings>
+
+ <!--
+ Create an "java.util.HashMap" bean instance when we visit the start of the
<order-item> element.
+ This bean is wired into the "orderItems" ArrayList bean.
+ -->
+ <jb:bindings beanId="orderItem" class="java.util.HashMap"
createOnElement="order-item">
+ <jb:value property="productId" decoder="Long"
data="order-item/product" />
+ <jb:value property="quantity" decoder="Integer"
data="order-item/quantity" />
+ <jb:value property="price" decoder="Double"
data="order-item/price" />
+ </jb:bindings>
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xml-to-java-virtual.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xml-to-java.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xml-to-java.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xml-to-java.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd">
+
+ <!--
+ Create an "example.beans.Order" bean instance when we visit the start of
the <order> element.
+ Assign the new bean instance to the beanId of "order".
+ Wire in the "header" and "orderItems" beans.
+ -->
+ <jb:bindings beanId="order" class="example.model.Order"
createOnElement="order">
+ <jb:wiring property="header" beanIdRef="header" />
+ <jb:wiring property="orderItems" beanIdRef="orderItems"
/>
+ </jb:bindings>
+
+ <!--
+ Create an ArrayList bean instance when we visit the start of the <order>
element.
+ This bean is wired into the "order" bean.
+ -->
+ <jb:bindings beanId="orderItems" class="java.util.ArrayList"
createOnElement="order">
+ <jb:wiring beanIdRef="orderItem" />
+ </jb:bindings>
+
+ <!--
+ Create an "example.beans.Header" bean instance when we visit the start of
the <header> element.
+ This bean is wired into the "order" bean.
+ -->
+ <jb:bindings beanId="header" class="example.model.Header"
createOnElement="header">
+ <jb:value property="date" decoder="Date"
data="header/date">
+ <jb:decodeParam name="format">EEE MMM dd HH:mm:ss z
yyyy</jb:decodeParam>
+ <jb:decodeParam
name="locale-language">en</jb:decodeParam>
+ <jb:decodeParam
name="locale-country">IE</jb:decodeParam>
+ </jb:value>
+ <jb:value property="customerNumber" decoder="Long"
data="header/customer/@number" />
+ <jb:value property="customerName" data="header/customer"
/>
+ </jb:bindings>
+
+ <!--
+ Create an "example.beans.OrderItem" bean instance when we visit the start
of the <order-item> element.
+ This bean is wired into the "orderItems" ArrayList bean.
+ -->
+ <jb:bindings beanId="orderItem"
class="example.model.OrderItem" createOnElement="order-item">
+ <jb:value property="productId" decoder="Long"
data="order-item/product" />
+ <jb:value property="quantity" decoder="Integer"
data="order-item/quantity" />
+ <jb:value property="price" decoder="Double"
data="order-item/price" />
+ </jb:bindings>
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xml-to-java.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-basic.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-basic.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-basic.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:xsl="http://www.milyn.org/xsd/smooks/xsl-1.1.xsd">
+
+ <xsl:xsl applyOnElement="c/b">
+ <xsl:template>/example/BasicXslTransform.xsl</xsl:template>
+ </xsl:xsl>
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-basic.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-groovy.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-groovy.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-groovy.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
+
xmlns:xsl="http://www.milyn.org/xsd/smooks/xsl-1.1.xsd">
+
+ <!--
+ Break out the <date> field into separate "time", "day",
"month" and "year" fields using Groovy.
+ This makes the complex date field value consumable by something like XSLT.
+ -->
+ <resource-config selector="header date">
+ <resource>/example/DateFormatter.groovy</resource>
+ <param name="input-format">EEE MMM dd HH:mm:ss z
yyyy</param>
+ <param name="output-format">
+ time=HH:mm
+ day=dd
+ month=MM
+ year=yy
+ </param>
+ </resource-config>
+
+ <!--
+ Transform the document (as a whole) using XSLT. The complex date field has already
been preprocessed into
+ separate fields using Groovy (see above config) - XSLT can handle it easily now :-)
+ -->
+ <xsl:xsl applyOnElement="$document">
+ <xsl:template>/example/order.xsl</xsl:template>
+ </xsl:xsl>
+
+</smooks-resource-list>
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-groovy.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-namespaces.xml
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-namespaces.xml
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-namespaces.xml 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:xsl="http://www.milyn.org/xsd/smooks/xsl-1.1.xsd">
+ <xsl:xsl targetProfile="adffaa" applyOnElement="$d">
+ <xsl:template>
+
+ <![CDATA[<xsl:stylesheet
+
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
+
+
xmlns:xhtml="http://www.w3.org/1999/xhtml"
+
+ exclude-result-prefixes="smk xhtml"
+
+
xmlns:smk="http://milyn.codehaus.org/Smooks">
+
+
+
+ <xsl:output method="xml" encoding="UTF-8"/>
+
+
+
+ <xsl:template match="/">
+
+ <CanonicalOrderFormat
xmlns="http://canonical.codehaus.org/Order">
+
+ <orderId>
+
+ <xsl:value-of
select="./smk:Order/smk:header/smk:order-id"/>
+
+ </orderId>
+
+ <item>
+
+ <productId>
+
+ <xsl:value-of
select="./smk:Order/smk:order-item/smk:product-id"/>
+
+ </productId>
+
+ <title>
+
+ <xsl:value-of
select="./smk:Order/smk:order-item/smk:title"/>
+
+ </title>
+
+ <price>
+
+ <xsl:value-of
select="./smk:Order/smk:order-item/smk:price"/>
+
+ </price>
+
+ </item>
+
+ </CanonicalOrderFormat>
+
+ </xsl:template>
+
+ </xsl:stylesheet>]]></xsl:template>
+ </xsl:xsl>
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model/configfiles/smooks112/xslt-namespaces.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/AbstractSmooks11ModelTestCase.java
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/AbstractSmooks11ModelTestCase.java
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/AbstractSmooks11ModelTestCase.java 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.test.model11;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashMap;
+
+import junit.framework.TestCase;
+
+import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage.Registry;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.calc.CalcPackage;
+import org.jboss.tools.smooks.model.calc.provider.CalcItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.common.CommonPackage;
+import org.jboss.tools.smooks.model.common.provider.CommonItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.csv.CsvPackage;
+import org.jboss.tools.smooks.model.csv.provider.CsvItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.datasource.DatasourcePackage;
+import
org.jboss.tools.smooks.model.datasource.provider.DatasourceItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.dbrouting.DbroutingPackage;
+import
org.jboss.tools.smooks.model.dbrouting.provider.DbroutingItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.edi.EdiPackage;
+import org.jboss.tools.smooks.model.edi.provider.EdiItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.fileRouting.FileRoutingPackage;
+import
org.jboss.tools.smooks.model.fileRouting.provider.FileRoutingItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.freemarker.FreemarkerPackage;
+import
org.jboss.tools.smooks.model.freemarker.provider.FreemarkerItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.groovy.GroovyPackage;
+import org.jboss.tools.smooks.model.groovy.provider.GroovyItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.iorouting.IoroutingPackage;
+import
org.jboss.tools.smooks.model.iorouting.provider.IoroutingItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.javabean.JavabeanPackage;
+import
org.jboss.tools.smooks.model.javabean.provider.JavabeanItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.jmsrouting.JmsroutingPackage;
+import
org.jboss.tools.smooks.model.jmsrouting.provider.JmsroutingItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.json.JsonPackage;
+import org.jboss.tools.smooks.model.json.provider.JsonItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.medi.MEdiPackage;
+import org.jboss.tools.smooks.model.medi.provider.MEdiItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.smooks.SmooksPackage;
+import org.jboss.tools.smooks.model.smooks.provider.SmooksItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.xsl.XslPackage;
+import org.jboss.tools.smooks.model.xsl.provider.XslItemProviderAdapterFactory;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksResourceFactoryImpl;
+
+/**
+ *
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public abstract class AbstractSmooks11ModelTestCase extends TestCase {
+
+ protected ComposedAdapterFactory adapterFactory;
+ protected AdapterFactoryEditingDomain editingDomain;
+ protected EObject smooksModel;
+
+ static{
+ // regist emf model uri mapping
+ Registry.INSTANCE.put(SmooksPackage.eNS_URI, SmooksPackage.eINSTANCE);
+ Registry.INSTANCE.put(CalcPackage.eNS_URI, CalcPackage.eINSTANCE);
+ Registry.INSTANCE.put(CommonPackage.eNS_URI, CommonPackage.eINSTANCE);
+ Registry.INSTANCE.put(CsvPackage.eNS_URI, CsvPackage.eINSTANCE);
+ Registry.INSTANCE.put(DatasourcePackage.eNS_URI, DatasourcePackage.eINSTANCE);
+ Registry.INSTANCE.put(DbroutingPackage.eNS_URI, DbroutingPackage.eINSTANCE);
+ Registry.INSTANCE.put(EdiPackage.eNS_URI, EdiPackage.eINSTANCE);
+ Registry.INSTANCE.put(FileRoutingPackage.eNS_URI, FileRoutingPackage.eINSTANCE);
+
+ Registry.INSTANCE.put(FreemarkerPackage.eNS_URI, FreemarkerPackage.eINSTANCE);
+ Registry.INSTANCE.put(GroovyPackage.eNS_URI, GroovyPackage.eINSTANCE);
+ Registry.INSTANCE.put(IoroutingPackage.eNS_URI, IoroutingPackage.eINSTANCE);
+ Registry.INSTANCE.put(JavabeanPackage.eNS_URI, JavabeanPackage.eINSTANCE);
+ Registry.INSTANCE.put(JmsroutingPackage.eNS_URI, JmsroutingPackage.eINSTANCE);
+ Registry.INSTANCE.put(JsonPackage.eNS_URI, JsonPackage.eINSTANCE);
+ Registry.INSTANCE.put(MEdiPackage.eNS_URI, MEdiPackage.eINSTANCE);
+ Registry.INSTANCE.put(XslPackage.eNS_URI, XslPackage.eINSTANCE);
+
+ Registry.INSTANCE.put(org.jboss.tools.smooks10.model.smooks.SmooksPackage.eNS_URI,
org.jboss.tools.smooks10.model.smooks.SmooksPackage.eINSTANCE);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ // init emf editingdomain
+ adapterFactory = new
ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+
+ adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new XslItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new FreemarkerItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new JavabeanItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new CommonItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new SmooksItemProviderAdapterFactory());
+
+ adapterFactory.addAdapterFactory(new
org.jboss.tools.smooks10.model.smooks.provider.SmooksItemProviderAdapterFactory());
+
+ adapterFactory.addAdapterFactory(new MEdiItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new EdiItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new IoroutingItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new JsonItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new JmsroutingItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new DbroutingItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new CsvItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new DatasourceItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new CalcItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new GroovyItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new FileRoutingItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
+
+ BasicCommandStack commandStack = new BasicCommandStack();
+ editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new
HashMap<Resource, Boolean>());
+
+ loadConfigFile() ;
+ }
+
+ protected void loadConfigFile() throws IOException{
+ Resource smooksResource = new SmooksResourceFactoryImpl().createResource(null);
+ smooksResource.load(getConfigFileContents() , Collections.emptyMap());
+ smooksModel = smooksResource.getContents().get(0);
+ editingDomain.getResourceSet().getResources().add(smooksResource);
+ }
+
+ abstract protected InputStream getConfigFileContents();
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public ComposedAdapterFactory getAdapterFactory() {
+ return adapterFactory;
+ }
+
+ public void setAdapterFactory(ComposedAdapterFactory adapterFactory) {
+ this.adapterFactory = adapterFactory;
+ }
+
+ public AdapterFactoryEditingDomain getEditingDomain() {
+ return editingDomain;
+ }
+
+ public void setEditingDomain(AdapterFactoryEditingDomain editingDomain) {
+ this.editingDomain = editingDomain;
+ }
+
+ public EObject getSmooksModel() {
+ return smooksModel;
+ }
+
+ public void setSmooksModel(EObject smooksModel) {
+ this.smooksModel = smooksModel;
+ }
+
+
+
+}
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/AbstractSmooks11ModelTestCase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/ParseConfigFileTestCase.java
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/ParseConfigFileTestCase.java
(rev 0)
+++
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/ParseConfigFileTestCase.java 2009-04-22
08:39:17 UTC (rev 14846)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.test.model11;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collections;
+
+import junit.framework.Assert;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.jboss.tools.smooks.model.smooks.DocumentRoot;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksResourceFactoryImpl;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class ParseConfigFileTestCase extends AbstractSmooks11ModelTestCase {
+
+ @Override
+ protected void loadConfigFile() throws IOException {
+ // do nothing
+ }
+
+ @Override
+ protected InputStream getConfigFileContents() {
+ return null;
+ }
+
+ private void loadFile(File file) throws IOException {
+ if (file.exists() && file.isDirectory()) {
+ File[] configFiles = file.listFiles();
+ for (int i = 0; i < configFiles.length; i++) {
+ File configFile = configFiles[i];
+ if (configFile.isFile()) {
+ FileInputStream inputStream = new FileInputStream(configFile);
+ Resource smooksResource = new SmooksResourceFactoryImpl().createResource(null);
+ if (inputStream != null) {
+ smooksResource.load(inputStream, Collections.emptyMap());
+ smooksModel = smooksResource.getContents().get(0);
+ Assert.assertNotNull(smooksModel);
+ Assert.assertTrue(smooksModel instanceof
org.jboss.tools.smooks.model.medi.DocumentRoot
+ || smooksModel instanceof DocumentRoot
+ || smooksModel instanceof org.jboss.tools.smooks10.model.smooks.DocumentRoot);
+ if (smooksModel instanceof DocumentRoot) {
+ System.out.println("load smooks 1.1.2 config file : \"" +
file.getName() +"/"+ configFile.getName()
+ + "\" success.");
+ }
+ if (smooksModel instanceof org.jboss.tools.smooks.model.medi.DocumentRoot) {
+ System.out.println("load edi-message-mapping-1.0 file config file :
\"" + file.getName() +"/"+ configFile.getName()
+ + "\" success.");
+ }
+ if (smooksModel instanceof org.jboss.tools.smooks10.model.smooks.DocumentRoot) {
+ System.out.println("load smooks 1.0 config file : \"" +
file.getName() +"/"+ configFile.getName()
+ + "\" success.");
+ }
+ }
+ }
+
+ if (configFile.isDirectory()) {
+ loadFile(configFile);
+ }
+ }
+ }
+ }
+
+ public void testParseConfigFile() throws IOException {
+ URL configFileFolder = this.getClass().getClassLoader().getResource(
+ "org/jboss/tools/smooks/test/model/configfiles");
+ File file = new File(configFileFolder.getFile());
+ loadFile(file);
+ }
+}
Property changes on:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/ParseConfigFileTestCase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain