diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:26:33 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:26:33 +0000 |
commit | a40e527938d76ba71f211da7e327adb50384ba69 (patch) | |
tree | cb8f99f1727122b040a3f0fbb6649292b6a74302 /sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode | |
parent | 968721109881107520d7aefa91d7fcc0519d7739 (diff) |
Moving 1.x tags
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835157 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode')
8 files changed, 687 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java new file mode 100644 index 0000000000..661f79f78d --- /dev/null +++ b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java @@ -0,0 +1,284 @@ +/* + * 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 java.io.File; +import java.net.URL; +import java.util.Collection; +import java.util.Properties; + +import javax.transaction.TransactionManager; +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +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.iapi.ProcessConf; +import org.apache.ode.bpel.iapi.ProcessStore; +import org.apache.ode.bpel.iapi.ProcessStoreEvent; +import org.apache.ode.bpel.iapi.ProcessStoreListener; +import org.apache.ode.bpel.iapi.Scheduler; +import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl; +import org.apache.ode.il.config.OdeConfigProperties; +import org.apache.ode.il.dbutil.Database; +import org.apache.ode.scheduler.simple.JdbcDelegate; +import org.apache.ode.scheduler.simple.SimpleScheduler; +import org.apache.ode.store.ProcessStoreImpl; +import org.apache.ode.utils.GUID; + +/** + * Embedded ODE process server + * + * @version $Rev$ $Date$ + */ +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; + + protected ProcessStore store; + + private Scheduler _scheduler; + + + public EmbeddedODEServer(TransactionManager txMgr) { + _txMgr = txMgr; + } + + public void init() throws ODEInitializationException { + Properties p = System.getProperties(); + p.put("derby.system.home", "target"); + + _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() { + if(_txMgr == null) { + 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"); + } + + _bpelServer = new BpelServerImpl(); + _scheduler = createScheduler(); + _scheduler.setJobProcessor(_bpelServer); + + _bpelServer.setDaoConnectionFactory(_daoCF); + _bpelServer.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl(_scheduler)); + // _bpelServer.setEndpointReferenceContext(new EndpointReferenceContextImpl(this)); + _bpelServer.setMessageExchangeContext(new ODEMessageExchangeContext(this)); + _bpelServer.setBindingContext(new ODEBindingContext(this)); + _bpelServer.setScheduler(_scheduler); + if (_config.isDehydrationEnabled()) { + CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy(); + _bpelServer.setDehydrationPolicy(dehy); + } + + store = new ProcessStoreImpl(_db.getDataSource(), "jpa", true); + store.registerListener(new ProcessStoreListener() { + public void onProcessStoreEvent(ProcessStoreEvent event) { + // bounce the process + _bpelServer.unregister(event.pid); + if (event.type != ProcessStoreEvent.Type.UNDEPLOYED) { + ProcessConf conf = (ProcessConf) store.getProcessConfiguration(event.pid); + // Test processes always run with in-mem DAOs + // conf.setTransient(true); //FIXME: what should we use for ProcessConfImpl + _bpelServer.register(conf); + } + } + }); + + _bpelServer.init(); + } + + public void stop() throws ODEShutdownException { + if(_bpelServer != null) { + try { + __log.debug("Stopping BPEL Embedded server"); + _bpelServer.shutdown(); + _bpelServer = null; + } catch (Exception ex) { + __log.debug("Error stopping BPEL server"); + } + } + + if(_scheduler != null) { + try { + __log.debug("Stopping scheduler"); + _scheduler.shutdown(); + _scheduler = null; + } catch (Exception ex) { + __log.debug("Error stopping scheduler"); + } + } + + if(store != null) { + try { + __log.debug("Stopping store"); + ((ProcessStoreImpl)store).shutdown(); + store = null; + } catch (Exception ex) { + __log.debug("Error stopping store"); + } + } + + if(_daoCF != null) { + try { + __log.debug("Stopping DAO"); + _daoCF.shutdown(); + _daoCF = null; + } catch (Exception ex) { + __log.debug("Error stopping DAO"); + } + } + + if(_db != null) { + try { + __log.debug("Stopping DB"); + _db.shutdown(); + _db = null; + } catch (Exception ex) { + __log.debug("Error stopping DB"); + } + } + + if(_txMgr != null) { + try { + __log.debug("Stopping Transaction Manager"); + _txMgr = null; + } catch (Exception ex) { + __log.debug("Error stopping Transaction Manager"); + } + } + } + + protected Scheduler createScheduler() { + SimpleScheduler scheduler = new SimpleScheduler(new GUID().toString(),new JdbcDelegate(_db.getDataSource())); + scheduler.setTransactionManager(_txMgr); + + return scheduler; + } + + public boolean isInitialized() { + return _initialized; + } + + public BpelServerImpl getBpelServer() { + return _bpelServer; + } + + public Scheduler getScheduler() { + return _scheduler; + } + + public void deploy(ODEDeployment d) { + Collection<QName> procs; + + try { + procs = store.deploy(d.deployDir); + + // _deployed.add(d); + } catch (Exception ex) { + String errMsg = ">>> DEPLOY: Unexpected exception: " + ex.getMessage(); + __log.debug(errMsg, ex); + throw new ODEDeploymentException(errMsg,ex); + } + + + /* We are already registering the process on the "register" event + try { + for (QName procName : procs) { + ProcessConf conf = (ProcessConf) store.getProcessConfiguration(procName); + // Test processes always run with in-mem DAOs + //conf.setTransient(true); //FIXME: what should we use for ProcessConfImpl + _bpelServer.register(conf); + } + } catch (Exception ex) { + String errMsg =">>>REGISTER: Unexpected exception: " + ex.getMessage(); + __log.debug(errMsg , ex); + throw new ODEDeploymentException(errMsg, ex); + } + */ + } + + public void undeploy(ODEDeployment d) { + //TODO + } +} diff --git a/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java new file mode 100644 index 0000000000..ad6e0cf3b7 --- /dev/null +++ b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java @@ -0,0 +1,48 @@ +/* + * 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 javax.transaction.TransactionManager; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Geronimo transaction factory + * + * @version $Rev$ $Date$ + */ +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/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java new file mode 100644 index 0000000000..96083614ff --- /dev/null +++ b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java @@ -0,0 +1,126 @@ +/* + * 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 javax.wsdl.PortType; +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.ode.bpel.iapi.BindingContext; +import org.apache.ode.bpel.iapi.Endpoint; +import org.apache.ode.bpel.iapi.EndpointReference; +import org.apache.ode.bpel.iapi.PartnerRoleChannel; +import org.apache.ode.utils.DOMUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * Binding Context information + * + * @version $Rev: 573789 $ $Date: 2007-09-07 23:59:49 -0700 (Fri, 07 Sep 2007) $ + */ +public class ODEBindingContext implements BindingContext { + private static final Log __log = LogFactory.getLog(ODEBindingContext.class); + + private EmbeddedODEServer _server; + + public ODEBindingContext(EmbeddedODEServer _server) { + this._server = _server; + } + + public EndpointReference activateMyRoleEndpoint(QName pid, Endpoint endpoint) { + // This will be needed when we support callBacks + if (__log.isDebugEnabled()) + __log.debug("Activating MyRole Endpoint : " + pid + " - " + endpoint.serviceName); + + System.out.println(">>> Activating MyRole Endpoint : " + pid + " - " + endpoint.serviceName); + + return new TuscanyEPR(endpoint); + } + + public void deactivateMyRoleEndpoint(Endpoint endpoint) { + if (__log.isDebugEnabled()) + __log.debug("Deactivate MyRole Endpoint : " + endpoint.serviceName); + + } + + public PartnerRoleChannel createPartnerRoleChannel(QName qName, PortType portType, Endpoint endpoint) { + if (__log.isDebugEnabled()) + __log.debug("Create PartnerRole channel : " + qName + " - " + portType.getQName() + " - "+ endpoint.serviceName); + + System.out.println(">>> Create PartnerRole channel : " + qName + " - " + portType.getQName() + " - "+ endpoint.serviceName); + + return new TuscanyPRC(); + } + + // TODO This should hold something that makes sense for Tuscany so that the + // process has an address that makes sense from the outside world perspective + private class TuscanyEPR implements EndpointReference { + private final Endpoint endpoint; + private final Document doc = DOMUtils.newDocument(); + + public TuscanyEPR() { + this.endpoint = null; + } + + public TuscanyEPR(Endpoint endpoint) { + this.endpoint = endpoint; + + Element serviceref = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(), + EndpointReference.SERVICE_REF_QNAME.getLocalPart()); + serviceref.setNodeValue(endpoint.serviceName + ":" + endpoint.portName); + doc.appendChild(serviceref); + } + + public Document toXML() { + return doc; + } + } + + private class TuscanyPRC implements PartnerRoleChannel { + private TuscanyEPR tuscanyEPR; + + public TuscanyPRC() { + this.tuscanyEPR = null; + } + + public TuscanyPRC(TuscanyEPR tuscanyEPR){ + this.tuscanyEPR = tuscanyEPR; + } + + public void close() { + + } + + public EndpointReference getInitialEndpointReference() { + final Document doc = DOMUtils.newDocument(); + Element serviceref = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(), + EndpointReference.SERVICE_REF_QNAME.getLocalPart()); + doc.appendChild(serviceref); + + return new EndpointReference() { + public Document toXML() { + return doc; + } + }; + } + + } +} diff --git a/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java new file mode 100644 index 0000000000..2677f38c88 --- /dev/null +++ b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.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 java.io.File; + +/** + * Deployment information + * + * @version $Rev$ $Date$ + */ +public class ODEDeployment { + /** The directory containing the deploy.xml and artefacts. */ + public File deployDir; + + /** If non-null the type of exception we expect to get when we deploy. */ + public Class expectedException = null; + + public ODEDeployment(File deployDir) { + this.deployDir = deployDir; + } + + public String toString() { + return "Deployment#" + deployDir; + } +}
\ No newline at end of file diff --git a/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java new file mode 100644 index 0000000000..b03f69d9aa --- /dev/null +++ b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java @@ -0,0 +1,41 @@ +/* + * 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 shutdown. + * + * @version $Rev$ $Date$ + */ +public class ODEDeploymentException extends RuntimeException { + private static final long serialVersionUID = -2869674556330744215L; + + public ODEDeploymentException(Throwable cause) { + super(cause); + } + + public ODEDeploymentException(String message) { + super(message); + } + + public ODEDeploymentException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java new file mode 100644 index 0000000000..2fa91e4e86 --- /dev/null +++ b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java @@ -0,0 +1,41 @@ +/* + * 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. + * + * @version $Rev$ $Date$ + */ +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/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java new file mode 100644 index 0000000000..d8f54e479a --- /dev/null +++ b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java @@ -0,0 +1,63 @@ +/* + * 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 org.apache.ode.bpel.iapi.BpelEngineException; +import org.apache.ode.bpel.iapi.ContextException; +import org.apache.ode.bpel.iapi.MessageExchangeContext; +import org.apache.ode.bpel.iapi.MyRoleMessageExchange; +import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange; +import org.apache.tuscany.sca.assembly.ComponentReference; +import org.apache.tuscany.sca.implementation.bpel.impl.ThreadRuntimeComponentContext; +import org.apache.tuscany.sca.runtime.RuntimeComponent; + +/** + * Message Exchange Context information + * + * @version $Rev: 573789 $ $Date: 2007-09-07 23:59:49 -0700 (Fri, 07 Sep 2007) $ + */ +public class ODEMessageExchangeContext implements MessageExchangeContext { + private static final Log __log = LogFactory.getLog(ODEMessageExchangeContext.class); + + private EmbeddedODEServer _server; + + public ODEMessageExchangeContext(EmbeddedODEServer _server) { + this._server = _server; + } + + public void invokePartner(PartnerRoleMessageExchange partnerRoleMessageExchange) throws ContextException { + if (__log.isDebugEnabled()) + __log.debug("Invoking a partner operation: " + partnerRoleMessageExchange.getOperationName()); + + System.out.println(">>> Invoking a partner operation: " + partnerRoleMessageExchange.getOperationName()); + + RuntimeComponent tuscanyRuntimeComponent = ThreadRuntimeComponentContext.getRuntimeComponent(); + for(ComponentReference componentReference : tuscanyRuntimeComponent.getReferences()) { + System.out.println("Reference : " + componentReference.getName()); + componentReference.getBindings().get(0); + } + } + + public void onAsyncReply(MyRoleMessageExchange myRoleMessageExchange) throws BpelEngineException { + if (__log.isDebugEnabled()) + __log.debug("Processing an async reply from service " + myRoleMessageExchange.getServiceName()); + } +} diff --git a/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java new file mode 100644 index 0000000000..a928379ba9 --- /dev/null +++ b/sca-java-1.x/tags/1.2.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java @@ -0,0 +1,41 @@ +/* + * 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 shutdown. + * + * @version $Rev$ $Date$ + */ +public class ODEShutdownException extends RuntimeException { + private static final long serialVersionUID = -2869674556330744215L; + + public ODEShutdownException(Throwable cause) { + super(cause); + } + + public ODEShutdownException(String message) { + super(message); + } + + public ODEShutdownException(String message, Throwable cause) { + super(message, cause); + } +} |