You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ms...@apache.org on 2007/02/16 18:48:09 UTC

svn commit: r508524 - in /incubator/ode/trunk: ./ axis2/src/main/java/org/apache/ode/axis2/ axis2/src/main/java/org/apache/ode/axis2/deploy/ bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ bpel-store/src/main/java/org/apache/ode/store/ jbi/ jbi...

Author: mszefler
Date: Fri Feb 16 09:48:08 2007
New Revision: 508524

URL: http://svn.apache.org/viewvc?view=rev&rev=508524
Log:
Moved some stuff that is common to both AXIS2/JBI into bpel-epr module 

Modified:
    incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java
    incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEConfigProperties.java
    incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
    incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java
    incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDAO.java
    incubator/ode/trunk/jbi/pom.xml
    incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/Messages.java
    incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeConfigProperties.java
    incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
    incubator/ode/trunk/pom.xml

Modified: incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java?view=diff&rev=508524&r1=508523&r2=508524
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java (original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java Fri Feb 16 09:48:08 2007
@@ -235,4 +235,8 @@
         return new IllegalArgumentException(s);
     }
 
+    public String msgOdeDbConfigError() {
+        return format("Error starting database connections, check the database configuration!");
+    }
+
 }

Modified: incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEConfigProperties.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEConfigProperties.java?view=diff&rev=508524&r1=508523&r2=508524
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEConfigProperties.java (original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEConfigProperties.java Fri Feb 16 09:48:08 2007
@@ -19,138 +19,20 @@
 
 package org.apache.ode.axis2;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.servlet.ServletException;
 import java.io.File;
-import java.io.FileInputStream;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Properties;
 
-public class ODEConfigProperties extends Properties {
+import org.apache.ode.il.config.OdeConfigProperties;
+
+public class ODEConfigProperties extends OdeConfigProperties {
 
     private static final long serialVersionUID = 1L;
-    private static final Log __log = LogFactory.getLog(ODEConfigProperties.class);
-    private static final Messages __msgs = Messages.getMessages(Messages.class);
     private static final String CONFIG_FILE_NAME = "ode-axis2.properties";
-    private static final String PROP_DB_MODE = "ode-axis2.db.mode";
-    private static final String PROP_DB_EXTERNAL_DS = "ode-axis2.db.ext.dataSource";
-    private static final String PROP_DB_EMBEDDED_NAME = "ode-axis2.db.emb.name";
-    private static final String PROP_DB_INTERNAL_URL = "ode-axis2.db.int.jdbcurl";
-    
-    private static final String PROP_TX_FACTORY_CLASS = "ode-axis2.tx.factory.class";
-    private static final String PROP_POOL_MAX = "ode-axis2.db.pool.max";
-    private static final String PROP_POOL_MIN = "ode-axis2.db.pool.min";
-    private static final String PROP_CONNECTOR_PORT = "ode-axis2.jca.port";
-    private static final String PROP_WORKING_DIR = "ode-axis2.working.dir";
-    private static final String PROP_REPLICATE_EMPTYNS = "ode-axis2.message.replicate.emptyns";
-    private static final String PROP_EVENT_LISTENERS = "ode-axis2.event.listeners";
-    private static final String PROP_PROCESS_DEHYDRATION = "ode-axis2.process.dehydration";
-
-    private File _installDir;
+        
 
     public ODEConfigProperties(File installRoot) {
-        _installDir = installRoot;
-    }
-
-    public void load() throws ServletException {
-        boolean found = true;
-        File configFile = new File(_installDir, ODEConfigProperties.CONFIG_FILE_NAME);
-        if (!configFile.exists()) {
-            try {
-                URL resource = getClass().getClassLoader().getResource(ODEConfigProperties.CONFIG_FILE_NAME);
-                if (resource != null) configFile = new File(resource.toURI());
-                else found = false;
-            } catch (URISyntaxException e) {
-                // Reported below as log msg
-            }
-        }
-
-        if (found) {
-            FileInputStream fis = null;
-            try {
-                fis = new FileInputStream(configFile);
-                load(fis);
-            } catch (Exception ex) {
-                String errmsg = ODEConfigProperties.__msgs.msgOdeInstallErrorCfgReadError(configFile);
-                ODEConfigProperties.__log.warn(errmsg,ex);
-            } finally {
-                if (fis != null)
-                    try {
-                        fis.close();
-                    } catch (Exception ex) { ex.printStackTrace(); }
-            }
-        } else {
-            String errmsg = ODEConfigProperties.__msgs.msgOdeInstallErrorCfgNotFound(configFile);
-            ODEConfigProperties.__log.warn(errmsg);
-        }
+        super(new File(installRoot, ODEConfigProperties.CONFIG_FILE_NAME),"ode-axis2.");
     }
 
-    /**
-     * Should the internal database be used, or are the datasources provided?
-     * @return db mode
-     */
-    public DatabaseMode getDbMode() {
-        return DatabaseMode.valueOf(getProperty(ODEConfigProperties.PROP_DB_MODE, DatabaseMode.EMBEDDED.toString()).trim().toUpperCase());
-    }
 
-    public String getDbDataSource() {
-        return getProperty(ODEConfigProperties.PROP_DB_EXTERNAL_DS, "java:comp/env/jdbc/ode-ds");
-    }
 
-    public String getDbEmbeddedName(){
-        return getProperty(ODEConfigProperties.PROP_DB_EMBEDDED_NAME, "data");
-    }
-
-    public String getDbIntenralJdbcUrl() {
-        return getProperty(ODEConfigProperties.PROP_DB_INTERNAL_URL, "jdbc:derby://localhost/ode");
-    }
-    
-    /**
-     * Possible database modes.
-     */
-    public enum DatabaseMode {
-        /** External data-source (managed by app server) */
-        EXTERNAL,
-
-        /** Internal data-source (managed by us--Minerva) */
-        INTERNAL,
-
-        /** Embedded database (managed by us--Minerva) */
-        EMBEDDED
-    }
-
-    public int getPoolMaxSize() {
-        return Integer.valueOf(getProperty(ODEConfigProperties.PROP_POOL_MAX, "10"));
-    }
-
-    public int getPoolMinSize() {
-        return Integer.valueOf(getProperty(ODEConfigProperties.PROP_POOL_MIN, "1"));
-    }
-
-    public int getConnectorPort() {
-        return Integer.valueOf(getProperty(ODEConfigProperties.PROP_CONNECTOR_PORT,"2099"));
-    }
-
-    public String getWorkingDir() {
-        return getProperty(ODEConfigProperties.PROP_WORKING_DIR);
-    }
-
-    public String getTxFactoryClass() {
-        return getProperty(ODEConfigProperties.PROP_TX_FACTORY_CLASS, "org.apache.ode.axis2.util.JotmFactory");
-    }
-
-    public boolean isReplicateEmptyNS() {
-        return Boolean.valueOf(getProperty(ODEConfigProperties.PROP_REPLICATE_EMPTYNS, "true"));
-    }
-
-    public String getEventListeners() {
-        return getProperty(PROP_EVENT_LISTENERS);
-    }
-
-    public boolean isDehydrationEnabled() {
-        return Boolean.valueOf(getProperty(ODEConfigProperties.PROP_PROCESS_DEHYDRATION, "false"));
-    }
 }

Modified: incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?view=diff&rev=508524&r1=508523&r2=508524
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java (original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java Fri Feb 16 09:48:08 2007
@@ -22,13 +22,13 @@
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Properties;
 import java.util.StringTokenizer;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
-import javax.naming.InitialContext;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.sql.DataSource;
@@ -55,15 +55,13 @@
 import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
 import org.apache.ode.bpel.iapi.BpelEventListener;
 import org.apache.ode.bpel.iapi.ContextException;
-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.scheduler.quartz.QuartzSchedulerImpl;
+import org.apache.ode.il.dbutil.Database;
 import org.apache.ode.store.ProcessStoreImpl;
-import org.apache.ode.utils.LoggingDataSourceWrapper;
 import org.apache.ode.utils.fs.TempFileManager;
-import org.opentools.minerva.MinervaPool;
 
 /**
  * Server class called by our Axis hooks to handle all ODE lifecycle management.
@@ -73,7 +71,6 @@
 public class ODEServer {
 
     private static final Log __log = LogFactory.getLog(ODEServer.class);
-    private static final Log __logSql = LogFactory.getLog("org.apache.ode.sql");
 
     private static final Messages __msgs = Messages.getMessages(Messages.class);
 
@@ -89,7 +86,6 @@
 
     protected AxisConfiguration _axisConfig;
 
-    protected DataSource _datasource;
 
     protected TransactionManager _txMgr;
 
@@ -107,7 +103,7 @@
 
     private BpelServerConnector _connector;
 
-    private MinervaPool _minervaPool;
+    private Database _db;
 
     public void init(ServletConfig config, AxisConfiguration axisConf) throws ServletException {
         boolean success = false;
@@ -122,7 +118,18 @@
                 _odeConfig = new ODEConfigProperties(new File(_appRoot, "conf"));
             else
                 _odeConfig = new ODEConfigProperties(new File(confDir));
-            _odeConfig.load();
+
+            try {
+                _odeConfig.load();
+            } catch (FileNotFoundException fnf) {
+                String errmsg = __msgs.msgOdeInstallErrorCfgNotFound(_odeConfig.getFile());
+                __log.warn(errmsg);
+
+            } catch (Exception ex) {
+                String errmsg = __msgs.msgOdeInstallErrorCfgReadError(_odeConfig.getFile());
+                __log.error(errmsg, ex);
+                throw new ServletException(errmsg, ex);
+            }
 
             String wdir = _odeConfig.getWorkingDir();
             if (wdir == null)
@@ -168,8 +175,8 @@
             _poller = new DeploymentPoller(deploymentDir, this);
 
             new ManagementService().enableService(_axisConfig, _server, _store, _appRoot.getAbsolutePath());
-            new DeploymentWebService().enableService(_axisConfig, _server, _store, _poller, _appRoot.getAbsolutePath(),
-                    _workRoot.getAbsolutePath());
+            new DeploymentWebService().enableService(_axisConfig, _server, _store, _poller, _appRoot.getAbsolutePath(), _workRoot
+                    .getAbsolutePath());
 
             _poller.start();
             __log.info(__msgs.msgPollingStarted(deploymentDir.getAbsolutePath()));
@@ -187,11 +194,24 @@
 
     }
 
+    private void initDataSource() throws ServletException {
+        _db = new Database(_odeConfig);
+        _db.setTransactionManager(_txMgr);
+        _db.setWorkRoot(_workRoot);
+
+        try {
+            _db.start();
+        } catch (Exception ex) {
+            String errmsg = __msgs.msgOdeDbConfigError();
+            __log.error(errmsg, ex);
+            throw new ServletException(errmsg, ex);
+        }
+
+    }
+
     /**
-     * Shutdown the service engine. This performs cleanup before the BPE is
-     * terminated. Once this method has been called, init() must be called
-     * before the transformation engine can be started again with a call to
-     * start().
+     * Shutdown the service engine. This performs cleanup before the BPE is terminated. Once this method has been called, init()
+     * must be called before the transformation engine can be started again with a call to start().
      * 
      * @throws AxisFault
      *             if the engine is unable to shut down.
@@ -228,29 +248,31 @@
                     __log.debug("Scheduler couldn't be shutdown.", ex);
                 }
 
-            if (_store != null) 
+            if (_store != null)
                 try {
                     _store.shutdown();
                     _store = null;
                 } catch (Throwable t) {
-                    __log.debug("Store could not be shutdown.",t);
+                    __log.debug("Store could not be shutdown.", t);
                 }
-                
-            if (_daoCF != null) 
+
+            if (_daoCF != null)
                 try {
                     _daoCF.shutdown();
-                    _daoCF = null;
                 } catch (Throwable ex) {
-                    __log.debug("DOA shutdown failed.", ex);                    
+                    __log.debug("DOA shutdown failed.", ex);
+                } finally {
+                    _daoCF = null;
                 }
-                
-            if (_minervaPool != null)
+
+            if (_db != null)
                 try {
-                    __log.debug("shutting down minerva pool.");
-                    _minervaPool.stop();
-                    _minervaPool = null;
-                } catch (Throwable t) {
-                    __log.debug("Minerva pool could not be shut down.", t);
+                    _db.shutdown();
+                    
+                } catch (Throwable ex) {
+                    __log.debug("DB shutdown failed.", ex);
+                } finally {
+                    _db = null;
                 }
 
             if (_txMgr != null) {
@@ -299,7 +321,7 @@
         return odeService;
     }
 
-    public ExternalService createExternalService(Definition def, QName serviceName, String portName) throws ContextException  {
+    public ExternalService createExternalService(Definition def, QName serviceName, String portName) throws ContextException {
         ExternalService extService = (ExternalService) _externalServices.get(serviceName);
         if (extService != null)
             return extService;
@@ -310,7 +332,7 @@
             __log.error("Could not create external service.", ex);
             throw new ContextException("Error creating external service.", ex);
         }
-        
+
         if (_odeConfig.isReplicateEmptyNS()) {
             __log.debug("Setting external service with empty namespace replication");
             extService.setReplicateEmptyNS(true);
@@ -362,22 +384,6 @@
         }
     }
 
-    private void initDataSource() throws ServletException {
-        switch (_odeConfig.getDbMode()) {
-        case EXTERNAL:
-            initExternalDb();
-            break;
-        case EMBEDDED:
-            initEmbeddedDb();
-            break;
-        case INTERNAL:
-            initInternalDb();
-            break;
-        default:
-            break;
-        }
-    }
-
     private void initConnector() throws ServletException {
         int port = _odeConfig.getConnectorPort();
         if (port == 0) {
@@ -396,72 +402,6 @@
         }
     }
 
-    private void initExternalDb() throws ServletException {
-        try {
-            if (__logSql.isDebugEnabled())
-                _datasource = new LoggingDataSourceWrapper((DataSource) lookupInJndi(_odeConfig.getDbDataSource()), __logSql);
-            else
-                _datasource = (DataSource) lookupInJndi(_odeConfig.getDbDataSource());
-            __log.info(__msgs.msgOdeUsingExternalDb(_odeConfig.getDbDataSource()));
-        } catch (Exception ex) {
-            String msg = __msgs.msgOdeInitExternalDbFailed(_odeConfig.getDbDataSource());
-            __log.error(msg, ex);
-            throw new ServletException(msg, ex);
-        }
-    }
-
-    private void initInternalDb() throws ServletException {
-        __log.info("Using internal data source for JDBC URL: " + _odeConfig.getDbIntenralJdbcUrl());
-        initInternalDb(_odeConfig.getDbIntenralJdbcUrl());
-        
-    }
-
-    private void initInternalDb(String url) throws ServletException {
-
-        __log.debug("Creating Minerva DataSource/Pool for " + url);
-
-        _minervaPool = new MinervaPool();
-        _minervaPool.setTransactionManager(_txMgr);
-        _minervaPool.getConnectionFactory().setConnectionURL(url);
-        _minervaPool.getConnectionFactory().setUserName("sa");
-        _minervaPool.getConnectionFactory().setDriver(org.apache.derby.jdbc.EmbeddedDriver.class.getName());
-
-        _minervaPool.getPoolParams().maxSize = _odeConfig.getPoolMaxSize();
-        _minervaPool.getPoolParams().minSize = _odeConfig.getPoolMinSize();
-        _minervaPool.getPoolParams().blocking = false;
-        _minervaPool.setType(MinervaPool.PoolType.MANAGED);
-
-        try {
-            _minervaPool.start();
-        } catch (Exception ex) {
-            String errmsg = __msgs.msgOdeDbPoolStartupFailed(url);
-            __log.error(errmsg, ex);
-            throw new ServletException(errmsg, ex);
-        }
-
-        if (__logSql.isDebugEnabled())
-            _datasource = new LoggingDataSourceWrapper(_minervaPool.createDataSource(), __logSql);
-        else _datasource = _minervaPool.createDataSource();
-        
-    }
-    /**
-     * Initialize embedded (DERBY) database.
-     */
-    private void initEmbeddedDb() throws ServletException {
-
-        String db = "jpadb";
-        String persistenceType = System.getProperty("ode.persistence");
-        if (persistenceType != null) {
-            if ("hibernate".equalsIgnoreCase(persistenceType))
-                db = "hibdb";
-        }
-
-        String url = "jdbc:derby:" + _workRoot + "/" + db + "/" + _odeConfig.getDbEmbeddedName();
-        __log.info("Using Embedded Derby: " + url);
-        initInternalDb(url);
-       
-    }
-
     /**
      * Initialize the DAO.
      * 
@@ -488,18 +428,18 @@
         }
 
         BpelDAOConnectionFactoryJDBC cf = createDaoCF();
-        cf.setDataSource(_datasource);
+        cf.setDataSource(_db.getDataSource());
         cf.setTransactionManager(_txMgr);
         cf.init(properties);
         _daoCF = cf;
     }
 
     protected void initProcessStore() {
-        _store = createProcessStore(_datasource);
+        _store = createProcessStore(_db.getDataSource());
         _store.registerListener(new ProcessStoreListenerImpl());
         _store.setDeployDir(new File(_workRoot, "processes"));
     }
-    
+
     protected ProcessStoreImpl createProcessStore(DataSource ds) {
         return new ProcessStoreImpl(ds);
     }
@@ -508,7 +448,7 @@
         QuartzSchedulerImpl scheduler = new QuartzSchedulerImpl();
         scheduler.setExecutorService(_executorService, 20);
         scheduler.setTransactionManager(_txMgr);
-        scheduler.setDataSource(_datasource);
+        scheduler.setDataSource(_db.getDataSource());
         scheduler.init();
         return scheduler;
     }
@@ -521,46 +461,22 @@
         _server = new BpelServerImpl();
         _scheduler = createScheduler();
         _scheduler.setJobProcessor(_server);
-        
 
         _server.setDaoConnectionFactory(_daoCF);
         _server.setInMemDaoConnectionFactory(new org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl());
         _server.setEndpointReferenceContext(new EndpointReferenceContextImpl(this));
-        _server.setMessageExchangeContext(new P2PMexContextImpl(this, new MessageExchangeContextImpl(this),
-                _scheduler));
+        _server.setMessageExchangeContext(new P2PMexContextImpl(this, new MessageExchangeContextImpl(this), _scheduler));
         _server.setBindingContext(new BindingContextImpl(this, _store));
         _server.setScheduler(_scheduler);
-        if (_odeConfig.isDehydrationEnabled()){
+        if (_odeConfig.isDehydrationEnabled()) {
             CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy();
-    //        dehy.setProcessMaxAge(10000);
+            // dehy.setProcessMaxAge(10000);
             _server.setDehydrationPolicy(dehy);
         }
         _server.init();
     }
 
-    @SuppressWarnings("unchecked")
-    private <T> T lookupInJndi(String objName) throws Exception {
-        ClassLoader old = Thread.currentThread().getContextClassLoader();
-        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-        try {
-            InitialContext ctx = null;
-            try {
-                ctx = new InitialContext();
-                return (T) ctx.lookup(objName);
-            } finally {
-                if (ctx != null)
-                    try {
-                        ctx.close();
-                    } catch (Exception ex1) {
-                        __log.error("Error closing JNDI connection.", ex1);
-                    }
-            }
-        } finally {
-            Thread.currentThread().setContextClassLoader(old);
-        }
-    }
-
-    public ProcessStore getProcessStore() {
+    public ProcessStoreImpl getProcessStore() {
         return _store;
     }
 

Modified: incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java?view=diff&rev=508524&r1=508523&r2=508524
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java (original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java Fri Feb 16 09:48:08 2007
@@ -58,9 +58,13 @@
 
     /** The polling interval. */
     private static final long POLL_TIME = 3000;
+
     private File _deployDir;
+
     private PollingThread _poller;
+
     private ODEServer _odeServer;
+
     private boolean _onHold = false;
 
     /** Filter accepting directories containing a .odedd file. */
@@ -77,6 +81,13 @@
         }
     };
 
+    /** Filter accepting *.deployed files. */
+    private static final FileFilter _deployedFilter = new FileFilter() {
+        public boolean accept(File path) {
+            return path.isFile() && path.getName().endsWith(".deployed");
+        }
+    };
+
     public DeploymentPoller(File deployDir, ODEServer odeServer) {
         _odeServer = odeServer;
         _deployDir = deployDir;
@@ -96,9 +107,8 @@
     }
 
     /**
-     * Scan the directory for new (or removed) files (called mainly from
-     * {@link PollingThread}) and calls whoever is in charge of the actual
-     * deployment (or undeployment).
+     * Scan the directory for new (or removed) files (called mainly from {@link PollingThread}) and calls whoever is in charge of
+     * the actual deployment (or undeployment).
      */
     private void check() {
         File[] files = _deployDir.listFiles(_fileFilter);
@@ -123,13 +133,13 @@
                 __log.error("Error creating deployed marker file, " + file + " will not be deployed");
                 continue;
             }
-            
+
             try {
                 _odeServer.getProcessStore().undeploy(file);
             } catch (Exception ex) {
                 __log.error("Error undeploying " + file.getName());
             }
-            
+
             try {
                 Collection<QName> deployed = _odeServer.getProcessStore().deploy(file);
                 __log.info("Deployment of artifact " + file.getName() + " successful.");
@@ -139,20 +149,18 @@
         }
 
         // Removing deployments that disappeared
-        Collection<String> deployed = _odeServer.getProcessStore().getPackages();
-        for (String s : deployed) {
-            if (s != null) {
-                File deployDir = new File(_deployDir, s);
-                if (!deployDir.exists()) {
-                    Collection<QName> undeployed = _odeServer.getProcessStore().undeploy(deployDir);
-                    File marker = new File(_deployDir, s + ".deployed");
-                    marker.delete();
-                    if (undeployed.size() > 0) __log.info("Successfully undeployed " + s);
-                }
+        File[] deployed = _deployDir.listFiles(_deployedFilter);
+        for (File file : deployed) {
+            String pkg = file.getName().substring(0, file.getName().length() - ".deployed".length());
+            File deployDir = new File(_deployDir, pkg);
+            if (!deployDir.exists()) {
+                Collection<QName> undeployed = _odeServer.getProcessStore().undeploy(deployDir);
+                file.delete();
+                if (undeployed.size() > 0)
+                    __log.info("Successfully undeployed " + pkg);
             }
         }
-     }
-
+    }
 
     /**
      * Thread that does the actual polling for new files.
@@ -176,7 +184,8 @@
         public void run() {
             try {
                 while (_active) {
-                    if (!_onHold) check();
+                    if (!_onHold)
+                        check();
                     synchronized (this) {
                         try {
                             this.wait(POLL_TIME);

Modified: incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java?view=diff&rev=508524&r1=508523&r2=508524
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java Fri Feb 16 09:48:08 2007
@@ -18,9 +18,35 @@
  */
 package org.apache.ode.bpel.runtime;
 
+import java.io.File;
+import java.sql.DriverManager;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
 import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
 import org.apache.ode.bpel.engine.BpelServerImpl;
-import org.apache.ode.bpel.iapi.*;
+import org.apache.ode.bpel.iapi.BindingContext;
+import org.apache.ode.bpel.iapi.ContextException;
+import org.apache.ode.bpel.iapi.Endpoint;
+import org.apache.ode.bpel.iapi.EndpointReference;
+import org.apache.ode.bpel.iapi.EndpointReferenceContext;
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.MessageExchangeContext;
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.apache.ode.bpel.iapi.PartnerRoleChannel;
+import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
+import org.apache.ode.bpel.iapi.Scheduler;
 import org.apache.ode.bpel.scheduler.quartz.QuartzSchedulerImpl;
 import org.apache.ode.dao.jpa.ojpa.BPELDAOConnectionFactoryImpl;
 import org.apache.ode.store.ProcessStoreImpl;
@@ -32,20 +58,6 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import javax.sql.DataSource;
-import javax.transaction.TransactionManager;
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.sql.DriverManager;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
 
 class MockBpelServer {
 
@@ -303,6 +315,7 @@
         public <T> T execTransaction(Callable<T> transaction) throws Exception, ContextException {
             return _quartz.execTransaction(transaction);
         }
+        
         public <T> Future<T> execIsolatedTransaction(Callable<T> transaction) throws Exception, ContextException {
             return _quartz.execIsolatedTransaction(transaction);
         }

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDAO.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDAO.java?view=diff&rev=508524&r1=508523&r2=508524
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDAO.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDAO.java Fri Feb 16 09:48:08 2007
@@ -25,6 +25,7 @@
      */
     String getDeploymentUnitDir();
     
+    
     void setDeploymentUnitDir(String dir);
     
     /**

Modified: incubator/ode/trunk/jbi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/pom.xml?view=diff&rev=508524&r1=508523&r2=508524
==============================================================================
--- incubator/ode/trunk/jbi/pom.xml (original)
+++ incubator/ode/trunk/jbi/pom.xml Fri Feb 16 09:48:08 2007
@@ -147,14 +147,6 @@
 
     </dependencies>
 
-    <pluginRepositories>
-        <pluginRepository>
-            <id>apache-snapshots</id>
-            <name>Apache Snapshots Repository</name>
-            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
-        </pluginRepository>
-    </pluginRepositories>
-
 	<build>
 		<plugins>
 			<plugin>

Modified: incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/Messages.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/Messages.java?view=diff&rev=508524&r1=508523&r2=508524
==============================================================================
--- incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/Messages.java (original)
+++ incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/Messages.java Fri Feb 16 09:48:08 2007
@@ -142,4 +142,8 @@
         return format("DAO property file \"{0}\" not found.", daoPropFile);
     }
 
+    public String msgOdeDbConfigError() {
+        return format("Database configuration error.");
+    }
+
 }

Modified: incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeConfigProperties.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeConfigProperties.java?view=diff&rev=508524&r1=508523&r2=508524
==============================================================================
--- incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeConfigProperties.java (original)
+++ incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeConfigProperties.java Fri Feb 16 09:48:08 2007
@@ -20,80 +20,32 @@
 package org.apache.ode.jbi;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.Properties;
-
-import javax.jbi.JBIException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.jbi.msgmap.JbiWsdl11WrapperMapper;
 
-public class OdeConfigProperties extends Properties {
+public class OdeConfigProperties extends org.apache.ode.il.config.OdeConfigProperties {
     private static final long serialVersionUID = 1L;
 
-    private static final Log __log = LogFactory.getLog(OdeConfigProperties.class);
-
-    private static final Messages __msgs = Messages.getMessages(Messages.class);
-
-    private static final String CONFIG_FILE_NAME = "ode-jbi.properties";
+    public static final String CONFIG_FILE_NAME = "ode-jbi.properties";
 
-    private static final String PROP_NAMESPACE = "ode-jbi.pidNamespace";
+    private static final String PROP_NAMESPACE = "pidNamespace";
 
-    private static final String PROP_ALLOW_INCOMPLETE_DEPLOYMENT = "ode-jbi.allowIncompleteDeployment";
+    private static final String PROP_ALLOW_INCOMPLETE_DEPLOYMENT = "allowIncompleteDeployment";
    
-    private static final String PROP_DAOCF = "ode-jbi.dao.factory";
-
-    private static final String PROP_DB_MODE = "ode-jbi.db.mode";
-
-    private static final String PROP_DB_EXTERNAL_DS = "ode-jbi.db.ext.dataSource";
-
-    private static final String PROP_DB_EMBEDDED_NAME = "ode-jbi.db.emb.name";
-
-    private static final String PROP_POOL_MAX = "ode-jbi.db.pool.max";
-
-    private static final String PROP_POOL_MIN = "ode-jbi.db.pool.min";
-
-    private static final String PROP_MSGMAPPER = "ode-jbi.messageMapper";
+    private static final String PROP_DAOCF = "dao.factory";
 
-    private static final String PROP_CONNECTOR_PORT = "ode-jbi.connector.registryPort";
+    private static final String PROP_MSGMAPPER = "messageMapper";
 
-    private static final String PROP_CONNECTOR_NAME = "ode-jbi.connector.registryName";
-
-    private final static String PROP_PERSISTENCE_TYPE = "ode-jbi.store.persistence";
 
     private String _installDir;
 
-    public OdeConfigProperties(String installRoot) {
-        _installDir = installRoot;
+    public OdeConfigProperties(File cfgFile) {
+        super(cfgFile, "ode-jbi.");
     }
 
-    public void load() throws JBIException {
-        File configFile = new File(_installDir, CONFIG_FILE_NAME);
-        if (!configFile.exists()) {
-            String errmsg = __msgs.msgOdeInstallErrorCfgNotFound(configFile);
-            __log.warn(errmsg);
-        } else {
-            InputStream fis = null;
-            try {
-                fis = new FileInputStream(configFile);
-                load(fis);
-
-            } catch (Exception ex) {
-                String errmsg = __msgs.msgOdeInstallErrorCfgReadError(configFile);
-                __log.error(errmsg, ex);
-                throw new JBIException(errmsg);
-            } finally {
-                if (fis != null)
-                    try {
-                        fis.close();
-                    } catch (Exception ex) {
-                    }
-            }
-        }
 
-    }
 
     /**
      * Get the namespace that should be used to generate process identifiers
@@ -105,37 +57,6 @@
         return getProperty(PROP_NAMESPACE, null);
     }
 
-    /**
-     * Should the internal database be used, or are the datasources provided?
-     * 
-     * @return
-     */
-    public DatabaseMode getDbMode() {
-        return DatabaseMode.valueOf(getProperty(PROP_DB_MODE, DatabaseMode.EMBEDDED.toString()).toUpperCase());
-    }
-
-    public String getDbDataSource() {
-        return getProperty(PROP_DB_EXTERNAL_DS, "java:comp/jdbc/ode-ds");
-    }
-
-    public String getDbEmbeddedName() {
-        return getProperty(PROP_DB_EMBEDDED_NAME, "data");
-    }
-
-    /**
-     * Possible database modes.
-     */
-    public enum DatabaseMode {
-        /** External data-source (managed by app server) */
-        EXTERNAL,
-
-        /** Internal data-source (managed by us--Minerva) */
-        INTERNAL,
-
-        /** Embedded database (managed by us--Minerva) */
-        EMBEDDED
-    }
-
     public boolean getAllowIncompleteDeployment() {
         return Boolean.valueOf(getProperty(PROP_ALLOW_INCOMPLETE_DEPLOYMENT, Boolean.FALSE.toString()));
     }
@@ -149,27 +70,7 @@
         return getProperty(PROP_MSGMAPPER, JbiWsdl11WrapperMapper.class.getName());
     }
 
-    public int getPoolMaxSize() {
-        return Integer.valueOf(getProperty(PROP_POOL_MAX, "10"));
-    }
-
-    public int getPoolMinSize() {
-        return Integer.valueOf(getProperty(PROP_POOL_MIN, "1"));
-    }
-
-    public int getConnectorPort() {
-        return Integer.valueOf(getProperty(PROP_CONNECTOR_PORT, "1099"));
-    }
-
-    public String getConnectorName() {
-        return getProperty(PROP_CONNECTOR_NAME, "ode");
-    }
-
     public String getDAOConnectionFactory() {
         return getProperty(PROP_DAOCF, "org.apache.ode.dao.jpa.ojpa.BPELDAOConnectionFactoryImpl");        
     }
-    
-    public String getPersistenceType() {
-        return getProperty(PROP_PERSISTENCE_TYPE, "jpa");
-    }
-}
+ }

Modified: incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java?view=diff&rev=508524&r1=508523&r2=508524
==============================================================================
--- incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java (original)
+++ incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java Fri Feb 16 09:48:08 2007
@@ -19,54 +19,56 @@
 
 package org.apache.ode.jbi;
 
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.concurrent.Executors;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.ComponentContext;
+import javax.jbi.component.ComponentLifeCycle;
+import javax.jbi.component.ServiceUnitManager;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.transaction.TransactionManager;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.derby.jdbc.EmbeddedDriver;
 import org.apache.ode.bpel.connector.BpelServerConnector;
 import org.apache.ode.bpel.dao.BpelDAOConnectionFactoryJDBC;
 import org.apache.ode.bpel.engine.BpelServerImpl;
 import org.apache.ode.bpel.scheduler.quartz.QuartzSchedulerImpl;
+import org.apache.ode.il.dbutil.Database;
 import org.apache.ode.jbi.msgmap.Mapper;
 import org.apache.ode.store.ProcessStoreImpl;
-import org.apache.ode.utils.LoggingDataSourceWrapper;
 import org.apache.ode.utils.fs.TempFileManager;
-import org.opentools.minerva.MinervaPool;
-import org.opentools.minerva.MinervaPool.PoolType;
-
-import javax.jbi.JBIException;
-import javax.jbi.component.ComponentContext;
-import javax.jbi.component.ComponentLifeCycle;
-import javax.jbi.component.ServiceUnitManager;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-import javax.sql.DataSource;
-import javax.transaction.TransactionManager;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.Properties;
-import java.util.concurrent.Executors;
 
 /**
- * This class implements ComponentLifeCycle. The JBI framework will start this
- * engine class automatically when JBI framework starts up.
+ * This class implements ComponentLifeCycle. The JBI framework will start this engine class automatically when JBI framework starts
+ * up.
  */
 public class OdeLifeCycle implements ComponentLifeCycle {
     private static final Messages __msgs = Messages.getMessages(Messages.class);
+
     private static final Log __log = LogFactory.getLog(OdeLifeCycle.class);
-    private static final Log __logSql = LogFactory.getLog("org.apache.ode.sql");
 
     private OdeSUManager _suManager = null;
+
     private boolean _initSuccess = false;
+
     private OdeContext _ode;
+
     private Receiver _receiver;
+
     private boolean _started;
-    private boolean _needDerbyShutdown;
-    private String _derbyUrl;
+
     private BpelServerConnector _connector;
 
+    private Database _db;
+
     ServiceUnitManager getSUManager() {
         return _suManager;
     }
@@ -85,10 +87,8 @@
             _ode.setContext(context);
             _ode._consumer = new OdeConsumer(_ode);
 
-
             if (_ode.getContext().getWorkspaceRoot() != null)
-                TempFileManager.setWorkingDirectory(new File(_ode.getContext()
-                        .getWorkspaceRoot()));
+                TempFileManager.setWorkingDirectory(new File(_ode.getContext().getWorkspaceRoot()));
 
             __log.debug("Loading properties.");
             initProperties();
@@ -120,7 +120,7 @@
         }
     }
 
-    private void initMappers() throws JBIException  {
+    private void initMappers() throws JBIException {
         Class mapperClass;
         try {
             mapperClass = Class.forName(_ode._config.getMessageMapper());
@@ -143,89 +143,38 @@
     }
 
     private void initDataSource() throws JBIException {
-        switch (_ode._config.getDbMode()) {
-            case EXTERNAL:
-                initExternalDb();
-                break;
-            case EMBEDDED:
-                initEmbeddedDb();
-                break;
-            case INTERNAL:
-                initInternalDb();
-                break;
-            default:
-                break;
-        }
-    }
-
-    private void initExternalDb() throws JBIException {
-        try {
-            if (__logSql.isDebugEnabled())
-                _ode._dataSource = new LoggingDataSourceWrapper((DataSource)
-                        lookupInJndi(_ode._config.getDbDataSource()), __logSql);
-            else
-                _ode._dataSource = (DataSource) lookupInJndi(_ode._config.getDbDataSource());
-            __log.info(__msgs.msgOdeUsingExternalDb(_ode._config.getDbDataSource()));
-        } catch (Exception ex) {
-            String msg = __msgs.msgOdeInitExternalDbFailed(_ode._config.getDbDataSource());
-            __log.error(msg,ex);
-            throw new JBIException(msg,ex);
-        }
-    }
-
-    private void initInternalDb() throws JBIException {
-        throw new JBIException("internalDb not supported!");
-    }
-
-    /**
-     * Initialize embedded (DERBY) database.
-     */
-    private void initEmbeddedDb() throws JBIException {
-        __log.info("Using DataSource Derby");
-
-        String url =
-                "jdbc:derby:" + _ode.getContext().getInstallRoot() + "/"
-                        + _ode._config.getDbEmbeddedName();
-
-        __log.debug("creating Minerva pool for " + url);
-
-        MinervaPool minervaPool = new MinervaPool();
-        minervaPool.setTransactionManager(_ode.getTransactionManager());
-        minervaPool.getConnectionFactory().setConnectionURL(url);
-        minervaPool.getConnectionFactory().setUserName("sa");
-        minervaPool.getConnectionFactory().setDriver(
-                org.apache.derby.jdbc.EmbeddedDriver.class.getName());
-
-        minervaPool.getPoolParams().maxSize = _ode._config.getPoolMaxSize();
-        minervaPool.getPoolParams().minSize = _ode._config.getPoolMinSize();
-        minervaPool.getPoolParams().blocking = false;
-        minervaPool.setType(PoolType.MANAGED);
+        _db = new Database(_ode._config);
+        _db.setTransactionManager(_ode.getTransactionManager());
+        _db.setWorkRoot(new File(_ode.getContext().getInstallRoot()));
 
         try {
-            minervaPool.start();
+            _db.start();
         } catch (Exception ex) {
-            String errmsg = __msgs.msgOdeDbPoolStartupFailed(url);
-            __log.error(errmsg,ex);
-            throw new JBIException(errmsg,ex);
+            String errmsg = __msgs.msgOdeDbConfigError();
+            __log.error(errmsg, ex);
+            throw new JBIException(errmsg, ex);
         }
-
-        if (__logSql.isDebugEnabled())
-            _ode._dataSource = new LoggingDataSourceWrapper(minervaPool.createDataSource(), __logSql);
-        else _ode._dataSource = minervaPool.createDataSource();
-
-        _needDerbyShutdown = true;
-        _derbyUrl = url;
+        
+        _ode._dataSource = _db.getDataSource();
     }
 
     /**
      * Load the "ode-jbi.properties" file from the install directory.
-     *
+     * 
      * @throws JBIException
      */
     private void initProperties() throws JBIException {
-        OdeConfigProperties config = new OdeConfigProperties(_ode.getContext()
-                .getInstallRoot());
-        config.load();
+        OdeConfigProperties config = new OdeConfigProperties(new File(_ode.getContext().getInstallRoot(),
+                OdeConfigProperties.CONFIG_FILE_NAME));
+        
+        try {
+            config.load();
+        } catch (FileNotFoundException fnf) {
+            __log.warn(__msgs.msgOdeInstallErrorCfgNotFound(config.getFile()));
+        } catch (Exception ex) {
+           String errmsg = __msgs.msgOdeInstallErrorCfgReadError(config.getFile());
+           throw new JBIException(errmsg,ex);
+        }
         _ode._config = config;
     }
 
@@ -243,15 +192,13 @@
         _ode._scheduler = new QuartzSchedulerImpl();
         _ode._scheduler.setJobProcessor(_ode._server);
         _ode._scheduler.setExecutorService(_ode._executorService, 20);
-        _ode._scheduler.setTransactionManager((TransactionManager) _ode
-                .getContext().getTransactionManager());
+        _ode._scheduler.setTransactionManager((TransactionManager) _ode.getContext().getTransactionManager());
         _ode._scheduler.setDataSource(_ode._dataSource);
         _ode._scheduler.init();
 
-        _ode._store = new ProcessStoreImpl(_ode._dataSource, _ode._config.getPersistenceType(), false);
+        _ode._store = new ProcessStoreImpl(_ode._dataSource, _ode._config.getDbDaoImpl().toString(), false);
         _ode._store.loadAll();
 
-
         _ode._server.setInMemDaoConnectionFactory(new org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl());
         _ode._server.setDaoConnectionFactory(_ode._daocf);
         _ode._server.setEndpointReferenceContext(_ode._eprContext);
@@ -265,16 +212,16 @@
 
     /**
      * Initialize the data store.
-     *
+     * 
      * @throws JBIException
      */
     private void initDao() throws JBIException {
-    
+
         Properties properties = new Properties();
         File daoPropFile;
         String confDir = _ode.getContext().getInstallRoot();
         daoPropFile = new File((confDir != null) ? new File(confDir) : new File(""), "bpel-dao.properties");
-    
+
         if (daoPropFile.exists()) {
             FileInputStream fis;
             try {
@@ -288,13 +235,12 @@
         } else {
             __log.info(__msgs.msgOdeInitDAOPropertiesNotFound(daoPropFile));
         }
-    
+
         BpelDAOConnectionFactoryJDBC cf = createDaoCF();
         cf.setDataSource(_ode._dataSource);
         cf.setTransactionManager(_ode.getTransactionManager());
         cf.init(properties);
 
-
         _ode._daocf = cf;
     }
 
@@ -313,7 +259,7 @@
             } catch (Exception e) {
 
                 __log.error("Failed to initialize JCA connector (check security manager configuration)");
-                __log.debug("Failed to initialize JCA connector (check security manager configuration)",e);
+                __log.debug("Failed to initialize JCA connector (check security manager configuration)", e);
 
             }
         }
@@ -347,7 +293,7 @@
                 String errmsg = "attempt to call start() after init() failure.";
                 IllegalStateException ex = new IllegalStateException(errmsg);
                 __log.fatal(errmsg, ex);
-                throw new JBIException(errmsg,ex);
+                throw new JBIException(errmsg, ex);
             }
 
             if (_ode.getChannel() == null) {
@@ -358,7 +304,7 @@
                 _ode._server.start();
             } catch (Exception ex) {
                 String errmsg = __msgs.msgOdeBpelServerStartFailure();
-                __log.error(errmsg,ex);
+                __log.error(errmsg, ex);
                 throw new JBIException(errmsg, ex);
             }
 
@@ -409,12 +355,11 @@
     }
 
     /**
-     * Shutdown the service engine. This performs cleanup before the BPE is
-     * terminated. Once this method has been called, init() must be called before
-     * the transformation engine can be started again with a call to start().
-     *
+     * Shutdown the service engine. This performs cleanup before the BPE is terminated. Once this method has been called, init()
+     * must be called before the transformation engine can be started again with a call to start().
+     * 
      * @throws javax.jbi.JBIException
-     *           if the transformation engine is unable to shut down.
+     *             if the transformation engine is unable to shut down.
      */
     public void shutDown() throws JBIException {
         ClassLoader old = Thread.currentThread().getContextClassLoader();
@@ -424,7 +369,7 @@
             try {
                 _connector.shutdown();
             } catch (Exception e) {
-                __log.error("Error shutting down JCA server.",e);
+                __log.error("Error shutting down JCA server.", e);
             }
             _connector = null;
         }
@@ -438,26 +383,20 @@
 
             }
 
+            try {
+                _db.shutdown();
+            } catch (Exception ex) {
+                __log.debug("error shutting down db.", ex);
+            } finally {
+                _db = null;
+            }
+
             __log.debug("cleaning up temporary files.");
             TempFileManager.cleanup();
 
             _suManager = null;
             _ode = null;
 
-            if (_needDerbyShutdown) {
-                __log.debug("shutting down derby.");
-                EmbeddedDriver driver = new EmbeddedDriver();
-                try {
-                    driver.connect(_derbyUrl+";shutdown=true", new Properties());
-                } catch (SQLException ex) {
-                    // Shutdown will always return an exeption!
-                    if (ex.getErrorCode() != 45000)
-                        __log.error("Error shutting down Derby: " + ex.getErrorCode(), ex);
-                        
-                } catch (Exception ex) {
-                    __log.error("Error shutting down Derby.", ex);
-                }
-            }
             __log.info("Shutdown completed.");
         } finally {
             Thread.currentThread().setContextClassLoader(old);
@@ -488,5 +427,4 @@
 
     }
 
-  
 }

Modified: incubator/ode/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/pom.xml?view=diff&rev=508524&r1=508523&r2=508524
==============================================================================
--- incubator/ode/trunk/pom.xml (original)
+++ incubator/ode/trunk/pom.xml Fri Feb 16 09:48:08 2007
@@ -447,6 +447,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.ode</groupId>
+                <artifactId>ode-axis2</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.ode</groupId>
                 <artifactId>ode-bpel-ql</artifactId>
                 <version>${project.version}</version>
             </dependency>
@@ -1020,6 +1025,11 @@
             <dependency>
                 <groupId>org.apache.derby</groupId>
                 <artifactId>derby</artifactId>
+                <version>${derbyVersion}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.derby</groupId>
+                <artifactId>derbyclient</artifactId>
                 <version>${derbyVersion}</version>
             </dependency>