riftsaw SVN: r481 - in trunk/runtime: engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode and 3 other directories.
by riftsaw-commits@lists.jboss.org
Author: objectiser
Date: 2010-01-28 12:16:14 -0500 (Thu, 28 Jan 2010)
New Revision: 481
Added:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/EndpointReferenceResolver.java
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationAdapter.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationAdapter.java
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/internal/soa/esb/actions/bpel/ESBInvocationAdapter.java
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java
Log:
RIFTSAW-156 - Needed ability to obtain the service endpoint reference, to access the endpoint specific properties obtained from a .endpoint file. To obtain the endpoint reference, it was necessary to additional pass the port name into the WSInvocationAdapter implementation, so that it was available in order to access the endpoint reference. For ESB invocation, need to consider where this port name can be obtained from - could be derived as in the WS integration, or supplied explicitly by the BPELInvoke. Need to consider best approach - as it is only required if wanting to access port specific properties.
Added: trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/EndpointReferenceResolver.java
===================================================================
--- trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/EndpointReferenceResolver.java (rev 0)
+++ trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/EndpointReferenceResolver.java 2010-01-28 17:16:14 UTC (rev 481)
@@ -0,0 +1,17 @@
+package org.jboss.soa.bpel.runtime.engine;
+
+import javax.xml.namespace.QName;
+
+public interface EndpointReferenceResolver {
+
+ /**
+ * This method returns the endpoint reference associated with the supplied service
+ * name and port name.
+ *
+ * @param serviceName The service name
+ * @param portName The port name
+ * @return The endpoint reference, or null if not found
+ */
+ public org.apache.ode.bpel.iapi.EndpointReference getEndpoint(QName serviceName, String portName);
+
+}
Modified: trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationAdapter.java
===================================================================
--- trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationAdapter.java 2010-01-27 17:32:53 UTC (rev 480)
+++ trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationAdapter.java 2010-01-28 17:16:14 UTC (rev 481)
@@ -39,6 +39,7 @@
{
String getOperationName();
QName getServiceName();
+ String getPortName();
/**
* Callback from the Engine towards the adapter when
Modified: trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
===================================================================
--- trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2010-01-27 17:32:53 UTC (rev 480)
+++ trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2010-01-28 17:16:14 UTC (rev 481)
@@ -39,6 +39,7 @@
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.Properties;
import org.jboss.soa.bpel.runtime.engine.BPELEngine;
+import org.jboss.soa.bpel.runtime.engine.EndpointReferenceResolver;
import org.jboss.soa.bpel.runtime.engine.IntegrationLayer;
import org.jboss.soa.bpel.runtime.engine.InvocationAdapter;
import org.w3c.dom.Element;
@@ -70,6 +71,7 @@
protected Database _db;
protected ExecutorService _executorService;
protected CronScheduler _cronScheduler;
+ private EndpointReferenceResolver _endpointRefResolver;
private java.util.List<IntegrationLayer> m_integrationLayers=new java.util.Vector<IntegrationLayer>();
@@ -158,7 +160,7 @@
if (odeMex.getOperation().getOutput() != null) {
// Waits for the response to arrive
try {
- responseFuture.get(resolveTimeout(), TimeUnit.MILLISECONDS);
+ responseFuture.get(resolveTimeout(invocationAdapter, odeMex), TimeUnit.MILLISECONDS);
} catch (Exception e) {
String errorMsg = "Timeout or execution error when waiting for response to MEX "
+ odeMex + " " + e.toString();
@@ -276,7 +278,19 @@
}
}
- private long resolveTimeout() {
+ private long resolveTimeout(InvocationAdapter invocationAdapter, MyRoleMessageExchange odeMex) {
+ EndpointReference serviceRef=_endpointRefResolver.getEndpoint(invocationAdapter.getServiceName(), invocationAdapter.getPortName());
+ ProcessConf conf=odeMex.getProcessConf();
+
+ String timeout = conf.getEndpointProperties(serviceRef).get(Properties.PROP_MEX_TIMEOUT);
+
+ if (timeout != null) {
+ try {
+ return Long.parseLong(timeout);
+ } catch (NumberFormatException e) {
+ if(__log.isWarnEnabled()) __log.warn("Mal-formatted Property: ["+ Properties.PROP_MEX_TIMEOUT+"="+timeout+"] Default value ("+Properties.DEFAULT_MEX_TIMEOUT+") will be used");
+ }
+ }
return Properties.DEFAULT_MEX_TIMEOUT;
}
@@ -500,7 +514,10 @@
_bpelServer.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl(_scheduler, _odeConfig.getInMemMexTtl()));
_bpelServer.setEndpointReferenceContext(eprContext);
_bpelServer.setMessageExchangeContext(new MessageExchangeContextImpl(this));
- _bpelServer.setBindingContext(new JAXWSBindingContext(this));
+
+ _endpointRefResolver = new JAXWSBindingContext(this);
+ _bpelServer.setBindingContext((JAXWSBindingContext)_endpointRefResolver);
+
_bpelServer.setScheduler(_scheduler);
if (_odeConfig.isDehydrationEnabled()) {
CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy();
Modified: trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java
===================================================================
--- trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java 2010-01-27 17:32:53 UTC (rev 480)
+++ trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java 2010-01-28 17:16:14 UTC (rev 481)
@@ -20,8 +20,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.iapi.*;
+import org.jboss.soa.bpel.runtime.engine.EndpointReferenceResolver;
import org.jboss.soa.bpel.runtime.engine.PartnerChannel;
import org.jboss.soa.bpel.runtime.ws.*;
+import org.jboss.soa.bpel.runtime.*;
import javax.wsdl.Definition;
import javax.wsdl.PortType;
@@ -39,7 +41,7 @@
*
* @author Heiko.Braun
*/
-public class JAXWSBindingContext implements BindingContext
+public class JAXWSBindingContext implements BindingContext, EndpointReferenceResolver
{
protected final Log log = LogFactory.getLog(getClass());
@@ -50,7 +52,12 @@
this.engine = server;
this.endpointManager = new EndpointManager(this.engine);
}
+
+ public org.apache.ode.bpel.iapi.EndpointReference getEndpoint(QName serviceName, String portName) {
+ return(endpointManager.maintains(serviceName, portName));
+ }
+
public org.apache.ode.bpel.iapi.EndpointReference activateMyRoleEndpoint(QName processId, Endpoint myRoleEndpoint)
{
log.info("*** ACTIVATING MY ROLE ENDPOINT: "+myRoleEndpoint);
Modified: trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
===================================================================
--- trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2010-01-27 17:32:53 UTC (rev 480)
+++ trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2010-01-28 17:16:14 UTC (rev 481)
@@ -97,6 +97,7 @@
WSInvocationAdapter invocationContext = new WSInvocationAdapter(
operationName,
serviceQName,
+ getPortName(),
soapAdapter
);
invocationContext.setSOAPMessage(soapMessage);
Modified: trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationAdapter.java
===================================================================
--- trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationAdapter.java 2010-01-27 17:32:53 UTC (rev 480)
+++ trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationAdapter.java 2010-01-28 17:16:14 UTC (rev 481)
@@ -37,6 +37,7 @@
{
private final String operationName;
private final QName serviceName;
+ private final String portName;
private SOAPMessage soapRequestMessage;
private SOAPMessage soapResponseMessage;
@@ -44,10 +45,11 @@
private final SOAPMessageAdapter soapAdapter;
public WSInvocationAdapter(String operationName,
- QName serviceName, SOAPMessageAdapter soapAdapter)
+ QName serviceName, String portName, SOAPMessageAdapter soapAdapter)
{
this.operationName = operationName;
this.serviceName = serviceName;
+ this.portName = portName;
this.soapAdapter = soapAdapter;
}
@@ -60,6 +62,11 @@
{
return serviceName;
}
+
+ public String getPortName()
+ {
+ return portName;
+ }
public void parseRequest(MyRoleMessageExchange mex, Message request)
{
Modified: trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/internal/soa/esb/actions/bpel/ESBInvocationAdapter.java
===================================================================
--- trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/internal/soa/esb/actions/bpel/ESBInvocationAdapter.java 2010-01-27 17:32:53 UTC (rev 480)
+++ trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/internal/soa/esb/actions/bpel/ESBInvocationAdapter.java 2010-01-28 17:16:14 UTC (rev 481)
@@ -63,6 +63,10 @@
{
return serviceName;
}
+
+ public String getPortName() {
+ return(null);
+ }
public void setRequestXML(Element requestXML)
{
Modified: trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java
===================================================================
--- trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java 2010-01-27 17:32:53 UTC (rev 480)
+++ trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java 2010-01-28 17:16:14 UTC (rev 481)
@@ -175,19 +175,16 @@
String serviceName=_config.getAttribute(SERVICE);
- javax.xml.namespace.QName qname=new javax.xml.namespace.QName(getNamespace(serviceName),
- getLocalPart(serviceName));
+ javax.xml.namespace.QName qname=javax.xml.namespace.QName.valueOf(serviceName);
logger.debug("Invoking service: "+qname);
org.w3c.dom.Element resp=null;
javax.xml.namespace.QName faultName=null;
- QName serviceQName = new QName(getNamespace(serviceName), getLocalPart(serviceName));
-
// Create invocationContext
ESBInvocationAdapter invocationContext =
- new ESBInvocationAdapter(_config.getAttribute(OPERATION), serviceQName);
+ new ESBInvocationAdapter(_config.getAttribute(OPERATION), qname);
invocationContext.setRequestXML(mesgElem);
// invoke ODE
@@ -422,56 +419,5 @@
return(ret);
}
- /**
- * This method extracts the namespace from a string formatted
- * using as follows: '{namespace}localpart'.
- *
- * @param qname The fully qualified name
- * @return The namespace, or null if not found
- */
- protected static String getNamespace(String qname) {
- String ret=null;
- int index=0;
-
- if (qname != null &&
- (index=qname.indexOf(NAMESPACE_PREFIX)) != -1) {
- int endindex=qname.indexOf(NAMESPACE_SUFFIX);
-
- if (endindex == -1) {
- endindex = qname.length();
- }
-
- ret = qname.substring(index+1, endindex);
- }
-
- return(ret);
- }
-
- /**
- * This method extracts the local part from the supplied
- * fully qualified name. If the namespace suffix cannot
- * be found, then the fully supplied name will be
- * returned.
- *
- * @param qname The fully qualified name
- * @return The local part
- */
- protected static String getLocalPart(String qname) {
- String ret=null;
- int index=0;
-
- if (qname != null &&
- (index=qname.indexOf(NAMESPACE_SUFFIX)) != -1) {
- ret = qname.substring(index+1);
- } else {
- ret = qname;
- }
-
- return(ret);
- }
-
private final Log logger = LogFactory.getLog(getClass());
-
- public static final String NAMESPACE_PREFIX="{";
- public static final String NAMESPACE_SUFFIX="}";
}