[jboss-svn-commits] JBL Code SVN: r7219 - in labs/jbossesb/trunk/product: core/listeners/src/org/jboss/soa/esb/listeners/message core/services/src/org/jboss/internal/soa/esb/persistence/format/db samples/trailblazer2/esb/conf samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/actions

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Oct 29 22:56:32 EST 2006


Author: daniel.brum at jboss.com
Date: 2006-10-29 22:56:27 -0500 (Sun, 29 Oct 2006)
New Revision: 7219

Modified:
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
   labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/db/DBConnectionManager.java
   labs/jbossesb/trunk/product/samples/trailblazer2/esb/conf/loanbroker-esb.xml
   labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/actions/LoanBrokerAction.java
Log:
bug fixes

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java	2006-10-30 03:12:08 UTC (rev 7218)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java	2006-10-30 03:56:27 UTC (rev 7219)
@@ -82,16 +82,15 @@
             	// The processing result of each action feeds into the processing of the next action...
                 try 
                 {
-                	// copy currentObject in Message body to 'previous' currentObject
-                	ActionUtils.copyCurrentToPrevious(_message);
                 	Message next = (Message)method.invoke(_currentProcessor,new Object[] {_message} );
                 	
-                    actionClassFinishedOk(oCurr);
+                    actionClassFinishedOk(oCurr,_message);
                     if(next==null)
                     {
                     	_logger.error(prematureTermination("returned <null> - Cannot continue"));
                     	return;
                     }
+                    _message = next;
                 }
                 catch (ClassCastException eCast)
                 {
@@ -99,10 +98,10 @@
                 	_logger.error(prematureTermination("returned a non Message Object)"));
                 	return;
                 }
-                catch (Exception e)
+                catch (InvocationTargetException e)
                 {
                 	// If action class threw exception, log and abort chain
-                    actionClassException(oCurr,e);
+                    actionClassException(oCurr,_message,e.getCause());
                     return;
                 }
             }
@@ -137,17 +136,17 @@
      * If 'current' action step was configured with a 'exceptionMethod' attribute
      * that method will be called with a single argument of type Exception 
      * @param tree ConfigTree - where to look for the exceptionMetod attribute
-     * @param thr Exception - to be used in invocation to method (if found)
+     * @param thrown Exception - to be used in invocation to method (if found)
      */
-    protected void actionClassException(ConfigTree tree, Exception thr)
+    protected void actionClassException(ConfigTree tree, Message msg,  Throwable thrown)
     {
-    	thr.printStackTrace();
+//    	thrown.printStackTrace();
     	String sMethod = obtainAttribute(tree,ListenerTagNames.EXCEPTION_METHOD_TAG,null);
     	if (null!=sMethod)
 	    	try
 	    	{
-	    		Method method = _currentClass.getMethod(sMethod,new Class[] {Exception.class});
-	    		method.invoke(_currentProcessor,new Object[] {thr} );
+	    		Method method = _currentClass.getMethod(sMethod,new Class[] {Message.class, Throwable.class});
+	    		method.invoke(_currentProcessor,new Object[] {msg, thrown} );
 	    	}
 	    	catch (NoSuchMethodException e) 	{_logger.error(e); }
 	    	catch (InvocationTargetException e) {_logger.error(e); }
@@ -159,14 +158,14 @@
      * that method will be called with no arguments 
      * @param tree ConfigTree - where to look for the okMetod attribute
      */
-    protected void actionClassFinishedOk(ConfigTree tree)
+    protected void actionClassFinishedOk(ConfigTree tree,Message msg)
     {
     	String sMethod = obtainAttribute(tree,ListenerTagNames.NORMAL_COMPLETION_METHOD_TAG,null);
     	if (null!=sMethod)
 	    	try
 	    	{
-	    		Method method = _currentClass.getMethod(sMethod,new Class[] {});
-	    		method.invoke(_currentProcessor,new Object[] {} );
+	    		Method method = _currentClass.getMethod(sMethod,new Class[] {Message.class});
+	    		method.invoke(_currentProcessor,new Object[] {msg} );
 	    	}
 	    	catch (NoSuchMethodException e) 	{_logger.error(e); }
 	    	catch (InvocationTargetException e) {_logger.error(e); }

Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/db/DBConnectionManager.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/db/DBConnectionManager.java	2006-10-30 03:12:08 UTC (rev 7218)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/db/DBConnectionManager.java	2006-10-30 03:56:27 UTC (rev 7219)
@@ -23,6 +23,8 @@
 
 import java.sql.Connection;
 
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.actions.templates.MockMessageAction;
 import org.jboss.soa.esb.common.Configuration;
 
 import com.mchange.v2.c3p0.ComboPooledDataSource;
@@ -36,7 +38,9 @@
 	
 	private static final Object foo = new Integer(0);
 	
+	private static Logger _logger = Logger.getLogger(DBConnectionManager.class);
 	
+	
 	protected DBConnectionManager() {}
 	
 	public static DBConnectionManager getInstance() {		
@@ -59,7 +63,7 @@
 	}
 	
 	private void init() throws Exception{
-		System.out.println("Initializing DBConnectionManager2...");		
+		_logger.info("Initializing DBConnectionManager");		
 		pooledDS = new ComboPooledDataSource();
 		
 		pooledDS.setDriverClass(Configuration.getStoreDriver());

Modified: labs/jbossesb/trunk/product/samples/trailblazer2/esb/conf/loanbroker-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/esb/conf/loanbroker-esb.xml	2006-10-30 03:12:08 UTC (rev 7218)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/esb/conf/loanbroker-esb.xml	2006-10-30 03:56:27 UTC (rev 7219)
@@ -10,7 +10,7 @@
     message-selector="service='loanRequest'"
    >
 	   <action class="org.jboss.soa.esb.samples.trailblazer.actions.LoanBrokerAction" process="processQuoteRequest" />
-   	   <action class="org.jboss.soa.esb.samples.trailblazer.actions.LoanBrokerAction" process="persistMessage" />
+   	   <action class="org.jboss.soa.esb.samples.trailblazer.actions.LoanBrokerAction" process="persistMessage" okMethod="persistOK" exceptionMethod="persistFail"/>
    </JmsQuoteRequest>
    
 </LoanBrokerESBExample>

Modified: labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/actions/LoanBrokerAction.java
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/actions/LoanBrokerAction.java	2006-10-30 03:12:08 UTC (rev 7218)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/actions/LoanBrokerAction.java	2006-10-30 03:56:27 UTC (rev 7219)
@@ -28,15 +28,24 @@
 		return message;
 	}
 	
-	public Message persistMessage(Message message) throws Exception {
-		System.out.println(this.getClass().getSimpleName() + " calling persistMessage()");
+	public Message persistMessage(Message message) throws Exception {		
 		
 		MessageStore store = MessageStoreFactory.getInstance().getMessageStore(MessageStoreType.DATABASE);
 		store.addMessage(message);
+		if (1 > 0)
+			throw new Exception ("The Dingo ate your baby! \n");
 		
 		return message;
 	}
 	
+	public void persistOK(Message msg) throws Exception {
+		_logger.info("*** NOTIFICATON *** Persist OK on Message: " + Util.serialize(msg));
+	}
+	
+	public void persistFail(Message msg, Throwable thrown) throws Exception {
+		_logger.error("*** NOTIFICATON *** Persist FAIL on Message with exception: " + thrown.toString());
+	}
+	
 	Object getMessagePayload() 
 	{ 
 		return new String(_message.getBody().getContents()); 




More information about the jboss-svn-commits mailing list