[jboss-svn-commits] JBL Code SVN: r9008 - in labs/jbossesb/trunk: product/console/distro and 16 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jan 24 10:49:17 EST 2007


Author: tfennelly
Date: 2007-01-24 10:49:17 -0500 (Wed, 24 Jan 2007)
New Revision: 9008

Added:
   labs/jbossesb/trunk/product/console/jboss-esb-console-service.xml
   labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/jboss-esb-console.properties
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/UpdateNotifier.java
   labs/jbossesb/trunk/product/console/view/flash/console-demo-02.html
   labs/jbossesb/trunk/product/console/view/flash/console-demo-02.swf
Modified:
   labs/jbossesb/trunk/product/console/build.xml
   labs/jbossesb/trunk/product/console/distro/distro-build.xml
   labs/jbossesb/trunk/product/console/distro/hsqldb-distro-build.xml
   labs/jbossesb/trunk/product/console/distro/postgres-distro-build.xml
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/SelectMessageExchange.java
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/ManageResources.java
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/NewResource.java
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TestTransformation.java
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/configimport/ResourceImport.java
   labs/jbossesb/trunk/product/console/view/about.xhtml
   labs/jbossesb/trunk/product/console/view/transform/list-resources.xhtml
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/converters/SmooksTransformer.java
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java
   labs/jbossesb/trunk/product/install/conf/jbossesb-properties.xml
   labs/jbossesb/trunk/product/install/deployment.properties-example
   labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/jbossesb-properties.xml
   labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_date_manipulation/jbossesb-properties.xml
   labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_simple/jbossesb-properties.xml
   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
Log:
Trigger transformation resource reloading on transformation updates via the console:
http://jira.jboss.com/jira/browse/JBESB-285

Modified: labs/jbossesb/trunk/product/console/build.xml
===================================================================
--- labs/jbossesb/trunk/product/console/build.xml	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/console/build.xml	2007-01-24 15:49:17 UTC (rev 9008)
@@ -62,8 +62,7 @@
     		<fileset dir="${build.console.dir}" excludes="test/**" />
     		<fileset dir="${resources.dir}" includes="WEB-INF/**" excludes="WEB-INF/classes/**" />
     		<fileset dir="${view.dir}" />
-    		<fileset dir="${basedir}" includes="distro/**" />
-    		<fileset dir="${basedir}" includes="import.sql" />
+    		<fileset dir="${basedir}" includes="distro/**,import.sql,jboss-esb-console-service.xml" />
     	</jar>
     	<delete dir="${resources.dir}/WEB-INF/lib" includes="milyn*.jar,opencsv*.jar,${package.name}.jar" />
     </target>
@@ -84,6 +83,7 @@
 		<copy file="${install.console.dir}/distro/distro-build.xml" tofile="${install.tools.dir}/build.xml" />
 		<copy file="${install.console.dir}/distro/distro-CONSOLE-README.TXT" tofile="${install.tools.dir}/CONSOLE-README.TXT" />
 		<copy file="${install.console.dir}/import.sql" tofile="${install.tools.dir}/CONSOLE-import.sql" />
+		<copy file="${install.console.dir}/jboss-esb-console-service.xml" todir="${install.tools.dir}" />
     </target>
 	
     <target name="clean" description="Delete the build folder..">

Modified: labs/jbossesb/trunk/product/console/distro/distro-build.xml
===================================================================
--- labs/jbossesb/trunk/product/console/distro/distro-build.xml	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/console/distro/distro-build.xml	2007-01-24 15:49:17 UTC (rev 9008)
@@ -17,15 +17,18 @@
     	<delete file="${console-package.name}-ds.xml" />
     	<delete file="${console-package.name}.war" />
 
-		<echo message="----------------------------------------------------------------------------------------------------------------" />
-		<echo message="|                                                                                                              |" />
-		<echo message="|             J B O S S    E S B    A D M I N I S T R A T I O N    C O N S O L E    C O N F I G                |" />
-		<echo message="|                                                                                                              |" />
-		<echo message="----------------------------------------------------------------------------------------------------------------" />
+		<echo message="-----------------------------------------------------------" />
+		<echo message="|                                                          |" />
+		<echo message="|    J B O S S    E S B    A D M I N I S T R A T I O N     |" />
+		<echo message="|              C O N S O L E    C O N F I G                |" />
+		<echo message="|                                                          |" />
+		<echo message="-----------------------------------------------------------" />
 		<echo message="" />
 		<echo message="" />
-		<input message="This script will help you configure your JBoss ESB Administration Console Application.  You can reconfigure at any time by re-running this script. ${line.separator}Press enter to start..." />
+		<echo message="This script will help you configure your JBoss ESB Administration Console Application. ${line.separator}You can reconfigure at any time by re-running this script." />
 		<echo message="" />
+		<input message="Press enter to start..." />
+		<echo message="" />
 		<input addproperty="db.target" message='Enter the target database type:' defaultvalue="hsqldb" validargs="hsqldb,postgres" />
 		<echo message="" />
     	    	

Modified: labs/jbossesb/trunk/product/console/distro/hsqldb-distro-build.xml
===================================================================
--- labs/jbossesb/trunk/product/console/distro/hsqldb-distro-build.xml	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/console/distro/hsqldb-distro-build.xml	2007-01-24 15:49:17 UTC (rev 9008)
@@ -18,8 +18,9 @@
     	</jar>
 
 		<echo message="" />
-		<echo message='*********** 1. COPY the ${console-package.name}.war file to your JBoss Application Server "deploy" folder.' />
-		<echo message='*********** 2. Access the console through "http://localhost:8080/jboss-esb-console/" (replacing the host and port as appropriate).' />
+		<echo message='*********** 1. COPY the "${console-package.name}.war" file to your JBoss Application Server "deploy" folder.' />
+		<echo message='*********** 2. COPY the "jboss-esb-console-service.xml" file to your JBoss Application Server "deploy" folder.' />
+		<echo message='*********** 3. Access the console through "http://localhost:8080/jboss-esb-console/" (replacing the host and port as appropriate).' />
 		<echo message="" />
     </target>
 	

Modified: labs/jbossesb/trunk/product/console/distro/postgres-distro-build.xml
===================================================================
--- labs/jbossesb/trunk/product/console/distro/postgres-distro-build.xml	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/console/distro/postgres-distro-build.xml	2007-01-24 15:49:17 UTC (rev 9008)
@@ -39,10 +39,11 @@
     	</jar>
 
 		<echo message="" />
-		<echo message='*********** 1. COPY the ${console-package.name}.war and ${console-package.name}-ds.xml files to your JBoss Application Server "deploy" folder (e.g. "../server/default/deploy").' />
-		<echo message='*********** 2. COPY the Postgres 8.1 JDBC drivers (recommended: postgresql-8.1-407.jdbc2ee.jar) to your JBoss Application Server "lib" folder (e.g. "../server/default/lib").' />
-		<echo message='*********** 3. Once deployed and running, seed the "${db.name}" database using the "CONSOLE-import.sql" script.' />
-		<echo message='*********** 4. Access the console through "http://localhost:8080/jboss-esb-console/" (replacing the host and port as appropriate).' />
+		<echo message='*********** 1. COPY the "${console-package.name}.war" and "${console-package.name}-ds.xml" files to your JBoss Application Server "deploy" folder (e.g. "../server/default/deploy").' />
+		<echo message='*********** 2. COPY the "jboss-esb-console-service.xml" file to your JBoss Application Server "deploy" folder.' />
+		<echo message='*********** 3. COPY the Postgres 8.1 JDBC drivers (recommended: postgresql-8.1-407.jdbc2ee.jar) to your JBoss Application Server "lib" folder (e.g. "../server/default/lib").' />
+		<echo message='*********** 4. Once deployed and running, seed the "${db.name}" database using the "CONSOLE-import.sql" script.' />
+		<echo message='*********** 5. Access the console through "http://localhost:8080/jboss-esb-console/" (replacing the host and port as appropriate).' />
 		<echo message="" />
     </target>
 	

Added: labs/jbossesb/trunk/product/console/jboss-esb-console-service.xml
===================================================================
--- labs/jbossesb/trunk/product/console/jboss-esb-console-service.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/console/jboss-esb-console-service.xml	2007-01-24 15:49:17 UTC (rev 9008)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+    <mbean code="org.jboss.mq.server.jmx.Topic" name="jboss.mq.destination:service=Topic,name=org.jboss.soa.esb.transformation.Update">
+        <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+    </mbean>
+</server>
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/console/jboss-esb-console-service.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/jboss-esb-console.properties
===================================================================
--- labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/jboss-esb-console.properties	                        (rev 0)
+++ labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/jboss-esb-console.properties	2007-01-24 15:49:17 UTC (rev 9008)
@@ -0,0 +1,20 @@
+##############################################################################
+#
+# Context properties.
+#
+# Defaults to JBoss AS on localhost.
+# 
+############################################################################## 
+java.naming.provider.url=localhost
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=
+
+##############################################################################
+#
+# JMS properties.
+#
+# Provider defaults to JBoss MQ.
+# 
+############################################################################## 
+javax.jms.ConnectionFactory=ConnectionFactory
+update.notification.topic=topic/org.jboss.soa.esb.transformation.Update
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/jboss-esb-console.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/UpdateNotifier.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/UpdateNotifier.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/UpdateNotifier.java	2007-01-24 15:49:17 UTC (rev 9008)
@@ -0,0 +1,233 @@
+/*
+ * 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
+ */
+package org.jboss.soa.esb.admin.console;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.log4j.Logger;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Destroy;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+/**
+ * Console update notifier.
+ * <p/>
+ * Sends a notification message to all parties interested in console data updates.
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+ at Name("updateNotifier")
+ at Scope(APPLICATION)
+public class UpdateNotifier {
+	
+	/**
+	 * Logger.
+	 */
+	private static Logger logger = Logger.getLogger(UpdateNotifier.class);
+
+	/**
+	 * Properties file.
+	 */
+	private static final String JBOSS_ESB_CONSOLE_PROPERTIES = "/jboss-esb-console.properties";
+
+	private TopicConnection conn = null;
+	private TopicSession session = null;
+	private Topic topic = null;
+
+	/**
+	 * Send a notification to all parties listening to the update notification topic.
+	 */
+	public void sendNotification() {
+		sendNotification(true);
+	}
+	
+	/**
+	 * Send a notification to all parties listening to the update notification topic.
+	 * @param retryOnFail Perform a single retry if the notification fails.
+	 */
+	private void sendNotification(boolean retryOnFail) {
+		if(topic == null) {
+			logger.warn("Unable to send Configuration notification sent successfully.");
+			reconnectAndNotify(retryOnFail);
+			return;
+		}		
+		
+		try {
+			TopicPublisher send = session.createPublisher(topic);
+			TextMessage tm = session.createTextMessage("update"); // The contents of the message is irrelevant!
+			send.publish(tm);
+			
+			logger.info("Configuration Update notification sent successfully.");
+		} catch (JMSException e) {
+			logger.error("Configuration Update notification failed.", e);
+			reconnectAndNotify(retryOnFail);
+		}
+	}
+	
+	/**
+	 * Connect to the notification topic.
+	 */
+	@Create
+	public void connect() {
+		Properties properties = new Properties();
+		InputStream propertiesStream = getClass().getResourceAsStream(JBOSS_ESB_CONSOLE_PROPERTIES);
+		InitialContext context;
+		TopicConnectionFactory connectionFactory = null;
+		
+		if(propertiesStream == null) {
+			throw new IllegalStateException("Unexpected runtime error. '" + JBOSS_ESB_CONSOLE_PROPERTIES + "' should be available on th classpath.");
+		}
+		
+		// Load the properties...
+		try {
+			properties.load(propertiesStream);
+		} catch (IOException e) {
+			logger.error("Error reading properties stream (" + JBOSS_ESB_CONSOLE_PROPERTIES + ").", e);
+			return;
+		}
+		
+		// Create the naming context...
+		try {
+			context = new InitialContext(properties);
+		} catch (NamingException e) {
+			logger.error("InitialContext creation failure.  Properties: " + properties, e);
+			return;
+		}
+
+		String connectionFactoryRuntime = properties.getProperty(ConnectionFactory.class.getName(), "ConnectionFactory");
+		try {
+			connectionFactory = (TopicConnectionFactory) context.lookup(connectionFactoryRuntime);
+		} catch (NamingException e) {
+			logger.error("JNDI lookup of JMS Connection Factory [" + connectionFactoryRuntime + "] failed.", e);
+		} catch (ClassCastException e) {
+			logger.error("JNDI lookup of JMS Connection Factory failed.  Class [" + connectionFactoryRuntime + "] is not an instance of [" + ConnectionFactory.class.getName() + "].", e);
+		}
+		
+		// Create the topic connection...
+		try {
+			conn = connectionFactory.createTopicConnection();
+		} catch (JMSException e) {
+			logger.error("Failed to open JMS TopicConnection for the Transformation configuration Update Notifier. Update Notifier disabled!", e);
+			return;
+		}
+		
+		// Lookup the topic...
+		String notificationTopic = properties.getProperty("update.notification.topic", "topic/org.jboss.soa.esb.transformation.Update");
+		try {
+			topic = (Topic) context.lookup(notificationTopic);
+		} catch (NamingException e) {
+			logger.error("Topic lookup failed for the Transformation configuration Update Notifier.  Topic name '" + notificationTopic + "'. Update Notifier disabled!", e);
+			close();
+			return;
+		}
+		
+		// Create the TopicSession...
+		try {
+			session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
+		} catch (JMSException e) {
+			logger.error("TopicSession creation failed for the Transformation configuration Update Notifier.  Update Notifier disabled!", e);
+			close();
+			return;
+		}
+		
+		// Start the connection...
+		try {
+			conn.start();
+		} catch (JMSException e) {
+			logger.error("Failed to start JMS TopicConnection for the Transformation configuration Update Notifier.  Update Notifier disabled!", e);
+			close();
+			return;
+		}
+
+		logger.info("Transformation Configuration Update Notifier started!");
+	}
+
+	/**
+	 * Attempt a single reconnect and notify operation.
+	 * @param attemptRetry Is the retry to be attempted on this call.
+	 */
+	private void reconnectAndNotify(boolean attemptRetry) {
+		if(attemptRetry) {
+			logger.info("Attempting a single reconnect and retry.");
+			close();
+			connect();
+			sendNotification(false);
+		} else {
+			logger.info("Already attempted a reconnect and retry - not attempting another.  This notification event will be lost!");
+		}
+	}
+	
+	@Destroy
+	public void destroy() {
+		close();
+	}
+
+	/**
+	 * Close out the listener and all it's resources.
+	 */
+	private void close() {
+		try {
+			if(conn != null) {
+				conn.stop();
+				logger.info("Update Notifier JMS TopicConnection stopped.");
+			}
+		} catch (Throwable e) {
+			logger.error("Failed to stop Update Notifier JMS connection.", e);
+			conn = null;
+		}
+		try {
+			if(session != null) {
+				session.close();
+				logger.info("Update Notifier JMS TopicSession closed.");
+			}
+		} catch (Throwable e) {
+			logger.error("Failed to close Update Notifier JMS session.", e);
+		} finally {
+			session = null;
+		}
+		try {
+			if(conn != null) {
+				conn.close();
+				logger.info("Update Notifier JMS TopicConnection closed.");
+			}
+		} catch (Throwable e) {
+			logger.error("Failed to close Update Notifier JMS connection.", e);
+		} finally {
+			conn = null;
+		}
+		topic = null;
+	}
+}


Property changes on: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/UpdateNotifier.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/SelectMessageExchange.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/SelectMessageExchange.java	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/SelectMessageExchange.java	2007-01-24 15:49:17 UTC (rev 9008)
@@ -27,7 +27,6 @@
 import java.util.List;
 
 import org.hibernate.Session;
-import org.jboss.seam.annotations.Create;
 import org.jboss.seam.annotations.In;
 import org.jboss.seam.annotations.Name;
 import org.jboss.seam.annotations.Out;

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/ManageResources.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/ManageResources.java	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/ManageResources.java	2007-01-24 15:49:17 UTC (rev 9008)
@@ -39,6 +39,7 @@
 import org.jboss.seam.annotations.datamodel.DataModelSelectionIndex;
 import org.jboss.soa.esb.admin.console.SeamViewIdStack;
 import org.jboss.soa.esb.admin.console.Toggle;
+import org.jboss.soa.esb.admin.console.UpdateNotifier;
 import org.jboss.soa.esb.admin.console.exchange.MessageExchange;
 import org.jboss.soa.esb.admin.console.exchange.SelectMessageExchange;
 
@@ -56,6 +57,9 @@
 
 	@In(required=false)
 	private MessageExchange messageExchange;
+
+	@In(create=true)
+	private UpdateNotifier updateNotifier;
 	
 	@DataModel 
 	private List<TransformationResource> messageExchangeConfigs;
@@ -108,6 +112,7 @@
 
 	public String updateParameter() {
 		esbDatabase.persist(selectedConfigParam);
+		updateNotifier.sendNotification();
 				
 		return "view-resource";
 	}
@@ -119,6 +124,7 @@
 		}
 		esbDatabase.delete(selectedConfig);
 		initialise();
+		updateNotifier.sendNotification();
 		
 		return "list-resources";
 	}

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/NewResource.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/NewResource.java	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/NewResource.java	2007-01-24 15:49:17 UTC (rev 9008)
@@ -39,6 +39,7 @@
 import org.jboss.seam.core.FacesMessages;
 import org.jboss.soa.esb.admin.console.SeamUtils;
 import org.jboss.soa.esb.admin.console.SeamViewIdStack;
+import org.jboss.soa.esb.admin.console.UpdateNotifier;
 import org.jboss.soa.esb.admin.console.exchange.MessageExchange;
 import org.jboss.soa.esb.admin.console.exchange.SelectMessageExchange;
 
@@ -56,6 +57,9 @@
 
 	@In(required=false)
 	private MessageExchange messageExchange;
+
+	@In(create=true)
+	private UpdateNotifier updateNotifier;
 	
 	@DataModel 
 	private List<TransformationResourceSpec> configurationSpecs;
@@ -148,6 +152,7 @@
 		try {
 			// Persist...
 			persistNewResource(transResource, esbDatabase);
+			updateNotifier.sendNotification();
 			
 			return "home";
 		} catch(Throwable thrown) {

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TestTransformation.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TestTransformation.java	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TestTransformation.java	2007-01-24 15:49:17 UTC (rev 9008)
@@ -25,7 +25,6 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
 
 import javax.xml.transform.OutputKeys;

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/configimport/ResourceImport.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/configimport/ResourceImport.java	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/configimport/ResourceImport.java	2007-01-24 15:49:17 UTC (rev 9008)
@@ -41,6 +41,7 @@
 import org.jboss.seam.annotations.Out;
 import org.jboss.seam.annotations.Scope;
 import org.jboss.seam.core.FacesMessages;
+import org.jboss.soa.esb.admin.console.UpdateNotifier;
 import org.jboss.soa.esb.admin.console.transform.NewResource;
 import org.jboss.soa.esb.admin.console.transform.SmooksUtils;
 import org.jboss.soa.esb.admin.console.transform.TransformationResource;
@@ -63,6 +64,9 @@
 
 	@In(create=true)
 	private Session esbDatabase;
+
+	@In(create=true)
+	private UpdateNotifier updateNotifier;
 	
 	@In(required=false) @Out(scope=CONVERSATION)
 	private ResourceLocation resourceLocation;
@@ -100,6 +104,8 @@
 			}
 		}
 		
+		updateNotifier.sendNotification();
+		
 		return "home";
 	}
 

Modified: labs/jbossesb/trunk/product/console/view/about.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/about.xhtml	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/console/view/about.xhtml	2007-01-24 15:49:17 UTC (rev 9008)
@@ -12,7 +12,7 @@
 		<h2>About JBoss ESB Message Transformation &amp; Analysis</h2>
 		<a href="#features">1. Features</a><br/>
 		<a href="#configuring">2. Configuring JBoss ESB Transformations</a><br/>
-		<a href="#custom-java">3. Creating and Using Customer Java Transformations</a><br/>
+		<a href="#custom-java">3. Creating and Using Custom Java Transformations</a><br/>
 		<a href="#faqs">4. FAQs</a><br/>
 		<a href="#flash-demos">5. Flash Demos</a>
 
@@ -79,8 +79,9 @@
 		<a href="#message-exchange-participant">What is a Message Exchange Participant?</a><br/>
 		<a href="#message-contract">What is a Message Contract?</a><br/>
 		<a href="#why-not-just-type-info">Why can't I define transformations purely in terms of message typing information?</a><br/>
+		<a href="#notify-esb-instances">How do I configure my ESB instance(s) to be notified of configuration updates made in the Admin Console?</a><br/>
 		<a href="#how-do-i-modify-the-default-exchange-targeting">How do I modify the default Message Exchange Targeting information?</a><br/>
-		
+	
 		<div id="message-exchange" class="section">
 			<h3>What is a "Message Exchange"?</h3>
 			Within the context of JBoss ESB, message transformations are performed in order to make a messages "produced" by one entity "<i>A</i>",
@@ -145,6 +146,25 @@
 			for more details.
 		</div>
 		
+		<div id="notify-esb-instances" class="section">
+			<h3>How do I configure my ESB instance(s) to be notified of configuration updates made in the Admin Console?</h3>
+			If your ESB instance is running on the same host as your Admin Console (i.e. the same host as the JBoss AS
+			instance hosting the Admin Console), then you should have nothing to do.  If your ESB instance is
+			running on a different host from the Admin Console, then you will need to update your <b>jbossesb-properties.xml</b>
+			and add the following configuration:
+<pre>
+    &lt;properties name="transformation"&gt;
+        &lt;property name="java.naming.provider.url" value="<b>consolehost.acme.com</b>"/&gt;
+    &lt;/properties&gt;
+</pre>
+			... where the value of the "java.naming.provider.url" property needs to be set to the address
+			of the Admin Console host.  The default value for this property is "localhost" - hence why you typically don't
+			need to specify this property if you're running the ESB and Admin Console instances on the same host.
+			<p/>
+			This is basically a Publish &amp; Subscribe Service offered by the Admin Console application.  Once your ESB instance
+			subscribes, it will be notified!
+		</div>
+		
 		<div id="how-do-i-modify-the-default-exchange-targeting" class="section">
 			<h3>How do I modify the default Message Exchange Targeting information?</h3>
 			All new message Transformation or Analysis configurations must be targeted at a "<a href="#message-exchange">Message Exchange</a>".
@@ -175,6 +195,9 @@
 				<a href="flash/console-demo-01.html">Demo 1</a>: A basic demo that walks you through most of the main
 				concepts within JBoss ESB Transformations.
 				<p/>
+				<a href="flash/console-demo-02.html">Demo 2</a>: A slightly more advanced demo that builds on Demo 1.
+				Be sure to go through Demo 1 before looking at Demo 2.
+				<p/>
 			</div>
 		</div>
 

Added: labs/jbossesb/trunk/product/console/view/flash/console-demo-02.html
===================================================================
--- labs/jbossesb/trunk/product/console/view/flash/console-demo-02.html	                        (rev 0)
+++ labs/jbossesb/trunk/product/console/view/flash/console-demo-02.html	2007-01-24 15:49:17 UTC (rev 9008)
@@ -0,0 +1,15 @@
+<!-- saved from url=(0014)about:internet -->
+<HTML>
+<BODY>
+<center>
+<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" WIDTH="1262" HEIGHT="1000" CODEBASE="http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0">
+<PARAM NAME=movie VALUE="console-demo-02.swf">
+<PARAM NAME=play VALUE=true>
+<PARAM NAME=loop VALUE=false>
+<PARAM NAME=quality VALUE=low>
+<EMBED SRC="console-demo-02.swf" WIDTH=1262 HEIGHT=1000 quality=low loop=false TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
+</EMBED>
+</OBJECT>
+</center>
+</BODY>
+</HTML>

Added: labs/jbossesb/trunk/product/console/view/flash/console-demo-02.swf
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/console/view/flash/console-demo-02.swf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/jbossesb/trunk/product/console/view/transform/list-resources.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/list-resources.xhtml	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/console/view/transform/list-resources.xhtml	2007-01-24 15:49:17 UTC (rev 9008)
@@ -59,6 +59,7 @@
 
 <!-- sidebar -->
 <ui:define name="sidebar">
+	<b><h:form><h:commandButton value="Configure New Resource" action="#{newResource.selectResourceSpec}" /></h:form></b>
 	<b><h:form><h:commandButton value="Test Transformation" action="#{testTransformation.show}" /></h:form></b>
 	<b><h:form><h:commandButton value="Reset Message Exchange" action="#{messageExchangeSelect.showFrom}" /></h:form></b>
 	<p/>

Modified: 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-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/converters/SmooksTransformer.java	2007-01-24 15:49:17 UTC (rev 9008)
@@ -25,6 +25,7 @@
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.CharArrayWriter;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Serializable;
@@ -33,11 +34,23 @@
 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.ActionProcessingException;
 import org.jboss.soa.esb.actions.ActionProcessor;
 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;
@@ -47,6 +60,7 @@
 import org.milyn.container.standalone.StandaloneContainerRequest;
 import org.milyn.device.ident.UnknownDeviceException;
 import org.milyn.javabean.BeanAccessor;
+import org.milyn.resource.URIResourceLocator;
 import org.w3c.dom.Node;
 
 /**
@@ -54,8 +68,37 @@
  * <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
- * XML message transformations.  
+ * 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
  */
@@ -63,6 +106,10 @@
 public class SmooksTransformer implements TransformationService, ActionProcessor {
 
 	/**
+	 * 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.
 	 */
@@ -79,8 +126,9 @@
 	public static final String TO_TYPE = "to-type";
 	
     private static Logger logger = Logger.getLogger(SmooksTransformer.class);
-    private static final String SMOOKS_CDR_LST = "smooks-cdr.lst";
-    private static SmooksStandalone smooks;
+    private static volatile SmooksStandalone smooks;
+    @SuppressWarnings("unused")
+	private static ConfigurationUpdateListener updateListener = new ConfigurationUpdateListener();
     private String defaultMessageFromType;
     private String defaultMessageFrom;
     private String defaultMessageToType;
@@ -339,22 +387,24 @@
     protected void initSmooks(List<KeyValuePair> properties) throws ConfigurationException {
         synchronized (SmooksTransformer.class) {
             if(smooks == null) {
-                String cpPrefix;
+                String smooksCdrlFile;
                 SmooksStandalone localSmooksRef;
+                InputStream configListStream;
 
-                // The "cpPrefix" property is "private" and only here in order to make unit testing easier.
-                // It allows us to force a "bad" config location for the smooks-cdr.lst file....
-                cpPrefix = KeyValuePair.getValue("smooks-cdr.list-classpath-prefix", properties, "/");
-                if(!cpPrefix.startsWith("/")) {
-                    cpPrefix = "/" + cpPrefix;
-                }
-            	
-            	InputStream configListStream = getClass().getResourceAsStream(cpPrefix + SMOOKS_CDR_LST);
-                
+                // 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 ConfigurationException("Failed to locate Tranformation configuration list file [" + smooksCdrlFile + "].  This resource must be made available at the specified URI.", e);
+				}
                 if(configListStream == null) {
-                    throw new ConfigurationException("Failed to locate Smooks configuration list file [" + SMOOKS_CDR_LST + "].  The folder containing this file must be located at " + cpPrefix + " relative to the root of the classpath.");
+                    throw new ConfigurationException("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 ...
                 localSmooksRef = new SmooksStandalone("UTF-8");
                 
                 try {
@@ -363,6 +413,12 @@
                 } catch (Exception e) {
                 	localSmooksRef = null;
                     throw new ConfigurationException("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.");
@@ -381,8 +437,207 @@
      * Clears the internal static smooks instance.
      */
     public static void reset() {
+    	SmooksStandalone instance = smooks;
+    	
         synchronized (SmooksTransformer.class) {
-            smooks = null;
+        	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 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 disabled!", 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.");
+			SmooksTransformer.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 disabled!", 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 disabled!", 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 disabled!", 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);
+			} catch (ConfigurationException e) {
+				logger.error("Topic lookup failed for the Transformation configuration Update Listener.  Topic name '" + notificationTopic + "'. Update listener disabled!", e);
+				close();
+				return false;
+			} catch (NamingException e) {
+				logger.error("Topic lookup failed for the Transformation configuration Update Listener.  Topic name '" + notificationTopic + "'. Update listener disabled!", e);
+				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 disabled!", 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 disabled!", 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 disabled!", 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 disabled!", 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/rosetta/src/org/jboss/soa/esb/common/Configuration.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java	2007-01-24 15:49:17 UTC (rev 9008)
@@ -22,7 +22,13 @@
 
 package org.jboss.soa.esb.common;
 
+import javax.jms.ConnectionFactory;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.helpers.NamingContext;
 
 public class Configuration
 {
@@ -290,6 +296,67 @@
 		return property;
 	}
 	
+	/**
+	 * Construct a naming context based on the connection details outlined
+	 * in the named configuration module/section.
+	 * <p/>
+	 * The module/section parameters are:
+	 * <ol>
+	 * 	<li><b>{@link Context#PROVIDER_URL}</b>: Value defaults to "{@link NamingContext#JBOSS_PROVIDER_URL}".</li>
+	 * 	<li><b>{@link Context#INITIAL_CONTEXT_FACTORY}</b>: Value defaults to "{@link NamingContext#JBOSS_INITIAL_CONTEXT_FACTORY}".</li>
+	 * 	<li><b>{@link Context#URL_PKG_PREFIXES}</b>: Value defaults to "{@link NamingContext#JBOSS_URL_PKG_PREFIX}".</li>
+	 * </ol>
+	 * 
+	 * @param contextModuleName Conficuration module/section name.
+	 * @return The context instance.
+	 * @throws ConfigurationException Unable to connect to context.
+	 */
+	public static Context getNamingContext(String contextModuleName) throws ConfigurationException {
+		String providerUrl = ModulePropertyManager.getPropertyManager(contextModuleName).getProperty(Context.PROVIDER_URL, NamingContext.JBOSS_PROVIDER_URL);
+		String initialContextFactory = ModulePropertyManager.getPropertyManager(contextModuleName).getProperty(Context.INITIAL_CONTEXT_FACTORY, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
+		String urlPackagePrefix = ModulePropertyManager.getPropertyManager(contextModuleName).getProperty(Context.URL_PKG_PREFIXES, NamingContext.JBOSS_URL_PKG_PREFIX);
+		Context context;
+		
+		context = NamingContext.getServerContext(providerUrl, initialContextFactory, urlPackagePrefix);
+		if(context == null) {
+			// Would be nice if NamingContext.getServerContext threw an exception with
+			// details attached.
+			throw new ConfigurationException("Failed to JNDI context [" + contextModuleName + "].");
+		}
+		
+		return context;
+	}
 	
-	
+	/**
+	 * Lookup the JMS Connection Factory based on the connection details outlined
+	 * in the named configuration module/section.
+	 * <p/>
+	 * The module/section parameters are:
+	 * <ol>
+	 * 	<li><b>{@link Context#PROVIDER_URL}</b>: Value defaults to "{@link NamingContext#JBOSS_PROVIDER_URL}".</li>
+	 * 	<li><b>{@link Context#INITIAL_CONTEXT_FACTORY}</b>: Value defaults to "{@link NamingContext#JBOSS_INITIAL_CONTEXT_FACTORY}".</li>
+	 * 	<li><b>{@link Context#URL_PKG_PREFIXES}</b>: Value defaults to "{@link NamingContext#JBOSS_URL_PKG_PREFIX}".</li>
+	 * 	<li><b>javax.jms.ConnectionFactory</b>: Value defaults to "".</li>
+	 * </ol>
+	 * 
+	 * @param jmsConnectionFactoryModuleName Configuration module/section name.
+	 * @return The JMS ConnectionFactory instance.
+	 * @throws ConfigurationException Lookup failed either because it was unable to 
+	 * lookup the context, or the ConnectionFactory lookup failed.
+	 */
+	public static ConnectionFactory getJmsConnectionFactory(String jmsConnectionFactoryModuleName) throws ConfigurationException {
+		Context context = getNamingContext(jmsConnectionFactoryModuleName);
+		String connectionFactoryRuntime = ModulePropertyManager.getPropertyManager(jmsConnectionFactoryModuleName).getProperty(ConnectionFactory.class.getName(), "ConnectionFactory");
+		ConnectionFactory factory = null;
+		
+		try {
+			factory = (ConnectionFactory) context.lookup(connectionFactoryRuntime);
+		} catch (NamingException e) {
+			throw new ConfigurationException("JNDI lookup of JMS Connection Factory [" + connectionFactoryRuntime + "] failed.", e);
+		} catch (ClassCastException e) {
+			throw new ConfigurationException("JNDI lookup of JMS Connection Factory failed.  Class [" + connectionFactoryRuntime + "] is not an instance of [" + ConnectionFactory.class.getName() + "].", e);
+		}
+		
+		return factory;
+	}
 }
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/install/conf/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/install/conf/jbossesb-properties.xml	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/install/conf/jbossesb-properties.xml	2007-01-24 15:49:17 UTC (rev 9008)
@@ -61,16 +61,16 @@
     	<property name="abandoned-connection-time-interval" value="30000"/>
     </properties>
     <properties name="dbstore">
-		<property name="org.jboss.soa.esb.persistence.db.connection.url" 	value="jdbc:hsqldb:hsql://localhost:9001/jbossesb"/>
-		<property name="org.jboss.soa.esb.persistence.db.jdbc.driver" 		value="org.hsqldb.jdbcDriver"/>
-		<property name="org.jboss.soa.esb.persistence.db.user" 			value="sa"/>
-		<property name="org.jboss.soa.esb.persistence.db.pwd" 			value=""/>		
-		<property name="org.jboss.soa.esb.persistence.db.pool.initial.size"	value="2"/>
-		<property name="org.jboss.soa.esb.persistence.db.pool.min.size"	value="2"/>
-		<property name="org.jboss.soa.esb.persistence.db.pool.max.size"	value="5"/>
-		<!--table managed by pool to test for valid connections - created by pool automatically -->
-		<property name="org.jboss.soa.esb.persistence.db.pool.test.table"	value="pooltest"/>
-		<!-- # of milliseconds to timeout waiting for a connection from pool -->
+	<property name="org.jboss.soa.esb.persistence.db.connection.url" 	value="jdbc:hsqldb:hsql://localhost:9001/jbossesb"/>
+	<property name="org.jboss.soa.esb.persistence.db.jdbc.driver" 		value="org.hsqldb.jdbcDriver"/>
+	<property name="org.jboss.soa.esb.persistence.db.user" 			value="sa"/>
+	<property name="org.jboss.soa.esb.persistence.db.pwd" 			value=""/>		
+	<property name="org.jboss.soa.esb.persistence.db.pool.initial.size"	value="2"/>
+	<property name="org.jboss.soa.esb.persistence.db.pool.min.size"	value="2"/>
+	<property name="org.jboss.soa.esb.persistence.db.pool.max.size"	value="5"/>
+	<!--table managed by pool to test for valid connections - created by pool automatically -->
+	<property name="org.jboss.soa.esb.persistence.db.pool.test.table"	value="pooltest"/>
+	<!-- # of milliseconds to timeout waiting for a connection from pool -->
 		<property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis"	value="5000"/> 
     </properties>
     <properties name="messagerouting">

Modified: labs/jbossesb/trunk/product/install/deployment.properties-example
===================================================================
--- labs/jbossesb/trunk/product/install/deployment.properties-example	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/install/deployment.properties-example	2007-01-24 15:49:17 UTC (rev 9008)
@@ -9,7 +9,7 @@
 #
 # application server root directory
 # application server root directory
-org.jboss.esb.appserver.home=/jboss-4.0.5.GA
+org.jboss.esb.appserver.home=/jboss-4.0.4.GA
 # the instance of jboss you are running (default)
 org.jboss.esb.appserver.config=default
 #the place where the jbossesb libraries can be found

Modified: labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/jbossesb-properties.xml	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2POJO/jbossesb-properties.xml	2007-01-24 15:49:17 UTC (rev 9008)
@@ -81,4 +81,7 @@
     <properties name="messagerouting">
     	<property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
     </properties>
+    <properties name="transformation">
+    	<property name="java.naming.provider.url" value="localhost"/>
+    </properties>
 </esb>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_date_manipulation/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_date_manipulation/jbossesb-properties.xml	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_date_manipulation/jbossesb-properties.xml	2007-01-24 15:49:17 UTC (rev 9008)
@@ -81,4 +81,7 @@
     <properties name="messagerouting">
     	<property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
     </properties>
+    <properties name="transformation">
+    	<property name="java.naming.provider.url" value="localhost"/>
+    </properties>
 </esb>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_simple/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_simple/jbossesb-properties.xml	2007-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_XML2XML_simple/jbossesb-properties.xml	2007-01-24 15:49:17 UTC (rev 9008)
@@ -81,4 +81,7 @@
     <properties name="messagerouting">
     	<property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
     </properties>
+    <properties name="transformation">
+    	<property name="java.naming.provider.url" value="localhost"/>
+    </properties>
 </esb>

Modified: 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-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerConfig.xml	2007-01-24 15:49:17 UTC (rev 9008)
@@ -28,6 +28,5 @@
 		from="Acme"
 		to-type="Partner2-Order-XML"
 		to="AcmePartner2"
-	    smooks-cdr.list-classpath-prefix="org/jboss/soa/esb/actions/"
 		/>
 </SmooksTransformerTest>	

Modified: 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-01-24 13:33:32 UTC (rev 9007)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerTest.java	2007-01-24 15:49:17 UTC (rev 9008)
@@ -28,6 +28,7 @@
 
 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;
@@ -38,6 +39,11 @@
  * @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();




More information about the jboss-svn-commits mailing list