[jboss-svn-commits] JBL Code SVN: r11448 - in labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr: src/org/jboss/soa/esb and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Apr 29 13:43:35 EDT 2007


Author: sebcao
Date: 2007-04-29 13:43:35 -0400 (Sun, 29 Apr 2007)
New Revision: 11448

Added:
   labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/
   labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/
   labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/
   labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/MyJMSListenerAction.java
   labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/ReturnJMSMessage.java
   labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/TeamAlert.java
Modified:
   labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/readme.txt
Log:
JBESB-403

Modified: labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/build.xml	2007-04-29 17:39:51 UTC (rev 11447)
+++ labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/build.xml	2007-04-29 17:43:35 UTC (rev 11448)
@@ -54,7 +54,7 @@
   <target name="runtest" depends="compile"
 	description="willl receive JMS message to tigger the actions in the ESB">
      <echo>Runs Test JMS Sender</echo>
-     <java fork="yes" classname="quickstart.test.SendJMSMessage" failonerror="true">
+     <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.funcbr.test.SendJMSMessage" failonerror="true">
 		<classpath refid="exec-classpath" />
      </java>
   </target>  
@@ -62,7 +62,7 @@
   <target name="receiveBlue" depends="compile"
 	description="willl receive a message from the quickstart_FunCBR_Green_Blue queue">
 	 <echo>Runs Test JMS Receiver</echo>
-	 <java fork="yes" classname="quickstart.test.ReceiveJMSMessage" failonerror="true">
+	 <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.funcbr.test.ReceiveJMSMessage" failonerror="true">
 	  	<arg value="queue/quickstart_Fun_CBR_Blue_Alert"/>
 		<classpath refid="exec-classpath" />
 	 </java>
@@ -71,7 +71,7 @@
   <target name="receiveRed" depends="compile"
 	description="willl receive a message from the quickstart_FunCBR_Green_Red queue">
 	 <echo>Runs Test JMS Receiver</echo>
-	 <java fork="yes" classname="quickstart.test.ReceiveJMSMessage" failonerror="true">
+	 <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.funcbr.test.ReceiveJMSMessage" failonerror="true">
 	   	<arg value="queue/quickstart_Fun_CBR_Red_Alert"/>
 		<classpath refid="exec-classpath" />
 	 </java>
@@ -80,7 +80,7 @@
   <target name="receiveGreen" depends="compile"
 	description="willl receive a message from the quickstart_FunCBR_Green_Alert queue">
 	 <echo>Runs Test JMS Receiver</echo>
-	 <java fork="yes" classname="quickstart.test.ReceiveJMSMessage" failonerror="true">
+	 <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.funcbr.test.ReceiveJMSMessage" failonerror="true">
 	   	<arg value="queue/quickstart_Fun_CBR_Green_Alert"/>
 		<classpath refid="exec-classpath" />
 	 </java>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/readme.txt	2007-04-29 17:39:51 UTC (rev 11447)
+++ labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/readme.txt	2007-04-29 17:43:35 UTC (rev 11448)
@@ -60,7 +60,7 @@
 		 </action>
 		 <action name="convertPOJO2Message" class="org.jboss.soa.esb.dvdstore.DVDStoreAction/>	
 		 <action name="displayAfterTransformer" 
-		   class="quickstart.MyJMSListenerAction" process="displayMessage" />  
+		   class="org.jboss.soa.esb.samples.quickstart.funcbr.MyJMSListenerAction" process="displayMessage" />  
 
 	10.	In the fifth command window, make sure to modify the SampleOrder.xml to change statusCode to 0 (or to whatever is appropriate 
 	per your routing rules) then execute "ant runtest" to see the transformed message in the Green Team's console.

Added: labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/MyJMSListenerAction.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/MyJMSListenerAction.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/MyJMSListenerAction.java	2007-04-29 17:43:35 UTC (rev 11448)
@@ -0,0 +1,62 @@
+/*
+ * 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.samples.quickstart.funcbr;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+
+public class MyJMSListenerAction extends AbstractActionLifecycle
+{
+    
+  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 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

Added: labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/ReturnJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/ReturnJMSMessage.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/ReturnJMSMessage.java	2007-04-29 17:43:35 UTC (rev 11448)
@@ -0,0 +1,69 @@
+/*
+ * 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.samples.quickstart.funcbr;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.jms.JMSException;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.QueueSender;
+import javax.jms.ObjectMessage;
+import javax.jms.TextMessage;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import org.jboss.soa.esb.message.Message;
+
+public class ReturnJMSMessage {
+       
+    public static void sendMessage(Message esbMessage,String newDestination) throws JMSException, NamingException, Exception {
+    	if (esbMessage == null || newDestination == null) 
+    		throw new Exception("Message and JMS Destination are required");
+    
+    	QueueConnection conn;
+        QueueSession session;
+        Queue que;
+        
+    	InitialContext iniCtx = new InitialContext();
+    	Object tmp = iniCtx.lookup("ConnectionFactory");
+    	QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+    	conn = qcf.createQueueConnection();
+    	que = (Queue) iniCtx.lookup("queue/" + newDestination);
+    	session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+    	conn.start();
+
+    	    	   
+    	String newMsg = new String(esbMessage.getBody().getContents());
+
+    	
+    	QueueSender send = session.createSender(que);        
+        TextMessage tm = session.createTextMessage(newMsg);
+        send.send(tm);
+        
+
+    	conn.stop();
+    }    
+    
+}
\ No newline at end of file

Added: labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/TeamAlert.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/TeamAlert.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/TeamAlert.java	2007-04-29 17:43:35 UTC (rev 11448)
@@ -0,0 +1,85 @@
+/*
+ * 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.samples.quickstart.funcbr;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+public class TeamAlert {
+	
+	  protected Message  _message;
+	  protected ConfigTree	_config;
+	  
+	  public TeamAlert (ConfigTree config) { _config = config; } 
+	  	  
+	  public Message sendResponseBlue(Message message) {
+		  try {
+			   logHeader();
+			   System.out.println(new String(message.getBody().getContents()));
+			   System.out.println("Blue Blue Blue");
+			   logFooter();
+			   ReturnJMSMessage.sendMessage(message,"quickstart_Fun_CBR_Blue_Alert");
+		   } catch (Exception e) {
+			   logHeader();
+			   System.out.println(e.getMessage());
+			   logFooter();
+		   }
+		   return message;
+	  }
+	  
+	  public Message sendResponseRed(Message message) {
+		  try {
+			   logHeader();
+			   System.out.println(new String(message.getBody().getContents()));
+			   System.out.println("Red Red Red");
+			   logFooter();
+			   ReturnJMSMessage.sendMessage(message,"quickstart_Fun_CBR_Red_Alert");
+		   } catch (Exception e) {
+			   logHeader();
+			   System.out.println(e.getMessage());
+			   logFooter();
+		   }
+		   return message;
+	  }
+
+	  public Message sendResponseGreen(Message message) {
+		  try {
+			   logHeader();
+			   System.out.println(new String(message.getBody().getContents()));
+			   System.out.println("Green Green Green");
+			   logFooter();
+			   ReturnJMSMessage.sendMessage(message,"quickstart_Fun_CBR_Green_Alert");
+		   } catch (Exception e) {
+			   logHeader();
+			   System.out.println(e.getMessage());
+			   logFooter();
+		   }
+		   return message;
+	  }
+	  
+	  private void logHeader() {
+		  System.out.println("\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+	  }
+	  private void logFooter() {
+		  System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n");
+	  }
+	
+}




More information about the jboss-svn-commits mailing list