[jboss-svn-commits] JBL Code SVN: r12261 - in labs/jbossesb/trunk: product/core/listeners/src/org/jboss/soa/esb/actions/converters and 43 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu May 31 10:18:42 EDT 2007


Author: kurt.stam at jboss.com
Date: 2007-05-31 10:18:41 -0400 (Thu, 31 May 2007)
New Revision: 12261

Added:
   labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/deployment.xml
   labs/jbossesb/trunk/product/services/smooks/
   labs/jbossesb/trunk/product/services/smooks/base-project-build.xml
   labs/jbossesb/trunk/product/services/smooks/build.properties
   labs/jbossesb/trunk/product/services/smooks/build.xml
   labs/jbossesb/trunk/product/services/smooks/lib/
   labs/jbossesb/trunk/product/services/smooks/lib/ext/
   labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/
   labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/commons-logging-1.0.4.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/jbossall-client.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/jbossts-common.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/junit-4.1.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/log4j.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-commons-0.9-SNAPSHOT.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-edisax-0.2-SNAPSHOT.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-core-0.9-SNAPSHOT.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-csv-0.1.1.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-edi-0.2-SNAPSHOT.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-javabean-0.3-SNAPSHOT.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-misc-0.2.1.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-scripting-0.1.jar
   labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-templating-0.2.1.jar
   labs/jbossesb/trunk/product/services/smooks/src/
   labs/jbossesb/trunk/product/services/smooks/src/main/
   labs/jbossesb/trunk/product/services/smooks/src/main/java/
   labs/jbossesb/trunk/product/services/smooks/src/main/java/org/
   labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/
   labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/
   labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/
   labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/
   labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/
   labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java
   labs/jbossesb/trunk/product/services/smooks/src/main/resources/
   labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/
   labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/deployment.xml
   labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml
   labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbm-queue-service.xml
   labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-cdr.lst
   labs/jbossesb/trunk/product/services/smooks/src/test/
   labs/jbossesb/trunk/product/services/smooks/src/test/java/
   labs/jbossesb/trunk/product/services/smooks/src/test/java/org/
   labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/
   labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/
   labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/
   labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/
   labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/
   labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java
   labs/jbossesb/trunk/product/services/smooks/src/test/resources/
   labs/jbossesb/trunk/product/services/smooks/src/test/resources/log4j.xml
   labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test-cdr.lst
   labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test.cdrl
   labs/jbossesb/trunk/product/services/soapui-client/lib/
   labs/jbossesb/trunk/product/services/soapui-client/lib/ext/
   labs/jbossesb/trunk/product/services/soapui-client/lib/ext/build-time/
Removed:
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/converters/SmooksTransformer.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/smooks-test.cdrl
   labs/jbossesb/trunk/product/install/conf/smooks-cdr.lst
   labs/jbossesb/trunk/product/lib/ext/commons-logging.jar
   labs/jbossesb/trunk/product/lib/ext/milyn-commons-0.9-SNAPSHOT.jar
   labs/jbossesb/trunk/product/lib/ext/milyn-edisax-0.2-SNAPSHOT.jar
   labs/jbossesb/trunk/product/lib/ext/milyn-smooks-core-0.9-SNAPSHOT.jar
   labs/jbossesb/trunk/product/lib/ext/milyn-smooks-csv-0.1.1.jar
   labs/jbossesb/trunk/product/lib/ext/milyn-smooks-edi-0.2-SNAPSHOT.jar
   labs/jbossesb/trunk/product/lib/ext/milyn-smooks-javabean-0.3-SNAPSHOT.jar
   labs/jbossesb/trunk/product/lib/ext/milyn-smooks-misc-0.2.1.jar
   labs/jbossesb/trunk/product/lib/ext/milyn-smooks-scripting-0.1.jar
   labs/jbossesb/trunk/product/lib/ext/milyn-smooks-templating-0.2.1.jar
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerConfig.xml
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerTest.java
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/smooks-cdr.lst
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/smooks-test.cdrl
Modified:
   labs/jbossesb/trunk/product/build-distr.xml
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/smooks-cdr.lst
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/dom/YADOMUtil.java
   labs/jbossesb/trunk/product/samples/quickstarts/transform_EDI2XML_Groovy_XSLT/deployment.xml
   labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/deployment.xml
   labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_date_manipulation/deployment.xml
   labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_simple/deployment.xml
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_bpel/deployment.xml
   labs/jbossesb/trunk/product/services/build.xml
   labs/jbossesb/trunk/product/tools/console/build.xml
Log:
JBESB-500 moving smooks to it's own smooks.esb project

Modified: labs/jbossesb/trunk/product/build-distr.xml
===================================================================
--- labs/jbossesb/trunk/product/build-distr.xml	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/build-distr.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -152,7 +152,8 @@
         <copy todir="${build.dir}/services">
             <fileset dir="${services.dir}/jbpm/build" includes="jbpm.esb/**/*"/>
             <fileset dir="${services.dir}/jbossesb/build" includes="jbossesb.esb/**/*"/>
-            <fileset dir="${services.dir}/jbrules/build" includes="jbrules.esb/**/*"/>
+        	<fileset dir="${services.dir}/jbrules/build" includes="jbrules.esb/**/*"/>
+        	<fileset dir="${services.dir}/smooks/build" includes="smooks.esb/**/*"/>
         </copy>
     </target>
 

Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/converters/SmooksTransformer.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/converters/SmooksTransformer.java	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/converters/SmooksTransformer.java	2007-05-31 14:18:41 UTC (rev 12261)
@@ -1,632 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions.converters;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.jms.JMSException;
-import javax.jms.MessageListener;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.naming.Context;
-import javax.naming.NamingException;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.ActionLifecycleException;
-import org.jboss.soa.esb.actions.ActionPipelineProcessor;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.common.ModulePropertyManager;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.helpers.KeyValuePair;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.services.transform.TransformationException;
-import org.jboss.soa.esb.services.transform.TransformationService;
-import org.milyn.Smooks;
-import org.milyn.SmooksUtil;
-import org.milyn.container.standalone.StandaloneExecutionContext;
-import org.milyn.javabean.BeanAccessor;
-import org.milyn.profile.DefaultProfileSet;
-import org.milyn.profile.ProfileStore;
-import org.milyn.profile.UnknownProfileMemberException;
-import org.milyn.resource.URIResourceLocator;
-
-/**
- * Smooks Transformer.
- * <p/>
- * This processor hooks the <a href="http://milyn.codehaus.org/Smooks">Milyn Smooks</a>
- * XML Transformation/Processing Engine into a message processing pipeline to support
- * non binary message transformations.
- * 
- * <h3>Action Configuration</h3>
- * This action is configured as follows:
- * <pre>
- * &lt;action name="transformAB" class="<b>org.jboss.soa.esb.actions.converters.SmooksTransformer</b>"&gt;
- * 	&lt;property name="<b>from</b>" value="A" /&gt;
- * 	&lt;property name="<b>from-type</b>" value="text/xml:messageAtA" /&gt;
- * 	&lt;property name="<b>to</b>" value="B" /&gt;
- * 	&lt;property name="<b>to-type</b>" value="text/xml:messageAtB" /&gt;
- * &lt;/action&gt;
- * </pre>
- * 
- * <h3>Configuartion Loading &amp; Administration Console Integration</h3>
- * This class picks up its list of transformation resource configurations from a list file
- * specified in the "configuration.list.file.uri" parameter of the "transformation" 
- * section of the ESB configuration file.  This configuration
- * should specify a URI to this list file and is loaded using the {@link URIResourceLocator}.
- * The default list file is "classpath:/smooks-cdr.lst" (note classpath based URIs are supported).
- * <p/>  
- * This file contains a list of URIs that reference
- * <a href="http://milyn.codehaus.org/Smooks">Smooks</a> resource configurations files.
- * Again, {@link URIResourceLocator} is used to load these configurations.  "classpath:/"
- * is the default if no scheme is specified.  This is also where the Administration Console
- * is integrated with this class.  The list file needs to specify the following a HTTP based 
- * URI for accessing the configurations under management by the Administration console:
- * <pre>
- * 	http://localhost:8080/jboss-esb-console/transform/smooks-config.jsp
- * </pre>
- * ... where the host and port values need to be modified appropriately.
- * 
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
-
-public class SmooksTransformer implements TransformationService, ActionPipelineProcessor {
-
-	/**
-	 * Configuration section key.
-	 */
-	public static final String CONFIGURATION_SECTION = "transformation";
-	/**
-	 * Key for storing/accessing any potential message Body bean HashMaps as populated
-	 * by the Smooks Javabean Cartridge.
-	 */
-	public static final String EXTRACTED_BEANS_HASH = "EXTRACTED_BEANS_HASH";
-	/**
-	 * Config property key for setting a true/false flag to indicate whether or not
-	 * a bean hashs should be set as the message payload before exiting the process method.
-	 */
-	public static final String SET_BEANHASH_TO_PAYLOAD = "set-beanhash-to-payload";
-		
-	public static final String FROM = "from";
-	public static final String FROM_TYPE = "from-type";
-	public static final String TO = "to";
-	public static final String TO_TYPE = "to-type";
-	
-    private static Logger logger = Logger.getLogger(SmooksTransformer.class);
-    private Smooks smooks;
-	private ConfigurationUpdateListener updateListener;
-    private String defaultMessageFromType;
-    private String defaultMessageFrom;
-    private String defaultMessageToType;
-    private String defaultMessageTo;
-    private boolean setPayloadToBeanHash = false;
-    private List<KeyValuePair> properties;
-
-    /**
-     * Public constructor.
-     * @param name Action name.
-     * @param propertiesTree Action Properties.
-     * @throws ConfigurationException Action not properly configured.
-     */
-	public SmooksTransformer(String name, ConfigTree propertiesTree) throws ConfigurationException {
-		this(propertiesTree);
-	}
-    
-    /**
-     * Public constructor.
-     * @param propertiesTree Action Properties.
-     * @throws ConfigurationException 
-     * @throws ConfigurationException Action not properly configured.
-     */
-	public SmooksTransformer(ConfigTree propertiesTree) throws ConfigurationException {
-		properties = propertiesTree.attributesAsList();
-
-		// Get the message flow properties...
-		defaultMessageFromType = KeyValuePair.getValue(FROM_TYPE, properties);
-		if(defaultMessageFromType != null && defaultMessageFromType.trim().equals("")) {
-			throw new ConfigurationException("Empty '" + FROM_TYPE + "' config attribute supplied.");
-		}
-		defaultMessageToType = KeyValuePair.getValue(TO_TYPE, properties);
-		if(defaultMessageToType != null && defaultMessageToType.trim().equals("")) {
-			throw new ConfigurationException("Empty '" + TO_TYPE + "' config attribute supplied.");
-		}
-		defaultMessageFrom = KeyValuePair.getValue(FROM, properties);
-		if(defaultMessageFrom != null && defaultMessageFrom.trim().equals("")) {
-			throw new ConfigurationException("Empty '" + FROM + "' config attribute supplied.");
-		}
-		defaultMessageTo = KeyValuePair.getValue(TO, properties);
-		if(defaultMessageTo != null && defaultMessageTo.trim().equals("")) {
-			throw new ConfigurationException("Empty '" + TO + "' config attribute supplied.");
-		}
-		
-		// Get the set-beanhash-to-payload property...
-		setPayloadToBeanHash = KeyValuePair.getBooleanValue(SET_BEANHASH_TO_PAYLOAD, properties, false);
-        
-        updateListener = new ConfigurationUpdateListener(this);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.jboss.soa.esb.services.transform.TransformationService#transform(org.jboss.soa.esb.message.Message)
-	 */
-	public Message transform(Message message) throws TransformationException {
-		try {
-			return process(message);
-		} catch (ActionProcessingException e) {
-			throw new TransformationException(e);
-		}
-	}
-
-    /* (non-Javadoc)
-     * @see org.jboss.soa.esb.actions.ActionProcessor#process(java.lang.Object)
-     */
-    public Message process(Message message) throws ActionProcessingException {
-    	Object payload = ActionUtils.getTaskObject(message);
-    	
-    	try {
-        	if(payload instanceof byte[]) {
-        		payload = new String((byte[])payload, "UTF-8");
-        	}
-        	
-        	if(payload instanceof String) {
-	            byte[] messageBytes = null;
-	            String transformedMessage;
-	        	String messageProfile;
-	            
-	            // Register the message useragent with Smooks (if not already registered)...
-	        	messageProfile = registerMessageProfile(message);
-	            
-                messageBytes = ((String)payload).getBytes("UTF-8");
-	
-	            long start = System.currentTimeMillis();
-	            StandaloneExecutionContext request;
-	            
-	            // Filter and Serialise...
-	            request = smooks.createExecutionContext( messageProfile );
-	            transformedMessage = SmooksUtil.filterAndSerialize( request, new ByteArrayInputStream( messageBytes), smooks );
-	            
-	            // Javabean cartridge resources may have extract data from the message and populated some beans.
-	            // Get them and stick them on the message - so they can be accessed by downstream actions...
-	            HashMap beanHash = BeanAccessor.getBeans(request);
-	            if(beanHash != null) {
-	            	message.getBody().add(EXTRACTED_BEANS_HASH, beanHash);
-	            }
-	            
-	            if(logger.isDebugEnabled()) {
-	            	long timeTaken = System.currentTimeMillis() - start;
-	            	logger.debug("Transformed message for useragent [" + messageProfile + "]. Time taken: " 
-	            			+ timeTaken + ".  Message in:\n[" + payload.toString()+ "].  \nMessage out:\n[" + transformedMessage + "].");
-	            }
-	            
-	            if(beanHash != null && setPayloadToBeanHash) {
-	            	ActionUtils.setTaskObject(message, beanHash);
-	            } else {
-	            	ActionUtils.setTaskObject(message, transformedMessage);
-	            	message.getBody().setByteArray(transformedMessage.getBytes("UTF-8"));
-	            }
-	        } else {
-	        	String sClass = (null==payload) ? "<null>" : payload.getClass().getName();
-	            logger.warn("String message types only supported.  Input message was [" 
-	            		+ sClass + "].  Returning message untransformed.");
-	        }
-    	} catch(Throwable thrown) {
-    		thrown.printStackTrace();
-    		throw new ActionProcessingException("Message transformation failed.", thrown);
-    	}
-        
-        // TODO: Cater for more message input types e.g. InputStream, DOM Document...
-        // TODO: Cater for more message output types e.g. InputStream, DOM Document...
-    	
-    	return message;
-    }
-
-    /**
-	 * Register the Message Exchange as a profile within Smooks.
-	 * @param message The message.
-	 * @return The Smooks "profile" string that uniquely identifies the message flow associated
-	 * with the message.
-	 * @throws ActionProcessingException Failed to register the message flow for the message.
-	 */
-	private String registerMessageProfile(Message message) throws ActionProcessingException {
-		String messageProfile;
-    	String messageFromType;
-        String messageFrom;
-        String messageToType;
-        String messageTo;
-
-        // Get the routing info from the message...
-        messageFrom = (String)message.getProperties().getProperty(FROM, defaultMessageFrom);
-        messageTo = (String)message.getProperties().getProperty(TO, defaultMessageTo);
-        
-        // Get the message typing info from the message...
-		messageFromType = (String)message.getProperties().getProperty(FROM_TYPE, defaultMessageFromType);
-		messageToType = (String)message.getProperties().getProperty(TO_TYPE, defaultMessageToType);
-		
-		// Construct the message useragent string for use with Smooks.  This is basically the 
-		// name of the Message Exchange on which transformations are to be performed...
-        messageProfile = getMessageProfileString(messageFromType, messageFrom, messageToType, messageTo);
-        
-        // Register this message flow if it isn't already registered...
-        try {
-        	ProfileStore profileStore = smooks.getApplicationContext().getProfileStore();
-        	profileStore.getProfileSet(messageProfile);
-        } catch(UnknownProfileMemberException e) {
-        	String[] profiles = getMessageProfiles(messageFromType, messageFrom, messageToType, messageTo);
-        	
-            synchronized (SmooksTransformer.class) {
-		        // Register the message flow within the Smooks context....
-	        	logger.info("Registering JBoss ESB Message-Exchange as Smooks Profile: [" + messageProfile + "].  Profiles: [" + Arrays.asList(profiles) + "]");
-	        	SmooksUtil.registerProfileSet(DefaultProfileSet.create( messageProfile, profiles ), smooks);
-            }
-        }
-        
-		return messageProfile;
-	}
-
-    /**
-     * Get the profile list based on the supplied message flow properties.
-	 * @param messageFromType The type string for the message source.
-	 * @param messageFrom The Message Exchange Participant name for the message source.
-	 * @param messageToType The type string for the message target.
-	 * @param messageTo The Message Exchange Participant name for the message target.
-	 * @return The list of profiles.
-	 */
-	protected static String[] getMessageProfiles(String messageFromType, String messageFrom, String messageToType, String messageTo) {
-		List<String> profiles = new ArrayList<String>();
-		String[] profileArray;
-		
-		if(messageFromType != null) {
-			profiles.add(FROM_TYPE + ":" + messageFromType);
-		}
-		if(messageFrom != null) {
-			profiles.add(FROM + ":" + messageFrom);
-		}
-		if(messageToType != null) {
-			profiles.add(TO_TYPE + ":" + messageToType);
-		}
-		if(messageTo != null) {
-			profiles.add(TO + ":" + messageTo);
-		}
-		
-		profileArray = new String[profiles.size()];
-		profiles.toArray(profileArray);
-
-		return profileArray;
-	}
-
-	/**
-	 * Construct the Smooks profile string based on the supplied message flow properties.
-	 * @param messageFromType The type string for the message source.
-	 * @param messageFrom The EPR string for the message source.
-	 * @param messageToType The type string for the message target.
-	 * @param messageTo The EPR srting for the message target.
-	 * @return Smooks profile string for the message flow.
-	 */
-	protected static String getMessageProfileString(String messageFromType, String messageFrom, String messageToType, String messageTo) {
-		StringBuffer string = new StringBuffer();
-		
-		if(messageFromType != null) {
-			string.append(FROM_TYPE + ":" + messageFromType);
-			string.append((messageFrom!=null || messageToType!=null || messageTo!=null?":":""));
-		}
-		if(messageFrom != null) {
-			string.append(FROM + ":" + messageFrom);
-			string.append((messageToType!=null || messageTo!=null?":":""));
-		}
-		if(messageToType != null) {
-			string.append(TO_TYPE + ":" + messageToType);
-			string.append((messageTo!=null?":":""));
-		}
-		if(messageTo != null) {
-			string.append(TO + ":" + messageTo);
-		}
-		
-		return string.toString();
-	}
-
-    public void processException(final Message message, final Throwable th) {
-    }
-
-    public void processSuccess(final Message message) {
-    }
-
-    /**
-     * Initialise the SmooksStandalone instance.
-     * <p/>
-     * We may need to write a Smooks Container implementation specifically for JBossESB's needs.  SmooksStandalone is
-     * fine for a start though.
-     * @throws ActionLifecycleException Failed to load Smooks configurations.
-     */
-    public void initialise() throws ActionLifecycleException {
-        String smooksCdrlFile;
-        InputStream configListStream;
-
-        // Get the configuration list file - can be overridden through a system property...
-        smooksCdrlFile = ModulePropertyManager.getPropertyManager(CONFIGURATION_SECTION).getProperty("configuration.list.file.uri", "classpath:/smooks-cdr.lst");
-        try {
-            configListStream = (new URIResourceLocator()).getResource(smooksCdrlFile);
-        } catch (IOException e) {
-            throw new ActionLifecycleException("Failed to locate Tranformation configuration list file [" + smooksCdrlFile + "].  This resource must be made available at the specified URI.", e);
-        }
-        if(configListStream == null) {
-            throw new ActionLifecycleException("Failed to locate Tranformation configuration list file [" + smooksCdrlFile + "].  This resource must be made available at the specified URI.");
-        }
-
-        // Initialise the local SmooksStandalone instance.  This "local" reference is
-        // used because we are using on the "global" smooks variable reference to controll
-        // access to this synchronisation block ...
-//        smooks = new SmooksStandalone("UTF-8");
-        smooks = new Smooks();
-
-        try {
-            BufferedReader configReader = new BufferedReader(new InputStreamReader(configListStream));
-            StandaloneExecutionContext context = smooks.createExecutionContext();
-            context.getContext().getStore().load(configReader );
-        } catch (Exception e) {
-        	e.printStackTrace();
-            smooks = null;
-            throw new ActionLifecycleException("Smooks configuration load failed.", e);
-        } finally {
-            try {
-                configListStream.close();
-            } catch (IOException e) {
-                logger.error("Error while closing transformation list config stream [" + smooksCdrlFile + "].", e);
-            }
-        }
-
-        logger.info("All Smooks configurations are now loaded.");
-    }
-
-    public void destroy() throws ActionLifecycleException {
-        updateListener.close();
-    }
-    
-    /**
-     * Reset the transformer.
-     * <p/>
-     * Clears the internal static smooks instance.
-     */
-    public void reset() {
-    	Smooks instance = smooks;
-    	
-        synchronized (SmooksTransformer.class) {
-        	if(smooks == instance) {
-        		smooks = null;
-        	}
-        }
-    }
-
-    /**
-     * JMS Listener for receiving configuration update notifications.
-     * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
-     */
-    private static class ConfigurationUpdateListener implements MessageListener {
-    	
-    	private TopicConnection conn = null;
-    	private TopicSession session = null;
-    	private Topic topic = null;
-        private SmooksTransformer transformer;
-
-        public ConfigurationUpdateListener(SmooksTransformer transformer) {
-            this.transformer = transformer;
-        }
-
-        /**
-    	 * Private constructor.
-    	 * <p/>
-    	 * Connects the listener to the topic.
-    	 */
-    	private ConfigurationUpdateListener() {
-    		try {
-    			connect();
-    		} catch(Throwable t) {
-				logger.error("Unexpected error while attempting to connect Transformation configuration Update Listener.  Update listener not enabled!", t);
-				close();
-				return;
-    		}
-    	}
-
-		/**
-    	 * Receive a notification message.
-    	 */
-		public void onMessage(javax.jms.Message message) {
-			// Reset the transformer instance so as to force a config reload.
-			logger.info("Transformation configuration update notification received.  Resetting SmooksTransformer in order to force a configuration re-read.");
-			transformer.reset();
-		}    	
-
-		/**
-		 * Connect to the configured topic.
-		 */
-    	private boolean connect() {
-    		TopicConnectionFactory connectionFactory = null;
-
-			logger.info("Attempting to connect Transformation configuration Update Listener to update notification topic.");
-    		
-    		// Get the Topic ConnectionFactory...
-    		try {
-				connectionFactory = (TopicConnectionFactory) Configuration.getJmsConnectionFactory(CONFIGURATION_SECTION);
-			} catch (ConfigurationException e) {
-				logger.error("Lookup of the JMS ConnectionFactory failed for the Transformation configuration Update Listener. Update listener not enabled!", e);
-				return false;
-			} catch (ClassCastException e) {
-				logger.error("Invalid JMS ConnectionFactory config for the Transformation configuration Update Listener.  ConnectionFactory doesn't implement " + TopicConnectionFactory.class.getName() + ". Update listener not enabled!", e);
-				return false;
-			}
-			
-			// Create the topic connection...
-			try {
-				conn = connectionFactory.createTopicConnection();
-			} catch (JMSException e) {
-				logger.error("Failed to open JMS TopicConnection for the Transformation configuration Update Listener. Update listener not enabled!", e);
-				return false;
-			}
-			
-			// Lookup the topic...
-    		String notificationTopic = ModulePropertyManager.getPropertyManager(CONFIGURATION_SECTION).getProperty("update.notification.topic", "topic/org.jboss.soa.esb.transformation.Update");
-			try {
-				Context context = Configuration.getNamingContext(CONFIGURATION_SECTION);
-				topic = (Topic) context.lookup(notificationTopic);
-                context.close();
-			} catch (ConfigurationException e) {
-				logger.error("Topic lookup failed for the Transformation configuration Update Listener.  Topic name '" + notificationTopic + "'.  \n\t\tThis JMS Topic may not be deployed, or this ESB instance may not be looking at the correct JMS provider (check configuration '" + Context.PROVIDER_URL + "' in config module/section '" + CONFIGURATION_SECTION + "').  \n\t\tUpdate listener not enabled!", e);
-				close();
-				return false;
-			} catch (NamingException e) {
-				logger.warn("Topic lookup failed for the Transformation configuration Update Listener.  Topic name '" + notificationTopic + "'.  \n\tThis JMS Topic may not be deployed, or this ESB instance may not be looking at the correct JMS provider (check configuration '" + Context.PROVIDER_URL + "' in config module/section '" + CONFIGURATION_SECTION + "').  \n\tUpdate listener not enabled!");
-				close();
-				return false;
-			}
-			
-			// Create the TopicSession...
-			try {
-				session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
-			} catch (JMSException e) {
-				logger.error("TopicSession creation failed for the Transformation configuration Update Listener.  Update listener not enabled!", e);
-				close();
-				return false;
-			}
-			
-			// Start the connection...
-			try {
-				conn.start();
-			} catch (JMSException e) {
-				logger.error("Failed to start JMS TopicConnection for the Transformation configuration Update Listener.  Update listener not enabled!", e);
-				close();
-				return false;
-			}
-			
-			// Bind "this" listener to the topic...
-			try {
-				TopicSubscriber topicSubscriber = session.createSubscriber(topic);
-				topicSubscriber.setMessageListener(this);
-			} catch (JMSException e) {
-				logger.error("Failed to start JMS TopicConnection for the Transformation configuration Update Listener.  Update listener not enabled!", e);
-				close();
-				return false;
-			}
-
-			// Listen for exceptions on the connection...
-			try {
-				conn.setExceptionListener(new ExceptionListener());
-			} catch (JMSException e) {
-				logger.error("Failed to attach an ExceptionListener for the Transformation configuration Update Listener.  Update listener not enabled!", e);
-				close();
-				return false;
-			}
-
-			logger.info("Transformation Configuration Update Listener started!");
-
-			return true;
-    	}
-    	
-    	@Override
-		protected void finalize() throws Throwable {
-    		close();
-			super.finalize();
-		}
-
-		/**
-    	 * Close out the listener and all it's resources.
-    	 */
-		private void close() {
-			try {
-				if(conn != null) {
-					conn.stop();
-					logger.info("Update Listener JMS TopicConnection stopped.");
-				}
-			} catch (Throwable e) {
-				logger.error("Failed to stop Update Listener JMS connection.", e);
-				conn = null;
-			}
-			try {
-				if(session != null) {
-					session.close();
-					logger.info("Update Listener JMS TopicSession closed.");
-				}
-			} catch (Throwable e) {
-				logger.error("Failed to close Update Listener JMS session.", e);
-			} finally {
-				session = null;
-			}
-			try {
-				if(conn != null) {
-					conn.close();
-					logger.info("Update Listener JMS TopicConnection closed.");
-				}
-			} catch (Throwable e) {
-				logger.error("Failed to close Update Listener JMS connection.", e);
-			} finally {
-				conn = null;
-			}
-			topic = null;
-		}
-
-		/**
-		 * Exception Listener.
-		 * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
-		 */
-		private class ExceptionListener implements javax.jms.ExceptionListener {
-
-			/**
-			 * We want this listener to handle only one exception.
-			 * It will close all existing resources and create a new instance
-			 * once it successfully reconnects.
-			 */
-			private boolean hasHandledOneException = false;
-			
-			/* (non-Javadoc)
-			 * @see javax.jms.ExceptionListener#onException(javax.jms.JMSException)
-			 */
-			public void onException(JMSException e) {
-				synchronized (ExceptionListener.class) {
-					if(!hasHandledOneException) {
-						logger.error("JMS Exception on Transformation Configuration Update Listener.", e);
-						close();
-						while(!connect()) {
-							try {
-								Thread.sleep(5000);
-							} catch (InterruptedException e1) {
-								logger.error("Interrupted during reconnect attempt.  Aborting reconnect!  Will need restart to reconnect.", e);
-							}
-						}
-						hasHandledOneException = true;
-					}
-				}
-			}
-		}
-    }
-}

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java	2007-05-31 14:18:41 UTC (rev 12261)
@@ -36,7 +36,6 @@
 import org.jboss.soa.esb.listeners.config.ActionDocument.Action;
 import org.jboss.soa.esb.listeners.config.PropertyDocument.Property;
 import org.jboss.ws.server.ServiceEndpoint;
-import org.milyn.xml.XmlUtil;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
@@ -107,8 +106,8 @@
 
         // Now, fudge it to fix up the binding transport and endpoint addressing info...
         Document wsdlDoc = YADOMUtil.parseStream(new ByteArrayInputStream(wsdl.getBytes("UTF-8")), false, false);
-        Attr transport = (Attr) XmlUtil.getNode(wsdlDoc, "/definitions/binding/binding/@transport");
-        Attr address = (Attr) XmlUtil.getNode(wsdlDoc, "/definitions/service/port/address/@location");
+        Attr transport = (Attr) YADOMUtil.getNode(wsdlDoc, "/definitions/binding/binding/@transport");
+        Attr address = (Attr) YADOMUtil.getNode(wsdlDoc, "/definitions/service/port/address/@location");
 
         // TODO: Doubt this is the correct thing to do!!
         transport.setNodeValue("http://schemas.xmlsoap.org/soap/" + endpointURI.getScheme());

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java	2007-05-31 14:18:41 UTC (rev 12261)
@@ -29,7 +29,6 @@
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
 import org.jboss.soa.esb.listeners.config.PropertyDocument.Property;
 import org.jboss.soa.esb.listeners.config.ServiceDocument.Service;
-import org.milyn.xml.DomUtils;
 import org.w3c.dom.Element;
 
 /**
@@ -79,7 +78,7 @@
 			// If the property has child content, add that directy to the action.  Of course it only really
 			// makes sense to do this with one property!
 			if(propertyElement.hasChildNodes()) {
-				DomUtils.copyChildNodes(propertyElement, actionConfigTree);
+				YADOMUtil.copyChildNodes(propertyElement, actionConfigTree);
 			} else {
 				actionConfigTree.setAttribute(property.getName(), property.getValue());
 			}

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java	2007-05-31 14:18:41 UTC (rev 12261)
@@ -27,6 +27,7 @@
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor.TokenType;
 import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
 import org.jboss.soa.esb.listeners.config.Bus;
 import org.jboss.soa.esb.listeners.config.Listener;
@@ -37,7 +38,6 @@
 import org.jboss.soa.esb.listeners.message.MessageAwareListener;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.milyn.xml.DomUtils;
 
 /**
  * Mapper utility methods.
@@ -98,7 +98,7 @@
          serialize(property, propertyElement);
          if (propertyElement.hasChildNodes())
          {
-            DomUtils.copyChildNodes(propertyElement, target);
+            YADOMUtil.copyChildNodes(propertyElement, target);
          }
          else
          {

Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java	2007-05-31 14:18:41 UTC (rev 12261)
@@ -1,122 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions.converters;
-
-import java.net.URISyntaxException;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.ActionLifecycleException;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-
-/**
- * SmooksTransformer unit tests.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
-public class SmooksTransformerUnitTest extends TestCase {
-
-    public void test_bad_config() {
-    	ConfigTree properties = new ConfigTree("name");
-
-        // Should get exceptions where message type configs are specified but empty...
-        properties.setAttribute(SmooksTransformer.FROM_TYPE, " ");
-        assertConfigException(properties, "Empty '" + SmooksTransformer.FROM_TYPE + "' config attribute supplied.");
-        properties.setAttribute(SmooksTransformer.FROM_TYPE, "x");
-        properties.setAttribute(SmooksTransformer.TO_TYPE, " ");
-        assertConfigException(properties, "Empty '" + SmooksTransformer.TO_TYPE + "' config attribute supplied.");
-    }
-
-    public void test_trans() throws ActionProcessingException, ConfigurationException, URISyntaxException, ActionLifecycleException {
-        String stringMessage;
-        String transRes;
-        
-        // Very basic test!  Just illustrates profile based resource selection.
-        // Read the smooks-test.cdrl config file in this package!! 
-
-        // Initialise the acme order message...
-        stringMessage = "<a><ddd>value</ddd></a>";
-        
-        // Transform the order message going to "AcmePartner1"...
-        transRes = transform(stringMessage, "Acme-Order-XML", "Acme", "AcmePartner1", "Partner1-Order-XML");
-        assertEquals("<x><b>value</b></x>", transRes);
-        
-        // Transform the order message going to "AcmePartner2"...
-        transRes = transform(stringMessage, "Acme-Order-XML", "Acme", "AcmePartner2", "Partner2-Order-XML");
-        assertEquals("<x><c>value</c></x>", transRes);
-    }
-    
-    private String transform(String stringMessage, String fromType, String from, String to, String toType) throws ActionProcessingException, ConfigurationException, URISyntaxException, ActionLifecycleException {
-        ConfigTree properties = new ConfigTree("name");
-
-        // Set the message properties in order to trigger the appropriate transformations
-        // on the message...
-        properties.setAttribute(SmooksTransformer.FROM, from);
-        properties.setAttribute(SmooksTransformer.FROM_TYPE, fromType);
-        properties.setAttribute(SmooksTransformer.TO, to);
-        properties.setAttribute(SmooksTransformer.TO_TYPE, toType);
-
-    	// The smooks-cdr.lst and device-profile.xml files are located in the root of the 
-        // test src folder.  You need to look at these to see how this works...
-        SmooksTransformer transformer = new SmooksTransformer(properties);
-        Message message;
-
-        transformer.initialise();
-
-        // Perform the transformation by setting the payload on the task object.
-        message = createNewMessage(fromType, from, to, toType);
-        ActionUtils.setTaskObject(message, stringMessage);
-        message = transformer.process(message);
-        String resultThroughTaskObj = (String) ActionUtils.getTaskObject(message);
-        assertEquals(resultThroughTaskObj, new String(message.getBody().getByteArray()));
-        
-        // Perform the transformation by setting the payload on the body "contents".
-        message = createNewMessage(fromType, from, to, toType);
-        message.getBody().setByteArray(stringMessage.getBytes());
-        message = transformer.process(message);
-        assertEquals(resultThroughTaskObj, new String(message.getBody().getByteArray()));
-        
-        return resultThroughTaskObj;
-    }
-
-	private Message createNewMessage(String fromType, String from, String to, String toType) {
-		Message message;
-		message = MessageFactory.getInstance().getMessage();
-        
-		return message;
-	}
-
-    private void assertConfigException(ConfigTree properties, String expectedException) {
-        try {
-            new SmooksTransformer("trans", properties);
-            fail("Expected ConfigurationException: [" + expectedException + "...]");
-        } catch(ConfigurationException e) {
-            assertTrue("Expected exception message to start with [" + expectedException + "]. Was [" + e.getMessage() + "]", e.getMessage().startsWith(expectedException));
-        }
-    }
-}

Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/smooks-test.cdrl
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/smooks-test.cdrl	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/smooks-test.cdrl	2007-05-31 14:18:41 UTC (rev 12261)
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
-
-	<!-- 
-		"Acme-Order-XML" messages going from "Acme" to "AcmePartner1" 
-	-->
-	<resource-config target-profile="from-type:Acme-Order-XML AND from:Acme AND to-type:Partner1-Order-XML AND to:AcmePartner1" selector="ddd">
-		<resource>org.milyn.cdres.trans.RenameElementTU</resource>
-		<param name="replacementElement">b</param>
-	</resource-config>
-
-	<!-- 
-		"Acme-Order-XML" messages going from "Acme" to "AcmePartner2" 
-	-->
-	<resource-config target-profile="from-type:Acme-Order-XML AND from:Acme AND to-type:Partner2-Order-XML AND to:AcmePartner2" selector="ddd">
-		<resource>org.milyn.cdres.trans.RenameElementTU</resource>
-		<param name="replacementElement">c</param>
-	</resource-config>
-
-	<!-- 
-		"Acme-Order-XML" messages going from "Acme" to anywhere
-	-->
-	<resource-config target-profile="from-type:Acme-Order-XML AND from:Acme" selector="a" >
-		<resource>org.milyn.cdres.trans.RenameElementTU</resource>
-		<param name="replacementElement">x</param>
-	</resource-config>
-
-</smooks-resource-list>
-

Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/smooks-cdr.lst
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/smooks-cdr.lst	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/smooks-cdr.lst	2007-05-31 14:18:41 UTC (rev 12261)
@@ -1 +1 @@
-classpath:/org/jboss/soa/esb/actions/converters/smooks-test.cdrl
+classpath:/smooks-test.cdrl

Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/dom/YADOMUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/dom/YADOMUtil.java	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/dom/YADOMUtil.java	2007-05-31 14:18:41 UTC (rev 12261)
@@ -412,4 +412,20 @@
             return element.getTagName();
         }
     }
+    /**
+     * Copy child node references from source to target.
+     * @param source Source Node.
+     * @param target Target Node.
+     */
+    public static void copyChildNodes(Node source, Node target) {
+        AssertArgument.isNotNull(source, "source");
+        AssertArgument.isNotNull(target, "target");
+        
+        List nodeList = copyNodeList(source.getChildNodes());
+        int childCount = nodeList.size();
+        
+        for(int i = 0; i < childCount; i++) {
+            target.appendChild((Node)nodeList.get(i));
+        }
+    }
 }

Deleted: labs/jbossesb/trunk/product/install/conf/smooks-cdr.lst
===================================================================
--- labs/jbossesb/trunk/product/install/conf/smooks-cdr.lst	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/install/conf/smooks-cdr.lst	2007-05-31 14:18:41 UTC (rev 12261)
@@ -1,9 +0,0 @@
-########################################################################################################
-# ESB Administration Console.
-#
-# You must "import" smooks-res.xml into the console in order to view and manipulate the
-# transformations in this sample.  You will also need to register the "Message Exchange Participants"
-# "A" and "B" as well as their supported message contracts "text/xml:messageAtA" and 
-# "text/xml:messageAtB" respectively.
-########################################################################################################
-http://localhost:8080/jboss-esb-console/transform/smooks-config.jsp

Deleted: labs/jbossesb/trunk/product/lib/ext/commons-logging.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/milyn-commons-0.9-SNAPSHOT.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/milyn-edisax-0.2-SNAPSHOT.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/milyn-smooks-core-0.9-SNAPSHOT.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/milyn-smooks-csv-0.1.1.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/milyn-smooks-edi-0.2-SNAPSHOT.jar
===================================================================
(Binary files differ)

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

Deleted: labs/jbossesb/trunk/product/lib/ext/milyn-smooks-misc-0.2.1.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/milyn-smooks-scripting-0.1.jar
===================================================================
(Binary files differ)

Deleted: labs/jbossesb/trunk/product/lib/ext/milyn-smooks-templating-0.2.1.jar
===================================================================
(Binary files differ)

Added: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/deployment.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/deployment.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbossesb-deployment>
+  <depends>jboss.esb:deployment=smooks.esb</depends>
+</jbossesb-deployment>


Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/deployment.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/samples/quickstarts/transform_EDI2XML_Groovy_XSLT/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_EDI2XML_Groovy_XSLT/deployment.xml	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_EDI2XML_Groovy_XSLT/deployment.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -5,4 +5,5 @@
             java2ParentDelegaton=false
         </loader-repository-config>
     </loader-repository>
+  	<depends>jboss.esb:deployment=smooks.esb</depends>
 </jbossesb-deployment>
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/deployment.xml	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/deployment.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -5,4 +5,5 @@
             java2ParentDelegaton=false
         </loader-repository-config>
     </loader-repository>
+    <depends>jboss.esb:deployment=smooks.esb</depends>
 </jbossesb-deployment>
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_date_manipulation/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_date_manipulation/deployment.xml	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_date_manipulation/deployment.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -5,4 +5,5 @@
             java2ParentDelegaton=false
         </loader-repository-config>
     </loader-repository>
+    <depends>jboss.esb:deployment=smooks.esb</depends>
 </jbossesb-deployment>
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_simple/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_simple/deployment.xml	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_simple/deployment.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -5,4 +5,5 @@
             java2ParentDelegaton=false
         </loader-repository-config>
     </loader-repository>
+    <depends>jboss.esb:deployment=smooks.esb</depends>
 </jbossesb-deployment>
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_bpel/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_bpel/deployment.xml	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_bpel/deployment.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -6,4 +6,5 @@
     <!-- SOAPUI required for making SOAP invocations. In a sar so as to scope some of the soapui dependencies
          that clash with some AS dependencies. -->
     <depends>jboss.esb:service=SoapUIClientService</depends>
+    <depends>jboss.esb:deployment=smooks.esb</depends>
 </jbossesb-deployment>

Modified: labs/jbossesb/trunk/product/services/build.xml
===================================================================
--- labs/jbossesb/trunk/product/services/build.xml	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/services/build.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -6,6 +6,7 @@
         <ant dir="jbossesb" target="dist"/>
 		<ant dir="jbpm" target="dist"/>
 		<ant dir="jbrules" target="dist"/>
+		<ant dir="smooks" target="dist"/>
         <ant dir="soapui-client" target="sar"/>
     </target>
 
@@ -13,6 +14,7 @@
         <ant dir="jbossesb" target="clean"/>
 		<ant dir="jbpm" target="clean"/>
 		<ant dir="jbrules" target="clean"/>
+		<ant dir="smooks" target="clean"/>
         <ant dir="soapui-client" target="clean"/>
     </target>
 
@@ -20,6 +22,8 @@
 		<ant dir="jbossesb" target="test"/>
 		<ant dir="jbpm" target="test"/>
 		<ant dir="jbrules" target="test"/>
+		<ant dir="smooks" target="test"/>
+		<ant dir="soapui-client" target="test"/>
     </target>
     
     <target name="copy-buildfiles">
@@ -29,6 +33,10 @@
         <copy todir="jbpm" file="build.properties"/>
         <copy todir="jbrules" file="base-project-build.xml"/>
         <copy todir="jbrules" file="build.properties"/>
+        <copy todir="smooks" file="base-project-build.xml"/>
+        <copy todir="smooks" file="build.properties"/>
+        <copy todir="soapui-client" file="base-project-build.xml"/>
+        <copy todir="soapui-client" file="build.properties"/>
     </target>
 	
 </project>


Property changes on: labs/jbossesb/trunk/product/services/smooks
___________________________________________________________________
Name: svn:ignore
   + build


Added: labs/jbossesb/trunk/product/services/smooks/base-project-build.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/base-project-build.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/base-project-build.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1,96 @@
+<project name="ESB-services-base-build" basedir=".">
+    <!-- 
+    		WARNING: Your edits maybe overwritten!
+    		
+    Only edit this file in the product/services directory. This
+    file is copied down into each services project directory to be
+    able to work on each subproject in a selfcontained manner.
+    
+    If you edit this file, please run the 'copy-buildfiles' target
+    from services to copy the new version down to the project directories.
+    
+     -->
+	<dirname property="services.dir" file="${ant.file.base-build}"/>
+	<property file="${services.dir}/build.properties"/>
+    
+	<target name="clean">
+		<delete dir="build" />
+	</target>
+	
+	<target name="prepare" depends="clean">
+		<mkdir dir="build/${ant.project.name}.esb/META-INF" />
+		<mkdir dir="build/classes" />
+	</target>
+	
+	<path id="classpath">
+		<pathelement location="build/${ant.project.name}.esb" />
+		<pathelement location="build/classes" />
+		<pathelement location="build/test/classes" />
+		<fileset dir="lib/ext" includes="*.jar" />
+		<fileset dir="lib/ext/build-time" includes="*.jar" />
+		<fileset dir="${esb.product.lib.dir}" includes="*.jar" /> <!-- Product Jars. -->
+		<pathelement location="src/test/resources"/>
+	</path>
+	
+	<target name="echoCP">
+		<property name="cp" refid="classpath" />
+		<echo message="Classpath is ${cp}" />
+	</target>
+
+    <target name="check.for.files">
+	    <fileset id="fs" dir="build/classes"/>
+	    <condition property="dir_empty">
+	        <length length="0">
+	    		<fileset refid="fs"/>
+	  		</length>
+	  </condition>
+    </target>
+    
+	<target name="compile" depends="prepare">
+		<javac srcdir="src/main/java" destdir="build/classes" debug="on" >
+			<classpath refid="classpath" />
+		</javac>
+	</target>
+	
+	<target name="jar" depends="compile,check.for.files" unless="dir_empty">
+		<jar basedir="build/classes" destfile="build/jbossesb-${ant.project.name}.jar" includes="**/*.class"/>
+	</target>
+
+    <target name="esb" depends="jar">
+        <copy todir="build/${ant.project.name}.esb/" >
+        	<fileset dir="lib/ext" includes="*.jar"/>
+        	<fileset dir="src/main/resources/" includes="**/*"/>
+        	<fileset dir="build" includes="*.jar"/>
+         </copy>
+    </target>
+	
+	<target name="dist" depends="esb">
+		<!-- copying to jbossesb/lib -->
+    	<mkdir dir="${esb.product.lib.dir}/${ant.project.name}.esb"/>
+    	<copy todir="${esb.product.lib.dir}/${ant.project.name}.esb">
+    		<fileset dir="build/${ant.project.name}.esb"  includes="**/*" />
+    	</copy>
+	</target>
+    
+    <target name="base.test" depends="esb">
+    	<mkdir dir="build/test/classes"/>
+    	<mkdir dir="build/test/report"/>
+    	<javac srcdir="src/test/java" destdir="build/test/classes" debug="on" >
+			<classpath refid="classpath" />
+		</javac>
+    	<copy todir="build/test/classes" >
+    		<fileset dir="src/test/java" includes="**/*.xml" />
+    	</copy>
+		<junit fork="yes" haltonfailure="true" haltonerror="true" showoutput="off">
+			<formatter type="plain" usefile="false" />
+			<classpath refid="classpath" />
+			<sysproperty key="log4j.configuration" value="log4j.xml" />
+			<test name="${testcase}" if="testcase" />
+			<batchtest unless="testcase" todir="build/test/report">
+				<fileset dir="build/test/classes" includes="**/*Test.class" />
+			</batchtest>
+		</junit>
+    </target>
+	
+
+</project>
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/services/smooks/base-project-build.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/services/smooks/build.properties
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/build.properties	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/build.properties	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1 @@
+esb.product.lib.dir=../../../product/build/jbossesb/lib
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/services/smooks/build.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/services/smooks/build.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/build.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/build.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1,8 @@
+<project name="smooks" default="test" basedir=".">
+	
+	<!-- Import the base Ant build script... -->
+	<import file="base-project-build.xml"/>
+	
+	<target name="test" depends="base.test"/>
+
+</project>


Property changes on: labs/jbossesb/trunk/product/services/smooks/build.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/commons-logging-1.0.4.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/commons-logging-1.0.4.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/jbossall-client.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/jbossall-client.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/jbossts-common.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/jbossts-common.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/junit-4.1.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/junit-4.1.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/log4j.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/services/smooks/lib/ext/build-time/log4j.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Copied: labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-commons-0.9-SNAPSHOT.jar (from rev 12237, labs/jbossesb/trunk/product/lib/ext/milyn-commons-0.9-SNAPSHOT.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-edisax-0.2-SNAPSHOT.jar (from rev 12237, labs/jbossesb/trunk/product/lib/ext/milyn-edisax-0.2-SNAPSHOT.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-core-0.9-SNAPSHOT.jar (from rev 12237, labs/jbossesb/trunk/product/lib/ext/milyn-smooks-core-0.9-SNAPSHOT.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-csv-0.1.1.jar (from rev 12237, labs/jbossesb/trunk/product/lib/ext/milyn-smooks-csv-0.1.1.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-edi-0.2-SNAPSHOT.jar (from rev 12237, labs/jbossesb/trunk/product/lib/ext/milyn-smooks-edi-0.2-SNAPSHOT.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-javabean-0.3-SNAPSHOT.jar (from rev 12237, labs/jbossesb/trunk/product/lib/ext/milyn-smooks-javabean-0.3-SNAPSHOT.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-misc-0.2.1.jar (from rev 12237, labs/jbossesb/trunk/product/lib/ext/milyn-smooks-misc-0.2.1.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-scripting-0.1.jar (from rev 12237, labs/jbossesb/trunk/product/lib/ext/milyn-smooks-scripting-0.1.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossesb/trunk/product/services/smooks/lib/ext/milyn-smooks-templating-0.2.1.jar (from rev 12237, labs/jbossesb/trunk/product/lib/ext/milyn-smooks-templating-0.2.1.jar)
===================================================================
(Binary files differ)

Added: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1,619 @@
+package org.jboss.soa.esb.actions.converters;
+
+
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.jms.JMSException;
+import javax.jms.MessageListener;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.ActionLifecycleException;
+import org.jboss.soa.esb.actions.ActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.ActionUtils;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.transform.TransformationException;
+import org.jboss.soa.esb.services.transform.TransformationService;
+import org.milyn.Smooks;
+import org.milyn.SmooksUtil;
+import org.milyn.container.standalone.StandaloneExecutionContext;
+import org.milyn.javabean.BeanAccessor;
+import org.milyn.profile.DefaultProfileSet;
+import org.milyn.profile.ProfileStore;
+import org.milyn.profile.UnknownProfileMemberException;
+import org.milyn.resource.URIResourceLocator;
+
+/**
+ * Smooks Transformer.
+ * <p/>
+ * This processor hooks the <a href="http://milyn.codehaus.org/Smooks">Milyn Smooks</a>
+ * XML Transformation/Processing Engine into a message processing pipeline to support
+ * non binary message transformations.
+ * 
+ * <h3>Action Configuration</h3>
+ * This action is configured as follows:
+ * <pre>
+ * &lt;action name="transformAB" class="<b>org.jboss.soa.esb.actions.converters.SmooksTransformer</b>"&gt;
+ * 	&lt;property name="<b>from</b>" value="A" /&gt;
+ * 	&lt;property name="<b>from-type</b>" value="text/xml:messageAtA" /&gt;
+ * 	&lt;property name="<b>to</b>" value="B" /&gt;
+ * 	&lt;property name="<b>to-type</b>" value="text/xml:messageAtB" /&gt;
+ * &lt;/action&gt;
+ * </pre>
+ * 
+ * <h3>Configuartion Loading &amp; Administration Console Integration</h3>
+ * This class picks up its list of transformation resource configurations from a list file
+ * specified in the "configuration.list.file.uri" parameter of the "transformation" 
+ * section of the ESB configuration file.  This configuration
+ * should specify a URI to this list file and is loaded using the {@link URIResourceLocator}.
+ * The default list file is "classpath:/smooks-cdr.lst" (note classpath based URIs are supported).
+ * <p/>  
+ * This file contains a list of URIs that reference
+ * <a href="http://milyn.codehaus.org/Smooks">Smooks</a> resource configurations files.
+ * Again, {@link URIResourceLocator} is used to load these configurations.  "classpath:/"
+ * is the default if no scheme is specified.  This is also where the Administration Console
+ * is integrated with this class.  The list file needs to specify the following a HTTP based 
+ * URI for accessing the configurations under management by the Administration console:
+ * <pre>
+ * 	http://localhost:8080/jboss-esb-console/transform/smooks-config.jsp
+ * </pre>
+ * ... where the host and port values need to be modified appropriately.
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+
+public class SmooksTransformer implements TransformationService, ActionPipelineProcessor {
+
+	/**
+	 * Configuration section key.
+	 */
+	public static final String CONFIGURATION_SECTION = "transformation";
+	/**
+	 * Key for storing/accessing any potential message Body bean HashMaps as populated
+	 * by the Smooks Javabean Cartridge.
+	 */
+	public static final String EXTRACTED_BEANS_HASH = "EXTRACTED_BEANS_HASH";
+	/**
+	 * Config property key for setting a true/false flag to indicate whether or not
+	 * a bean hashs should be set as the message payload before exiting the process method.
+	 */
+	public static final String SET_BEANHASH_TO_PAYLOAD = "set-beanhash-to-payload";
+		
+	public static final String FROM = "from";
+	public static final String FROM_TYPE = "from-type";
+	public static final String TO = "to";
+	public static final String TO_TYPE = "to-type";
+    public static final String SMOOKS_CDRL_FILE="smooks-cdrl-file";
+    public static final String UPDATE_TOPIC="update-topic";
+	
+    private static Logger logger = Logger.getLogger(SmooksTransformer.class);
+    private Smooks smooks;
+	private ConfigurationUpdateListener updateListener;
+    private String smooksCdrlFile;
+    private static String notificationTopic;
+    private String defaultMessageFromType;
+    private String defaultMessageFrom;
+    private String defaultMessageToType;
+    private String defaultMessageTo;
+    private boolean setPayloadToBeanHash = false;
+    private List<KeyValuePair> properties;
+
+    /**
+     * Public constructor.
+     * @param name Action name.
+     * @param propertiesTree Action Properties.
+     * @throws ConfigurationException Action not properly configured.
+     */
+	public SmooksTransformer(String name, ConfigTree propertiesTree) throws ConfigurationException {
+		this(propertiesTree);
+	}
+    
+    /**
+     * Public constructor.
+     * @param propertiesTree Action Properties.
+     * @throws ConfigurationException 
+     * @throws ConfigurationException Action not properly configured.
+     */
+	public SmooksTransformer(ConfigTree propertiesTree) throws ConfigurationException {
+		properties = propertiesTree.attributesAsList();
+
+        // Get the smooks config file
+        smooksCdrlFile = KeyValuePair.getValue(SMOOKS_CDRL_FILE, properties, "classpath:/smooks-cdr.lst");
+        
+        // Get the notification topic
+        notificationTopic = KeyValuePair.getValue(UPDATE_TOPIC, properties,"topic/org.jboss.soa.esb.transformation.Update");
+        
+		// Get the message flow properties...
+		defaultMessageFromType = KeyValuePair.getValue(FROM_TYPE, properties);
+		if(defaultMessageFromType != null && defaultMessageFromType.trim().equals("")) {
+			throw new ConfigurationException("Empty '" + FROM_TYPE + "' config attribute supplied.");
+		}
+		defaultMessageToType = KeyValuePair.getValue(TO_TYPE, properties);
+		if(defaultMessageToType != null && defaultMessageToType.trim().equals("")) {
+			throw new ConfigurationException("Empty '" + TO_TYPE + "' config attribute supplied.");
+		}
+		defaultMessageFrom = KeyValuePair.getValue(FROM, properties);
+		if(defaultMessageFrom != null && defaultMessageFrom.trim().equals("")) {
+			throw new ConfigurationException("Empty '" + FROM + "' config attribute supplied.");
+		}
+		defaultMessageTo = KeyValuePair.getValue(TO, properties);
+		if(defaultMessageTo != null && defaultMessageTo.trim().equals("")) {
+			throw new ConfigurationException("Empty '" + TO + "' config attribute supplied.");
+		}
+		
+		// Get the set-beanhash-to-payload property...
+		setPayloadToBeanHash = KeyValuePair.getBooleanValue(SET_BEANHASH_TO_PAYLOAD, properties, false);
+        
+        updateListener = new ConfigurationUpdateListener(this);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.soa.esb.services.transform.TransformationService#transform(org.jboss.soa.esb.message.Message)
+	 */
+	public Message transform(Message message) throws TransformationException {
+		try {
+			return process(message);
+		} catch (ActionProcessingException e) {
+			throw new TransformationException(e);
+		}
+	}
+
+    /* (non-Javadoc)
+     * @see org.jboss.soa.esb.actions.ActionProcessor#process(java.lang.Object)
+     */
+    public Message process(Message message) throws ActionProcessingException {
+    	Object payload = ActionUtils.getTaskObject(message);
+    	
+    	try {
+        	if(payload instanceof byte[]) {
+        		payload = new String((byte[])payload, "UTF-8");
+        	}
+        	
+        	if(payload instanceof String) {
+	            byte[] messageBytes = null;
+	            String transformedMessage;
+	        	String messageProfile;
+	            
+	            // Register the message useragent with Smooks (if not already registered)...
+	        	messageProfile = registerMessageProfile(message);
+	            
+                messageBytes = ((String)payload).getBytes("UTF-8");
+	
+	            long start = System.currentTimeMillis();
+	            StandaloneExecutionContext request;
+	            
+	            // Filter and Serialise...
+	            request = smooks.createExecutionContext( messageProfile );
+	            transformedMessage = SmooksUtil.filterAndSerialize( request, new ByteArrayInputStream( messageBytes), smooks );
+	            
+	            // Javabean cartridge resources may have extract data from the message and populated some beans.
+	            // Get them and stick them on the message - so they can be accessed by downstream actions...
+	            HashMap beanHash = BeanAccessor.getBeans(request);
+	            if(beanHash != null) {
+	            	message.getBody().add(EXTRACTED_BEANS_HASH, beanHash);
+	            }
+	            
+	            if(logger.isDebugEnabled()) {
+	            	long timeTaken = System.currentTimeMillis() - start;
+	            	logger.debug("Transformed message for useragent [" + messageProfile + "]. Time taken: " 
+	            			+ timeTaken + ".  Message in:\n[" + payload.toString()+ "].  \nMessage out:\n[" + transformedMessage + "].");
+	            }
+	            
+	            if(beanHash != null && setPayloadToBeanHash) {
+	            	ActionUtils.setTaskObject(message, beanHash);
+	            } else {
+	            	ActionUtils.setTaskObject(message, transformedMessage);
+	            	message.getBody().setByteArray(transformedMessage.getBytes("UTF-8"));
+	            }
+	        } else {
+	        	String sClass = (null==payload) ? "<null>" : payload.getClass().getName();
+	            logger.warn("String message types only supported.  Input message was [" 
+	            		+ sClass + "].  Returning message untransformed.");
+	        }
+    	} catch(Throwable thrown) {
+    		thrown.printStackTrace();
+    		throw new ActionProcessingException("Message transformation failed.", thrown);
+    	}
+        
+        // TODO: Cater for more message input types e.g. InputStream, DOM Document...
+        // TODO: Cater for more message output types e.g. InputStream, DOM Document...
+    	
+    	return message;
+    }
+
+    /**
+	 * Register the Message Exchange as a profile within Smooks.
+	 * @param message The message.
+	 * @return The Smooks "profile" string that uniquely identifies the message flow associated
+	 * with the message.
+	 * @throws ActionProcessingException Failed to register the message flow for the message.
+	 */
+	private String registerMessageProfile(Message message) throws ActionProcessingException {
+		String messageProfile;
+    	String messageFromType;
+        String messageFrom;
+        String messageToType;
+        String messageTo;
+
+        // Get the routing info from the message...
+        messageFrom = (String)message.getProperties().getProperty(FROM, defaultMessageFrom);
+        messageTo = (String)message.getProperties().getProperty(TO, defaultMessageTo);
+        
+        // Get the message typing info from the message...
+		messageFromType = (String)message.getProperties().getProperty(FROM_TYPE, defaultMessageFromType);
+		messageToType = (String)message.getProperties().getProperty(TO_TYPE, defaultMessageToType);
+		
+		// Construct the message useragent string for use with Smooks.  This is basically the 
+		// name of the Message Exchange on which transformations are to be performed...
+        messageProfile = getMessageProfileString(messageFromType, messageFrom, messageToType, messageTo);
+        
+        // Register this message flow if it isn't already registered...
+        try {
+        	ProfileStore profileStore = smooks.getApplicationContext().getProfileStore();
+        	profileStore.getProfileSet(messageProfile);
+        } catch(UnknownProfileMemberException e) {
+        	String[] profiles = getMessageProfiles(messageFromType, messageFrom, messageToType, messageTo);
+        	
+            synchronized (SmooksTransformer.class) {
+		        // Register the message flow within the Smooks context....
+	        	logger.info("Registering JBoss ESB Message-Exchange as Smooks Profile: [" + messageProfile + "].  Profiles: [" + Arrays.asList(profiles) + "]");
+	        	SmooksUtil.registerProfileSet(DefaultProfileSet.create( messageProfile, profiles ), smooks);
+            }
+        }
+        
+		return messageProfile;
+	}
+
+    /**
+     * Get the profile list based on the supplied message flow properties.
+	 * @param messageFromType The type string for the message source.
+	 * @param messageFrom The Message Exchange Participant name for the message source.
+	 * @param messageToType The type string for the message target.
+	 * @param messageTo The Message Exchange Participant name for the message target.
+	 * @return The list of profiles.
+	 */
+	protected static String[] getMessageProfiles(String messageFromType, String messageFrom, String messageToType, String messageTo) {
+		List<String> profiles = new ArrayList<String>();
+		String[] profileArray;
+		
+		if(messageFromType != null) {
+			profiles.add(FROM_TYPE + ":" + messageFromType);
+		}
+		if(messageFrom != null) {
+			profiles.add(FROM + ":" + messageFrom);
+		}
+		if(messageToType != null) {
+			profiles.add(TO_TYPE + ":" + messageToType);
+		}
+		if(messageTo != null) {
+			profiles.add(TO + ":" + messageTo);
+		}
+		
+		profileArray = new String[profiles.size()];
+		profiles.toArray(profileArray);
+
+		return profileArray;
+	}
+
+	/**
+	 * Construct the Smooks profile string based on the supplied message flow properties.
+	 * @param messageFromType The type string for the message source.
+	 * @param messageFrom The EPR string for the message source.
+	 * @param messageToType The type string for the message target.
+	 * @param messageTo The EPR srting for the message target.
+	 * @return Smooks profile string for the message flow.
+	 */
+	protected static String getMessageProfileString(String messageFromType, String messageFrom, String messageToType, String messageTo) {
+		StringBuffer string = new StringBuffer();
+		
+		if(messageFromType != null) {
+			string.append(FROM_TYPE + ":" + messageFromType);
+			string.append((messageFrom!=null || messageToType!=null || messageTo!=null?":":""));
+		}
+		if(messageFrom != null) {
+			string.append(FROM + ":" + messageFrom);
+			string.append((messageToType!=null || messageTo!=null?":":""));
+		}
+		if(messageToType != null) {
+			string.append(TO_TYPE + ":" + messageToType);
+			string.append((messageTo!=null?":":""));
+		}
+		if(messageTo != null) {
+			string.append(TO + ":" + messageTo);
+		}
+		
+		return string.toString();
+	}
+
+    public void processException(final Message message, final Throwable th) {
+    }
+
+    public void processSuccess(final Message message) {
+    }
+
+    /**
+     * Initialise the SmooksStandalone instance.
+     * <p/>
+     * We may need to write a Smooks Container implementation specifically for JBossESB's needs.  SmooksStandalone is
+     * fine for a start though.
+     * @throws ActionLifecycleException Failed to load Smooks configurations.
+     */
+    public void initialise() throws ActionLifecycleException {
+        
+        InputStream configListStream;
+
+        try {
+            configListStream = (new URIResourceLocator()).getResource(smooksCdrlFile);
+        } catch (IOException e) {
+            throw new ActionLifecycleException("Failed to locate Tranformation configuration list file [" + smooksCdrlFile + "].  This resource must be made available at the specified URI.", e);
+        }
+        if(configListStream == null) {
+            throw new ActionLifecycleException("Failed to locate Tranformation configuration list file [" + smooksCdrlFile + "].  This resource must be made available at the specified URI.");
+        }
+
+        // Initialise the local SmooksStandalone instance.  This "local" reference is
+        // used because we are using on the "global" smooks variable reference to controll
+        // access to this synchronisation block ...
+//        smooks = new SmooksStandalone("UTF-8");
+        smooks = new Smooks();
+
+        try {
+            BufferedReader configReader = new BufferedReader(new InputStreamReader(configListStream));
+            //String line=configReader.readLine();
+            StandaloneExecutionContext context = smooks.createExecutionContext();
+            context.getContext().getStore().load(configReader );
+        } catch (Exception e) {
+        	e.printStackTrace();
+            smooks = null;
+            throw new ActionLifecycleException("Smooks configuration load failed.", e);
+        } finally {
+            try {
+                configListStream.close();
+            } catch (IOException e) {
+                logger.error("Error while closing transformation list config stream [" + smooksCdrlFile + "].", e);
+            }
+        }
+
+        logger.info("All Smooks configurations are now loaded.");
+    }
+
+    public void destroy() throws ActionLifecycleException {
+        updateListener.close();
+    }
+    
+    /**
+     * Reset the transformer.
+     * <p/>
+     * Clears the internal static smooks instance.
+     */
+    public void reset() {
+    	Smooks instance = smooks;
+    	
+        synchronized (SmooksTransformer.class) {
+        	if(smooks == instance) {
+        		smooks = null;
+        	}
+        }
+    }
+
+    /**
+     * JMS Listener for receiving configuration update notifications.
+     * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+     */
+    private static class ConfigurationUpdateListener implements MessageListener {
+    	
+    	private TopicConnection conn = null;
+    	private TopicSession session = null;
+    	private Topic topic = null;
+        private SmooksTransformer transformer;
+
+        public ConfigurationUpdateListener(SmooksTransformer transformer) {
+            this.transformer = transformer;
+        }
+
+        /**
+    	 * Private constructor.
+    	 * <p/>
+    	 * Connects the listener to the topic.
+    	 */
+    	private ConfigurationUpdateListener() {
+    		try {
+    			connect();
+    		} catch(Throwable t) {
+				logger.error("Unexpected error while attempting to connect Transformation configuration Update Listener.  Update listener not enabled!", t);
+				close();
+				return;
+    		}
+    	}
+
+		/**
+    	 * Receive a notification message.
+    	 */
+		public void onMessage(javax.jms.Message message) {
+			// Reset the transformer instance so as to force a config reload.
+			logger.info("Transformation configuration update notification received.  Resetting SmooksTransformer in order to force a configuration re-read.");
+			transformer.reset();
+		}    	
+
+		/**
+		 * Connect to the configured topic.
+		 */
+    	private boolean connect() {
+    		TopicConnectionFactory connectionFactory = null;
+
+			logger.info("Attempting to connect Transformation configuration Update Listener to update notification topic.");
+    		
+    		// Get the Topic ConnectionFactory...
+    		try {
+				connectionFactory = (TopicConnectionFactory) Configuration.getJmsConnectionFactory(CONFIGURATION_SECTION);
+			} catch (ConfigurationException e) {
+				logger.error("Lookup of the JMS ConnectionFactory failed for the Transformation configuration Update Listener. Update listener not enabled!", e);
+				return false;
+			} catch (ClassCastException e) {
+				logger.error("Invalid JMS ConnectionFactory config for the Transformation configuration Update Listener.  ConnectionFactory doesn't implement " + TopicConnectionFactory.class.getName() + ". Update listener not enabled!", e);
+				return false;
+			}
+			
+			// Create the topic connection...
+			try {
+				conn = connectionFactory.createTopicConnection();
+			} catch (JMSException e) {
+				logger.error("Failed to open JMS TopicConnection for the Transformation configuration Update Listener. Update listener not enabled!", e);
+				return false;
+			}
+			
+			// Lookup the topic...
+			try {
+				Context context = Configuration.getNamingContext(CONFIGURATION_SECTION);
+				topic = (Topic) context.lookup(notificationTopic);
+                context.close();
+			} catch (ConfigurationException e) {
+				logger.error("Topic lookup failed for the Transformation configuration Update Listener.  Topic name '" + notificationTopic + "'.  \n\t\tThis JMS Topic may not be deployed, or this ESB instance may not be looking at the correct JMS provider (check configuration '" + Context.PROVIDER_URL + "' in config module/section '" + CONFIGURATION_SECTION + "').  \n\t\tUpdate listener not enabled!", e);
+				close();
+				return false;
+			} catch (NamingException e) {
+				logger.warn("Topic lookup failed for the Transformation configuration Update Listener.  Topic name '" + notificationTopic + "'.  \n\tThis JMS Topic may not be deployed, or this ESB instance may not be looking at the correct JMS provider (check configuration '" + Context.PROVIDER_URL + "' in config module/section '" + CONFIGURATION_SECTION + "').  \n\tUpdate listener not enabled!");
+				close();
+				return false;
+			}
+			
+			// Create the TopicSession...
+			try {
+				session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
+			} catch (JMSException e) {
+				logger.error("TopicSession creation failed for the Transformation configuration Update Listener.  Update listener not enabled!", e);
+				close();
+				return false;
+			}
+			
+			// Start the connection...
+			try {
+				conn.start();
+			} catch (JMSException e) {
+				logger.error("Failed to start JMS TopicConnection for the Transformation configuration Update Listener.  Update listener not enabled!", e);
+				close();
+				return false;
+			}
+			
+			// Bind "this" listener to the topic...
+			try {
+				TopicSubscriber topicSubscriber = session.createSubscriber(topic);
+				topicSubscriber.setMessageListener(this);
+			} catch (JMSException e) {
+				logger.error("Failed to start JMS TopicConnection for the Transformation configuration Update Listener.  Update listener not enabled!", e);
+				close();
+				return false;
+			}
+
+			// Listen for exceptions on the connection...
+			try {
+				conn.setExceptionListener(new ExceptionListener());
+			} catch (JMSException e) {
+				logger.error("Failed to attach an ExceptionListener for the Transformation configuration Update Listener.  Update listener not enabled!", e);
+				close();
+				return false;
+			}
+
+			logger.info("Transformation Configuration Update Listener started!");
+
+			return true;
+    	}
+    	
+    	@Override
+		protected void finalize() throws Throwable {
+    		close();
+			super.finalize();
+		}
+
+		/**
+    	 * Close out the listener and all it's resources.
+    	 */
+		private void close() {
+			try {
+				if(conn != null) {
+					conn.stop();
+					logger.info("Update Listener JMS TopicConnection stopped.");
+				}
+			} catch (Throwable e) {
+				logger.error("Failed to stop Update Listener JMS connection.", e);
+				conn = null;
+			}
+			try {
+				if(session != null) {
+					session.close();
+					logger.info("Update Listener JMS TopicSession closed.");
+				}
+			} catch (Throwable e) {
+				logger.error("Failed to close Update Listener JMS session.", e);
+			} finally {
+				session = null;
+			}
+			try {
+				if(conn != null) {
+					conn.close();
+					logger.info("Update Listener JMS TopicConnection closed.");
+				}
+			} catch (Throwable e) {
+				logger.error("Failed to close Update Listener JMS connection.", e);
+			} finally {
+				conn = null;
+			}
+			topic = null;
+		}
+
+		/**
+		 * Exception Listener.
+		 * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+		 */
+		private class ExceptionListener implements javax.jms.ExceptionListener {
+
+			/**
+			 * We want this listener to handle only one exception.
+			 * It will close all existing resources and create a new instance
+			 * once it successfully reconnects.
+			 */
+			private boolean hasHandledOneException = false;
+			
+			/* (non-Javadoc)
+			 * @see javax.jms.ExceptionListener#onException(javax.jms.JMSException)
+			 */
+			public void onException(JMSException e) {
+				synchronized (ExceptionListener.class) {
+					if(!hasHandledOneException) {
+						logger.error("JMS Exception on Transformation Configuration Update Listener.", e);
+						close();
+						while(!connect()) {
+							try {
+								Thread.sleep(5000);
+							} catch (InterruptedException e1) {
+								logger.error("Interrupted during reconnect attempt.  Aborting reconnect!  Will need restart to reconnect.", e);
+							}
+						}
+						hasHandledOneException = true;
+					}
+				}
+			}
+		}
+    }
+}


Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/deployment.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/deployment.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbossesb-deployment>
+  <depends>jboss.messaging.destination:service=Topic,name=SmooksNotificationTopic</depends>
+</jbossesb-deployment>


Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/deployment.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1,6 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
+     <!--  
+     		jbossesb internal services 
+     -->
+</jbossesb>


Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbm-queue-service.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbm-queue-service.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.messaging.destination:service=Topic,name=SmooksNotificationTopic"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+    <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+  </mbean>
+</server>


Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbm-queue-service.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Copied: labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-cdr.lst (from rev 12237, labs/jbossesb/trunk/product/install/conf/smooks-cdr.lst)
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-cdr.lst	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-cdr.lst	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1,10 @@
+####################################################
+# Lotpoad config from database
+####################################################
+#http://localhost:8080/jboss-esb-console/transform/smooks-config.jsp
+
+####################################################
+# Load config from local XML file
+####################################################
+#/smooks-res.xml
+#/org/milyn/templating/templating-cdu-creators-0.1.cdrl

Copied: labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java (from rev 12237, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.actions.converters;
+
+
+
+import java.net.URISyntaxException;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.ActionLifecycleException;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.ActionUtils;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+
+/**
+ * SmooksTransformer unit tests.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class SmooksTransformerUnitTest extends TestCase {
+
+    public void test_bad_config() {
+    	ConfigTree properties = new ConfigTree("name");
+
+        properties.setAttribute(SmooksTransformer.SMOOKS_CDRL_FILE, "smooks-test-cdr.lst");
+        // Should get exceptions where message type configs are specified but empty...
+        properties.setAttribute(SmooksTransformer.FROM_TYPE, " ");
+        assertConfigException(properties, "Empty '" + SmooksTransformer.FROM_TYPE + "' config attribute supplied.");
+        properties.setAttribute(SmooksTransformer.FROM_TYPE, "x");
+        properties.setAttribute(SmooksTransformer.TO_TYPE, " ");
+        assertConfigException(properties, "Empty '" + SmooksTransformer.TO_TYPE + "' config attribute supplied.");
+    }
+    
+    public void test_trans() throws ActionProcessingException, ConfigurationException, URISyntaxException, ActionLifecycleException {
+        String stringMessage;
+        String transRes;
+        
+        // Very basic test!  Just illustrates profile based resource selection.
+        // Read the smooks-test.cdrl config file in this package!! 
+
+        // Initialise the acme order message...
+        stringMessage = "<a><ddd>value</ddd></a>";
+        
+        // Transform the order message going to "AcmePartner1"...
+        transRes = transform(stringMessage, "Acme-Order-XML", "Acme", "AcmePartner1", "Partner1-Order-XML");
+        assertEquals("<x><b>value</b></x>", transRes);
+        
+        // Transform the order message going to "AcmePartner2"...
+        transRes = transform(stringMessage, "Acme-Order-XML", "Acme", "AcmePartner2", "Partner2-Order-XML");
+        assertEquals("<x><c>value</c></x>", transRes);
+    }
+    
+    private String transform(String stringMessage, String fromType, String from, String to, String toType) throws ActionProcessingException, ConfigurationException, URISyntaxException, ActionLifecycleException {
+        ConfigTree properties = new ConfigTree("name");
+
+        properties.setAttribute(SmooksTransformer.SMOOKS_CDRL_FILE, "smooks-test-cdr.lst");
+        // Set the message properties in order to trigger the appropriate transformations
+        // on the message...
+        properties.setAttribute(SmooksTransformer.FROM, from);
+        properties.setAttribute(SmooksTransformer.FROM_TYPE, fromType);
+        properties.setAttribute(SmooksTransformer.TO, to);
+        properties.setAttribute(SmooksTransformer.TO_TYPE, toType);
+
+    	// The smooks-cdr.lst and device-profile.xml files are located in the root of the 
+        // test src folder.  You need to look at these to see how this works...
+        SmooksTransformer transformer = new SmooksTransformer(properties);
+        Message message;
+
+        transformer.initialise();
+
+        // Perform the transformation by setting the payload on the task object.
+        message = createNewMessage(fromType, from, to, toType);
+        ActionUtils.setTaskObject(message, stringMessage);
+        message = transformer.process(message);
+        String resultThroughTaskObj = (String) ActionUtils.getTaskObject(message);
+        assertEquals(resultThroughTaskObj, new String(message.getBody().getByteArray()));
+        
+        // Perform the transformation by setting the payload on the body "contents".
+        message = createNewMessage(fromType, from, to, toType);
+        message.getBody().setByteArray(stringMessage.getBytes());
+        message = transformer.process(message);
+        assertEquals(resultThroughTaskObj, new String(message.getBody().getByteArray()));
+        
+        return resultThroughTaskObj;
+    }
+
+	private Message createNewMessage(String fromType, String from, String to, String toType) {
+		Message message;
+		message = MessageFactory.getInstance().getMessage();
+        
+		return message;
+	}
+
+    private void assertConfigException(ConfigTree properties, String expectedException) {
+        try {
+            new SmooksTransformer("trans", properties);
+            fail("Expected ConfigurationException: [" + expectedException + "...]");
+        } catch(ConfigurationException e) {
+            assertTrue("Expected exception message to start with [" + expectedException + "]. Was [" + e.getMessage() + "]", e.getMessage().startsWith(expectedException));
+        }
+    }
+}

Added: labs/jbossesb/trunk/product/services/smooks/src/test/resources/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/test/resources/log4j.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/test/resources/log4j.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <!-- ============================== -->
+   <!-- Append messages to the console -->
+   <!-- ============================== -->
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <!-- ================ -->
+   <!-- Limit categories -->
+   <!-- ================ -->
+
+   <category name="org.jbpm">
+      <priority value="INFO"/>
+   </category>
+   <category name="org.hibernate">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.jboss">
+      <priority value="WARN"/>
+   </category>
+   <category name="org.jboss.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.jboss.internal.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.apache">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.jboss.soa.esb.services.jbpm">
+      <priority value="DEBUG"/>
+   </category>
+   <!-- ======================= -->
+   <!-- Setup the Root category -->
+   <!-- ======================= -->
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>


Property changes on: labs/jbossesb/trunk/product/services/smooks/src/test/resources/log4j.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test-cdr.lst
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test-cdr.lst	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test-cdr.lst	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1 @@
+classpath:/smooks-test.cdrl

Added: labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test.cdrl
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test.cdrl	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test.cdrl	2007-05-31 14:18:41 UTC (rev 12261)
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
+
+	<!-- 
+		"Acme-Order-XML" messages going from "Acme" to "AcmePartner1" 
+	-->
+	<resource-config target-profile="from-type:Acme-Order-XML AND from:Acme AND to-type:Partner1-Order-XML AND to:AcmePartner1" selector="ddd">
+		<resource>org.milyn.cdres.trans.RenameElementTU</resource>
+		<param name="replacementElement">b</param>
+	</resource-config>
+
+	<!-- 
+		"Acme-Order-XML" messages going from "Acme" to "AcmePartner2" 
+	-->
+	<resource-config target-profile="from-type:Acme-Order-XML AND from:Acme AND to-type:Partner2-Order-XML AND to:AcmePartner2" selector="ddd">
+		<resource>org.milyn.cdres.trans.RenameElementTU</resource>
+		<param name="replacementElement">c</param>
+	</resource-config>
+
+	<!-- 
+		"Acme-Order-XML" messages going from "Acme" to anywhere
+	-->
+	<resource-config target-profile="from-type:Acme-Order-XML AND from:Acme" selector="a" >
+		<resource>org.milyn.cdres.trans.RenameElementTU</resource>
+		<param name="replacementElement">x</param>
+	</resource-config>
+
+</smooks-resource-list>
+

Modified: labs/jbossesb/trunk/product/tools/console/build.xml
===================================================================
--- labs/jbossesb/trunk/product/tools/console/build.xml	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/product/tools/console/build.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -24,17 +24,22 @@
 	<property name="testng.jar" value="${basedir}/lib/testng-4.5.1-jdk15.jar" />
 	<property name="javac.debug" value="true" />
 	<property name="javac.deprecation" value="false" />
-	<property name="product.lib.ext.dir" location="../../lib/ext" />
+	<property name="product.lib.ext.dir" location="../../lib/ext" />
+	<property name="product.services.smooks.lib.ext.dir" location="../../services/smooks/lib/ext" />
 
 	<fileset id="lib" dir="${lib.dir}">
 		<include name="*.jar" />
 	</fileset>
-
+
+	<fileset id="milyn" dir="${product.services.smooks.lib.ext.dir}" 
+		includes="milyn*.jar" />
+	
 	<fileset id="milyn-dependencies" dir="${product.lib.ext.dir}" 
-		includes="milyn*.jar,opencsv*.jar,ognl-*.jar,xbean.jar,xmlpublic.jar,groovy*.jar" />
+		includes="opencsv*.jar,ognl-*.jar,xbean.jar,xmlpublic.jar,groovy*.jar" />
 	
 	<path id="build.classpath">
-		<fileset refid="lib" />
+		<fileset refid="lib" />
+		<fileset refid="milyn" />
 		<fileset refid="milyn-dependencies" />
 	</path>
 
@@ -143,7 +148,8 @@
 				<include name="antlr-*.jar"/>
 				<include name="commons-jci-*.jar"/>
 				<include name="stringtemplate-*.jar"/>
-			</fileset>
+			</fileset>
+			<fileset refid="milyn" />
 			<fileset refid="milyn-dependencies" />
 		</copy>
 		<copy todir="${ear.dir}/META-INF">

Deleted: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerConfig.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerConfig.xml	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerConfig.xml	2007-05-31 14:18:41 UTC (rev 12261)
@@ -1,32 +0,0 @@
-<!-- 
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */ 
- -->
-
-<SmooksTransformerTest>
-	<action class="org.jboss.soa.esb.actions.converters.SmooksTransformer" 
-		from-type="Acme-Order-XML"
-		from="Acme"
-		to-type="Partner2-Order-XML"
-		to="AcmePartner2"
-		/>
-</SmooksTransformerTest>	

Deleted: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerTest.java	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerTest.java	2007-05-31 14:18:41 UTC (rev 12261)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated 
- * by the @authors tag. All rights reserved. 
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors. 
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A 
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
- * MA  02110-1301, USA.
- * 
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-
-package org.jboss.soa.esb.actions;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.converters.SmooksTransformer;
-import org.jboss.soa.esb.common.ModulePropertyManager;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.message.ActionProcessingPipeline;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.xml.sax.SAXException;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class SmooksTransformerTest extends TestCase {
-	
-	@Override
-	protected void setUp() throws Exception {
-		ModulePropertyManager.getPropertyManager(SmooksTransformer.CONFIGURATION_SECTION).setProperty("configuration.list.file.uri", "classpath:/org/jboss/soa/esb/actions/smooks-cdr.lst");
-	}
-
-	public void test_SmooksTransformer() throws SAXException, IOException, ConfigurationException, URISyntaxException {
-		Message message = createEmptyMessage();
-
-		// Set the message payload for processing - don't set the message typing
-		// or routing info on the message...
-        ActionUtils.setTaskObject(message, "<a><ddd>value</ddd></a>");
-        // Process the message...
-		process(message);
-		// Check make sure it did it OK ("ddd" converted to "c")...
-		assertEquals("<x><c>value</c></x>", (String)ActionUtils.getTaskObject(message));
-		
-		// Set the message type and routing info on the message - should override the 
-		// configured typing and routing parameters...
-		message.getProperties().setProperty(SmooksTransformer.FROM, "Acme");
-		message.getProperties().setProperty(SmooksTransformer.FROM_TYPE, "Acme-Order-XML");
-		message.getProperties().setProperty(SmooksTransformer.TO, "AcmePartner1");
-		message.getProperties().setProperty(SmooksTransformer.TO_TYPE, "Partner1-Order-XML");
-		// Set the message payload for processing...
-        ActionUtils.setTaskObject(message, "<a><ddd>value</ddd></a>");
-        // Process the message...
-		process(message);
-		// Check make sure it did it OK ("ddd" converted to "b")...
-		assertEquals("<x><b>value</b></x>", (String)ActionUtils.getTaskObject(message));
-	}
-	
-    private void process(Message message) throws SAXException, IOException, ConfigurationException {
-		ConfigTree config = ConfigTree.fromInputStream(getClass().getResourceAsStream("SmooksTransformerConfig.xml"));
-
-                ActionProcessingPipeline chain = new ActionProcessingPipeline(config);
-                chain.initialise() ;
-        
-                chain.process(message) ;
-    }
-
-	private Message createEmptyMessage() {
-		Message message = MessageFactory.getInstance().getMessage();
-
-		
-		return message;
-	}
-}

Deleted: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/smooks-cdr.lst
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/smooks-cdr.lst	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/smooks-cdr.lst	2007-05-31 14:18:41 UTC (rev 12261)
@@ -1 +0,0 @@
-classpath:/org/jboss/soa/esb/actions/smooks-test.cdrl

Deleted: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/smooks-test.cdrl
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/smooks-test.cdrl	2007-05-31 14:12:22 UTC (rev 12260)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/smooks-test.cdrl	2007-05-31 14:18:41 UTC (rev 12261)
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
-
-	<!-- 
-		"Acme-Order-XML" messages going from "Acme" to "AcmePartner1" 
-	-->
-	<resource-config target-profile="from-type:Acme-Order-XML AND from:Acme AND to-type:Partner1-Order-XML AND to:AcmePartner1" selector="ddd">
-		<resource>org.milyn.cdres.trans.RenameElementTU</resource>
-		<param name="replacementElement">b</param>
-	</resource-config>
-
-	<!-- 
-		"Acme-Order-XML" messages going from "Acme" to "AcmePartner2" 
-	-->
-	<resource-config target-profile="from-type:Acme-Order-XML AND from:Acme AND to-type:Partner2-Order-XML AND to:AcmePartner2" selector="ddd">
-		<resource>org.milyn.cdres.trans.RenameElementTU</resource>
-		<param name="replacementElement">c</param>
-	</resource-config>
-
-	<!-- 
-		"Acme-Order-XML" messages going from "Acme" to anywhere
-	-->
-	<resource-config target-profile="from-type:Acme-Order-XML AND from:Acme" selector="a">
-		<resource>org.milyn.cdres.trans.RenameElementTU</resource>
-		<param name="replacementElement">x</param>
-	</resource-config>
-
-</smooks-resource-list>
-




More information about the jboss-svn-commits mailing list