diff options
author | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
---|---|---|
committer | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
commit | bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch) | |
tree | 38a92061c0793434c4be189f1d70c3458b6bc41d /branches/sca-java-0.99/modules/implementation-bpel/src |
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-0.99/modules/implementation-bpel/src')
20 files changed, 1284 insertions, 0 deletions
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPEL.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPEL.java new file mode 100644 index 0000000000..c474c59d51 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPEL.java @@ -0,0 +1,35 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel;
+
+/**
+ * The service interface of the single BPEL service provided by BPEL components.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BPEL {
+
+ /**
+ * Invoke a bpel process
+ * @param object
+ * @return object
+ */
+ Object invokeProcess(Object object);
+
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java new file mode 100644 index 0000000000..9e3adefe5c --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java @@ -0,0 +1,51 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel;
+
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.ode.bpel.iapi.ProcessConf;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The model representing the BPEL implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BPELImplementation extends Implementation, Extensible {
+
+ /**
+ * Builds the process configuration used by ODE to get deployment and configuration
+ * level information about a process.
+ * @return
+ */
+ ProcessConf getProcessConf();
+
+ /**
+ * Sets the implementation compiled process bytes
+ * @param compiledProcess serialized compiled process
+ */
+ void setCompiledProcess(byte[] compiledProcess);
+
+ /**
+ * @param processName process QName
+ */
+ void setProcessName(QName processName);
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationFactory.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationFactory.java new file mode 100644 index 0000000000..9df99b6069 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationFactory.java @@ -0,0 +1,36 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel;
+
+/**
+ * A factory for the BPEL implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BPELImplementationFactory {
+
+ /**
+ * Creates a new CRUD implementation.
+ *
+ * @return
+ */
+ BPELImplementation createBPELImplementation();
+
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELImplementationFactory.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELImplementationFactory.java new file mode 100644 index 0000000000..28bc603c8b --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELImplementationFactory.java @@ -0,0 +1,46 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.bpel.impl.BPELImplementationImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+
+/**
+ * A default factory for the BPEL implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultBPELImplementationFactory implements BPELImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private WSDLFactory wsdlFactory;
+
+ public DefaultBPELImplementationFactory(AssemblyFactory assemblyFactory,
+ WSDLFactory wsdlFactory) {
+ this.assemblyFactory = assemblyFactory;
+ this.wsdlFactory = wsdlFactory;
+ }
+
+ public BPELImplementation createBPELImplementation() {
+ return new BPELImplementationImpl(assemblyFactory, wsdlFactory);
+ }
+
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELArtifactProcessor.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELArtifactProcessor.java new file mode 100644 index 0000000000..1bb88496b4 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELArtifactProcessor.java @@ -0,0 +1,144 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.ode.bpel.compiler.BpelC;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementationFactory;
+import org.apache.tuscany.sca.implementation.bpel.DefaultBPELImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+
+/**
+ * Implements a STAX artifact processor for BPEL implementations.
+ *
+ * The artifact processor is responsible for processing <implementation.bpel>
+ * elements in SCA assembly XML composite files and populating the BPEL
+ * implementation model, resolving its references to other artifacts in the SCA
+ * contribution, and optionally write the model back to SCA assembly XML.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELArtifactProcessor implements StAXArtifactProcessor<BPELImplementation> {
+ private static final QName IMPLEMENTATION_BPEL = new QName(Constants.SCA10_TUSCANY_NS, "implementation.bpel");
+
+ private BPELImplementationFactory bpelFactory;
+
+ public BPELArtifactProcessor(ModelFactoryExtensionPoint modelFactories) {
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+ this.bpelFactory = new DefaultBPELImplementationFactory(assemblyFactory, wsdlFactory);
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_BPEL;
+ }
+
+ public Class<BPELImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return BPELImplementation.class;
+ }
+
+ public BPELImplementation read(XMLStreamReader reader) throws ContributionReadException {
+ assert IMPLEMENTATION_BPEL.equals(reader.getName());
+
+ // Read an <implementation.bpel> element
+ try {
+ // Read the process attribute.
+ QName process = getAttributeValueNS(reader, "process");
+ String bpelFile = reader.getAttributeValue(null, "file");
+
+ // Resolving the BPEL file and compiling it
+ URL bpelURL = getClass().getClassLoader().getResource(bpelFile);
+ if (bpelURL == null)
+ throw new ODEProcessException("Couldn't find referenced bpel file " + bpelFile);
+ BpelC bpelc = BpelC.newBpelCompiler();
+ ByteArrayOutputStream compiledProcess = new ByteArrayOutputStream();
+ bpelc.setOutputStream(compiledProcess);
+ try {
+ bpelc.compile(new File(bpelURL.getFile()));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ // Create an initialize the BPEL implementation model
+ BPELImplementation implementation = bpelFactory.createBPELImplementation();
+ implementation.setProcessName(process);
+ implementation.setCompiledProcess(compiledProcess.toByteArray());
+ implementation.setUnresolved(false);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_BPEL.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void resolve(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ System.out.println("IN RESOLVE");
+ if( impl != null && impl.isUnresolved()) {
+
+ impl.setUnresolved(false);
+ }
+
+ }
+
+ public void write(BPELImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+ }
+
+ private QName getAttributeValueNS(XMLStreamReader reader, String attribute) {
+ String fullValue = reader.getAttributeValue(null, "process");
+ if (fullValue.indexOf(":") < 0)
+ throw new ODEProcessException("Attribute " + attribute + " with value " + fullValue +
+ " in your composite should be prefixed (process=\"prefix:name\").");
+ String prefix = fullValue.substring(0, fullValue.indexOf(":"));
+ String name = fullValue.substring(fullValue.indexOf(":") + 1);
+ String nsUri = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (nsUri == null)
+ throw new ODEProcessException("Attribute " + attribute + " with value " + fullValue +
+ " in your composite has un unrecognized namespace prefix.");
+ return new QName(nsUri, name, prefix);
+ }
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java new file mode 100644 index 0000000000..81401f0c72 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java @@ -0,0 +1,214 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.evt.BpelEvent;
+import org.apache.ode.bpel.iapi.Endpoint;
+import org.apache.ode.bpel.iapi.ProcessConf;
+import org.apache.ode.bpel.iapi.ProcessState;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+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.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.w3c.dom.Node;
+
+/**
+ * The model representing a BPEL implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELImplementationImpl implements BPELImplementation {
+
+ private Service _bpelService;
+ private QName _processName;
+ private byte[] _compiledProcess;
+ private boolean unresolved;
+
+ /**
+ * Constructs a new BPEL implementation.
+ */
+ public BPELImplementationImpl(AssemblyFactory assemblyFactory,
+ WSDLFactory wsdlFactory) {
+
+ _bpelService = assemblyFactory.createService();
+ _bpelService.setName("BPEL");
+// WSDLInterface wsdlInterface;
+// try {
+// wsdlInterface = introspector.introspect(BPEL.class);
+// } catch (InvalidInterfaceException e) {
+// throw new IllegalArgumentException(e);
+// }
+// WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
+// interfaceContract.setInterface(wsdlInterface);
+// _bpelService.setInterfaceContract(interfaceContract);
+ }
+
+ public void setCompiledProcess(byte[] compiledProcess) {
+ _compiledProcess = compiledProcess;
+ }
+
+ public void setProcessName(QName processName) {
+ _processName = processName;
+ }
+
+ public ProcessConf getProcessConf() {
+ return null;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The sample BPEL implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The sample BPEL implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The sample BPEL implementation provides a single fixed CRUD service
+ return Collections.singletonList(_bpelService);
+ }
+
+ public List<Reference> getReferences() {
+ // The sample BPEL implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ // The sample BPEL implementation does not have a URI
+ return null;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The sample BPEL implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ // The sample BPEL implementation does not have a URI
+ }
+
+
+ public List<Object> getExtensions() {
+ // The sample BPEL implementation does not support extensions
+ return Collections.emptyList();
+ }
+
+ public boolean isUnresolved() {
+ return this.unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ private class ProcessConfImpl implements ProcessConf {
+ public QName getProcessId() {
+ return _processName;
+ }
+
+ public QName getType() {
+ return _processName;
+ }
+
+ public long getVersion() {
+ // TODO Versioniong?
+ return 0;
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public InputStream getCBPInputStream() {
+ return new ByteArrayInputStream(_compiledProcess);
+ }
+
+ public String getBpelDocument() {
+ return null;
+ }
+
+ public URL getBaseURL() {
+ return null;
+ }
+
+ public Date getDeployDate() {
+ return null;
+ }
+
+ public String getDeployer() {
+ return null;
+ }
+
+ public ProcessState getState() {
+ return null;
+ }
+
+ public List<File> getFiles() {
+ return null;
+ }
+
+ public Map<QName, Node> getProperties() {
+ return null;
+ }
+
+ public String getPackage() {
+ return null;
+ }
+
+ public Definition getDefinitionForService(QName qName) {
+ return null;
+ }
+
+ public Definition getDefinitionForPortType(QName qName) {
+ return null;
+ }
+
+ public Map<String, Endpoint> getProvideEndpoints() {
+ return null;
+ }
+
+ public Map<String, Endpoint> getInvokeEndpoints() {
+ return null;
+ }
+
+ public boolean isEventEnabled(List<String> strings, BpelEvent.TYPE type) {
+ return true;
+ }
+ }
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java new file mode 100644 index 0000000000..34743896b1 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java @@ -0,0 +1,40 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.impl;
+
+/**
+ * Thrown when a process can't be compiled properly or when its descriptors
+ * are invalid.
+ */
+public class ODEProcessException extends RuntimeException {
+ private static final long serialVersionUID = 1047893235216756186L;
+
+ public ODEProcessException(String message) {
+ super(message);
+ }
+
+ public ODEProcessException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ODEProcessException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java new file mode 100644 index 0000000000..5846c90150 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java @@ -0,0 +1,151 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.ode;
+
+import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.il.dbutil.Database;
+import org.apache.ode.bpel.dao.BpelDAOConnectionFactoryJDBC;
+import org.apache.ode.bpel.engine.BpelServerImpl;
+import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
+import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
+import org.apache.ode.bpel.scheduler.quartz.QuartzSchedulerImpl;
+import org.apache.ode.bpel.iapi.Scheduler;
+
+import java.util.Properties;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ExecutorService;
+import java.io.File;
+import java.net.URL;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.transaction.TransactionManager;
+
+/**
+ *
+ */
+public class EmbeddedODEServer {
+ protected final Log __log = LogFactory.getLog(getClass());
+
+ private boolean _initialized;
+ private OdeConfigProperties _config;
+ private TransactionManager _txMgr;
+ private Database _db;
+ private File _workRoot;
+ private BpelDAOConnectionFactoryJDBC _daoCF;
+ private BpelServerImpl _bpelServer;
+ private ExecutorService _executor;
+ private Scheduler _scheduler;
+
+ public void init() throws ODEInitializationException {
+ _config = new OdeConfigProperties(new Properties(), "ode-sca");
+
+ // Setting work root as the directory containing our database (wherever in the classpath)
+ URL dbLocation = getClass().getClassLoader().getResource("jpadb");
+ if (dbLocation == null)
+ throw new ODEInitializationException("Couldn't find database in the classpath");
+ _workRoot = new File(dbLocation.getFile()).getParentFile();
+
+ initTxMgr();
+ initPersistence();
+ initBpelServer();
+
+ try {
+ _bpelServer.start();
+ } catch (Exception ex) {
+ String errmsg = "An error occured during the ODE BPEL server startup.";
+ __log.error(errmsg, ex);
+ throw new ODEInitializationException(errmsg, ex);
+ }
+
+ __log.info("ODE BPEL server started.");
+ _initialized = true;
+ }
+
+ private void initTxMgr() {
+ try {
+ GeronimoTxFactory txFactory = new GeronimoTxFactory();
+ _txMgr = txFactory.getTransactionManager();
+ } catch (Exception e) {
+ __log.fatal("Couldn't initialize a transaction manager using Geronimo's transaction factory.", e);
+ throw new ODEInitializationException("Couldn't initialize a transaction manager using " +
+ "Geronimo's transaction factory.", e);
+ }
+ }
+
+ private void initPersistence() {
+ _db = new Database(_config);
+ _db.setTransactionManager(_txMgr);
+ _db.setWorkRoot(_workRoot);
+
+ try {
+ _db.start();
+ _daoCF = _db.createDaoCF();
+ } catch (Exception ex) {
+ String errmsg = "Error while configuring ODE persistence.";
+ __log.error(errmsg, ex);
+ throw new ODEInitializationException(errmsg, ex);
+ }
+ }
+
+ private void initBpelServer() {
+ if (__log.isDebugEnabled()) {
+ __log.debug("ODE initializing");
+ }
+ if (_config.getThreadPoolMaxSize() == 0)
+ _executor = Executors.newCachedThreadPool();
+ else
+ _executor = Executors.newFixedThreadPool(_config.getThreadPoolMaxSize());
+
+ _bpelServer = new BpelServerImpl();
+ _scheduler = createScheduler();
+ _scheduler.setJobProcessor(_bpelServer);
+
+ _bpelServer.setDaoConnectionFactory(_daoCF);
+ _bpelServer.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl(_scheduler));
+// _bpelServer.setEndpointReferenceContext(new EndpointReferenceContextImpl(this));
+// _bpelServer.setMessageExchangeContext(new MessageExchangeContextImpl(this));
+// _bpelServer.setBindingContext(new BindingContextImpl(this, _store));
+ _bpelServer.setScheduler(_scheduler);
+ if (_config.isDehydrationEnabled()) {
+ CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy();
+ _bpelServer.setDehydrationPolicy(dehy);
+ }
+ _bpelServer.init();
+ }
+
+ protected Scheduler createScheduler() {
+ QuartzSchedulerImpl scheduler = new QuartzSchedulerImpl();
+ scheduler.setExecutorService(_executor, 20);
+ scheduler.setTransactionManager(_txMgr);
+ scheduler.setDataSource(_db.getDataSource());
+ scheduler.init();
+ return scheduler;
+ }
+
+ public boolean isInitialized() {
+ return _initialized;
+ }
+
+ public BpelServerImpl getBpelServer() {
+ return _bpelServer;
+ }
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java new file mode 100644 index 0000000000..d20dbe6ffc --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java @@ -0,0 +1,43 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.ode;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.transaction.TransactionManager;
+
+public class GeronimoTxFactory {
+ private static final Log __log = LogFactory.getLog(GeronimoTxFactory.class);
+
+ /* Public no-arg contructor is required */
+ public GeronimoTxFactory() {
+ }
+
+ public TransactionManager getTransactionManager() {
+ __log.info("Using embedded Geronimo transaction manager");
+ try {
+ Object obj = new org.apache.geronimo.transaction.manager.GeronimoTransactionManager();
+ return (TransactionManager) obj;
+ } catch (Exception except) {
+ throw new IllegalStateException("Unable to instantiate Geronimo Transaction Manager", except);
+ }
+ }
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java new file mode 100644 index 0000000000..bf8f55be3d --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java @@ -0,0 +1,39 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.ode;
+
+/**
+ * Thrown when ODE failed to initialize one if its needed resources.
+ */
+public class ODEInitializationException extends RuntimeException {
+ private static final long serialVersionUID = -2869674556330744215L;
+
+ public ODEInitializationException(Throwable cause) {
+ super(cause);
+ }
+
+ public ODEInitializationException(String message) {
+ super(message);
+ }
+
+ public ODEInitializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java new file mode 100644 index 0000000000..e95bb80438 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java @@ -0,0 +1,75 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel.provider;
+
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ * The sample CRUD implementation is not a full blown implementation, it only
+ * supports a subset of what a component implementation can support: - a single
+ * fixed service (as opposed to a list of services typed by different
+ * interfaces) - a directory attribute used to specify where a CRUD component is
+ * going to persist resources - no references or properties - no policy intents
+ * or policy sets
+ */
+public class BPELImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+ private BPELImplementation implementation;
+ private EmbeddedODEServer odeServer;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public BPELImplementationProvider(RuntimeComponent component, BPELImplementation implementation,
+ EmbeddedODEServer odeServer) {
+ this.component = component;
+ this.implementation = implementation;
+ this.odeServer = odeServer;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ BPELInvoker invoker = new BPELInvoker(operation);
+ return invoker;
+ }
+
+ public Invoker createCallbackInvoker(Operation operation) {
+ BPELInvoker invoker = new BPELInvoker(operation);
+ return invoker;
+ }
+
+ public void start() {
+ System.out.println("Starting " + component.getName() + " " + component.getClass().getName());
+ if (!odeServer.isInitialized()) odeServer.init();
+
+ odeServer.getBpelServer().register(implementation.getProcessConf());
+ }
+
+ public void stop() {
+ System.out.println("Stopping " + component.getName() + " " + component.getClass().getName());
+ }
+
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java new file mode 100644 index 0000000000..33112dbc0c --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java @@ -0,0 +1,50 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel.provider;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ */
+public class BPELImplementationProviderFactory implements ImplementationProviderFactory<BPELImplementation> {
+
+ private EmbeddedODEServer odeServer;
+
+ /**
+ * Constructs a new CRUD implementation.
+ * @param odeServer the server instance passed to the implementation provider
+ */
+ public BPELImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ this.odeServer = new EmbeddedODEServer();
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, BPELImplementation implementation) {
+ return new BPELImplementationProvider(component, implementation, odeServer);
+ }
+
+ public Class<BPELImplementation> getModelType() {
+ return BPELImplementation.class;
+ }
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java new file mode 100644 index 0000000000..b786f00266 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java @@ -0,0 +1,62 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.provider;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Implements a target invoker for CRUD component implementations.
+ *
+ * The target invoker is responsible for dispatching invocations to the particular
+ * component implementation logic. In this example we are simply delegating the
+ * CRUD operation invocations to the corresponding methods on our fake
+ * resource manager.
+ */
+public class BPELInvoker implements Invoker {
+ private Operation operation;
+
+ public BPELInvoker(Operation operation) {
+ this.operation = operation;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+ Object resp = doTheWork(args);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+ public Object doTheWork(Object[] args) throws InvocationTargetException {
+ if (operation.getName().equals("invokeProcess")) {
+ return args[0];
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-0.99/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor new file mode 100644 index 0000000000..91b67833a8 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the artifact processor extension +org.apache.tuscany.sca.implementation.bpel.impl.BPELArtifactProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-java-0.99/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory new file mode 100644 index 0000000000..b6481b1512 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.bpel.provider.BPELImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELTestCase.java b/branches/sca-java-0.99/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELTestCase.java new file mode 100644 index 0000000000..0a872c7df8 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELTestCase.java @@ -0,0 +1,59 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the BPEL service
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private BPEL bpelService;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void setUp() throws Exception {
+ //scaDomain = SCADomain.newInstance("helloworld.composite");
+ //bpelService = scaDomain.getService(BPEL.class, "BPELHelloWorldComponent");
+
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void tearDown() throws Exception {
+ //scaDomain.close();
+ }
+
+
+ public void testCRUD() throws Exception {
+ //Object result = bpelService.invokeProcess("something");
+ //assertEquals("something", result);
+ }
+
+
+}
diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.bpel b/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.bpel new file mode 100644 index 0000000000..7156fa11b6 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.bpel @@ -0,0 +1,66 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> +<process name="HelloWorld" + targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl" + queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0" + expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"> + + <import location="HelloWorld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/" + namespace="file:///home/mriou/dev/projects/ode/distro-axis2/src/examples/HelloWorld2/HelloWorld2.wsdl"/> + + <partnerLinks> + <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" /> + </partnerLinks> + + <variables> + <variable name="myVar" messageType="test:HelloMessage"/> + <variable name="tmpVar" type="xsd:string"/> + </variables> + + <sequence> + <receive + name="start" + partnerLink="helloPartnerLink" + portType="test:HelloPortType" + operation="hello" + variable="myVar" + createInstance="yes"/> + + <assign name="assign1"> + <copy> + <from variable="myVar" part="TestPart"/> + <to variable="tmpVar"/> + </copy> + <copy> + <from>concat($tmpVar,' World')</from> + <to variable="myVar" part="TestPart"/> + </copy> + </assign> + <reply name="end" + partnerLink="helloPartnerLink" + portType="test:HelloPortType" + operation="hello" + variable="myVar"/> + </sequence> +</process> diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.wsdl b/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.wsdl new file mode 100644 index 0000000000..a2ae0c5fa5 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.wsdl @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<wsdl:definitions + targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + + <wsdl:message name="HelloMessage"> + <wsdl:part name="TestPart" type="xsd:string"/> + </wsdl:message> + + <wsdl:portType name="HelloPortType"> + <wsdl:operation name="hello"> + <wsdl:input message="tns:HelloMessage" name="TestIn"/> + <wsdl:output message="tns:HelloMessage" name="TestOut"/> + </wsdl:operation> + </wsdl:portType> + + <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="hello"> + <soap:operation soapAction="" style="rpc"/> + <wsdl:input> + <soap:body + namespace="http://ode/bpel/unit-test.wsdl" + use="literal"/> + </wsdl:input> + <wsdl:output> + <soap:body + namespace="http://ode/bpel/unit-test.wsdl" + use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="HelloService"> + <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding"> + <soap:address location="http://localhost:8085/ode/processes/helloWorld"/> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="HelloPartnerLinkType"> + <plnk:role name="me" portType="tns:HelloPortType"/> + <plnk:role name="you" portType="tns:HelloPortType"/> + </plnk:partnerLinkType> +</wsdl:definitions> + diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.componentType b/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.componentType new file mode 100644 index 0000000000..9360403f7e --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.componentType @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <service name="BPELHelloWorldService"> + <interface.wsdl + interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsd#wsdl.interface(HelloPortType)" /> + </service> + +</componentType> +
\ No newline at end of file diff --git a/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.composite b/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.composite new file mode 100644 index 0000000000..7930685e47 --- /dev/null +++ b/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="bpel">
+
+ <service name="BPELHelloWorldService" promote="BPELHelloWorldComponent">
+ <interface.wsdl
+ interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsd#wsdl.interface(HelloPortType)" />
+ </service>
+
+ <component name="BPELHelloWorldComponent">
+ <tuscany:implementation.bpel process="hns:HelloWorld" file="HelloWorld.bpel"/>
+ </component>
+
+</composite>
|