Author: mszefler
Date: Thu Aug 31 05:44:45 2006
New Revision: 438897
URL: http://svn.apache.org/viewvc?rev=438897&view=rev
Log:
Checked in missing files for EPR fix.
Modified:
incubator/ode/trunk/jbi/.classpath
incubator/ode/trunk/jbi/.project
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/BindingContextImpl.java
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/EndpointReferenceContextImpl.java
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeContext.java
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeService.java
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeServiceUnit.java
Modified: incubator/ode/trunk/jbi/.classpath
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/.classpath?rev=438897&r1=438896&r2=438897&view=diff
==============================================================================
--- incubator/ode/trunk/jbi/.classpath (original)
+++ incubator/ode/trunk/jbi/.classpath Thu Aug 31 05:44:45 2006
@@ -1,60 +1,60 @@
-<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="src" path="/ode-bpel-scheduler-quartz"/>
- <classpathentry kind="src" path="/ode-bpel-bom"/>
- <classpathentry kind="src" path="/ode-bpel-compiler"/>
- <classpathentry kind="var"
path="M2_REPO/xerces/xercesImpl/2.6.2/xercesImpl-2.6.2.jar"/>
- <classpathentry kind="src" path="/ode-utils"/>
- <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-qname_1.1_spec/1.0/geronimo-qname_1.1_spec-1.0.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/ccil/cowan/tagsoup/tagsoup/0.9.7/tagsoup-0.9.7.jar"/>
- <classpathentry kind="src" path="/ode-jca-ra"/>
- <classpathentry kind="src" path="/ode-dao-hibernate"/>
- <classpathentry kind="var"
path="M2_REPO/ehcache/ehcache/1.1/ehcache-1.1.jar"/>
- <classpathentry kind="src" path="/ode-bpel-el-xpath20"/>
- <classpathentry kind="src" path="/ode-bpel-api-jca"/>
- <classpathentry kind="var"
path="M2_REPO/xmlbeans/xbean/2.1.0/xbean-2.1.0.jar"/>
- <classpathentry kind="src" path="/ode-bpel-dd"/>
- <classpathentry kind="var"
path="M2_REPO/com/ibm/icu/icu4j/2.6.1/icu4j-2.6.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/commons-lang/commons-lang/2.1/commons-lang-2.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/apache/derby/derby/10.1.2.1/derby-10.1.2.1.jar"/>
- <classpathentry kind="src" path="/ode-bpel-el-xpath10"/>
- <classpathentry kind="var"
path="M2_REPO/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar"/>
- <classpathentry kind="var"
path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/antlr/antlr/2.7.6rc1/antlr-2.7.6rc1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/saxon/saxon/8.4/saxon-8.4.jar"/>
- <classpathentry kind="var" path="M2_REPO/xom/xom/1.0b3/xom-1.0b3.jar"/>
- <classpathentry kind="src" path="/ode-bpel-api"/>
- <classpathentry kind="var"
path="M2_REPO/xalan/xalan/2.6.0/xalan-2.6.0.jar"/>
- <classpathentry kind="src" path="/ode-bpel-parser"/>
- <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-activation_1.0.2_spec/1.0/geronimo-activation_1.0.2_spec-1.0.jar"/>
- <classpathentry kind="var"
path="M2_REPO/xmlbeans/xmlpublic/2.1.0/xmlpublic-2.1.0.jar"/>
- <classpathentry kind="var"
path="M2_REPO/log4j/log4j/1.2.12/log4j-1.2.12.jar"/>
- <classpathentry kind="var"
path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/>
- <classpathentry kind="src" path="/ode-jca-server"/>
- <classpathentry kind="var"
path="M2_REPO/quartz/quartz/1.5.1/quartz-1.5.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/saxon/saxon-dom/8.4/saxon-dom-8.4.jar"/>
- <classpathentry kind="var"
path="M2_REPO/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar"/>
- <classpathentry kind="src" path="/ode-bpel-obj"/>
- <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-j2ee-connector_1.5_spec/1.0/geronimo-j2ee-connector_1.5_spec-1.0.jar"/>
- <classpathentry kind="src" path="/ode-bpel-runtime"/>
- <classpathentry kind="var"
path="M2_REPO/org/apache/servicemix/servicemix-jbi/3.0-incubating-SNAPSHOT/servicemix-jbi-3.0-incubating-SNAPSHOT.jar"/>
- <classpathentry kind="var"
path="M2_REPO/commons-pool/commons-pool/1.2/commons-pool-1.2.jar"/>
- <classpathentry kind="var"
path="M2_REPO/stax/stax-api/1.0/stax-api-1.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/asm/asm/1.5.3/asm-1.5.3.jar"/>
- <classpathentry kind="var"
path="M2_REPO/jaxen/jaxen/1.1-beta-8/jaxen-1.1-beta-8.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/hibernate/hibernate/3.1.2/hibernate-3.1.2.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-jta_1.0.1B_spec/1.0/geronimo-jta_1.0.1B_spec-1.0.jar"/>
- <classpathentry kind="var"
path="M2_REPO/wsdl4j/wsdl4j/1.5.1/wsdl4j-1.5.1.jar"/>
- <classpathentry kind="src" path="/ode-minerva"/>
- <classpathentry kind="src" path="/ode-jacob"/>
- <classpathentry kind="var"
path="M2_REPO/cglib/cglib/2.1_3/cglib-2.1_3.jar"/>
- <classpathentry kind="src" path="/ode-bpel-connector"/>
- <classpathentry kind="src" path="/ode-bpel-ql"/>
- <classpathentry kind="var" path="M2_REPO/jdom/jdom/1.0/jdom-1.0.jar"/>
- <classpathentry kind="var"
path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" path="/ode-bpel-api-jca"/>
+ <classpathentry kind="src" path="/ode-bpel-api"/>
+ <classpathentry kind="src" path="/ode-bpel-runtime"/>
+ <classpathentry kind="var"
path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/jaxen/jaxen/1.1-beta-8/jaxen-1.1-beta-8.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/>
+ <classpathentry kind="src" path="/ode-dao-hibernate"/>
+ <classpathentry kind="var"
path="M2_REPO/org/apache/derby/derby/10.1.2.1/derby-10.1.2.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/xmlbeans/xbean/2.1.0/xbean-2.1.0.jar"/>
+ <classpathentry kind="src" path="/ode-bpel-connector"/>
+ <classpathentry kind="var"
path="M2_REPO/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-j2ee-connector_1.5_spec/1.0/geronimo-j2ee-connector_1.5_spec-1.0.jar"/>
+ <classpathentry kind="src" path="/ode-bpel-dd"/>
+ <classpathentry kind="src" path="/ode-jca-server"/>
+ <classpathentry kind="var"
path="M2_REPO/org/apache/servicemix/servicemix-jbi/3.0-incubating-SNAPSHOT/servicemix-jbi-3.0-incubating-SNAPSHOT.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/saxon/saxon-dom/8.4/saxon-dom-8.4.jar"/>
+ <classpathentry kind="src" path="/ode-bpel-compiler"/>
+ <classpathentry kind="src" path="/ode-jacob"/>
+ <classpathentry kind="var" path="M2_REPO/jdom/jdom/1.0/jdom-1.0.jar"/>
+ <classpathentry kind="src" path="/ode-bpel-el-xpath20"/>
+ <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-qname_1.1_spec/1.0/geronimo-qname_1.1_spec-1.0.jar"/>
+ <classpathentry kind="src" path="/ode-bpel-parser"/>
+ <classpathentry kind="src" path="/ode-bpel-schemas"/>
+ <classpathentry kind="src" path="/ode-bpel-el-xpath10"/>
+ <classpathentry kind="var"
path="M2_REPO/commons-pool/commons-pool/1.2/commons-pool-1.2.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/org/hibernate/hibernate/3.1.2/hibernate-3.1.2.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/com/ibm/icu/icu4j/2.6.1/icu4j-2.6.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/xmlbeans/xmlpublic/2.1.0/xmlpublic-2.1.0.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/antlr/antlr/2.7.6rc1/antlr-2.7.6rc1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/cglib/cglib/2.1_3/cglib-2.1_3.jar"/>
+ <classpathentry kind="src" path="/ode-minerva"/>
+ <classpathentry kind="var" path="M2_REPO/xom/xom/1.0b3/xom-1.0b3.jar"/>
+ <classpathentry kind="src" path="/ode-bpel-ql"/>
+ <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-activation_1.0.2_spec/1.0/geronimo-activation_1.0.2_spec-1.0.jar"/>
+ <classpathentry kind="src" path="/ode-bpel-obj"/>
+ <classpathentry kind="src" path="/ode-bpel-bom"/>
+ <classpathentry kind="var" path="M2_REPO/xalan/xalan/2.6.0/xalan-2.6.0.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/quartz/quartz/1.5.1/quartz-1.5.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/xerces/xercesImpl/2.6.2/xercesImpl-2.6.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/asm/asm/1.5.3/asm-1.5.3.jar"/>
+ <classpathentry kind="src" path="/ode-utils"/>
+ <classpathentry kind="var"
path="M2_REPO/commons-lang/commons-lang/2.1/commons-lang-2.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/stax/stax-api/1.0/stax-api-1.0.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/org/ccil/cowan/tagsoup/tagsoup/0.9.7/tagsoup-0.9.7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/log4j/log4j/1.2.12/log4j-1.2.12.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/wsdl4j/wsdl4j/1.5.2/wsdl4j-1.5.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/saxon/saxon/8.4/saxon-8.4.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/ehcache/ehcache/1.1/ehcache-1.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-jta_1.0.1B_spec/1.0/geronimo-jta_1.0.1B_spec-1.0.jar"/>
+ <classpathentry kind="src" path="/ode-bpel-scheduler-quartz"/>
+ <classpathentry kind="src" path="/ode-jca-ra"/>
+</classpath>
\ No newline at end of file
Modified: incubator/ode/trunk/jbi/.project
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/.project?rev=438897&r1=438896&r2=438897&view=diff
==============================================================================
--- incubator/ode/trunk/jbi/.project (original)
+++ incubator/ode/trunk/jbi/.project Thu Aug 31 05:44:45 2006
@@ -2,25 +2,26 @@
<name>ode-jbi</name>
<comment/>
<projects>
- <project>ode-bpel-scheduler-quartz</project>
- <project>ode-bpel-bom</project>
- <project>ode-bpel-compiler</project>
- <project>ode-utils</project>
- <project>ode-jca-ra</project>
- <project>ode-dao-hibernate</project>
- <project>ode-bpel-el-xpath20</project>
<project>ode-bpel-api-jca</project>
- <project>ode-bpel-dd</project>
- <project>ode-bpel-el-xpath10</project>
<project>ode-bpel-api</project>
- <project>ode-bpel-parser</project>
- <project>ode-jca-server</project>
- <project>ode-bpel-obj</project>
<project>ode-bpel-runtime</project>
- <project>ode-minerva</project>
- <project>ode-jacob</project>
+ <project>ode-dao-hibernate</project>
<project>ode-bpel-connector</project>
+ <project>ode-bpel-dd</project>
+ <project>ode-jca-server</project>
+ <project>ode-bpel-compiler</project>
+ <project>ode-jacob</project>
+ <project>ode-bpel-el-xpath20</project>
+ <project>ode-bpel-parser</project>
+ <project>ode-bpel-schemas</project>
+ <project>ode-bpel-el-xpath10</project>
+ <project>ode-minerva</project>
<project>ode-bpel-ql</project>
+ <project>ode-bpel-obj</project>
+ <project>ode-bpel-bom</project>
+ <project>ode-utils</project>
+ <project>ode-bpel-scheduler-quartz</project>
+ <project>ode-jca-ra</project>
</projects>
<buildSpec>
<buildCommand>
Modified:
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/BindingContextImpl.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/BindingContextImpl.java?rev=438897&r1=438896&r2=438897&view=diff
==============================================================================
---
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/BindingContextImpl.java
(original)
+++
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/BindingContextImpl.java
Thu Aug 31 05:44:45 2006
@@ -48,10 +48,10 @@
_ode = ode;
}
- public Element activateMyRoleEndpoint(QName processId, DeploymentUnit
deploymentUnit, Endpoint myRoleEndpoint,
+ public EndpointReference activateMyRoleEndpoint(QName processId,
DeploymentUnit deploymentUnit, Endpoint myRoleEndpoint,
PortType portType) {
try {
- return _ode.activateEndpoint(processId,
myRoleEndpoint).toXML().getDocumentElement();
+ return _ode.activateEndpoint(processId, myRoleEndpoint);
} catch (Exception ex) {
throw new ContextException("Could not activate endpoint " +
myRoleEndpoint + " for process " + processId,
ex);
Modified:
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/EndpointReferenceContextImpl.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/EndpointReferenceContextImpl.java?rev=438897&r1=438896&r2=438897&view=diff
==============================================================================
---
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/EndpointReferenceContextImpl.java
(original)
+++
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/EndpointReferenceContextImpl.java
Thu Aug 31 05:44:45 2006
@@ -19,18 +19,19 @@
package org.apache.ode.jbi;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.namespace.QName;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.epr.EndpointFactory;
-import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.EndpointReference;
import org.apache.ode.bpel.iapi.EndpointReferenceContext;
import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Element;
-
-import javax.jbi.servicedesc.ServiceEndpoint;
-import javax.wsdl.Definition;
-import javax.xml.namespace.QName;
+import org.w3c.dom.NodeList;
/**
* Implementation of the ODE [EMAIL PROTECTED]
org.apache.ode.bpel.iapi.EndpointReferenceContext}
@@ -61,28 +62,6 @@
if (__log.isDebugEnabled()) {
__log.debug( "resolveEndpointReference:\n" + prettyPrint( epr ) );
}
- if (elname.equals(EndpointReference.SERVICE_REF_QNAME)) {
- epr = DOMUtils.getFirstChildElement(epr);
- elname = new QName(epr.getNamespaceURI(),epr.getLocalName());
- }
- // resolve JBI end-point-references directly
- if (epr != null && elname.equals(JBI_EPR)) {
- String serviceName = epr.getAttribute("service-name");
- QName serviceQName = convertClarkQName( serviceName );
- String endpointName = epr.getAttribute("end-point-name");
- ServiceEndpoint se = _ode.getContext().getEndpoint(serviceQName,
endpointName);
- if (se == null) {
- __log.warn( "Unable to resolve JBI endpoint reference:\n" +
prettyPrint( epr ) );
- return null;
- }
- if (__log.isDebugEnabled()) {
- __log.debug( "Resolved JBI endpoint reference: " + se );
- }
- return new JbiEndpointReference(se);
- }
-
- // Otherwise, we expect the EPR to be wrapped in a BPEL service-ref
element.
- /*
if (!elname.equals(EndpointReference.SERVICE_REF_QNAME))
throw new IllegalArgumentException("EPR root element "
+ elname + " should be " + EndpointReference.SERVICE_REF_QNAME);
@@ -96,9 +75,6 @@
if (se == null)
return null;
return new JbiEndpointReference(se);
- */
- __log.warn( "Unsupported endpoint reference:\n" + prettyPrint( epr ) );
- return null;
}
Modified:
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeContext.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeContext.java?rev=438897&r1=438896&r2=438897&view=diff
==============================================================================
--- incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeContext.java
(original)
+++ incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeContext.java
Thu Aug 31 05:44:45 2006
@@ -99,8 +99,7 @@
try {
chnl = _context.getDeliveryChannel();
} catch (Exception e) {
- // TODO better error logging
- e.printStackTrace();
+ __log.error("JBI Error", e);
}
}
Modified:
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeService.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeService.java?rev=438897&r1=438896&r2=438897&view=diff
==============================================================================
--- incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeService.java
(original)
+++ incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeService.java
Thu Aug 31 05:44:45 2006
@@ -42,314 +42,303 @@
*/
public class OdeService implements JbiMessageExchangeProcessor {
- private static final Log __log = LogFactory.getLog(OdeService.class);
+ private static final Log __log = LogFactory.getLog(OdeService.class);
- /** utility for tracking outstanding JBI message exchanges. */
- private final JbiMexTracker _jbiMexTracker = new JbiMexTracker();
-
- /** JBI-Generated Endpoint */
- private ServiceEndpoint _internal;
-
- /** External endpoint. */
- private ServiceEndpoint _external;
-
- private OdeContext _ode;
-
- private Element _serviceref;
-
- private Endpoint _endpoint;
-
-
- public OdeService(OdeContext odeContext, Endpoint endpoint)
- throws Exception {
- _ode = odeContext;
- _endpoint = endpoint;
- }
-
- /**
- * Do the JBI endpoint activation.
- *
- * @throws JBIException
- */
- public void activate() throws JBIException {
- if (_serviceref == null) {
- ServiceEndpoint[] candidates =
_ode.getContext().getExternalEndpointsForService(_endpoint.serviceName);
- if (candidates.length != 0) {
- _external = candidates[0];
- }
- }
- _internal = _ode.getContext().activateEndpoint(_endpoint.serviceName,
_endpoint.portName);
- if (__log.isDebugEnabled()) {
- __log.debug("Activated endpoint " + _endpoint);
- }
- // TODO: Is there a race situation here?
- }
-
- /**
- * Deactivate endpoints in JBI.
- */
- public void deactivate() throws JBIException {
- _ode.getContext().deactivateEndpoint(_internal);
- __log.debug("Dectivated endpoint " + _endpoint);
- }
-
- public ServiceEndpoint getInternalServiceEndpoint() {
- return _internal;
- }
-
- public ServiceEndpoint getExternalServiceEndpoint() {
- return _external;
- }
-
-
- public void onJbiMessageExchange(javax.jbi.messaging.MessageExchange jbiMex)
throws MessagingException {
- if (jbiMex.getRole() != javax.jbi.messaging.MessageExchange.Role.PROVIDER)
{
- String errmsg ="Message exchange is not in PROVIDER role as expected: "
+ jbiMex.getExchangeId();
- __log.fatal(errmsg);
- throw new IllegalArgumentException(errmsg);
- }
-
- if (jbiMex.getStatus() != ExchangeStatus.ACTIVE) {
- // We can forget about the exchange.
- _jbiMexTracker.consume(jbiMex.getExchangeId());
- return;
- }
-
- if
(jbiMex.getPattern().equals(org.apache.ode.jbi.MessageExchangePattern.IN_ONLY))
{
- boolean success = false;
- Exception err = null;
- try {
- invokeOde(jbiMex, ((InOnly)jbiMex).getInMessage());
- success = true;
- } catch (Exception ex) {
- __log.error("Error invoking ODE.",ex);
- err = ex;
- } finally {
- if (!success) {
- jbiMex.setStatus(ExchangeStatus.ERROR);
- jbiMex.setError(err);
- } else {
- jbiMex.setStatus(ExchangeStatus.DONE);
- }
- }
- } else if
(jbiMex.getPattern().equals(org.apache.ode.jbi.MessageExchangePattern.IN_OUT)) {
- boolean success = false;
- Exception err = null;
- try {
- invokeOde(jbiMex, ((InOut)jbiMex).getInMessage());
- success = true;
- } catch (Exception ex) {
- __log.error("Error invoking ODE.", ex);
- err = ex;
- } finally {
- if (!success) {
- jbiMex.setError(err);
- jbiMex.setStatus(ExchangeStatus.ERROR);
- }
- }
- } else {
- __log.error("JBI MessageExchange " + jbiMex.getExchangeId() + " is of an
unsupported pattern "
- + jbiMex.getPattern());
- jbiMex.setStatus(ExchangeStatus.ERROR);
- jbiMex.setError(new Exception("Unknown message exchange pattern: " +
jbiMex.getPattern()));
- }
-
- }
-
- /**
- * Called from [EMAIL PROTECTED]
MessageExchangeContextImpl#onAsyncReply(MyRoleMessageExchange)}
- * @param mex message exchenge
- */
- public void onResponse(MyRoleMessageExchange mex) {
- javax.jbi.messaging.MessageExchange jbiMex =
_jbiMexTracker.consume(mex.getClientId());
- if (jbiMex == null) {
- __log.warn("Ignoring unknown async reply: " + mex);
- return;
- }
-
- switch (mex.getStatus()) {
- case FAULT:
- outResponseFault(mex, jbiMex);
- break;
- case RESPONSE:
- outResponse(mex, jbiMex);
- break;
- case FAILURE:
- outFailure(mex, jbiMex);
- break;
- default :
- __log.warn("Received ODE message exchange in unexpected state: " +
mex.getStatus());
- }
- }
-
- /**
- * Forward a JBI input message to ODE.
- *
- * @param jbiMex
- */
- private void invokeOde(javax.jbi.messaging.MessageExchange jbiMex,
- NormalizedMessage request) throws Exception {
-
- // If this has already been tracked, we will not invoke!
- if (_jbiMexTracker.track(jbiMex)) {
- __log.debug("Skipping JBI MEX " + jbiMex.getExchangeId() + ", already
received!");
- return;
- }
-
- QName serviceName = jbiMex.getEndpoint().getServiceName();
-
- _ode.getTransactionManager().begin();
-
- boolean success = false;
- MyRoleMessageExchange odeMex = null;
- try {
- if (__log.isDebugEnabled()) {
- __log.debug("invokeOde() JBI exchangeId=" + jbiMex.getExchangeId() +
" endpoint=" + _endpoint + " operation=" + jbiMex.getOperation() );
- }
- odeMex = _ode._server.getEngine().createMessageExchange(
- jbiMex.getExchangeId(),
- _endpoint.serviceName,
- jbiMex.getOperation().getLocalPart());
-
- if (odeMex.getOperation() != null) {
- javax.wsdl.Message msgdef =
odeMex.getOperation().getInput().getMessage();
- Message odeRequest =
odeMex.createMessage(odeMex.getOperation().getInput().getMessage().getQName());
- Mapper mapper = _ode.findMapper(request,odeMex.getOperation());
- if (mapper == null) {
- String errmsg = "Could not find a mapper for request message for JBI
MEX " + jbiMex.getExchangeId()
- + "; ODE MEX " + odeMex.getMessageExchangeId() + " is failed. ";
- __log.error(errmsg);
- throw new MessageTranslationException(errmsg);
-
- }
- odeMex.setProperty(Mapper.class.getName(),
mapper.getClass().getName());
- mapper.toODE(odeRequest, request, msgdef);
- odeMex.invoke(odeRequest);
-
- // Handle the response if it is immediately available.
- if (odeMex.getStatus() != Status.ASYNC) {
- __log.debug("ODE MEX " + odeMex + " completed SYNCHRONOUSLY.");
- onResponse(odeMex);
- _jbiMexTracker.consume(jbiMex.getExchangeId());
+ /** utility for tracking outstanding JBI message exchanges. */
+ private final JbiMexTracker _jbiMexTracker = new JbiMexTracker();
+
+ /** JBI-Generated Endpoint */
+ private ServiceEndpoint _internal;
+
+ private OdeContext _ode;
+
+ private Endpoint _endpoint;
+
+ public OdeService(OdeContext odeContext, Endpoint endpoint) throws
Exception {
+ _ode = odeContext;
+ _endpoint = endpoint;
+ }
+
+ /**
+ * Do the JBI endpoint activation.
+ *
+ * @throws JBIException
+ */
+ public void activate() throws JBIException {
+
+ _internal = _ode.getContext().activateEndpoint(_endpoint.serviceName,
_endpoint.portName);
+ if (__log.isDebugEnabled()) {
+ __log.debug("Activated endpoint " + _endpoint);
+ }
+ // TODO: Is there a race situation here?
+ }
+
+ /**
+ * Deactivate endpoints in JBI.
+ */
+ public void deactivate() throws JBIException {
+ _ode.getContext().deactivateEndpoint(_internal);
+ __log.debug("Dectivated endpoint " + _endpoint);
+ }
+
+ public ServiceEndpoint getInternalServiceEndpoint() {
+ return _internal;
+ }
+
+ public ServiceEndpoint getExternalServiceEndpoint() {
+ ServiceEndpoint[] candidates =
_ode.getContext().getExternalEndpointsForService(_endpoint.serviceName);
+ if (candidates.length != 0) {
+ return candidates[0];
+ }
+ return null;
+ }
+
+ public void onJbiMessageExchange(javax.jbi.messaging.MessageExchange
jbiMex) throws MessagingException {
+ if (jbiMex.getRole() !=
javax.jbi.messaging.MessageExchange.Role.PROVIDER) {
+ String errmsg = "Message exchange is not in PROVIDER role as
expected: " + jbiMex.getExchangeId();
+ __log.fatal(errmsg);
+ throw new IllegalArgumentException(errmsg);
+ }
+
+ if (jbiMex.getStatus() != ExchangeStatus.ACTIVE) {
+ // We can forget about the exchange.
+ _jbiMexTracker.consume(jbiMex.getExchangeId());
+ return;
+ }
+
+ if
(jbiMex.getPattern().equals(org.apache.ode.jbi.MessageExchangePattern.IN_ONLY))
{
+ boolean success = false;
+ Exception err = null;
+ try {
+ invokeOde(jbiMex, ((InOnly) jbiMex).getInMessage());
+ success = true;
+ } catch (Exception ex) {
+ __log.error("Error invoking ODE.", ex);
+ err = ex;
+ } finally {
+ if (!success) {
+ jbiMex.setStatus(ExchangeStatus.ERROR);
+ jbiMex.setError(err);
+ } else {
+ jbiMex.setStatus(ExchangeStatus.DONE);
+ }
+ }
+ } else if
(jbiMex.getPattern().equals(org.apache.ode.jbi.MessageExchangePattern.IN_OUT)) {
+ boolean success = false;
+ Exception err = null;
+ try {
+ invokeOde(jbiMex, ((InOut) jbiMex).getInMessage());
+ success = true;
+ } catch (Exception ex) {
+ __log.error("Error invoking ODE.", ex);
+ err = ex;
+ } finally {
+ if (!success) {
+ jbiMex.setError(err);
+ jbiMex.setStatus(ExchangeStatus.ERROR);
+ }
+ }
} else {
- __log.debug("ODE MEX " + odeMex + " completed ASYNCHRONOUSLY.");
+ __log.error("JBI MessageExchange " + jbiMex.getExchangeId() + " is
of an unsupported pattern "
+ + jbiMex.getPattern());
+ jbiMex.setStatus(ExchangeStatus.ERROR);
+ jbiMex.setError(new Exception("Unknown message exchange pattern: "
+ jbiMex.getPattern()));
+ }
+
+ }
+
+ /**
+ * Called from
+ * [EMAIL PROTECTED]
MessageExchangeContextImpl#onAsyncReply(MyRoleMessageExchange)}
+ *
+ * @param mex
+ * message exchenge
+ */
+ public void onResponse(MyRoleMessageExchange mex) {
+ javax.jbi.messaging.MessageExchange jbiMex =
_jbiMexTracker.consume(mex.getClientId());
+ if (jbiMex == null) {
+ __log.warn("Ingorning unknown async reply: " + mex);
+ return;
+ }
+
+ switch (mex.getStatus()) {
+ case FAULT:
+ outResponseFault(mex, jbiMex);
+ break;
+ case RESPONSE:
+ outResponse(mex, jbiMex);
+ break;
+ case FAILURE:
+ outFailure(mex, jbiMex);
+ break;
+ default:
+ __log.warn("Received ODE message exchange in unexpected state: " +
mex.getStatus());
+ }
+ }
+
+ /**
+ * Forward a JBI input message to ODE.
+ *
+ * @param jbiMex
+ */
+ private void invokeOde(javax.jbi.messaging.MessageExchange jbiMex,
NormalizedMessage request) throws Exception {
+
+ // If this has already been tracked, we will not invoke!
+ if (_jbiMexTracker.track(jbiMex)) {
+ __log.debug("Skipping JBI MEX " + jbiMex.getExchangeId() + ",
already received!");
+ return;
+ }
+
+ QName serviceName = jbiMex.getEndpoint().getServiceName();
+
+ _ode.getTransactionManager().begin();
+
+ boolean success = false;
+ MyRoleMessageExchange odeMex = null;
+ try {
+ if (__log.isDebugEnabled()) {
+ __log.debug("invokeOde() JBI exchangeId=" +
jbiMex.getExchangeId() + " endpoint=" + _endpoint
+ + " operation=" + jbiMex.getOperation());
+ }
+ odeMex =
_ode._server.getEngine().createMessageExchange(jbiMex.getExchangeId(),
_endpoint.serviceName,
+ jbiMex.getOperation().getLocalPart());
+
+ if (odeMex.getOperation() != null) {
+ javax.wsdl.Message msgdef =
odeMex.getOperation().getInput().getMessage();
+ Message odeRequest =
odeMex.createMessage(odeMex.getOperation().getInput().getMessage().getQName());
+ Mapper mapper = _ode.findMapper(request,
odeMex.getOperation());
+ if (mapper == null) {
+ String errmsg = "Could not find a mapper for request
message for JBI MEX " + jbiMex.getExchangeId()
+ + "; ODE MEX " + odeMex.getMessageExchangeId() + "
is failed. ";
+ __log.error(errmsg);
+ throw new MessageTranslationException(errmsg);
+
+ }
+ odeMex.setProperty(Mapper.class.getName(),
mapper.getClass().getName());
+ odeMex.setCallbackEndpointReference();
+ mapper.toODE(odeRequest, request, msgdef);
+ odeMex.invoke(odeRequest);
+
+ // Handle the response if it is immediately available.
+ if (odeMex.getStatus() != Status.ASYNC) {
+ __log.debug("ODE MEX " + odeMex + " completed
SYNCHRONOUSLY.");
+ onResponse(odeMex);
+ _jbiMexTracker.consume(jbiMex.getExchangeId());
+ } else {
+ __log.debug("ODE MEX " + odeMex + " completed
ASYNCHRONOUSLY.");
+ }
+ } else {
+ __log.error("ODE MEX " + odeMex + " was unroutable.");
+ jbiMex.setError(new IllegalArgumentException("Unroutable
invocation."));
+ }
+
+ success = true;
+ // For one-way invocation we do not need to maintain the
association
+ if (odeMex.getMessageExchangePattern() !=
MessageExchangePattern.REQUEST_RESPONSE)
+ _jbiMexTracker.consume(jbiMex.getExchangeId());
+
+ } finally {
+ if (success) {
+ __log.debug("Commiting ODE MEX " + odeMex);
+ _ode.getTransactionManager().commit();
+ } else {
+ __log.debug("Rolling back ODE MEX " + odeMex);
+ _jbiMexTracker.consume(jbiMex.getExchangeId());
+ _ode.getTransactionManager().rollback();
+
+ }
+ }
+
+ }
+
+ private void outFailure(MyRoleMessageExchange odeMex,
javax.jbi.messaging.MessageExchange jbiMex) {
+ try {
+ jbiMex.setError(new Exception("MEXFailure"));
+ jbiMex.setStatus(ExchangeStatus.ERROR);
+ // TODO: get failure codes out of the message.
+ } catch (MessagingException ex) {
+ __log.fatal("Error bridging ODE out response: ", ex);
+ }
+ }
+
+ private void outResponse(MyRoleMessageExchange mex,
javax.jbi.messaging.MessageExchange jbiMex) {
+ InOut inout = (InOut) jbiMex;
+
+ try {
+ NormalizedMessage nmsg = inout.createMessage();
+ String mapperName = mex.getProperty(Mapper.class.getName());
+ Mapper mapper = _ode.getMapper(mapperName);
+ if (mapper == null) {
+ String errmsg = "Message-mapper " + mapperName + " used in ODE
MEX " + mex.getMessageExchangeId()
+ + " is no longer available.";
+ __log.error(errmsg);
+ throw new MessageTranslationException(errmsg);
+ }
+
+ mapper.toNMS(nmsg, mex.getResponse(),
mex.getOperation().getOutput().getMessage());
+
+ inout.setOutMessage(nmsg);
+ _ode.getChannel().send(inout);
+
+ } catch (MessagingException ex) {
+ __log.error("Error bridging ODE out response: ", ex);
+ inout.setError(ex);
+ } catch (MessageTranslationException e) {
+ __log.error("Error translating ODE message " + mex.getResponse() +
" to NMS format!", e);
+ inout.setError(e);
}
- } else {
- __log.error("ODE MEX " +odeMex + " was unroutable.");
- jbiMex.setError(new IllegalArgumentException("Unroutable
invocation."));
- }
-
- success = true;
- // For one-way invocation we do not need to maintain the association
- if (odeMex.getMessageExchangePattern() !=
MessageExchangePattern.REQUEST_RESPONSE)
- _jbiMexTracker.consume(jbiMex.getExchangeId());
-
- } finally {
- if (success) {
- __log.debug("Commiting ODE MEX " + odeMex );
- _ode.getTransactionManager().commit();
- } else {
- __log.debug("Rolling back ODE MEX " + odeMex );
- _jbiMexTracker.consume(jbiMex.getExchangeId());
- _ode.getTransactionManager().rollback();
-
- }
- }
-
- }
-
- private void outFailure(MyRoleMessageExchange odeMex,
javax.jbi.messaging.MessageExchange jbiMex) {
- try {
- jbiMex.setError(new Exception("MEXFailure"));
- jbiMex.setStatus(ExchangeStatus.ERROR);
- // TODO: get failure codes out of the message.
- } catch (MessagingException ex) {
- __log.fatal("Error bridging ODE out response: ", ex);
- }
- }
-
- private void outResponse(MyRoleMessageExchange mex,
javax.jbi.messaging.MessageExchange jbiMex) {
- InOut inout = (InOut)jbiMex;
-
- try {
- NormalizedMessage nmsg = inout.createMessage();
- String mapperName = mex.getProperty(Mapper.class.getName());
- Mapper mapper = _ode.getMapper(mapperName);
- if (mapper == null) {
- String errmsg = "Message-mapper " + mapperName + " used in ODE MEX "
- + mex.getMessageExchangeId() + " is no longer available.";
- __log.error(errmsg);
- throw new MessageTranslationException(errmsg);
- }
-
- mapper.toNMS(nmsg,mex.getResponse(),
- mex.getOperation().getOutput().getMessage());
-
- inout.setOutMessage(nmsg);
- _ode.getChannel().send(inout);
-
- } catch (MessagingException ex) {
- __log.error("Error bridging ODE out response: ", ex);
- inout.setError(ex);
- } catch (MessageTranslationException e) {
- __log.error("Error translating ODE message " + mex.getResponse()
- + " to NMS format!", e);
- inout.setError(e);
- }
- }
-
- private void outResponseFault(MyRoleMessageExchange mex,
javax.jbi.messaging.MessageExchange jbiMex) {
-
- InOut inout = (InOut)jbiMex;
-
- try {
- Fault flt = inout.createFault();
- String mapperName = mex.getProperty(Mapper.class.getName());
- Mapper mapper = _ode.getMapper(mapperName);
- if (mapper == null) {
- String errmsg = "Message-mapper " + mapperName + " used in ODE MEX "
- + mex.getMessageExchangeId() + " is no longer available.";
- __log.error(errmsg);
- throw new MessageTranslationException(errmsg);
- }
-
- mapper.toNMS(flt,mex.getResponse(),
- mex.getOperation().getOutput().getMessage());
- inout.setFault(flt);
- _ode.getChannel().send(inout);
- } catch (MessagingException e) {
- __log.error("Error bridging ODE fault response: ", e);
- inout.setError(e);
- } catch (MessageTranslationException mte) {
- __log.error("Error translating ODE fault message " +
mex.getFaultResponse()
- + " to NMS format!", mte);
- inout.setError(mte);
- }
- }
-
- public Endpoint getEndpoint() {
- return _endpoint;
- }
-
-
- /**
- * Class for tracking outstanding message exchanges from JBI.
- */
- private static class JbiMexTracker {
- /** Outstanding JBI-initiated exchanges: mapping for JBI MEX ID to JBI MEX
*/
- private Map<String, javax.jbi.messaging.MessageExchange>
_outstandingJbiExchanges =
- new HashMap<String, javax.jbi.messaging.MessageExchange>();
-
- synchronized boolean track(javax.jbi.messaging.MessageExchange jbiMex) {
- boolean found =
_outstandingJbiExchanges.containsKey(jbiMex.getExchangeId());
- _outstandingJbiExchanges.put(jbiMex.getExchangeId(), jbiMex);
- return found;
- }
-
- synchronized javax.jbi.messaging.MessageExchange consume(String clientId) {
- return _outstandingJbiExchanges.remove(clientId);
- }
-
-
- }
+ }
+
+ private void outResponseFault(MyRoleMessageExchange mex,
javax.jbi.messaging.MessageExchange jbiMex) {
+
+ InOut inout = (InOut) jbiMex;
+
+ try {
+ Fault flt = inout.createFault();
+ String mapperName = mex.getProperty(Mapper.class.getName());
+ Mapper mapper = _ode.getMapper(mapperName);
+ if (mapper == null) {
+ String errmsg = "Message-mapper " + mapperName + " used in ODE
MEX " + mex.getMessageExchangeId()
+ + " is no longer available.";
+ __log.error(errmsg);
+ throw new MessageTranslationException(errmsg);
+ }
+
+ mapper.toNMS(flt, mex.getResponse(),
mex.getOperation().getOutput().getMessage());
+ inout.setFault(flt);
+ _ode.getChannel().send(inout);
+ } catch (MessagingException e) {
+ __log.error("Error bridging ODE fault response: ", e);
+ inout.setError(e);
+ } catch (MessageTranslationException mte) {
+ __log.error("Error translating ODE fault message " +
mex.getFaultResponse() + " to NMS format!", mte);
+ inout.setError(mte);
+ }
+ }
+
+ public Endpoint getEndpoint() {
+ return _endpoint;
+ }
+
+ /**
+ * Class for tracking outstanding message exchanges from JBI.
+ */
+ private static class JbiMexTracker {
+ /**
+ * Outstanding JBI-initiated exchanges: mapping for JBI MEX ID to JBI
+ * MEX
+ */
+ private Map<String, javax.jbi.messaging.MessageExchange>
_outstandingJbiExchanges = new HashMap<String,
javax.jbi.messaging.MessageExchange>();
+
+ synchronized boolean track(javax.jbi.messaging.MessageExchange jbiMex)
{
+ boolean found =
_outstandingJbiExchanges.containsKey(jbiMex.getExchangeId());
+ _outstandingJbiExchanges.put(jbiMex.getExchangeId(), jbiMex);
+ return found;
+ }
+
+ synchronized javax.jbi.messaging.MessageExchange consume(String
clientId) {
+ return _outstandingJbiExchanges.remove(clientId);
+ }
+
+ }
}
Modified:
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeServiceUnit.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeServiceUnit.java?rev=438897&r1=438896&r2=438897&view=diff
==============================================================================
---
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeServiceUnit.java
(original)
+++
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeServiceUnit.java
Thu Aug 31 05:44:45 2006
@@ -20,15 +20,11 @@
package org.apache.ode.jbi;
import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
import javax.jbi.management.DeploymentException;
-import javax.xml.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.deploy.DeploymentUnitImpl;
/**
* Representation of a JBI service unit. A JBI service unit may actually
consist