diff options
10 files changed, 53 insertions, 39 deletions
diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java index dc77c5ecc6..4b65f77479 100644 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java +++ b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java @@ -209,9 +209,8 @@ public class BPELODEDeployFile { * @return - the File object containing the BPEL process
*/
private File getBPELFile() {
- URL fileURL = implementation.getProcessDefinition().getLocation();
try {
- File theProcess = new File( fileURL.toURI());
+ File theProcess = new File(implementation.getProcessDefinition().getLocation());
return theProcess;
} catch( Exception e ) {
if(__log.isDebugEnabled()) {
diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java index 13523734d1..8bd2b911ee 100644 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java +++ b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java @@ -95,9 +95,9 @@ public class TuscanyProcessConfImpl implements ProcessConf { */ public String getBpelDocument() { //System.out.println("getBPELDocument called"); - URL processURL = implementation.getProcessDefinition().getLocation(); + String processURL = implementation.getProcessDefinition().getLocation(); try { - return getRelativePath( getDirectory(), new File( processURL.toURI() )); + return getRelativePath( getDirectory(), new File(processURL)); } catch (Exception e) { if(__log.isWarnEnabled()) { __log.warn("Unable to resolve relative path of BPEL process" + processURL, e ); @@ -382,9 +382,8 @@ public class TuscanyProcessConfImpl implements ProcessConf { * @return - the File object containing the BPEL process */ private File getBPELFile() { - URL fileURL = implementation.getProcessDefinition().getLocation(); try { - File theProcess = new File( fileURL.toURI()); + File theProcess = new File(implementation.getProcessDefinition().getLocation()); return theProcess; } catch( Exception e ) { if(__log.isDebugEnabled()) { diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java index b67d6755c3..51948e1392 100644 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java +++ b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java @@ -19,7 +19,7 @@ package org.apache.tuscany.sca.implementation.bpel.ode.provider; import java.io.File; -import java.net.URL; +import java.net.URI; import javax.transaction.TransactionManager; @@ -95,9 +95,9 @@ public class BPELImplementationProvider implements ImplementationProvider { odeServer.init(); } - URL deployURL = this.implementation.getProcessDefinition().getLocation(); + URI deployURI = URI.create(this.implementation.getProcessDefinition().getLocation()); - File deploymentDir = new File(deployURL.toURI().getPath()).getParentFile(); + File deploymentDir = new File(deployURI.getPath()).getParentFile(); if(__log.isInfoEnabled()) { __log.info(">>> Deploying : " + deploymentDir.toString()); diff --git a/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java b/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java index 5d90f7e18d..d54add5391 100644 --- a/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java +++ b/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java @@ -22,6 +22,7 @@ import javax.xml.namespace.QName; import org.apache.tuscany.sca.assembly.ComponentType; import org.apache.tuscany.sca.assembly.Implementation; +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; /** * The model representing the BPEL implementation in an SCA assembly model. @@ -71,4 +72,20 @@ public interface BPELImplementation extends Implementation { * @param componentType the component type to set */ public void setComponentType(ComponentType componentType); + + /** + * Returns the model resolver that can be used to resolve WSDLs and XSDs + * referenced by the BPEL process. + * + * @return + */ + ModelResolver getModelResolver(); + + /** + * Sets the model resolver that can be used to resolve WSDLs and XSDs referenced + * by the BPEL process. + * + * @param modelResolver + */ + void setModelResolver(ModelResolver modelResolver); } diff --git a/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java b/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java index 3fde135357..a6518ed11b 100644 --- a/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java +++ b/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java @@ -57,28 +57,28 @@ public interface BPELProcessDefinition extends Base { * * @return URI for the process */ - URI getURI(); + String getURI(); /** * Set the BPEL process URI * * @param uri for the process */ - void setURI(URI uri); + void setURI(String uri); /** * Get the URL for the process location * * @return */ - URL getLocation(); + String getLocation(); /** * Set the URL for the process location * * @param url */ - void setLocation(URL location); + void setLocation(String location); /** * Return the list of PartnerLinks for this process diff --git a/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java b/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java index 52af7503a3..f1c943e49c 100644 --- a/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java +++ b/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java @@ -29,6 +29,7 @@ import org.apache.tuscany.sca.assembly.Property; import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.assembly.impl.ImplementationImpl; +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.implementation.bpel.BPELImplementation; import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition; @@ -42,6 +43,7 @@ class BPELImplementationImpl extends ImplementationImpl implements BPELImplement private QName processName; private BPELProcessDefinition processDefinition; private ComponentType componentType; + private ModelResolver modelResolver; public QName getProcess() { return processName; @@ -61,53 +63,49 @@ class BPELImplementationImpl extends ImplementationImpl implements BPELImplement @Override public String getURI() { - // The sample BPEL implementation does not have a URI + // The BPEL implementation does not have a URI return null; } @Override public void setURI(String uri) { - // The sample BPEL implementation does not have a URI + // The BPEL implementation does not have a URI } @Override public ConstrainingType getConstrainingType() { - // The sample BPEL implementation does not support constrainingTypes + // The BPEL implementation does not support constrainingTypes return null; } @Override public List<Property> getProperties() { - // The sample BPEL implementation does not support properties + // The BPEL implementation does not support properties return Collections.emptyList(); } - /* - * Returns the componentType for this BPEL process implementation - */ public ComponentType getComponentType() { return componentType; } - /* - * Sets the componentType for this BPEL process implementation - */ public void setComponentType(ComponentType componentType) { this.componentType = componentType; } + public ModelResolver getModelResolver() { + return modelResolver; + } + + public void setModelResolver(ModelResolver modelResolver) { + this.modelResolver = modelResolver; + } + @Override - /** - * Returns a List of the services for this BPEL process implementation - */ public List<Service> getServices() { return componentType.getServices(); } @Override - /** - * Returns a List of the references for this BPEL process implementation - */ public List<Reference> getReferences() { return componentType.getReferences(); } diff --git a/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java b/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java index 0f087e3727..5ce4f91376 100644 --- a/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java +++ b/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java @@ -19,7 +19,6 @@ package org.apache.tuscany.sca.implementation.bpel.impl; -import java.net.URI; import java.net.URL; import java.util.ArrayList; import java.util.List; @@ -39,8 +38,8 @@ import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; */ class BPELProcessDefinitionImpl implements BPELProcessDefinition { private QName name; - private URI uri; - private URL location; + private String uri; + private String location; private boolean unresolved; private List<BPELPartnerLinkElement> partnerLinks = new ArrayList<BPELPartnerLinkElement>(); private List<BPELImportElement> imports = new ArrayList<BPELImportElement>(); @@ -55,19 +54,19 @@ class BPELProcessDefinitionImpl implements BPELProcessDefinition { this.name = name; } - public URI getURI() { + public String getURI() { return uri; } - public void setURI(URI uri) { + public void setURI(String uri) { this.uri = uri; } - public URL getLocation() { + public String getLocation() { return location; } - public void setLocation(URL location) { + public void setLocation(String location) { this.location = location; } diff --git a/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java b/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java index 28651a93bd..cde6fc4fc5 100644 --- a/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java +++ b/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java @@ -109,7 +109,7 @@ public class BPELDocumentProcessor extends BaseStAXArtifactProcessor implements // and relying on componentType file for service definition // so it's OK to set resolved for now processDefinition = readProcessDefinition(artifactURL); - processDefinition.setURI(artifactURI); + processDefinition.setURI(artifactURI.toString()); processDefinition.setUnresolved(false); } catch (Exception e) { ContributionReadException ce = new ContributionReadException(e); @@ -333,7 +333,7 @@ public class BPELDocumentProcessor extends BaseStAXArtifactProcessor implements private BPELProcessDefinition readProcessDefinition(URL doc) throws Exception { BPELProcessDefinition processDefinition = factory.createBPELProcessDefinition(); processDefinition.setUnresolved(true); - processDefinition.setLocation(doc); + processDefinition.setLocation(doc.toString()); InputStream is = doc.openStream(); XMLStreamReader reader = null; diff --git a/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java b/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java index e12d3568d6..ce1c22e641 100644 --- a/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java +++ b/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java @@ -125,6 +125,8 @@ public class BPELImplementationProcessor extends BaseStAXArtifactProcessor imple if( implementation != null && implementation.isUnresolved()) { + implementation.setModelResolver(resolver); + BPELProcessDefinition processDefinition = resolveBPELProcessDefinition(implementation, resolver); if(processDefinition.isUnresolved()) { error("BPELProcessNotFound", implementation, processDefinition.getName()); diff --git a/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java b/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java index 76644e5209..e355b7adf9 100644 --- a/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java +++ b/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java @@ -54,6 +54,6 @@ public class BPELDocumentProcessorTestCase extends TestCase { assertNotNull(bpelProcessDefinition); assertEquals(new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld", "HelloWorld"), bpelProcessDefinition.getName()); - assertEquals(processLocation, bpelProcessDefinition.getLocation()); + assertEquals(processLocation.toString(), bpelProcessDefinition.getLocation()); } } |