[jboss-svn-commits] JBL Code SVN: r12238 - in labs/jbossesb/trunk/product: samples/quickstarts/transform_XML2POJO and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed May 30 10:49:39 EDT 2007


Author: tfennelly
Date: 2007-05-30 10:49:38 -0400 (Wed, 30 May 2007)
New Revision: 12238

Modified:
   labs/jbossesb/trunk/product/lib/ext/milyn-smooks-javabean-0.3-SNAPSHOT.jar
   labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/smooks-res.xml
   labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/src/org/jboss/soa/esb/dvdstore/OrderHeader.java
   labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/src/org/jboss/soa/esb/dvdstore/OrderItem.java
Log:
Updated XML2POJO quickstart

Modified: labs/jbossesb/trunk/product/lib/ext/milyn-smooks-javabean-0.3-SNAPSHOT.jar
===================================================================
(Binary files differ)

Modified: labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/smooks-res.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/smooks-res.xml	2007-05-30 13:29:11 UTC (rev 12237)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/smooks-res.xml	2007-05-30 14:49:38 UTC (rev 12238)
@@ -1,98 +1,65 @@
-<?xml version="1.0"?>
-<!DOCTYPE smooks-resource-list PUBLIC "-//MILYN//DTD SMOOKS 1.0//EN" "http://www.milyn.org/dtd/smooksres-list-1.0.dtd" >
-<smooks-resource-list>
-	<smooks-resource selector="cdu-creator" useragent="*" path="org.milyn.templating.xslt.XslContentDeliveryUnitCreator" >
-		<param name="restype"><![CDATA[xsl]]></param>
-	</smooks-resource>
-	<smooks-resource selector="cdu-creator" useragent="*" path="org.milyn.templating.stringtemplate.StringTemplateContentDeliveryUnitCreator" >
-		<param name="restype"><![CDATA[st]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+<?xml version='1.0' encoding='UTF-8'?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
 
-		<param name="beanId"><![CDATA[orderHeader]]></param>
-		<param name="beanClass"><![CDATA[org.jboss.soa.esb.dvdstore.OrderHeader]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[orderHeader]]></param>
-		<param name="attributeName"><![CDATA[orderId]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[orderHeader]]></param>
+	<resource-config selector="cdu-creator">
+        <resource>org.milyn.templating.xslt.XslContentDeliveryUnitCreator</resource>
+        <param name="restype">xsl></param>
+	</resource-config>
+	<resource-config selector="cdu-creator">
+        <resource>org.milyn.templating.stringtemplate.StringTemplateContentDeliveryUnitCreator</resource>
+        <param name="restype">st</param>
+	</resource-config>
 
-		<param name="attributeName"><![CDATA[orderDate]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[orderHeader]]></param>
-		<param name="attributeName"><![CDATA[statusCode]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[orderHeader]]></param>
-		<param name="attributeName"><![CDATA[netAmount]]></param>
+    <!-- Populate the OrderHeader -->
+	<resource-config selector="order" target-profile="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice">
+        <resource>org.milyn.javabean.ProcessingPhaseBeanPopulator</resource>
+        <param name="beanId">orderHeader</param>
+		<param name="beanClass">org.jboss.soa.esb.dvdstore.OrderHeader</param>
+        <param name="bindings">
+            <binding property="orderId" selector="Order @orderId" />
+            <binding property="orderDate" selector="Order @orderDate" type="LongDate"/>
+            <binding property="statusCode" selector="Order @statusCode" type="Integer" />
+            <binding property="netAmount" selector="Order @netAmount" type="Double" />
+            <binding property="totalAmount" selector="Order @totalAmount" type="Double" />
+            <binding property="tax" selector="Order @tax" type="Double" />
+        </param>
+    </resource-config>
 
-	</smooks-resource>
-	<smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[orderHeader]]></param>
-		<param name="attributeName"><![CDATA[totalAmount]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[orderHeader]]></param>
-		<param name="attributeName"><![CDATA[tax]]></param>
-	</smooks-resource>
+    <!-- Populate the Customer -->
+    <resource-config selector="order customer" target-profile="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice">
+        <resource>org.milyn.javabean.ProcessingPhaseBeanPopulator</resource>
+		<param name="beanId">customer</param>
+		<param name="beanClass">org.jboss.soa.esb.dvdstore.Customer></param>
+        <param name="bindings">
+            <binding property="userName" selector="order customer @userName" />
+            <binding property="firstName" selector="order customer @firstName" />
+            <binding property="lastName" selector="order customer @lastName" />
+            <binding property="state" selector="order customer @state" />
+        </param>
+	</resource-config>
 
-	<smooks-resource selector="order customer" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[customer]]></param>
-		<param name="beanClass"><![CDATA[org.jboss.soa.esb.dvdstore.Customer]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order customer" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[customer]]></param>
-		<param name="attributeName"><![CDATA[userName]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order customer" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
+    <!-- Populate the OrderItem list -->
+	<resource-config selector="order orderlines orderline" target-profile="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice">
+        <resource>org.milyn.javabean.ProcessingPhaseBeanPopulator</resource>
+		<param name="beanId">orderItem</param>
+		<param name="beanClass">org.jboss.soa.esb.dvdstore.OrderItem</param>
+		<param name="addToList">true</param>
+        <param name="bindings">
+            <binding property="position"  selector="order orderlines orderline @position" type="Integer" />
+            <binding property="quantity"  selector="order orderlines orderline @quantity" type="Integer" />
+            <binding property="productId" selector="order orderlines orderline product @productId" />
+            <binding property="title"     selector="order orderlines orderline product @title" />
+            <binding property="price"     selector="order orderlines orderline product @price" type="Double" />
+        </param>
+	</resource-config>
 
-		<param name="beanId"><![CDATA[customer]]></param>
-		<param name="attributeName"><![CDATA[firstName]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order customer" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[customer]]></param>
-		<param name="attributeName"><![CDATA[lastName]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order customer" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[customer]]></param>
+	<resource-config selector="order orderlines orderline" target-profile="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice and to-type:text/xml:shiporder and to:dvdwarehouse_1:orderhandlingservice">
+        <resource>/org/jboss/soa/esb/dvdstore/orderitem.st</resource>
+	</resource-config>
 
-		<param name="attributeName"><![CDATA[state]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order orderlines orderline" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[orderItem]]></param>
-		<param name="beanClass"><![CDATA[org.jboss.soa.esb.dvdstore.OrderItem]]></param>
-		<param name="addToList"><![CDATA[true]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order orderlines orderline" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[orderItem]]></param>
-
-		<param name="attributeName"><![CDATA[position]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order orderlines orderline" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[orderItem]]></param>
-		<param name="attributeName"><![CDATA[quantity]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order orderlines orderline product" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[orderItem]]></param>
-		<param name="attributeName"><![CDATA[productId]]></param>
-
-	</smooks-resource>
-	<smooks-resource selector="order orderlines orderline product" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[orderItem]]></param>
-		<param name="attributeName"><![CDATA[title]]></param>
-	</smooks-resource>
-	<smooks-resource selector="order orderlines orderline product" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice" path="org.milyn.javabean.ProcessingPhaseBeanPopulator" >
-		<param name="beanId"><![CDATA[orderItem]]></param>
-		<param name="attributeName"><![CDATA[price]]></param>
-	</smooks-resource>
-
-	<smooks-resource selector="order orderlines orderline" useragent="from-type:text/xml:fullfillorder and from:dvdstore:orderdispatchservice and to-type:text/xml:shiporder and to:dvdwarehouse_1:orderhandlingservice" path="/org/jboss/soa/esb/dvdstore/orderitem.st" >
-		<param name="encoding"><![CDATA[UTF-8]]></param>
-		<param name="visitBefore"><![CDATA[false]]></param>
-		<param name="action"><![CDATA[replace]]></param>
-	</smooks-resource>
-
+    <resource-config selector="decoder:LongDate">
+        <resource>org.milyn.javabean.decoders.CalendarDecoder</resource>
+        <param name="format">EEE MMM dd HH:mm:ss z yyyy</param>
+    </resource-config>
+    
 </smooks-resource-list>
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/src/org/jboss/soa/esb/dvdstore/OrderHeader.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/src/org/jboss/soa/esb/dvdstore/OrderHeader.java	2007-05-30 13:29:11 UTC (rev 12237)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/src/org/jboss/soa/esb/dvdstore/OrderHeader.java	2007-05-30 14:49:38 UTC (rev 12238)
@@ -21,6 +21,8 @@
 
 package org.jboss.soa.esb.dvdstore;
 
+import java.util.Calendar;
+
 /**
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
@@ -28,35 +30,34 @@
 	
 	// <Order orderId="1" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="0" netAmount="59.97" totalAmount="64.92" tax="4.95">
 	private String orderId;
-	private String orderDate;
-	private String statusCode;
-	private String netAmount;
-	private String totalAmount;
-	private String tax;
+	private Calendar orderDate;
+	private int statusCode;
+	private double netAmount;
+	private double totalAmount;
+	private double tax;
 	
 	/**
 	 * @return Returns the netAmount.
 	 */
-	public String getNetAmount() {
+	public double getNetAmount() {
 		return netAmount;
 	}
 	/**
 	 * @param netAmount The netAmount to set.
 	 */
-	public void setNetAmount(String netAmount) {
-		// System.out.println("**** netAmount: " + netAmount);
+	public void setNetAmount(double netAmount) {
 		this.netAmount = netAmount;
 	}
 	/**
 	 * @return Returns the orderDate.
 	 */
-	public String getOrderDate() {
+	public Calendar getOrderDate() {
 		return orderDate;
 	}
 	/**
 	 * @param orderDate The orderDate to set.
 	 */
-	public void setOrderDate(String orderDate) {
+	public void setOrderDate(Calendar orderDate) {
 		this.orderDate = orderDate;
 	}
 	/**
@@ -74,37 +75,37 @@
 	/**
 	 * @return Returns the statusCode.
 	 */
-	public String getStatusCode() {
+	public int getStatusCode() {
 		return statusCode;
 	}
 	/**
 	 * @param statusCode The statusCode to set.
 	 */
-	public void setStatusCode(String statusCode) {
+	public void setStatusCode(int statusCode) {
 		this.statusCode = statusCode;
 	}
 	/**
 	 * @return Returns the tax.
 	 */
-	public String getTax() {
+	public double getTax() {
 		return tax;
 	}
 	/**
 	 * @param tax The tax to set.
 	 */
-	public void setTax(String tax) {
+	public void setTax(double tax) {
 		this.tax = tax;
 	}
 	/**
 	 * @return Returns the totalAmount.
 	 */
-	public String getTotalAmount() {
+	public double getTotalAmount() {
 		return totalAmount;
 	}
 	/**
 	 * @param totalAmount The totalAmount to set.
 	 */
-	public void setTotalAmount(String totalAmount) {
+	public void setTotalAmount(double totalAmount) {
 		this.totalAmount = totalAmount;
 	}
 	
@@ -113,6 +114,6 @@
 	 */
 	@Override
 	public String toString() {
-		return orderId + ", " + orderDate + ", " + statusCode + ", " + netAmount + ", " + totalAmount + ", " + tax + ", ";
+		return orderId + ", " + (orderDate == null?null:orderDate.getTime()) + ", " + statusCode + ", " + netAmount + ", " + totalAmount + ", " + tax + ", ";
 	}
 }

Modified: labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/src/org/jboss/soa/esb/dvdstore/OrderItem.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/src/org/jboss/soa/esb/dvdstore/OrderItem.java	2007-05-30 13:29:11 UTC (rev 12237)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/src/org/jboss/soa/esb/dvdstore/OrderItem.java	2007-05-30 14:49:38 UTC (rev 12238)
@@ -29,35 +29,35 @@
 	// <OrderLine position="1" quantity="1">
 	// 		<Product productId="364" title="The 40-Year-Old Virgin " price="29.98"/>
 	// </OrderLine>
-	private String position;
-	private String quantity;
+	private int position;
+	private int quantity;
 	private String productId;
 	private String title;
-	private String price;
+	private double price;
 	
 	/**
 	 * @return Returns the position.
 	 */
-	public String getPosition() {
+	public int getPosition() {
 		return position;
 	}
 	/**
 	 * @param position The position to set.
 	 */
-	public void setPosition(String position) {
+	public void setPosition(int position) {
 		//System.out.println("**** position: " + position);
 		this.position = position;
 	}
 	/**
 	 * @return Returns the price.
 	 */
-	public String getPrice() {
+	public double getPrice() {
 		return price;
 	}
 	/**
 	 * @param price The price to set.
 	 */
-	public void setPrice(String price) {
+	public void setPrice(double price) {
 		//System.out.println("**** price: " + price);
 		this.price = price;
 	}
@@ -76,13 +76,13 @@
 	/**
 	 * @return Returns the quantity.
 	 */
-	public String getQuantity() {
+	public int getQuantity() {
 		return quantity;
 	}
 	/**
 	 * @param quantity The quantity to set.
 	 */
-	public void setQuantity(String quantity) {
+	public void setQuantity(int quantity) {
 		this.quantity = quantity;
 	}
 	/**




More information about the jboss-svn-commits mailing list