You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ed...@apache.org on 2009/08/17 14:03:31 UTC

svn commit: r804947 - /tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/

Author: edwardsmj
Date: Mon Aug 17 12:03:30 2009
New Revision: 804947

URL: http://svn.apache.org/viewvc?rev=804947&view=rev
Log:
Adjusted handling of WSDL interfaces for Callback cases as part of adding Callback support - TUSCANY-3216

Modified:
    tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentModelResolver.java
    tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java
    tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java
    tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java
    tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.java

Modified: tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentModelResolver.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentModelResolver.java?rev=804947&r1=804946&r2=804947&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentModelResolver.java (original)
+++ tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentModelResolver.java Mon Aug 17 12:03:30 2009
@@ -191,17 +191,13 @@
             			                                        theImport.getNamespace(), resolver );
                 if( theWSDL != null ) {
 	            	theImport.setWSDLDefinition( theWSDL );
-	
+	            	
 	                // Find all the WSDL definitions matching the imported namespace
 	            	if( wsdlDefinitions == null ) {
 	            		wsdlDefinitions = new HashSet<Definition>();
 	            	} // end if 
 	            	
 	                wsdlDefinitions.add(theWSDL.getDefinition());
-	                // Fetch any definitions that are imported
-	                for (WSDLDefinition importedWSDL: theWSDL.getImportedDefinitions()) {
-	                    wsdlDefinitions.add(importedWSDL.getDefinition());
-	                } // end for
                 } // end if
             } // end if
         } // end for

Modified: tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java?rev=804947&r1=804946&r2=804947&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java (original)
+++ tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java Mon Aug 17 12:03:30 2009
@@ -50,16 +50,10 @@
 /**
  * BPEL document processor responsible for reading a BPEL file and producing necessary model info about it
  * 
- * TODO: The namespaces for WS-BPEL include 2 versions - only the earlier BPEL 1.1 versions are
- * supported at present - the BPEL 2.0 namespaces also need support.  This will require inspection
- * of both BPEL process files and of WSDL files for their BPEL namespaces
+ * Handles both BPEL 1.1 documents and BPEL 2.0 documents
  * @version $Rev$ $Date$
  */
 public class BPELDocumentProcessor extends BaseStAXArtifactProcessor implements URLArtifactProcessor<BPELProcessDefinition> {
-//    public final static QName BPEL_PROCESS_DEFINITION = new QName("http://schemas.xmlsoap.org/ws/2004/03/business-process/", "process");
-//    public final static QName BPEL_EXECUTABLE_DEFINITION = new QName("http://docs.oasis-open.org/wsbpel/2.0/process/executable", "process");
-
-
     
     private final static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
     
@@ -83,12 +77,16 @@
         return BPELProcessDefinition.class;
     }
 
+    /** 
+     * Read the BPEL Process definition file from the location identified by an artifact URL
+     * @param contributionURL	- URL of the Contribution containing the Process definition
+     * @param artifactURI		- URI of the artifact containing the BPEL Process definition
+     * @param artifactURL		- URL of the artifact containing the BPEL Process definition
+     * @return BPELProcessDefinition - SCA model of the BPEL Process
+     */
     public BPELProcessDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
         BPELProcessDefinition processDefinition = null;
         try {
-            // for now we are just using process name
-            // and relying on componentType file for service definition
-            // so it's OK to set resolved for now
             processDefinition = readProcessDefinition(artifactURL);
             processDefinition.setURI(artifactURI.toString());
             processDefinition.setUnresolved(true);

Modified: tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java?rev=804947&r1=804946&r2=804947&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java (original)
+++ tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java Mon Aug 17 12:03:30 2009
@@ -255,20 +255,19 @@
         WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
         reference.setInterfaceContract(interfaceContract);
 
-        // Establish whether there is just a call interface or a call + callback
-        // interface
+        // Establish whether there is just a call interface or a call + callback interface
         PortType callPT = null;
         PortType callbackPT = null;
-        if (myRolePT != null) {
-            callPT = myRolePT;
+        if (partnerRolePT != null) {
+            callPT = partnerRolePT;
             // If the 2 port types are not the same one, there is a callback...
-            if (partnerRolePT != null) {
+            if (myRolePT != null) {
                 if (!myRolePT.getQName().equals(partnerRolePT.getQName())) {
-                    callbackPT = partnerRolePT;
+                    callbackPT = myRolePT;
                 } // end if
             } // end if
-        } else if (partnerRolePT != null) {
-            callPT = partnerRolePT;
+        } else if (myRolePT != null) {
+            callPT = myRolePT;
         } // end if
 
         // No interfaces mean an error
@@ -277,8 +276,7 @@
         } // end if
 
         // Set the name of the reference to the supplied name and the
-        // multiplicity of the reference
-        // to 1..1
+        // multiplicity of the reference to 1..1
         // TODO: support other multiplicities
         reference.setName(name);
         reference.setMultiplicity(Multiplicity.ONE_ONE);
@@ -294,11 +292,10 @@
                 error("NoInterfaceForPortType", theInterfaces, callPT.getQName().toString());
             } else
                 reference.getInterfaceContract().setInterface(callInterface);
-        }
+        } // end if
 
         // There is a callback if the partner role is not null and if the
-        // partner role port type
-        // is not the same as the port type for my role
+        // partner role port type is not the same as the port type for my role
         if (callbackPT != null) {
             WSDLInterface callbackInterface = null;
             for (WSDLInterface anInterface : theInterfaces) {
@@ -367,8 +364,7 @@
         } // end if
 
         // There is a callback if the partner role is not null and if the
-        // partner role port type
-        // is not the same as the port type for my role
+        // partner role port type is not the same as the port type for my role
         if (callbackPT != null) {
             WSDLInterface callbackInterface = null;
             for (WSDLInterface anInterface : theInterfaces) {

Modified: tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java?rev=804947&r1=804946&r2=804947&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java (original)
+++ tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java Mon Aug 17 12:03:30 2009
@@ -80,6 +80,9 @@
     	if (theRole == null || theRole.length() == 0) {
             return null;
         } // end if
+    	if( pLinkType == null ) {
+    		throw new IllegalStateException("BPELPartnerLinkElement: " + this.name + " has no Partner Link type object set");
+    	} // end if 
         if (theRole.equals(pLinkType.getRole1Name())) {
             return pLinkType.getRole1pType();
         } else if (theRole.equals(pLinkType.getRole2Name())) {

Modified: tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.java?rev=804947&r1=804946&r2=804947&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.java (original)
+++ tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.java Mon Aug 17 12:03:30 2009
@@ -107,5 +107,12 @@
     public void setRequired(java.lang.Boolean required) {
         this.required = required;
     }
+    
+    /**
+     * toString method to return a description of this BPELPartnerLinkType useful for debugging
+     */
+    public String toString() {
+    	return "BPELPartnerLinkType: " + name.toString();
+    } // end method toString
 
 } // end BPELPartnerLinkType