You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2008/01/29 13:38:38 UTC

svn commit: r616286 [2/2] - in /incubator/tuscany/java/sca/modules: binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/ binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/ binding-ws-axis2/src/main/java/org/apache/tu...

Modified: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java?rev=616286&r1=616285&r2=616286&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java Tue Jan 29 04:38:29 2008
@@ -1,284 +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
-    }
-}
+/*
+ * 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
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java?rev=616286&r1=616285&r2=616286&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java Tue Jan 29 04:38:29 2008
@@ -1,48 +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);
-        }
-    }
-}
+/*
+ * 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);
+        }
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java?rev=616286&r1=616285&r2=616286&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java Tue Jan 29 04:38:29 2008
@@ -1,41 +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);
-    }
-}
+/*
+ * 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);
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java?rev=616286&r1=616285&r2=616286&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java Tue Jan 29 04:38:29 2008
@@ -1,123 +1,123 @@
-/*
- * 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.io.File;
-import java.net.URL;
-
-import javax.transaction.TransactionManager;
-
-import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
-import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
-import org.apache.tuscany.sca.implementation.bpel.ode.ODEDeployment;
-import org.apache.tuscany.sca.implementation.bpel.ode.ODEInitializationException;
-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 EmbeddedODEServer odeServer;
-    private TransactionManager txMgr;
-
-    private BPELImplementation implementation;
-    
-    /**
-     * Constructs a new BPEL Implementation.
-     */
-    public BPELImplementationProvider(RuntimeComponent component,
-                                      BPELImplementation implementation,
-                                      EmbeddedODEServer odeServer,
-                                      TransactionManager txMgr) {
-        this.component = component;
-        this.implementation = implementation;
-        this.odeServer = odeServer;
-        this.txMgr = txMgr;
-    }
-
-    public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
-        BPELInvoker invoker = new BPELInvoker(operation, odeServer, txMgr);
-        return invoker;
-    }
-    
-    public boolean supportsOneWayInvocation() {
-        return false;
-    }
-
-    public void start() {
-        System.out.println("Starting " + component.getName());
-
-        try {
-            if (!odeServer.isInitialized()) {
-                // start ode server
-                odeServer.init();
-            }
-
-            URL deployURL = this.implementation.getProcessDefinition().getLocation();
-            
-            File deploymentDir = new File(deployURL.toURI().getPath()).getParentFile();
-            System.out.println(">>> Deploying : " + deploymentDir.toString());
-
-            // deploy the process
-            if (odeServer.isInitialized()) {
-                try {
-                    txMgr.begin();
-                    odeServer.deploy(new ODEDeployment(deploymentDir));
-                    txMgr.commit();
-                } catch (Exception e) {
-                    e.printStackTrace();
-                    txMgr.rollback();
-                }
-            }
-            
-        } catch (ODEInitializationException inite) {
-            throw new RuntimeException("BPEL Component Type Implementation : Error initializing embedded ODE server " + inite.getMessage(), inite);
-        } catch(Exception e) {
-            throw new RuntimeException("BPEl Component Type Implementation initialization failure : " + e.getMessage(), e);
-        }
-    }
-
-    public void stop() {
-        System.out.println("Stopping " + component.getName());
-        
-        if (odeServer.isInitialized()) {
-            // start ode server
-            odeServer.stop();
-        }
-        
-        txMgr = null;
-        
-        System.out.println("Stopped !!!");
-
-    }
-
-}
+/*
+ * 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.io.File;
+import java.net.URL;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
+import org.apache.tuscany.sca.implementation.bpel.ode.ODEDeployment;
+import org.apache.tuscany.sca.implementation.bpel.ode.ODEInitializationException;
+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 EmbeddedODEServer odeServer;
+    private TransactionManager txMgr;
+
+    private BPELImplementation implementation;
+    
+    /**
+     * Constructs a new BPEL Implementation.
+     */
+    public BPELImplementationProvider(RuntimeComponent component,
+                                      BPELImplementation implementation,
+                                      EmbeddedODEServer odeServer,
+                                      TransactionManager txMgr) {
+        this.component = component;
+        this.implementation = implementation;
+        this.odeServer = odeServer;
+        this.txMgr = txMgr;
+    }
+
+    public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+        BPELInvoker invoker = new BPELInvoker(operation, odeServer, txMgr);
+        return invoker;
+    }
+    
+    public boolean supportsOneWayInvocation() {
+        return false;
+    }
+
+    public void start() {
+        System.out.println("Starting " + component.getName());
+
+        try {
+            if (!odeServer.isInitialized()) {
+                // start ode server
+                odeServer.init();
+            }
+
+            URL deployURL = this.implementation.getProcessDefinition().getLocation();
+            
+            File deploymentDir = new File(deployURL.toURI().getPath()).getParentFile();
+            System.out.println(">>> Deploying : " + deploymentDir.toString());
+
+            // deploy the process
+            if (odeServer.isInitialized()) {
+                try {
+                    txMgr.begin();
+                    odeServer.deploy(new ODEDeployment(deploymentDir));
+                    txMgr.commit();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    txMgr.rollback();
+                }
+            }
+            
+        } catch (ODEInitializationException inite) {
+            throw new RuntimeException("BPEL Component Type Implementation : Error initializing embedded ODE server " + inite.getMessage(), inite);
+        } catch(Exception e) {
+            throw new RuntimeException("BPEl Component Type Implementation initialization failure : " + e.getMessage(), e);
+        }
+    }
+
+    public void stop() {
+        System.out.println("Stopping " + component.getName());
+        
+        if (odeServer.isInitialized()) {
+            // start ode server
+            odeServer.stop();
+        }
+        
+        txMgr = null;
+        
+        System.out.println("Stopped !!!");
+
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java?rev=616286&r1=616285&r2=616286&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java Tue Jan 29 04:38:29 2008
@@ -1,67 +1,67 @@
-/*
- * 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 javax.transaction.TransactionManager;
-
-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.implementation.bpel.ode.GeronimoTxFactory;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.osoa.sca.annotations.Destroy;
-
-/**
- * BPEL Implementation provider factory
- * 
- * We use the provider factory to instantiate a ODE server that is going to be injected in all BPEL components
- */
-public class BPELImplementationProviderFactory implements ImplementationProviderFactory<BPELImplementation> {
-
-    private EmbeddedODEServer odeServer;
-    private TransactionManager txMgr;
-
-    /**
-     * Default constructor receiving an extension point
-     * @param extensionPoints
-     */
-    public BPELImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
-        GeronimoTxFactory txFactory = new GeronimoTxFactory();
-        txMgr = txFactory.getTransactionManager();
-        this.odeServer = new EmbeddedODEServer(txMgr);
-    }
-
-    /**
-     * Creates a new BPEL Implementation and inject the EmbeddedODEServer
-     */
-    public ImplementationProvider createImplementationProvider(RuntimeComponent component, BPELImplementation implementation) {
-        return new BPELImplementationProvider(component, implementation, odeServer, txMgr);
-    }
-    
-    public Class<BPELImplementation> getModelType() {
-        return BPELImplementation.class;
-    }
-    
-    @Destroy
-    public void destroy() {
-        txMgr = null;
-    }
-}
+/*
+ * 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 javax.transaction.TransactionManager;
+
+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.implementation.bpel.ode.GeronimoTxFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.osoa.sca.annotations.Destroy;
+
+/**
+ * BPEL Implementation provider factory
+ * 
+ * We use the provider factory to instantiate a ODE server that is going to be injected in all BPEL components
+ */
+public class BPELImplementationProviderFactory implements ImplementationProviderFactory<BPELImplementation> {
+
+    private EmbeddedODEServer odeServer;
+    private TransactionManager txMgr;
+
+    /**
+     * Default constructor receiving an extension point
+     * @param extensionPoints
+     */
+    public BPELImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+        GeronimoTxFactory txFactory = new GeronimoTxFactory();
+        txMgr = txFactory.getTransactionManager();
+        this.odeServer = new EmbeddedODEServer(txMgr);
+    }
+
+    /**
+     * Creates a new BPEL Implementation and inject the EmbeddedODEServer
+     */
+    public ImplementationProvider createImplementationProvider(RuntimeComponent component, BPELImplementation implementation) {
+        return new BPELImplementationProvider(component, implementation, odeServer, txMgr);
+    }
+    
+    public Class<BPELImplementation> getModelType() {
+        return BPELImplementation.class;
+    }
+    
+    @Destroy
+    public void destroy() {
+        txMgr = null;
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java?rev=616286&r1=616285&r2=616286&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java Tue Jan 29 04:38:29 2008
@@ -1,214 +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.provider;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.concurrent.Future;
-
-import javax.transaction.SystemException;
-import javax.transaction.TransactionManager;
-import javax.wsdl.Part;
-import javax.wsdl.Service;
-import javax.xml.namespace.QName;
-
-import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
-import org.apache.ode.bpel.iapi.MessageExchange.Status;
-import org.apache.ode.utils.DOMUtils;
-import org.apache.ode.utils.GUID;
-import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Implements a target invoker for BPEL 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 EmbeddedODEServer odeServer;
-    private TransactionManager txMgr;
-    
-    private Operation operation;
-    private QName bpelServiceName;
-    private String bpelOperationName;
-    private Part bpelOperationInputPart;
-    private Part bpelOperationOutputPart;
-    
-    public BPELInvoker(Operation operation, EmbeddedODEServer odeServer, TransactionManager txMgr) {
-        this.operation = operation;
-        this.bpelOperationName = operation.getName();
-        this.odeServer = odeServer;
-        this.txMgr = txMgr;
-
-        initializeInvocation();
-    }
-
-    
-    private void initializeInvocation() {
-      
-        Interface interfaze = operation.getInterface();
-        if(interfaze instanceof WSDLInterface){
-            WSDLInterface wsdlInterface = null;
-            wsdlInterface = (WSDLInterface) interfaze;
-            
-            Service serviceDefinition = (Service) wsdlInterface.getWsdlDefinition().getDefinition().getAllServices().values().iterator().next(); 
-            bpelServiceName = serviceDefinition.getQName();
-                
-            bpelOperationInputPart = (Part) wsdlInterface.getPortType().getOperation(bpelOperationName,null,null).getInput().getMessage().getParts().values().iterator().next();
-            bpelOperationOutputPart = (Part) wsdlInterface.getPortType().getOperation(bpelOperationName,null,null).getOutput().getMessage().getParts().values().iterator().next();
-        }
-    }
-    
-    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 {
-        Element response = null;
-        
-        if(! (operation.getInterface() instanceof WSDLInterface)) {
-            throw new InvocationTargetException(null,"Unsupported service contract");
-        }
-        
-        org.apache.ode.bpel.iapi.MyRoleMessageExchange mex = null;
-        Future onhold = null;
-        
-        //Process the BPEL process invocation
-        try {
-            txMgr.begin();
-            mex = odeServer.getBpelServer().getEngine().createMessageExchange(new GUID().toString(),
-                                                                              bpelServiceName,
-                                                                              bpelOperationName);
-            onhold = mex.invoke(createInvocationMessage(mex, args));
-            
-            txMgr.commit();
-        } catch (Exception e) {
-            try {
-                txMgr.rollback();
-            } catch (SystemException se) {
-
-            }
-            throw new InvocationTargetException(e, "Error invoking BPEL process : " + e.getMessage());
-        } 
-
-
-        // Waiting until the reply is ready in case the engine needs to continue in a different thread
-        if (onhold != null) {
-            try {
-                onhold.get();
-            } catch (Exception e) {
-                throw new InvocationTargetException(e,"Error invoking BPEL process : " + e.getMessage());
-            }
-        }
-
-        //Process the BPEL invocation response
-        try {
-            txMgr.begin();
-            // Reloading the mex in the current transaction, otherwise we can't
-            // be sure we have the "freshest" one.
-            mex = (MyRoleMessageExchange)odeServer.getBpelServer().getEngine().getMessageExchange(mex.getMessageExchangeId());
-
-            Status status = mex.getStatus();
-            System.out.println("Status: " + status.name());
-            Element invocationResponse = mex.getResponse().getMessage();
-            System.out.println("Response: " + DOMUtils.domToString(invocationResponse));
-            
-            //process the method invocation result
-            response = processResponse(invocationResponse);
-            
-            txMgr.commit();
-            // end of transaction two
-        } catch (Exception e) {
-            try {
-                txMgr.rollback();
-            } catch (SystemException se) {
-
-            }
-            throw new InvocationTargetException(e, "Error retrieving BPEL process invocation status : " + e
-                .getMessage());
-        }
-    
-    
-        return response;
-    }
-
-    /**
-     * Create BPEL Invocation message
-     * 
-     *  BPEL invocation message like :
-     *  <message>
-     *     <TestPart>
-     *        <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">Hello</hello>
-     *     </TestPart>
-     *   </message>
-     * @param args
-     * @return
-     */
-    private org.apache.ode.bpel.iapi.Message createInvocationMessage(org.apache.ode.bpel.iapi.MyRoleMessageExchange mex, Object[] args) {
-        Document dom = DOMUtils.newDocument();
-        
-        Element contentMessage = dom.createElement("message");
-        Element contentPart = dom.createElement(bpelOperationInputPart.getName());
-        Element contentInvocation = (Element) args[0];
-        
-        contentPart.appendChild(dom.importNode(contentInvocation, true));
-        contentMessage.appendChild(contentPart);
-        dom.appendChild(contentMessage);
-        
-        System.out.println("::arg:::::: " + DOMUtils.domToString((Element) args[0]));
-        System.out.println("::message:: " + DOMUtils.domToString(dom.getDocumentElement()));
-
-        org.apache.ode.bpel.iapi.Message request = mex.createMessage(new QName("", ""));
-        request.setMessage(dom.getDocumentElement());
-                
-        return request;
-    }
-    
-    /**
-     * Process BPEL response
-     * 
-     *  <message>
-     *     <TestPart>
-     *        <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">World</hello>
-     *     </TestPart>
-     *   </message> 
-     * 
-     * @param response
-     * @return
-     */
-    private Element processResponse(Element response) {
-        return (Element) DOMUtils.findChildByName(response, new QName("",bpelOperationOutputPart.getName()));
-    }
-}
+/*
+ * 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 java.util.concurrent.Future;
+
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import javax.wsdl.Part;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.apache.ode.bpel.iapi.MessageExchange.Status;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.GUID;
+import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Implements a target invoker for BPEL 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 EmbeddedODEServer odeServer;
+    private TransactionManager txMgr;
+    
+    private Operation operation;
+    private QName bpelServiceName;
+    private String bpelOperationName;
+    private Part bpelOperationInputPart;
+    private Part bpelOperationOutputPart;
+    
+    public BPELInvoker(Operation operation, EmbeddedODEServer odeServer, TransactionManager txMgr) {
+        this.operation = operation;
+        this.bpelOperationName = operation.getName();
+        this.odeServer = odeServer;
+        this.txMgr = txMgr;
+
+        initializeInvocation();
+    }
+
+    
+    private void initializeInvocation() {
+      
+        Interface interfaze = operation.getInterface();
+        if(interfaze instanceof WSDLInterface){
+            WSDLInterface wsdlInterface = null;
+            wsdlInterface = (WSDLInterface) interfaze;
+            
+            Service serviceDefinition = (Service) wsdlInterface.getWsdlDefinition().getDefinition().getAllServices().values().iterator().next(); 
+            bpelServiceName = serviceDefinition.getQName();
+                
+            bpelOperationInputPart = (Part) wsdlInterface.getPortType().getOperation(bpelOperationName,null,null).getInput().getMessage().getParts().values().iterator().next();
+            bpelOperationOutputPart = (Part) wsdlInterface.getPortType().getOperation(bpelOperationName,null,null).getOutput().getMessage().getParts().values().iterator().next();
+        }
+    }
+    
+    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 {
+        Element response = null;
+        
+        if(! (operation.getInterface() instanceof WSDLInterface)) {
+            throw new InvocationTargetException(null,"Unsupported service contract");
+        }
+        
+        org.apache.ode.bpel.iapi.MyRoleMessageExchange mex = null;
+        Future onhold = null;
+        
+        //Process the BPEL process invocation
+        try {
+            txMgr.begin();
+            mex = odeServer.getBpelServer().getEngine().createMessageExchange(new GUID().toString(),
+                                                                              bpelServiceName,
+                                                                              bpelOperationName);
+            onhold = mex.invoke(createInvocationMessage(mex, args));
+            
+            txMgr.commit();
+        } catch (Exception e) {
+            try {
+                txMgr.rollback();
+            } catch (SystemException se) {
+
+            }
+            throw new InvocationTargetException(e, "Error invoking BPEL process : " + e.getMessage());
+        } 
+
+
+        // Waiting until the reply is ready in case the engine needs to continue in a different thread
+        if (onhold != null) {
+            try {
+                onhold.get();
+            } catch (Exception e) {
+                throw new InvocationTargetException(e,"Error invoking BPEL process : " + e.getMessage());
+            }
+        }
+
+        //Process the BPEL invocation response
+        try {
+            txMgr.begin();
+            // Reloading the mex in the current transaction, otherwise we can't
+            // be sure we have the "freshest" one.
+            mex = (MyRoleMessageExchange)odeServer.getBpelServer().getEngine().getMessageExchange(mex.getMessageExchangeId());
+
+            Status status = mex.getStatus();
+            System.out.println("Status: " + status.name());
+            Element invocationResponse = mex.getResponse().getMessage();
+            System.out.println("Response: " + DOMUtils.domToString(invocationResponse));
+            
+            //process the method invocation result
+            response = processResponse(invocationResponse);
+            
+            txMgr.commit();
+            // end of transaction two
+        } catch (Exception e) {
+            try {
+                txMgr.rollback();
+            } catch (SystemException se) {
+
+            }
+            throw new InvocationTargetException(e, "Error retrieving BPEL process invocation status : " + e
+                .getMessage());
+        }
+    
+    
+        return response;
+    }
+
+    /**
+     * Create BPEL Invocation message
+     * 
+     *  BPEL invocation message like :
+     *  <message>
+     *     <TestPart>
+     *        <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">Hello</hello>
+     *     </TestPart>
+     *   </message>
+     * @param args
+     * @return
+     */
+    private org.apache.ode.bpel.iapi.Message createInvocationMessage(org.apache.ode.bpel.iapi.MyRoleMessageExchange mex, Object[] args) {
+        Document dom = DOMUtils.newDocument();
+        
+        Element contentMessage = dom.createElement("message");
+        Element contentPart = dom.createElement(bpelOperationInputPart.getName());
+        Element contentInvocation = (Element) args[0];
+        
+        contentPart.appendChild(dom.importNode(contentInvocation, true));
+        contentMessage.appendChild(contentPart);
+        dom.appendChild(contentMessage);
+        
+        System.out.println("::arg:::::: " + DOMUtils.domToString((Element) args[0]));
+        System.out.println("::message:: " + DOMUtils.domToString(dom.getDocumentElement()));
+
+        org.apache.ode.bpel.iapi.Message request = mex.createMessage(new QName("", ""));
+        request.setMessage(dom.getDocumentElement());
+                
+        return request;
+    }
+    
+    /**
+     * Process BPEL response
+     * 
+     *  <message>
+     *     <TestPart>
+     *        <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">World</hello>
+     *     </TestPart>
+     *   </message> 
+     * 
+     * @param response
+     * @return
+     */
+    private Element processResponse(Element response) {
+        return (Element) DOMUtils.findChildByName(response, new QName("",bpelOperationOutputPart.getName()));
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org