[jboss-svn-commits] JBL Code SVN: r10297 - in labs/jbossesb/trunk/product: core/listeners/tests/src/org/jboss/soa/esb/listeners/message and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Mar 17 05:04:56 EDT 2007


Author: kevin.conner at jboss.com
Date: 2007-03-17 05:04:56 -0400 (Sat, 17 Mar 2007)
New Revision: 10297

Modified:
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessorMethodInfo.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipelineUnitTest.java
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/jboss-esb.xml
Log:
Changed to work on embedded properties instead of attributes

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessorMethodInfo.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessorMethodInfo.java	2007-03-17 02:06:52 UTC (rev 10296)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessorMethodInfo.java	2007-03-17 09:04:56 UTC (rev 10297)
@@ -207,12 +207,32 @@
         final String processMethod = actionConfig.getAttribute(ListenerTagNames.PROCESS_METHOD_TAG) ;
         if (processMethod == null || ActionPipelineProcessor.PROCESS_METHOD.equals(processMethod))
         {
-            final String successMethod = actionConfig.getAttribute(ListenerTagNames.NORMAL_COMPLETION_METHOD_TAG) ;
-            if (successMethod == null || ActionPipelineProcessor.PROCESS_SUCCESS_METHOD.equals(successMethod))
+            final ConfigTree[] properties = actionConfig.getChildren(ListenerTagNames.ACTION_PROPERTY_TAG) ;
+            final int numProperties = (properties == null ? 0 : properties.length) ;
+            if (numProperties > 0)
             {
-                final String exceptionMethod = actionConfig.getAttribute(ListenerTagNames.EXCEPTION_METHOD_TAG) ;
-                return ((exceptionMethod != null) && !ActionPipelineProcessor.PROCESS_EXCEPTION_METHOD.equals(exceptionMethod)) ;
+                for(int count = 0 ; count < numProperties ; count++)
+                {
+                    final ConfigTree property = properties[count] ;
+                    final String name = property.getAttribute("name") ;
+                    final String value = property.getAttribute("value") ;
+                    if (ListenerTagNames.NORMAL_COMPLETION_METHOD_TAG.equals(name))
+                    {
+                        if ((value != null) && !ActionPipelineProcessor.PROCESS_SUCCESS_METHOD.equals(value))
+                        {
+                            return true ;
+                        }
+                    }
+                    if (ListenerTagNames.EXCEPTION_METHOD_TAG.equals(name))
+                    {
+                        if ((value != null) && !ActionPipelineProcessor.PROCESS_EXCEPTION_METHOD.equals(value))
+                        {
+                            return true ;
+                        }
+                    }
+                }
             }
+            return false ;
         }
         return true ;
     }
@@ -232,10 +252,10 @@
             final String processMethodName = actionConfig.getAttribute(ListenerTagNames.PROCESS_METHOD_TAG, ActionPipelineProcessor.PROCESS_METHOD) ;
             final Method[] processMethods = getMethods(actionClass, processMethodName, Message.class);
             
-            final String processSuccessName = actionConfig.getAttribute(ListenerTagNames.NORMAL_COMPLETION_METHOD_TAG) ;
+            final String processSuccessName = getPropertyValue(actionConfig, ListenerTagNames.NORMAL_COMPLETION_METHOD_TAG) ;
             final Method processSuccess = getMethod(actionClass, processSuccessName, Message.class);
             
-            final String processExceptionName = actionConfig.getAttribute(ListenerTagNames.EXCEPTION_METHOD_TAG) ;
+            final String processExceptionName = getPropertyValue(actionConfig, ListenerTagNames.EXCEPTION_METHOD_TAG) ;
             final Method processException = getMethod(actionClass, processExceptionName, Message.class, Exception.class) ;
             
             return new ActionProcessorMethodInfo(processMethods, processSuccess, processException) ;
@@ -247,6 +267,31 @@
     }
     
     /**
+     * Get the value of an action property.
+     * @param actionConfig The action configuration.
+     * @param propertyName The name of the property.
+     * @return The value of the property or null.
+     */
+    private static String getPropertyValue(final ConfigTree actionConfig, final String propertyName)
+    {
+        final ConfigTree[] properties = actionConfig.getChildren(ListenerTagNames.ACTION_PROPERTY_TAG) ;
+        final int numProperties = (properties == null ? 0 : properties.length) ;
+        if (numProperties > 0)
+        {
+            for(int count = 0 ; count < numProperties ; count++)
+            {
+                final ConfigTree property = properties[count] ;
+                final String name = property.getAttribute("name") ;
+                if (propertyName.equals(name))
+                {
+                    return property.getAttribute("value") ;
+                }
+            }
+        }
+        return null ;
+    }
+    
+    /**
      * Get the methods specified by the list.
      * @param actionClass The action class
      * @param methodNameList The list of method names

Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipelineUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipelineUnitTest.java	2007-03-17 02:06:52 UTC (rev 10296)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipelineUnitTest.java	2007-03-17 09:04:56 UTC (rev 10297)
@@ -344,14 +344,21 @@
         }
         if (successOverride != null)
         {
-            actionChild.setAttribute(ListenerTagNames.NORMAL_COMPLETION_METHOD_TAG, successOverride) ;
+            addProperty(actionChild, ListenerTagNames.NORMAL_COMPLETION_METHOD_TAG, successOverride) ;
         }
         if (exceptionOverride != null)
         {
-            actionChild.setAttribute(ListenerTagNames.EXCEPTION_METHOD_TAG, exceptionOverride) ;
+            addProperty(actionChild, ListenerTagNames.EXCEPTION_METHOD_TAG, exceptionOverride) ;
         }
     }
     
+    private void addProperty(final ConfigTree actionChild, final String name, final String value)
+    {
+        final ConfigTree property = new ConfigTree(ListenerTagNames.ACTION_PROPERTY_TAG, actionChild) ;
+        property.setAttribute("name", name) ;
+        property.setAttribute("value", value) ;
+    }
+    
     private void checkOrder(final Integer[] list, int ... values)
     {
         final int numValues = (values == null ? 0 : values.length) ;

Modified: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/jboss-esb.xml	2007-03-17 02:06:52 UTC (rev 10296)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/jboss-esb.xml	2007-03-17 09:04:56 UTC (rev 10297)
@@ -40,13 +40,13 @@
                <action name="displayAction" 
                		class="quickstart.helloworld_action.MyJMSListenerAction" 
                		process="displayMessage">
-               		<!-- property name="exceptionMethod" value="exceptionHandler"/ -->
+               		<property name="exceptionMethod" value="exceptionHandler"/>
                </action>
   			   <action name="playAction" 
   			   		class="quickstart.helloworld_action.MyJMSListenerAction" 
   			   		process="playWithMessage">
   	               
-               		<!-- property name="exceptionMethod" value="exceptionHandler"/ -->
+               		<property name="exceptionMethod" value="exceptionHandler"/>
   			   </action>
                <action name="notificationAction" 
                		class="org.jboss.soa.esb.actions.Notifier">




More information about the jboss-svn-commits mailing list