Author: mriou
Date: Mon Oct 16 18:03:19 2006
New Revision: 464763
URL: http://svn.apache.org/viewvc?view=rev&rev=464763
Log:
Allowing the deployment of processes relying on several services declared in
the same namespace but different definitions. We all know that's bad but
apparently some people like it.
Modified:
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/DeploymentUnit.java
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerBPEL20.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentUnitImpl.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentRegistry.java
incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BindingContextImpl.java
Modified:
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java?view=diff&rev=464763&r1=464762&r2=464763
==============================================================================
---
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java
(original)
+++
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java
Mon Oct 16 18:03:19 2006
@@ -66,8 +66,8 @@
public EndpointReference activateMyRoleEndpoint(QName processId,
DeploymentUnit deploymentUnit, Endpoint myRoleEndpoint,
PortType portType) {
try {
- ODEService svc =
_server.createService(deploymentUnit.getDefinitionForNamespace(myRoleEndpoint.serviceName
- .getNamespaceURI()), myRoleEndpoint.serviceName,
myRoleEndpoint.portName);
+ ODEService svc =
_server.createService(deploymentUnit.getDefinitionForService(myRoleEndpoint.serviceName)
+ , myRoleEndpoint.serviceName, myRoleEndpoint.portName);
return svc.getMyServiceRef();
} catch (AxisFault axisFault) {
throw new ContextException("Could not activate endpoint for
service " + myRoleEndpoint.serviceName
@@ -84,7 +84,7 @@
// NOTE: This implementation assumes that the initial value of the
// partner role determines the binding.
return _server.createExternalService(deploymentUnit
-
.getDefinitionForNamespace(initialPartnerEndpoint.serviceName.getNamespaceURI()),
+ .getDefinitionForService(initialPartnerEndpoint.serviceName),
initialPartnerEndpoint.serviceName,
initialPartnerEndpoint.portName);
}
Modified:
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java?view=diff&rev=464763&r1=464762&r2=464763
==============================================================================
---
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
(original)
+++
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
Mon Oct 16 18:03:19 2006
@@ -352,7 +352,18 @@
* @return XML representation of the EPR
*/
public static Element genEPRfromWSDL(Definition wsdlDef, QName name,
String portName) {
+ System.out.println("SERVICE NAME: " + name);
+ System.out.println("SERVICE PORT: " + portName);
+
+ for (Object s : wsdlDef.getServices().values()) {
+ System.out.println("Found service " + ((Service)s).getQName());
+ for (Object p : ((Service) s).getPorts().values()) {
+ System.out.println("Found port " + ((Port)p).getName());
+ }
+ }
+
Service serviceDef = wsdlDef.getService(name);
+ System.out.println("Service def " + serviceDef);
if (serviceDef != null) {
Port portDef = serviceDef.getPort(portName);
if (portDef != null) {
Modified:
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/DeploymentUnit.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/DeploymentUnit.java?view=diff&rev=464763&r1=464762&r2=464763
==============================================================================
---
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/DeploymentUnit.java
(original)
+++
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/DeploymentUnit.java
Mon Oct 16 18:03:19 2006
@@ -51,11 +51,11 @@
* Get a WSDL definition from the deployment directory for the given
* namespace.
*
- * @param namespaceURI
+ * @param name
* WSDL targetNamespace
* @return corresponding WSDL document
*/
- Definition getDefinitionForNamespace(String namespaceURI);
+ Definition getDefinitionForService(QName name);
/**
* Get a collection of all the WSDL definitions in the deployment
directory.
Modified:
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerBPEL20.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerBPEL20.java?view=diff&rev=464763&r1=464762&r2=464763
==============================================================================
---
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerBPEL20.java
(original)
+++
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerBPEL20.java
Mon Oct 16 18:03:19 2006
@@ -155,6 +155,7 @@
// varResolver.resolveVariable(new QName(null, varStr));
// }
} catch (XPathExpressionException e) {
+ __log.debug(e);
__log.info("Couldn't validate properly expression " + xpathStr);
} catch (WrappedResolverException wre) {
if (wre._compilationMsg != null) throw new
CompilationException(wre._compilationMsg, wre);
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentUnitImpl.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentUnitImpl.java?view=diff&rev=464763&r1=464762&r2=464763
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentUnitImpl.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentUnitImpl.java
Mon Oct 16 18:03:19 2006
@@ -251,8 +251,8 @@
return _docRegistry;
}
- public Definition getDefinitionForNamespace(String namespaceURI) {
- return getDocRegistry().getDefinition(namespaceURI);
+ public Definition getDefinitionForService(QName name) {
+ return getDocRegistry().getDefinition(name);
}
public Collection<Definition> getDefinitions() {
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentRegistry.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentRegistry.java?view=diff&rev=464763&r1=464762&r2=464763
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentRegistry.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentRegistry.java
Mon Oct 16 18:03:19 2006
@@ -40,182 +40,140 @@
import javax.xml.namespace.QName;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* A parsed collection of WSDL definitions, including BPEL-specific extensions.
*/
public class DocumentRegistry {
- private static final Log __log = LogFactory.getLog(DocumentRegistry.class);
- private static final Messages __msgs = Messages.getMessages(Messages.class);
+ private static final Log __log = LogFactory.getLog(DocumentRegistry.class);
+ private static final Messages __msgs =
Messages.getMessages(Messages.class);
+
+ private final ArrayList<Definition4BPEL> _definitions = new
ArrayList<Definition4BPEL>();
+ private final Map<URI, byte[]> _schemas = new HashMap<URI,byte[]>();
+
+ private SchemaModel _model;
+ private XMLEntityResolver _resolver;
+
+ public DocumentRegistry(XMLEntityResolver resolver) {
+ // bogus schema to force schema creation
+ _schemas.put(URI.create("http://www.apache.org/ode/bogus/namespace"),
+ ("<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
+ + "
targetNamespace=\"http://www.apache.org/ode/bogus/namespace\">"
+ + "<xsd:simpleType name=\"__bogusType__\">"
+ + "<xsd:restriction base=\"xsd:normalizedString\"/>"
+ + "</xsd:simpleType>" + "</xsd:schema>").getBytes());
+ _resolver = resolver;
+ }
- private final HashSet<String> _loadedDefinitions = new HashSet<String>();
- private final HashMap<String, Definition4BPEL> _definitions = new
HashMap<String, Definition4BPEL>();
- private final Map<URI, byte[]> _schemas = new HashMap<URI,byte[]>();
-
- private SchemaModel _model;
- private XMLEntityResolver _resolver;
-
- public DocumentRegistry(XMLEntityResolver resolver) {
- // bogus schema to force schema creation
- _schemas.put(URI.create("http://www.apache.org/ode/bogus/namespace"),
- ("<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
- + "
targetNamespace=\"http://www.apache.org/ode/bogus/namespace\">"
- + "<xsd:simpleType name=\"__bogusType__\">"
- + "<xsd:restriction base=\"xsd:normalizedString\"/>"
- + "</xsd:simpleType>" + "</xsd:schema>").getBytes());
- _resolver = resolver;
- }
-
-
- /**
- * Obtains an WSDL definition based on its target namespace.
- *
- * @param targetNamespace
- *
- * @return WSDL definition or <code>null</code> if unavailable.
- */
- public Definition4BPEL getDefinition(String targetNamespace) {
- return _definitions.get(targetNamespace);
- }
-
- public Definition4BPEL[] getDefinitions(){
- return _definitions.values().toArray(new
Definition4BPEL[_definitions.size()]);
- }
-
-
- /**
- * Get the schema model (XML Schema).
- *
- * @return schema model
- */
- public SchemaModel getSchemaModel() {
- if (_model == null) {
- _model = SchemaModelImpl.newModel(_schemas);
- }
-
- assert _model != null;
-
- return _model;
- }
-
- /**
- * Adds a WSDL definition for use in resolving MessageType, PortType,
- * Operation and BPEL properties and property aliases
- * @param def WSDL definition
- */
- @SuppressWarnings("unchecked")
- public void addDefinition(Definition4BPEL def) throws CompilationException {
- if (def == null)
- throw new NullPointerException("def=null");
-
- if (__log.isDebugEnabled()) {
- __log.debug("addDefinition(" + def.getTargetNamespace() + " from " +
def.getDocumentBaseURI() + ")");
- }
-
- // Do not load the same definition twice.
- if (_loadedDefinitions.contains(def.getDocumentBaseURI())) {
- if (__log.isDebugEnabled()) {
- __log.debug("WSDL at " + def.getDocumentBaseURI() + " will not be
imported (duplicate import).");
- }
- return;
- }
-
- if (_definitions.containsKey(def.getTargetNamespace())) {
- // This indicates that we imported a WSDL with the same namespace from
- // two different locations. This is not an error, but should be a
warning.
- if (__log.isDebugEnabled()) {
- __log.debug("WSDL at " + def.getDocumentBaseURI() + " will not be
imported (duplicate import ).");
- }
- return;
- }
-
- _definitions.put(def.getTargetNamespace(), def);
- _loadedDefinitions.add(def.getDocumentBaseURI());
-
-
- captureSchemas(def);
- }
-
- @SuppressWarnings("unchecked")
- private void captureSchemas(Definition def) throws CompilationException {
- assert def != null;
-
- if (__log.isDebugEnabled())
- __log.debug("Processing XSD schemas in " + def.getDocumentBaseURI());
-
- Types types = def.getTypes();
-
- if (types != null) {
- for (ExtensibilityElement ee : ((List<ExtensibilityElement>)
def.getTypes().getExtensibilityElements())) {
- if (ee instanceof XMLSchemaType) {
- String schema = ((XMLSchemaType) ee).getXMLSchema();
- Map<URI, byte[]> capture;
- URI docuri;
- try {
- docuri = new URI(def.getDocumentBaseURI());
- } catch (URISyntaxException e) {
- // This is really quite unexpected..
- __log.fatal("Internal Error: WSDL Base URI is invalid.", e);
- throw new RuntimeException(e);
- }
-
- try {
- capture = XSUtils.captureSchema(docuri, schema, _resolver);
-
- // Add new schemas to our list.
- _schemas.putAll(capture);
- } catch (XsdException xsde) {
- System.out.println("+++++++++++++++++++++++++++++++++");
- xsde.printStackTrace();
- System.out.println("+++++++++++++++++++++++++++++++++");
- __log.debug("captureSchemas: capture failed for " + docuri, xsde);
-
- LinkedList<XsdException> exceptions = new
LinkedList<XsdException>();
- while (xsde != null) {
- exceptions.addFirst(xsde);
- xsde = xsde.getPrevious();
- }
- if (exceptions.size() > 0) {
- throw new BpelEngineException(
-
__msgs.errSchemaError(exceptions.get(0).getDetailMessage()));
+ /**
+ * Obtains an WSDL definition based on its target namespace.
+ *
+ * @param serviceName
+ *
+ * @return WSDL definition or <code>null</code> if unavailable.
+ */
+ public Definition4BPEL getDefinition(QName serviceName) {
+ for (Definition4BPEL definition4BPEL : _definitions) {
+ if
(definition4BPEL.getTargetNamespace().equals(serviceName.getNamespaceURI())) {
+ if (definition4BPEL.getService(serviceName) != null)
+ return definition4BPEL;
}
- }
- // invalidate model
- _model = null;
}
- }
+ return null;
+ }
+
+ public Definition4BPEL[] getDefinitions(){
+ return _definitions.toArray(new Definition4BPEL[_definitions.size()]);
+ }
+
+
+ /**
+ * Get the schema model (XML Schema).
+ *
+ * @return schema model
+ */
+ public SchemaModel getSchemaModel() {
+ if (_model == null) {
+ _model = SchemaModelImpl.newModel(_schemas);
+ }
+
+ assert _model != null;
+
+ return _model;
}
- }
- public Property getProperty(QName name) {
- Definition4BPEL declaringDef = getDefinition(name.getNamespaceURI());
- if (declaringDef == null) return null;
- return declaringDef.getProperty(name);
- }
-
- public PropertyAlias getPropertyAlias(QName propertyName, QName messageType)
{
- Definition4BPEL declaringDef =
getDefinition(propertyName.getNamespaceURI());
- if (declaringDef == null) return null;
- return declaringDef.getPropertyAlias(propertyName, messageType);
- }
-
- public PartnerLinkType getPartnerLinkType(QName partnerLinkType) {
- Definition4BPEL declaringDef =
getDefinition(partnerLinkType.getNamespaceURI());
- if (declaringDef == null) return null;
- return declaringDef.getPartnerLinkType(partnerLinkType);
- }
-
- public PortType getPortType(QName portType) {
- Definition4BPEL declaringDef = getDefinition(portType.getNamespaceURI());
- if (declaringDef == null) return null;
- return declaringDef.getPortType(portType);
- }
+ /**
+ * Adds a WSDL definition for use in resolving MessageType, PortType,
+ * Operation and BPEL properties and property aliases
+ * @param def WSDL definition
+ */
+ @SuppressWarnings("unchecked")
+ public void addDefinition(Definition4BPEL def) throws CompilationException
{
+ if (def == null)
+ throw new NullPointerException("def=null");
+
+ if (__log.isDebugEnabled()) {
+ __log.debug("addDefinition(" + def.getTargetNamespace() + " from "
+ def.getDocumentBaseURI() + ")");
+ }
+
+ _definitions.add(def);
+
+ captureSchemas(def);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void captureSchemas(Definition def) throws CompilationException {
+ assert def != null;
+
+ if (__log.isDebugEnabled())
+ __log.debug("Processing XSD schemas in " +
def.getDocumentBaseURI());
+
+ Types types = def.getTypes();
+
+ if (types != null) {
+ for (ExtensibilityElement ee : ((List<ExtensibilityElement>)
def.getTypes().getExtensibilityElements())) {
+ if (ee instanceof XMLSchemaType) {
+ String schema = ((XMLSchemaType) ee).getXMLSchema();
+ Map<URI, byte[]> capture;
+ URI docuri;
+ try {
+ docuri = new URI(def.getDocumentBaseURI());
+ } catch (URISyntaxException e) {
+ // This is really quite unexpected..
+ __log.fatal("Internal Error: WSDL Base URI is
invalid.", e);
+ throw new RuntimeException(e);
+ }
+
+ try {
+ capture = XSUtils.captureSchema(docuri, schema,
_resolver);
+
+ // Add new schemas to our list.
+ _schemas.putAll(capture);
+ } catch (XsdException xsde) {
+
System.out.println("+++++++++++++++++++++++++++++++++");
+ xsde.printStackTrace();
+
System.out.println("+++++++++++++++++++++++++++++++++");
+ __log.debug("captureSchemas: capture failed for " +
docuri, xsde);
+
+ LinkedList<XsdException> exceptions = new
LinkedList<XsdException>();
+ while (xsde != null) {
+ exceptions.addFirst(xsde);
+ xsde = xsde.getPrevious();
+ }
+
+ if (exceptions.size() > 0) {
+ throw new BpelEngineException(
+
__msgs.errSchemaError(exceptions.get(0).getDetailMessage()));
+ }
+ }
+ // invalidate model
+ _model = null;
+ }
+ }
+ }
+ }
}
Modified:
incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BindingContextImpl.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BindingContextImpl.java?view=diff&rev=464763&r1=464762&r2=464763
==============================================================================
---
incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BindingContextImpl.java
(original)
+++
incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BindingContextImpl.java
Mon Oct 16 18:03:19 2006
@@ -58,8 +58,7 @@
final Document doc = DOMUtils.newDocument();
Element serviceref =
doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(),
EndpointReference.SERVICE_REF_QNAME.getLocalPart());
-
serviceref.setNodeValue(deploymentUnit.getDefinitionForNamespace(myRoleEndpoint.serviceName
- .getNamespaceURI()) +":" +
+
serviceref.setNodeValue(deploymentUnit.getDefinitionForService(myRoleEndpoint.serviceName)
+":" +
myRoleEndpoint.serviceName +":" +
myRoleEndpoint.portName);
doc.appendChild(serviceref);