[jboss-svn-commits] JBL Code SVN: r8551 - in labs/jbossesb/trunk/product/samples/quickstarts/helloworld_file_action/src/quickstart: . hw_file_action

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Dec 22 12:23:02 EST 2006


Author: estebanschifman
Date: 2006-12-22 12:23:00 -0500 (Fri, 22 Dec 2006)
New Revision: 8551

Added:
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld_file_action/src/quickstart/hw_file_action/
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld_file_action/src/quickstart/hw_file_action/MyAction.java
Log:
change package name

Added: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_file_action/src/quickstart/hw_file_action/MyAction.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_file_action/src/quickstart/hw_file_action/MyAction.java	2006-12-22 16:54:49 UTC (rev 8550)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_file_action/src/quickstart/hw_file_action/MyAction.java	2006-12-22 17:23:00 UTC (rev 8551)
@@ -0,0 +1,60 @@
+package quickstart.hw_file_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 MyAction
+{
+    
+  protected ConfigTree	_config;
+	  
+  public MyAction(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("\nBEFORE\n");
+	   sb.append(contents);
+	   sb.append("\nAFTER\n");
+	   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




More information about the jboss-svn-commits mailing list