Adjusted handling of WSDL interfaces for Callback cases as part of adding Callback support - TUSCANY-3216

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@804947 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
edwardsmj 2009-08-17 12:03:30 +00:00
parent bcc56f14a4
commit 718e75b8a5
5 changed files with 30 additions and 30 deletions

View file

@ -191,17 +191,13 @@ public class BPELDocumentModelResolver implements ModelResolver {
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

View file

@ -50,16 +50,10 @@ import org.apache.tuscany.sca.monitor.Problem.Severity;
/**
* 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 @@ public class BPELDocumentProcessor extends BaseStAXArtifactProcessor implements
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);

View file

@ -255,20 +255,19 @@ public class BPELImplementationProcessor extends BaseStAXArtifactProcessor imple
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 @@ public class BPELImplementationProcessor extends BaseStAXArtifactProcessor imple
} // 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 @@ public class BPELImplementationProcessor extends BaseStAXArtifactProcessor imple
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 @@ public class BPELImplementationProcessor extends BaseStAXArtifactProcessor imple
} // 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) {

View file

@ -80,6 +80,9 @@ public class BPELPartnerLinkElement {
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())) {

View file

@ -107,5 +107,12 @@ public class BPELPartnerLinkTypeElement implements ExtensibilityElement {
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