[jboss-svn-commits] JBL Code SVN: r12095 - in labs/jbossesb/workspace/dbevenius/product: core/listeners/src/org/jboss/soa/esb/actions/soap and 13 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed May 23 03:20:27 EDT 2007
Author: beve
Date: 2007-05-23 03:20:26 -0400 (Wed, 23 May 2007)
New Revision: 12095
Added:
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/actions/soap/SOAPClient.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JmsEndpoint.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ErrorActionProcessor.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/NPEActionProcessor.java
labs/jbossesb/workspace/dbevenius/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/OGNLUtils.java
Removed:
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/webservice_bpel/soapui-client/
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/webservice_bpel/src/org/jboss/soa/esb/actions/soap/
Modified:
labs/jbossesb/workspace/dbevenius/product/.classpath
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerUtil.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/ServiceInvoker.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListener.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JcaInflowGateway.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipelineUnitTest.java
labs/jbossesb/workspace/dbevenius/product/etc/schemas/xml/jbossesb-1.0.1.xsd
labs/jbossesb/workspace/dbevenius/product/install/standalone/jbossesb-server-base.zip
labs/jbossesb/workspace/dbevenius/product/lib/ext/xbean.jar
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/webservice_bpel/build.xml
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/webservice_bpel/jboss-esb.xml
labs/jbossesb/workspace/dbevenius/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java
Log:
Merge from main 12057:12094
Modified: labs/jbossesb/workspace/dbevenius/product/.classpath
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/.classpath 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/.classpath 2007-05-23 07:20:26 UTC (rev 12095)
@@ -17,18 +17,13 @@
<classpathentry kind="lib" path="lib/ext/commons-collections-2.0.jar"/>
<classpathentry kind="lib" path="lib/ext/commons-collections-3.2.jar"/>
<classpathentry kind="lib" path="lib/ext/commons-dbcp-1.2.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/commons-jci-core-1.0-406301.jar"/>
- <classpathentry kind="lib" path="lib/ext/commons-jci-janino-2.4.3.jar"/>
<classpathentry kind="lib" path="lib/ext/commons-lang-2.1.jar"/>
<classpathentry kind="lib" path="lib/ext/commons-logging.jar"/>
- <classpathentry kind="lib" path="lib/ext/drools-compiler-3.0.4.jar"/>
- <classpathentry kind="lib" path="lib/ext/drools-core-3.0.4.jar"/>
<classpathentry kind="lib" path="lib/ext/emma_ant.jar"/>
<classpathentry kind="lib" path="lib/ext/emma.jar"/>
<classpathentry kind="lib" path="lib/ext/groovy-all-1.0.jar"/>
<classpathentry kind="lib" path="lib/ext/hsqldb.jar"/>
<classpathentry kind="lib" path="lib/ext/jakarta-oro-2.0.8.jar"/>
- <classpathentry kind="lib" path="lib/ext/janino-2.4.3.jar"/>
<classpathentry kind="lib" path="lib/ext/jaxr-api-1.0-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/ext/jbossall-client.jar"/>
<classpathentry kind="lib" path="lib/ext/jboss-system.jar"/>
Copied: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/actions/soap/SOAPClient.java (from rev 12094, labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/SOAPClient.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/actions/soap/SOAPClient.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/actions/soap/SOAPClient.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -0,0 +1,121 @@
+package org.jboss.soa.esb.actions.soap;
+
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.ActionUtils;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.apache.log4j.Logger;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.HttpClient;
+
+import javax.management.*;
+import java.util.Map;
+import java.io.IOException;
+
+/**
+ * SOAP Client action processor.
+ * <p/>
+ * Uses the SOAPUI Client Service to construct an populate a message
+ * for the target service. This action then routes that message to the service.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class SOAPClient extends AbstractActionPipelineProcessor {
+
+ private Logger logger = Logger.getLogger(SOAPClient.class);
+ private String wsdl;
+ private String operation;
+ private String paramsLocation;
+ private String responseLocation;
+ private MBeanServer mbeanServer;
+ private ObjectName serviceName;
+ private String[] buildRequestSig = new String[] {String.class.getName(), String.class.getName(), Map.class.getName()};
+ private String[] getEndpointSig = new String[] {String.class.getName()};
+
+ public SOAPClient(ConfigTree config) throws ConfigurationException {
+ wsdl = config.getRequiredAttribute("wsdl");
+ operation = config.getRequiredAttribute("operation");
+ paramsLocation = config.getAttribute("paramsLocation");
+ responseLocation = config.getAttribute("responseLocation");
+ mbeanServer = MBeanServerLocator.locate();
+
+ try {
+ serviceName = new ObjectName("jboss.esb:service=SoapUIClientService");
+ } catch (MalformedObjectNameException e) {
+ throw new IllegalStateException("Unexpected exception.", e);
+ }
+ }
+
+ public Message process(final Message message) throws ActionProcessingException {
+ Map params;
+
+ if(paramsLocation != null) {
+ params = (Map) message.getBody().get(paramsLocation);
+ } else {
+ params = (Map) message.getBody().get();
+ if(params == null) {
+ params = (Map) ActionUtils.getTaskObject(message);
+ }
+ }
+ if(params == null) {
+ throw new ActionProcessingException("No params. SOAP message parameters must either be set as the default message body payload, or set on the body under the key defined in the 'paramsLocation' acton property.");
+ } else if(params.isEmpty()) {
+ logger.warn("Params Map found in message, but the map is empty.");
+ }
+
+ String request = buildRequestMessage(params);
+ String response = invokeEndpoint(request);
+
+ if(responseLocation != null) {
+ message.getBody().add(responseLocation, response);
+ } else {
+ message.getBody().add(response);
+ ActionUtils.setTaskObject(message, response);
+ }
+
+ return message;
+ }
+
+ private String buildRequestMessage(Map params) throws ActionProcessingException {
+ try {
+ return (String) mbeanServer.invoke(serviceName, "buildRequest", new Object[] {wsdl, operation, params}, buildRequestSig);
+ } catch (InstanceNotFoundException e) {
+ throw new ActionProcessingException("SOAP UI Client Service not found under name '" + serviceName.getCanonicalName() + "'. This service must be deployed before this action can be used.", e);
+ } catch (MBeanException e) {
+ throw new ActionProcessingException(e);
+ } catch (ReflectionException e) {
+ throw new ActionProcessingException(e);
+ }
+ }
+
+ private String getEndpoint() throws ActionProcessingException {
+ try {
+ return (String) mbeanServer.invoke(serviceName, "getEndpoint", new Object[] {wsdl}, getEndpointSig);
+ } catch (InstanceNotFoundException e) {
+ throw new ActionProcessingException("SOAP UI Client Service not found under name '" + serviceName.getCanonicalName() + "'. This service must be deployed before this action can be used.", e);
+ } catch (MBeanException e) {
+ throw new ActionProcessingException(e);
+ } catch (ReflectionException e) {
+ throw new ActionProcessingException(e);
+ }
+ }
+
+ private String invokeEndpoint(String request) throws ActionProcessingException {
+ PostMethod post = new PostMethod(getEndpoint());
+
+ post.setRequestHeader("SOAPAction", operation);
+ post.setRequestBody(request);
+ HttpClient httpclient = new HttpClient();
+ try {
+ int result = httpclient.executeMethod(post);
+ return post.getResponseBodyAsString();
+ } catch (IOException e) {
+ throw new ActionProcessingException("Failed to invoke SOAP Endpoint: '" + getEndpoint() + " ' - '" + operation + "'.", e);
+ } finally {
+ post.releaseConnection();
+ }
+ }
+}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerTagNames.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerTagNames.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -68,6 +68,8 @@
/** Gateway Composer */
public static final String GATEWAY_COMPOSER_CLASS_TAG = "composer-class";
public static final String GATEWAY_COMPOSER_METHOD_TAG = "composer-process";
+ public static final String GATEWAY_RESPONDER_METHOD_TAG = "responder-process";
+ public static final String GATEWAY_WAIT_MILLIS_TAG = "max-millis-for-response";
/** Routing */
public static final String DESTINATION_NAME_TAG = "destination-name";
/** Content Based Routing */
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerUtil.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerUtil.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerUtil.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -365,6 +365,43 @@
_logger.debug("No value specified for " + tag + " attribute"
+ " - Using default value: '" + defaultValue + "'");
} // ________________________________
+
+ public static long getMaxMillisGatewayWait(ConfigTree tree, Logger logr, boolean hasResponder)
+ throws ConfigurationException
+ {
+ long maxWait = -1;
+ String sAux = tree.getAttribute(ListenerTagNames.GATEWAY_WAIT_MILLIS_TAG);
+ if (!Util.isNullString(sAux))
+ {
+ try
+ {
+ maxWait = Long.parseLong(sAux);
+ if (maxWait < 1)
+ logr.warn("Value specified for "
+ + ListenerTagNames.GATEWAY_WAIT_MILLIS_TAG
+ + " ("+maxWait
+ +") implies that this will be an 'inbound-only' gateway");
+ else if (! hasResponder)
+ throw new ConfigurationException(
+ "For two-way gateways (max-millis-for-response>0)"
+ +", you must specify the '"
+ +ListenerTagNames.GATEWAY_RESPONDER_METHOD_TAG
+ +"' attribute");
+ }
+ catch (NumberFormatException e)
+ {
+ throw new ConfigurationException("Invalid value for "
+ +ListenerTagNames.GATEWAY_WAIT_MILLIS_TAG,e);
+ }
+ }
+ else
+ {
+ logr.warn("No value specified for: "
+ + ListenerTagNames.GATEWAY_WAIT_MILLIS_TAG
+ + " - This will be an 'inbound-only' gateway");
+ }
+ return maxWait;
+ } //________________________________
private static final Logger _logger = Logger.getLogger(ListenerUtil.class);
}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/ServiceInvoker.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/ServiceInvoker.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/ServiceInvoker.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -90,7 +90,6 @@
Courier courier = CourierFactory.getCourier(current);
try
{
- System.out.println("Trying EPR: " + current);
if (courier.deliver(message))
{
bSent = true;
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -108,12 +108,15 @@
return controller;
}
+ else
+ {
+ throw new IllegalStateException("ESB file had validation errors.");
+
+ }
}
catch (Exception e)
{
throw new RuntimeException(e);
}
-
- return null;
}
}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -102,8 +102,8 @@
// Of course we could do the following reflectively if we really want to - TODO perhaps!!
if(listener instanceof JmsListener) {
listenerConfigTree = JmsListenerMapper.map(root, (JmsListener)listener, model);
- } else if(listener instanceof FsListener) {
- listenerConfigTree = FsListenerMapper.map(root, (FsListener)listener, model);
+ } else if(listener instanceof FsListener) {
+ listenerConfigTree = FsListenerMapper.map(root, (FsListener)listener, model);
} else if (listener instanceof FtpListener) {
listenerConfigTree = FtpListenerMapper.map(root, (FtpListener)listener, model);
} else if (listener instanceof SqlListener) {
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -39,6 +39,7 @@
import org.jboss.soa.esb.listeners.config.mappers.JmsListenerMapper;
import org.jboss.soa.esb.listeners.config.mappers.SqlListenerMapper;
import org.jboss.soa.esb.listeners.config.mappers.UntypedListenerMapper;
+import org.jboss.soa.esb.listeners.config.mappers.JcaGatewayMapper;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -99,6 +100,8 @@
JmsListenerMapper.map(root, (JmsListener)gateway, model);
} else if (gateway instanceof FsListener){
FsListenerMapper.map(root, (FsListener)gateway, model);
+ } else if(gateway instanceof JcaGatewayDocument.JcaGateway) {
+ JcaGatewayMapper.map(root, (JcaGatewayDocument.JcaGateway)gateway, model);
} else if (gateway instanceof FtpListener) {
FtpListenerMapper.map(root, (FtpListener)gateway, model);
} else if (gateway instanceof SqlListener) {
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -287,8 +287,12 @@
throw new IllegalStateException("No Provider instance found for the supplied Bus config instance. This should not be possible if the Bus instance was provided by this configuration. Where has this Bus instance come from?");
}
-
- /**
+ private boolean isGateway(Listener listener)
+ {
+ return listener.getIsGateway() || (listener instanceof JcaGatewayDocument.JcaGateway);
+ }
+
+ /**
* Get the list of ESB Listeners based on their Gateway flag.
* @return The list of ESB Aware or Gateway Listeners from the configuration.
* @param isGateway Is the listener a gateway or ESB aware listener.
@@ -300,7 +304,7 @@
for(Service service : services) {
for(Listener listener : service.getListeners().getListenerList()) {
- if(listener.getIsGateway() == isGateway) {
+ if(isGateway(listener) == isGateway) {
gateways.add(listener);
}
}
Copied: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java (from rev 12094, labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY 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 along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.listeners.config.mappers;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.dom.YADOMUtil;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.config.Generator;
+import org.jboss.soa.esb.listeners.config.JcaGatewayDocument.JcaGateway;
+import org.jboss.soa.esb.listeners.config.ServiceDocument;
+import org.jboss.soa.esb.listeners.jca.JcaInflowGateway;
+import org.w3c.dom.Element;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class JcaGatewayMapper
+{
+ public static Element map(Element root, JcaGateway gateway, Generator.XMLBeansModel model) throws ConfigurationException
+ {
+ Element listenerNode = YADOMUtil.addElement(root, gateway.getName());
+ gateway.setIsGateway(true);
+
+ ServiceDocument.Service service = model.getService(gateway);
+ listenerNode.setAttribute(ListenerTagNames.SERVICE_DESCRIPTION_TAG, service.getDescription());
+ listenerNode.setAttribute(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG, service.getCategory());
+ listenerNode.setAttribute(ListenerTagNames.TARGET_SERVICE_NAME_TAG, service.getName());
+
+ listenerNode.setAttribute("adapter", gateway.getAdapter());
+ listenerNode.setAttribute("endpointClass", gateway.getEndpointClass());
+ listenerNode.setAttribute("messagingType", gateway.getMessagingType());
+ listenerNode.setAttribute("jcaBridge", gateway.getJcaBridge());
+
+ MapperUtil.mapProperties(gateway.getPropertyList(), listenerNode);
+ listenerNode.setAttribute("gatewayClass", JcaInflowGateway.class.getName());
+ Element activationConfig = YADOMUtil.addElement(listenerNode, "activation-config");
+ MapperUtil.serialize(gateway.getActivationConfig(), activationConfig);
+
+
+ YADOMUtil.removeEmptyAttributes(listenerNode);
+ return listenerNode;
+ }
+}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -40,7 +40,9 @@
import org.jboss.soa.esb.couriers.Courier;
import org.jboss.soa.esb.couriers.CourierException;
import org.jboss.soa.esb.couriers.CourierFactory;
+import org.jboss.soa.esb.couriers.CourierTimeoutException;
import org.jboss.soa.esb.couriers.CourierUtil;
+import org.jboss.soa.esb.couriers.TwoWayCourier;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.ListenerTagNames;
import org.jboss.soa.esb.listeners.ListenerUtil;
@@ -49,6 +51,7 @@
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleThreadState;
import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.services.registry.RegistryException;
import org.jboss.soa.esb.util.ClassUtil;
import org.jboss.soa.esb.util.Util;
@@ -77,6 +80,8 @@
abstract void getDefaultComposer() throws GatewayException;
+ abstract void bytesToFile(byte[] bytes, File file) throws GatewayException;
+
protected AbstractFileGateway(ConfigTree config) throws ConfigurationException, RegistryException, GatewayException
{
super(config) ;
@@ -110,13 +115,17 @@
*/
protected void doRun()
{
- if (_logger.isDebugEnabled())
- {
+
+ EPR replyEpr = null;
+ Message replyMsg = null;
+
+ if (_logger.isDebugEnabled())
+ {
_logger.debug("run() method of " + this.getClass().getSimpleName()
+ " started on thread " + Thread.currentThread().getName());
- }
+ }
- do
+ do
{
File[] fileList;
try
@@ -159,6 +168,7 @@
continue;
}
boolean bSent = false;
+
Message outMessage = (Message) obj;
outMessage.getProperties().setProperty(ORIGINAL_FILE_NAME_MSG_PROP, fileIn.getName());
for (EPR current : _targetEprs)
@@ -178,20 +188,26 @@
{
_logger.error("Problems with file EPR", e); }
}
-// _courier = CourierFactory.getCourier(current);
_courier = getCourier(current);
- try
- {
- if (_courier.deliver(outMessage))
- {
- bSent = true;
- break;
- }
- }
- finally
- {
- CourierUtil.cleanCourier(_courier) ;
- }
+ try
+ {
+ replyEpr = null;
+ outMessage.getHeader().getCall().setTo(current);
+ if (_maxMillisForResponse>0)
+ {
+ replyEpr = CourierUtil.getDefaultReplyToEpr(current);
+ outMessage.getHeader().getCall().setReplyTo(replyEpr);
+ }
+ if (_courier.deliver(outMessage))
+ {
+ bSent = true;
+ break;
+ }
+ }
+ finally
+ {
+ CourierUtil.cleanCourier(_courier) ;
+ }
}
if (!bSent)
@@ -201,6 +217,31 @@
+ "> is not registered";
thrown = new Exception(text);
}
+ else if (null!=replyEpr)
+ {
+ TwoWayCourier replyCourier = CourierFactory.getPickupCourier(replyEpr);
+ try
+ {
+ replyMsg = replyCourier.pickup(_maxMillisForResponse);
+ _responderMethod.invoke(_composer, new Object[] {replyMsg,fileIn});
+ }
+ catch (CourierTimeoutException e)
+ {
+ thrown = e;
+ text = "Expected response was not received from invoked service";
+ replyMsg = MessageFactory.getInstance().getMessage();
+ String timedOut = "Service <"
+ +_targetServiceCategory+","+"_targetServiceName"
+ +"> timed out without sending response";
+ replyMsg.getBody().setByteArray(timedOut.getBytes());
+ _responderMethod.invoke(_composer, new Object[] {replyMsg,fileIn});
+ }
+ finally
+ {
+ if (null!=replyCourier)
+ CourierUtil.cleanCourier(replyCourier);
+ }
+ }
}
catch (InvocationTargetException e)
{
@@ -390,6 +431,9 @@
resolveComposerClass();
+ boolean hasResponder = _responderMethod!=null;
+ _maxMillisForResponse = ListenerUtil.getMaxMillisGatewayWait
+ (_config, _logger, hasResponder);
try
{
// INPUT directory and suffix (used for FileFilter)
@@ -472,9 +516,10 @@
protected void resolveComposerClass() throws ConfigurationException, GatewayException
{
+ String sProcessMethod = null;
+ String sResponderMethod = null;
try
{
- String sProcessMethod = null;
_composerName = _config.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_CLASS_TAG);
if (null != _composerName)
{ // class attribute
@@ -483,15 +528,21 @@
{ ConfigTree.class });
_composer = oConst.newInstance(_config);
sProcessMethod = _config.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_METHOD_TAG, "process");
+ sResponderMethod = _config.getAttribute(ListenerTagNames.GATEWAY_RESPONDER_METHOD_TAG);
}
else
{
getDefaultComposer();
- sProcessMethod = "process";
+ sProcessMethod = "process";
+ sResponderMethod = "respond";
}
- _processMethod = _composerClass.getMethod(sProcessMethod, new Class[]
- { Object.class });
+ _processMethod = _composerClass.getMethod
+ (sProcessMethod, new Class[]{ Object.class });
+
+ _responderMethod = (null==sResponderMethod) ? null
+ : _composerClass.getMethod(sResponderMethod
+ , new Class[] {Message.class, File.class});
}
catch (InvocationTargetException ex)
{
@@ -533,6 +584,7 @@
protected ConfigTree _config;
protected long _sleepBetweenPolls; // milliseconds
+ protected long _maxMillisForResponse;
protected String _targetServiceCategory, _targetServiceName;
@@ -545,6 +597,7 @@
protected Object _composer;
protected Method _processMethod;
+ protected Method _responderMethod;
protected Courier _courier;
@@ -559,4 +612,5 @@
/** Message property name for original filename */
public static final String ORIGINAL_FILE_NAME_MSG_PROP = "org.jboss.soa.esb.gateway.original.file.name";
+
} // ____________________________________________________________________________
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListener.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListener.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -26,9 +26,11 @@
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.addressing.eprs.FileEpr;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.ListenerTagNames;
import org.jboss.soa.esb.message.Message;
@@ -173,6 +175,23 @@
+ " - Using default composer class : " + _composerName);
}
+ @Override
+ void bytesToFile(byte[] bytes, File file) throws GatewayException
+ {
+ try
+ {
+ if (file.exists() && !file.delete())
+ throw new GatewayException("Unable to delete existing file "+file);
+ FileOutputStream out = new FileOutputStream(file);
+ out.write(bytes);
+ out.close();
+ }
+ catch (Exception e)
+ {
+ throw new GatewayException(e);
+ }
+ }
+
// ______________________________________________________________________________
/**
* Default gateway action for files <p/>It will just drop the file contents
@@ -199,6 +218,14 @@
{
return getFileContents(file);
}
+
+ public void respond(Message msg, File file) throws Exception
+ {
+ File responseFile = new File(file.getParent(),file.getName()
+ + FileEpr.DEFAULT_REPLY_TO_FILE_SUFFIX+"_gw");
+ bytesToFile(msg.getBody().getByteArray(), responseFile);
+ }
+
} // ____________________________________________________
/**
@@ -281,4 +308,5 @@
private FileFilter _inputFileFilter; // normal file filter
private FileFilter _ignoreFileFilter; // worker file filter (used if input suffix is null)
+
}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -123,6 +123,7 @@
}
}
+ @Override
protected void seeIfOkToWorkOnDir(File p_oDir) throws GatewayException
{
// TODO: Implement. Very expensive though.
@@ -134,11 +135,13 @@
}
+ @Override
public boolean deleteFile(File file) throws GatewayException
{
return remotefileSystemStrategy.deleteFile( file );
}
+ @Override
byte[] getFileContents(File file) throws GatewayException
{
RemoteFileSystem rfs = null;
@@ -311,4 +314,31 @@
return instance;
}
+ @Override
+ void bytesToFile(byte[] bytes, File file) throws GatewayException
+ {
+ RemoteFileSystem rfs = null;
+ try
+ {
+ EPR epr = ListenerUtil.assembleEpr(_config);
+ if (!(epr instanceof FTPEpr))
+ throw new Exception("This Gateway only accepts FTP and SFTP.");
+
+ FTPEpr ftpEpr = (FTPEpr) epr;
+ rfs = RemoteFileSystemFactory.getRemoteFileSystem(ftpEpr, true);
+ rfs.setRemoteDir(FtpClientUtil.fileToFtpString(_inputDirectory));
+
+ File tmpFile = File.createTempFile("RemoteGW", ".forUpload");
+ super.bytesToFile(bytes, tmpFile);
+ rfs.uploadFile(tmpFile, file.getName());
+ tmpFile.delete();
+
+ } catch (Exception e) {
+ throw new GatewayException(e);
+ } finally {
+ if (null != rfs)
+ rfs.quit();
+ }
+ }
+
}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JcaInflowGateway.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JcaInflowGateway.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JcaInflowGateway.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -63,10 +63,10 @@
ListenerTagNames.TARGET_SERVICE_NAME_TAG, null);
ConfigTree spec = config.getFirstChild("activation-config");
- for (ConfigTree configProperty : spec.getChildren("activation-config-property"))
+ for (ConfigTree configProperty : spec.getChildren("property"))
{
- String name = configProperty.getFirstTextChild("activation-config-property-name").trim();
- String value = configProperty.getFirstTextChild("activation-config-property-value").trim();
+ String name = configProperty.getAttribute("name");
+ String value = configProperty.getAttribute("value");
activationSpec.put(name, value);
}
@@ -228,7 +228,7 @@
invoker.start();
bean.setServiceInvoker(invoker);
bridge.activate();
-
+
}
Copied: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JmsEndpoint.java (from rev 12094, labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JmsEndpoint.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JmsEndpoint.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JmsEndpoint.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY 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 along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.listeners.jca;
+
+import org.jboss.soa.esb.listeners.ServiceInvoker;
+import org.jboss.soa.esb.listeners.gateway.PackageJmsMessageContents;
+
+import javax.jms.MessageListener;
+import javax.jms.Message;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class JmsEndpoint implements InflowGateway, MessageListener
+{
+ private ServiceInvoker service;
+ private PackageJmsMessageContents transformer = new PackageJmsMessageContents();
+
+ public void setServiceInvoker(ServiceInvoker invoker)
+ {
+ this.service = invoker;
+ }
+
+ public void onMessage(Message message)
+ {
+ try
+ {
+ org.jboss.soa.esb.message.Message esbMessage = transformer.process(message);
+ service.postMessage(esbMessage);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -357,27 +357,39 @@
if (replyToEPR != null)
replyToAddress = replyToEPR;
- try
+ if (replyToAddress == null)
{
- courier = CourierFactory.getCourier(replyToAddress);
- courier.deliver(message);
+ LOGGER.warn("No reply to address defined for reply message!");
}
- catch (final CourierException e)
+ else
{
- LOGGER.error("Failed to reply to address " + replyToAddress + ".",
- e);
- }
- catch (final MalformedEPRException e)
- {
- LOGGER.error("Failed to reply to address " + replyToAddress + ".",
- e);
- }
- finally
- {
- if (courier != null)
+ try
{
- CourierUtil.cleanCourier(courier);
+ courier = CourierFactory.getCourier(replyToAddress);
+ courier.deliver(message);
}
+ catch (final CourierException e)
+ {
+ LOGGER.error("Failed to reply to address " + replyToAddress + ".",
+ e);
+ }
+ catch (final MalformedEPRException e)
+ {
+ LOGGER.error("Failed to reply to address " + replyToAddress + ".",
+ e);
+ }
+ catch (final Throwable e)
+ {
+ LOGGER.error("Failed to reply to address " + replyToAddress + ".",
+ e);
+ }
+ finally
+ {
+ if (courier != null)
+ {
+ CourierUtil.cleanCourier(courier);
+ }
+ }
}
}
@@ -430,27 +442,39 @@
if (faultToEPR != null)
faultToAddress = faultToEPR;
- try
+ if (faultToAddress == null)
{
- courier = CourierFactory.getCourier(faultToAddress);
- courier.deliver(message);
+ LOGGER.warn("No fault address defined for fault message!");
}
- catch (final CourierException e)
+ else
{
- LOGGER.error("Failed to send error to address " + faultToAddress
- + ".", e);
- }
- catch (final MalformedEPRException e)
- {
- LOGGER.error("Failed to send error to address " + faultToAddress
- + ".", e);
- }
- finally
- {
- if (courier != null)
+ try
{
- CourierUtil.cleanCourier(courier);
+ courier = CourierFactory.getCourier(faultToAddress);
+ courier.deliver(message);
}
+ catch (final CourierException e)
+ {
+ LOGGER.error("Failed to send error to address " + faultToAddress
+ + ".", e);
+ }
+ catch (final MalformedEPRException e)
+ {
+ LOGGER.error("Failed to send error to address " + faultToAddress
+ + ".", e);
+ }
+ catch (final Throwable e)
+ {
+ LOGGER.error("Failed to send error to address " + faultToAddress
+ + ".", e);
+ }
+ finally
+ {
+ if (courier != null)
+ {
+ CourierUtil.cleanCourier(courier);
+ }
+ }
}
}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipelineUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipelineUnitTest.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipelineUnitTest.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -314,6 +314,54 @@
checkOrder(MockActionInfo.getDestroyList()) ;
}
+ public void testErrorActionProcessorException() throws Exception
+ {
+ final ConfigTree configTree = new ConfigTree("parent");
+
+ addAction(configTree, ErrorActionProcessor.class.getName(), "process",
+ null, null);
+ addAction(configTree, ErrorActionProcessor.class.getName(), null,
+ "anotherProcessSuccess", null);
+ addAction(configTree, MockActionProcessorFailure.class.getName(), null,
+ null, "anotherProcessException");
+ addAction(configTree, ErrorActionProcessor.class.getName(),
+ "process, anotherProcess", "anotherProcessSuccess",
+ "anotherProcessException");
+
+ final ActionProcessingPipeline pipeline = new ActionProcessingPipeline(
+ configTree);
+ pipeline.initialise();
+
+ final boolean result = pipeline.process(MessageFactory.getInstance()
+ .getMessage());
+
+ assertFalse(result);
+ }
+
+ public void testNPEActionProcessorException() throws Exception
+ {
+ final ConfigTree configTree = new ConfigTree("parent");
+
+ addAction(configTree, NPEActionProcessor.class.getName(), "process",
+ null, null);
+ addAction(configTree, NPEActionProcessor.class.getName(), null,
+ "anotherProcessSuccess", null);
+ addAction(configTree, MockActionProcessorFailure.class.getName(), null,
+ null, "anotherProcessException");
+ addAction(configTree, ErrorActionProcessor.class.getName(),
+ "process, anotherProcess", "anotherProcessSuccess",
+ "anotherProcessException");
+
+ final ActionProcessingPipeline pipeline = new ActionProcessingPipeline(
+ configTree);
+ pipeline.initialise();
+
+ final boolean result = pipeline.process(MessageFactory.getInstance()
+ .getMessage());
+
+ assertFalse(result);
+ }
+
public void testInvalidConstructor()
throws Exception
{
Copied: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ErrorActionProcessor.java (from rev 12094, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ErrorActionProcessor.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ErrorActionProcessor.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ErrorActionProcessor.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.listeners.message;
+
+import org.jboss.soa.esb.actions.ActionLifecycleException;
+import org.jboss.soa.esb.actions.ActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+public class ErrorActionProcessor implements ActionPipelineProcessor
+{
+ private final Integer id ;
+ private final Integer anotherId ;
+
+ public ErrorActionProcessor(final ConfigTree tree)
+ {
+ id = MockActionInfo.getNextId() ;
+ anotherId = MockActionInfo.getNextId() ;
+ }
+
+ public Message process(Message message) throws ActionProcessingException
+ {
+ throw new ActionProcessingException("foo");
+ }
+
+ public Message anotherProcess(Message message) throws ActionProcessingException
+ {
+ throw new ActionProcessingException("foo");
+ }
+
+ public void processException(Message message, Throwable th)
+ {
+ MockActionInfo.addExceptionId(id) ;
+ }
+
+ public void anotherProcessException(Message message, Throwable th)
+ {
+ MockActionInfo.addExceptionId(anotherId) ;
+ }
+
+ public void processSuccess(Message message)
+ {
+ MockActionInfo.addSuccessId(id) ;
+ }
+
+ public void anotherProcessSuccess(Message message)
+ {
+ MockActionInfo.addSuccessId(anotherId) ;
+ }
+
+ public void destroy() throws ActionLifecycleException
+ {
+ MockActionInfo.addDestroyId(id) ;
+ }
+
+ public void initialise() throws ActionLifecycleException
+ {
+ MockActionInfo.addInitialiseId(id) ;
+ }
+}
Copied: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/NPEActionProcessor.java (from rev 12094, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/NPEActionProcessor.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/NPEActionProcessor.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/NPEActionProcessor.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.listeners.message;
+
+import org.jboss.soa.esb.actions.ActionLifecycleException;
+import org.jboss.soa.esb.actions.ActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+public class NPEActionProcessor implements ActionPipelineProcessor
+{
+ private final Integer id ;
+ private final Integer anotherId ;
+
+ public NPEActionProcessor(final ConfigTree tree)
+ {
+ id = MockActionInfo.getNextId() ;
+ anotherId = MockActionInfo.getNextId() ;
+ }
+
+ public Message process(Message message) throws ActionProcessingException
+ {
+ throw new NullPointerException();
+ }
+
+ public Message anotherProcess(Message message) throws ActionProcessingException
+ {
+ throw new NullPointerException();
+ }
+
+ public void processException(Message message, Throwable th)
+ {
+ MockActionInfo.addExceptionId(id) ;
+ }
+
+ public void anotherProcessException(Message message, Throwable th)
+ {
+ MockActionInfo.addExceptionId(anotherId) ;
+ }
+
+ public void processSuccess(Message message)
+ {
+ MockActionInfo.addSuccessId(id) ;
+ }
+
+ public void anotherProcessSuccess(Message message)
+ {
+ MockActionInfo.addSuccessId(anotherId) ;
+ }
+
+ public void destroy() throws ActionLifecycleException
+ {
+ MockActionInfo.addDestroyId(id) ;
+ }
+
+ public void initialise() throws ActionLifecycleException
+ {
+ MockActionInfo.addInitialiseId(id) ;
+ }
+}
Modified: labs/jbossesb/workspace/dbevenius/product/etc/schemas/xml/jbossesb-1.0.1.xsd
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2007-05-23 07:20:26 UTC (rev 12095)
@@ -230,6 +230,37 @@
</xsd:complexType>
<xsd:element name="listener" type="jesb:listener"/>
+ <!-- JCA Types -->
+ <xsd:element name="activation-config">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">Activation configuration for jca bus or listener.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="jesb:property" maxOccurs="unbounded" minOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="jca-gateway" substitutionGroup="jesb:listener">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A specific gateway using JCA inflow.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:listener">
+ <xsd:sequence>
+ <xsd:element ref="jesb:activation-config" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="adapter" use="required" type="xsd:string"/>
+ <xsd:attribute name="endpointClass" use="required" type="xsd:string"/>
+ <xsd:attribute name="messagingType" use="optional" type="xsd:string"/>
+ <xsd:attribute name="jcaBridge" use="optional" type="xsd:string"/>
+ <xsd:attribute name="transacted" use="optional" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+
<!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
JMS Type Implementations.
88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
Modified: labs/jbossesb/workspace/dbevenius/product/install/standalone/jbossesb-server-base.zip
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/dbevenius/product/lib/ext/xbean.jar
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/webservice_bpel/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/webservice_bpel/build.xml 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/webservice_bpel/build.xml 2007-05-23 07:20:26 UTC (rev 12095)
@@ -40,9 +40,6 @@
<include name="**/*"/>
</fileset>
</war>
-
- <!-- Build the SOAPUI Client Service. -->
- <ant dir="${basedir}/soapui-client" />
</target>
<target name="quickstart-specific-deploys">
@@ -50,7 +47,6 @@
<copy overwrite="true" todir="${org.jboss.esb.server.deploy.dir}">
<fileset dir="${build.dir}/order-manager" includes="order-manager-service.jar,order-manager.war" />
<fileset dir="${build.dir}/shipping" includes="shipping-service.jar" />
- <fileset dir="${basedir}/soapui-client/target" includes="soapui-client.sar" />
</copy>
<!-- Deploy the ActiveBPEL components. -->
@@ -69,18 +65,19 @@
<echo message='${line.separator}******************' />
<echo>Quickstart deployed to target JBoss ESB/App Server at '${org.jboss.esb.server.deploy.dir}'.</echo>
<echo>1. Ensure that the value of the 'directory' attribute on the 'notificationChannel' (jboss-esb.xml) matches the value of the 'order.approval.drop.location' property in 'services/order-manager/order-manager.properties'.</echo>
- <echo>2. Check your ESB Server console to make sure the deployment was executed without errors.</echo>
- <echo>3. Make sure your Tomcat deployment at '${env.CATALINA_HOME}' is configured such that it's ports do not clash with those of your running JBoss AS. See '${env.CATALINA_HOME}/conf/server.xml'.</echo>
- <echo>4. Make sure your Tomcat deployment at '${env.CATALINA_HOME}' is configured to listen for HTTP traffic on port 18080. See '${env.CATALINA_HOME}/conf/server.xml'.</echo>
- <echo>5. Start your Tomcat deployment at '${env.CATALINA_HOME}'.</echo>
- <echo>6. Goto 'Deployed Processes' on the BPEL Console (http://localhost:18080/BpelAdmin) and confirm that the 'Customer' and 'OrderProcess' BPEL processes are deployed.</echo>
- <echo>7. Start your favorite SOAP client (e.g. SOAPUI) and load the 'RetailerService' WSDL (http://localhost:18080/active-bpel/services/RetailerService?wsdl).</echo>
- <echo>8. Load the SOAP client with the sample order in 'bpel/resources/sampleData/submit-order-01.xml'.</echo>
- <echo>9. Submit the new order using the SOAP UI client.</echo>
- <echo>10. View the state of the new process in 'Active Processes' on the BPEL Console. Will appear as 'Running'.</echo>
- <echo>11. Drill into the 'Running' OrderProcess process (select it).</echo>
- <echo>12. Drill down, you will see that the process is waiting on an acknowledgement/notification from the OrderManager service (WaitForNotificationFromOrderManager).</echo>
- <echo>13. Goto http://localhost:8080/order-manager/ (note, not port '18080'). From here, you can approve the order.</echo>
+ <echo>2. Check your JBoss App Server deployment folder to make sure the "soapui-client.sar" service is deployed. This .sar can be found in the "services" folder of the distribution.</echo>
+ <echo>3. Check your JBoss App Server console to make sure the deployment was executed without errors.</echo>
+ <echo>4. Make sure your Tomcat deployment at '${env.CATALINA_HOME}' is configured such that it's ports do not clash with those of your running JBoss AS. See '${env.CATALINA_HOME}/conf/server.xml'.</echo>
+ <echo>5. Make sure your Tomcat deployment at '${env.CATALINA_HOME}' is configured to listen for HTTP traffic on port 18080. See '${env.CATALINA_HOME}/conf/server.xml'.</echo>
+ <echo>6. Start your Tomcat deployment at '${env.CATALINA_HOME}'.</echo>
+ <echo>7. Goto 'Deployed Processes' on the BPEL Console (http://localhost:18080/BpelAdmin) and confirm that the 'Customer' and 'OrderProcess' BPEL processes are deployed.</echo>
+ <echo>8. Start your favorite SOAP client (e.g. SOAPUI) and load the 'RetailerService' WSDL (http://localhost:18080/active-bpel/services/RetailerService?wsdl).</echo>
+ <echo>9. Load the SOAP client with the sample order in 'bpel/resources/sampleData/submit-order-01.xml'.</echo>
+ <echo>10. Submit the new order using the SOAP UI client.</echo>
+ <echo>11. View the state of the new process in 'Active Processes' on the BPEL Console. Will appear as 'Running'.</echo>
+ <echo>12. Drill into the 'Running' OrderProcess process (select it).</echo>
+ <echo>13. Drill down, you will see that the process is waiting on an acknowledgement/notification from the OrderManager service (WaitForNotificationFromOrderManager).</echo>
+ <echo>14. Goto http://localhost:8080/order-manager/ (note, not port '18080'). From here, you can approve the order.</echo>
<echo message='******************' />
</target>
@@ -111,8 +108,4 @@
</jar>
</target>
- <target name="quickstart-specific-clean">
- <ant dir="${basedir}/soapui-client" target="clean" />
- </target>
-
</project>
\ No newline at end of file
Modified: labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/webservice_bpel/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/webservice_bpel/jboss-esb.xml 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/webservice_bpel/jboss-esb.xml 2007-05-23 07:20:26 UTC (rev 12095)
@@ -120,13 +120,13 @@
<property name="to-type" value="text/xml:SendSalesOrderNotification"/>
</action>
<action name="print-after-transform" class="org.jboss.soa.esb.actions.SystemPrintln">
- <property name="message" value="[Quickstart_webservice_bpel] Message after transform and before SOAPUI"/>
+ <property name="message" value="[Quickstart_webservice_bpel] Message after transform and before SOAPClient"/>
</action>
<!-- Inject the com.activebpel.ordermanagement.SalesOrderNotification instance
- into the SOAPUIClient. SOAPUIClient will use SOAPUI to construct a soap request
+ into the SOAPClient. SOAPClient will use SOAPUI to construct a soap request
template and will then use OGNL to populate the values (from the Smooks
EXTRACTED_BEANS_HASH) into the soap message. -->
- <action name="soapui-client" class="org.jboss.soa.esb.actions.soap.SOAPUIClient">
+ <action name="soapui-client" class="org.jboss.soa.esb.actions.soap.SOAPClient">
<property name="wsdl" value="http://localhost:18080/active-bpel/services/RetailerCallback?wsdl"/>
<property name="operation" value="SendSalesOrderNotification"/>
<property name="paramsLocation" value="EXTRACTED_BEANS_HASH"/>
Copied: labs/jbossesb/workspace/dbevenius/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/OGNLUtils.java (from rev 12094, labs/jbossesb/trunk/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/OGNLUtils.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/OGNLUtils.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/OGNLUtils.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -0,0 +1,98 @@
+/*
+ Milyn - Copyright (C) 2006
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License (version 2.1) as published by the Free Software
+ Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ See the GNU Lesser General Public License for more details:
+ http://www.gnu.org/licenses/lgpl.txt
+*/
+package org.jboss.soa.esb.services.soapui;
+
+import ognl.Ognl;
+import ognl.OgnlException;
+
+import java.util.Map;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.apache.log4j.Logger;
+
+/**
+ * OGNL Utilities for the SOAP UI Client service.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public abstract class OGNLUtils {
+
+ private static Logger logger = Logger.getLogger(OGNLUtils.class);
+
+ public static Object getParameter(String ognl, Map params) {
+ Object param;
+
+ // Try getting the parameter from the params Map using the
+ // raw OGNL expression as the key...
+ param = params.get(ognl);
+ if(param == null) {
+ // And if that didn't work, try using the OGNL expression to extract the param
+ // from an Object Graph using the OGNL toolkit...
+ try {
+ param = Ognl.getValue(ognl, params);
+ } catch (OgnlException ex) {
+ if(logger.isDebugEnabled()) {
+ logger.debug("OGNL Error.", ex);
+ }
+ }
+ }
+
+ return (param != null?param:"");
+ }
+
+ public static String getOGNLExpression(Element element) {
+ StringBuffer xpath = new StringBuffer();
+ Node parent = element.getParentNode();
+
+ xpath.append(getOGNLToken(element));
+
+ while (parent != null && parent.getNodeType() == Node.ELEMENT_NODE) {
+ if (parent.getLocalName().equalsIgnoreCase("body") &&
+ parent.getNamespaceURI().equalsIgnoreCase("http://schemas.xmlsoap.org/soap/envelope/")) {
+ break;
+ }
+
+ Element parentElement = (Element) parent;
+ String preassignedOgnl = parentElement.getAttributeNS(SoapUIClientService.SOAPUICL_NS, SoapUIClientService.OGNL_ATTRIB);
+ if(preassignedOgnl != null && !preassignedOgnl.equals("")) {
+ xpath.insert(0, "." + preassignedOgnl);
+ break;
+ } else {
+ xpath.insert(0, getOGNLToken(parentElement));
+ }
+ parent = parent.getParentNode();
+ }
+
+ // Remove the leading '.'
+ xpath.deleteCharAt(0);
+
+ return xpath.toString();
+ }
+
+ public static String getOGNLToken(Element element) {
+ String localName = element.getLocalName();
+ int count = DomUtils.countElementsBefore(element, element.getTagName());
+ String xpathToken;
+
+ if (count > 0) {
+ xpathToken = "." + localName + "[" + (count + 1) + "]";
+ } else {
+ xpathToken = "." + localName;
+ }
+
+ return xpathToken;
+ }
+}
Modified: labs/jbossesb/workspace/dbevenius/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java 2007-05-23 04:02:38 UTC (rev 12094)
+++ labs/jbossesb/workspace/dbevenius/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java 2007-05-23 07:20:26 UTC (rev 12095)
@@ -36,11 +36,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import ognl.OgnlException;
-import ognl.Ognl;
-
/**
* Soap UI Soap Client Service MBean.
*
@@ -48,10 +44,10 @@
*/
public class SoapUIClientService extends ServiceMBeanSupport implements SoapUIClientServiceMBean {
- private static final String SOAPUICL_NS = "http://jbossesb.jboss.org/soapui-client";
- private static final String SOAPUICL_NS_PREFIX = "soapui:";
- private static final String IS_CLONE_ATTRIB = "is-clone";
- private static final String OGNL_ATTRIB = "ognl";
+ protected static final String SOAPUICL_NS = "http://jbossesb.jboss.org/soapui-client";
+ protected static final String SOAPUICL_NS_PREFIX = "soapui:";
+ protected static final String IS_CLONE_ATTRIB = "is-clone";
+ protected static final String OGNL_ATTRIB = "ognl";
private static Logger logger = Logger.getLogger(SoapUIClientService.class);
private Map<String, WsdlInterface[]> wsdls = new HashMap<String, WsdlInterface[]>();
private DocumentBuilder docBuilder;
@@ -166,29 +162,23 @@
// If this element is not a cloned element, check does it need to be cloned...
if(!element.hasAttributeNS(SOAPUICL_NS, IS_CLONE_ATTRIB)) {
- String ognl = getOGNLExpression(element);
+ String ognl = OGNLUtils.getOGNLExpression(element);
Object param;
- try {
- param = Ognl.getValue(ognl, params);
- if(param != null) {
- Class paramRuntime = param.getClass();
+ param = OGNLUtils.getParameter(ognl, params);
+ if(param != null) {
+ Class paramRuntime = param.getClass();
- if(paramRuntime.isArray()) {
- Element item = getCollectionItemElement(element);
- // It's an "array" containing node. Grab the first/only
- // Element in it and clone it the required number of times.
- cloneCollectionTemplateElement(item, ((Object[])param).length - 1, ognl);
- } else if(Collection.class.isAssignableFrom(paramRuntime)) {
- Element item = getCollectionItemElement(element);
- // It's a "collection" containing node. Grab the first/only
- // Element in it and clone it the required number of times.
- cloneCollectionTemplateElement(item, ((Collection)param).size() - 1, ognl);
- }
+ if(paramRuntime.isArray()) {
+ Element item = getCollectionItemElement(element);
+ // It's an "array" containing node. Grab the first/only
+ // Element in it and clone it the required number of times.
+ cloneCollectionTemplateElement(item, ((Object[])param).length - 1, ognl);
+ } else if(Collection.class.isAssignableFrom(paramRuntime)) {
+ Element item = getCollectionItemElement(element);
+ // It's a "collection" containing node. Grab the first/only
+ // Element in it and clone it the required number of times.
+ cloneCollectionTemplateElement(item, ((Collection)param).size() - 1, ognl);
}
- } catch (OgnlException ex) {
- if(logger.isDebugEnabled()) {
- logger.debug("OGNL Error.", ex);
- }
}
}
@@ -266,14 +256,10 @@
if (childCount == 1 && node.getNodeType() == Node.TEXT_NODE) {
if (node.getTextContent().equals("?")) {
- String ognl = getOGNLExpression(element);
+ String ognl = OGNLUtils.getOGNLExpression(element);
Object param;
- try {
- param = Ognl.getValue(ognl, params);
- } catch (OgnlException ex) {
- param = "";
- }
+ param = OGNLUtils.getParameter(ognl, params);
element.removeChild(node);
element.appendChild(element.getOwnerDocument().createTextNode(param.toString()));
@@ -287,47 +273,4 @@
element.removeAttributeNS(SOAPUICL_NS, OGNL_ATTRIB);
}
- private String getOGNLExpression(Element element) {
- StringBuffer xpath = new StringBuffer();
- Node parent = element.getParentNode();
-
- xpath.append(getOGNLToken(element));
-
- while (parent != null && parent.getNodeType() == Node.ELEMENT_NODE) {
- if (parent.getLocalName().equalsIgnoreCase("body") &&
- parent.getNamespaceURI().equalsIgnoreCase("http://schemas.xmlsoap.org/soap/envelope/")) {
- break;
- }
-
- Element parentElement = (Element) parent;
- String preassignedOgnl = parentElement.getAttributeNS(SOAPUICL_NS, OGNL_ATTRIB);
- if(preassignedOgnl != null && !preassignedOgnl.equals("")) {
- xpath.insert(0, "." + preassignedOgnl);
- break;
- } else {
- xpath.insert(0, getOGNLToken(parentElement));
- }
- parent = parent.getParentNode();
- }
-
- // Remove the leading '.'
- xpath.deleteCharAt(0);
-
- return xpath.toString();
- }
-
- private String getOGNLToken(Element element) {
- String localName = element.getLocalName();
- int count = DomUtils.countElementsBefore(element, element.getTagName());
- String xpathToken;
-
- if (count > 0) {
- xpathToken = "." + localName + "[" + (count + 1) + "]";
- } else {
- xpathToken = "." + localName;
- }
-
- return xpathToken;
- }
-
}
More information about the jboss-svn-commits
mailing list