[jboss-svn-commits] JBL Code SVN: r8523 - in labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart: . helloworld_action helloworld_action/test

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Dec 21 14:46:02 EST 2006


Author: burrsutter
Date: 2006-12-21 14:46:01 -0500 (Thu, 21 Dec 2006)
New Revision: 8523

Added:
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/Launcher.java
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/MyJMSListenerAction.java
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/test/
Modified:
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/test/SendJMSMessage.java
Log:
using  the new package

Copied: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/Launcher.java (from rev 8486, labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/Launcher.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/Launcher.java	2006-12-21 11:08:12 UTC (rev 8486)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/Launcher.java	2006-12-21 19:46:01 UTC (rev 8523)
@@ -0,0 +1,80 @@
+package quickstart.helloworld_action;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.listeners.gateway.GatewayListenerController;
+import org.jboss.soa.esb.listeners.message.EsbListenerController;
+import org.jboss.soa.esb.listeners.message.EsbListenerControllerFactory;
+
+
+public class Launcher {	
+	private static Log log = LogFactory.getLog(Launcher.class);
+	
+	private EsbListenerController	_esbListController;
+	private GatewayListenerController _gatewayController;
+	
+	
+	
+	private Logger _logger = Logger.getLogger(Launcher.class);
+	
+	public static void main (String args[]) throws Exception {
+		
+		log.info("args passed into Launcher: " + args.length);
+		for (int x=0; x<args.length; x++)
+			log.info("arg[" + x + "]=" + args[x]);
+		
+		
+		Launcher launcher = new Launcher();
+		
+		launcher.triggerListener(Long.valueOf(args[0]).longValue(), args[1], args[2]);
+	
+	}
+	
+	private void triggerListener(long runTime, String messageAwareConfigFile, 
+		String gatewayConfigFile) throws Exception{
+		try 
+        {
+								
+    		if (null != messageAwareConfigFile) {
+    			_logger.info("starting message aware listener with config file - " + 
+    					messageAwareConfigFile);
+    			_esbListController = EsbListenerControllerFactory.getInstance(messageAwareConfigFile);
+    		}
+    		if (null != gatewayConfigFile) {
+    			_logger.info("starting gateway listener with config file - " + 
+    					gatewayConfigFile);
+    			_gatewayController = new GatewayListenerController(gatewayConfigFile);
+    			new Thread(_gatewayController).start();
+    			Thread.sleep(2000);
+    		}
+    		
+    		System.out.println("**Listener Ready**");
+    		
+//    		This code is used to automatically shutdown the listeners which
+//    		might be useful for automated testing purposes. It is not needed
+//    		in the quickstart samples.
+//    		_logger.info("going to sleep now for " + runTime + " milliseconds...");    		
+//    		Thread.sleep(runTime);
+//    		if (null != messageAwareConfigFile) {
+//    			_logger.info("shutting down message aware listener...");
+//    			_esbListController.requestEnd();
+//    		}
+//    		
+//    		if (null != gatewayConfigFile) {
+//    			_logger.info("shutting down gateway listener...");
+//    			_gatewayController.requestEnd();
+//    		}
+    		
+    	
+        }
+        catch (Exception e) { 
+        	_logger.error(e);
+        	throw(e);
+        }
+        
+	
+	}		
+	
+
+}
\ No newline at end of file

Copied: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/MyJMSListenerAction.java (from rev 8491, labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/MyJMSListenerAction.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/MyJMSListenerAction.java	2006-12-21 12:58:33 UTC (rev 8491)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/MyJMSListenerAction.java	2006-12-21 19:46:01 UTC (rev 8523)
@@ -0,0 +1,60 @@
+package quickstart.helloworld_action;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.Header;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.EPR;
+import org.apache.log4j.Logger;
+
+public class MyJMSListenerAction
+{
+    
+  protected ConfigTree	_config;
+	  
+  public MyJMSListenerAction(ConfigTree config) { _config = config; } 
+  
+  public Message noOperation(Message message) { return message; } 
+
+  public Message displayMessage(Message message) throws Exception{		
+		  logHeader();
+		  System.out.println("Body: " + new String(message.getBody().getContents()));
+		  logFooter();
+		  return message;         	
+	}
+  
+   public Message playWithMessage(Message message) throws Exception {
+	   Header msgHeader = message.getHeader();
+	   Body msgBody = message.getBody();
+	   Call theCall = msgHeader.getCall();
+	   EPR theEpr = theCall.getFrom();
+	   String contents = new String(msgBody.getContents());
+	   StringBuffer sb = new StringBuffer();
+	   sb.append("BEFORE\n");
+	   sb.append(contents);
+	   sb.append("\nAFTER");
+	   msgBody.setContents(sb.toString().getBytes());
+	   return message;
+   }
+   
+   public void exceptionHandler(Message message, Throwable exception) {
+	   logHeader();
+	   System.out.println("!ERROR!");
+	   System.out.println(exception.getMessage());
+	   System.out.println("For Message: ");
+	   System.out.println(message.getBody().getContents());
+	   logFooter();
+   }
+	
+   // This makes it easier to read on the console
+   private void logHeader() {
+	   System.out.println("\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+   }
+   private void logFooter() {
+	   System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n");
+   }
+    
+	
+}
\ No newline at end of file

Copied: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/test (from rev 8486, labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/test)

Modified: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/test/SendJMSMessage.java	2006-12-21 11:08:12 UTC (rev 8486)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/test/SendJMSMessage.java	2006-12-21 19:46:01 UTC (rev 8523)
@@ -1,4 +1,4 @@
-package quickstart.test;
+package quickstart.helloworld_action.test;
 
 import javax.naming.InitialContext;
 import javax.naming.NamingException;




More information about the jboss-svn-commits mailing list