Ejemplo n.º 1
0
  private void initDataSource() throws ServletException {
    _db = Database.create(_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);
    }
  }
Ejemplo n.º 2
0
 protected void initProcessStore(EndpointReferenceContext eprContext) {
   _store = createProcessStore(eprContext, _db.getDataSource());
   _store.registerListener(new ProcessStoreListenerImpl());
   _store.setDeployDir(
       _odeConfig.getDeployDir() != null
           ? new File(_odeConfig.getDeployDir())
           : new File(_workRoot, "processes"));
   _store.setConfigDir(_configRoot);
 }
Ejemplo n.º 3
0
 protected Scheduler createScheduler() {
   SimpleScheduler scheduler =
       new SimpleScheduler(
           new GUID().toString(),
           new JdbcDelegate(_db.getDataSource()),
           _odeConfig.getProperties());
   scheduler.setExecutorService(_executorService);
   scheduler.setTransactionManager(_txMgr);
   return scheduler;
 }
Ejemplo n.º 4
0
 /**
  * Initialize the DAO.
  *
  * @throws ServletException
  */
 protected void initDAO() throws ServletException {
   __log.info(__msgs.msgOdeUsingDAOImpl(_odeConfig.getDAOConnectionFactory()));
   try {
     _daoCF = _db.createDaoCF();
   } catch (Exception ex) {
     String errmsg = __msgs.msgDAOInstantiationFailed(_odeConfig.getDAOConnectionFactory());
     __log.error(errmsg, ex);
     throw new ServletException(errmsg, ex);
   }
 }
Ejemplo n.º 5
0
 private void registerExternalVariableModules() {
   JdbcExternalVariableModule jdbcext;
   jdbcext = new JdbcExternalVariableModule();
   jdbcext.registerDataSource("ode", _db.getDataSource());
   _bpelServer.registerExternalVariableEngine(jdbcext);
 }
Ejemplo n.º 6
0
  /**
   * 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.
   */
  public void shutDown() throws AxisFault {

    ClassLoader old = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
    try {
      if (_poller != null)
        try {
          __log.debug("shutting down poller");
          _poller.stop();
          _poller = null;
        } catch (Throwable t) {
          __log.debug("Error stopping poller.", t);
        }

      if (_bpelServer != null)
        try {
          __log.debug("shutting down ODE server.");
          _bpelServer.shutdown();
          _bpelServer = null;
        } catch (Throwable ex) {
          __log.debug("Error stopping services.", ex);
        }

      if (_cronScheduler != null) {
        try {
          __log.debug("shutting down cron scheduler.");
          _cronScheduler.shutdown();
          _cronScheduler = null;
        } catch (Exception ex) {
          __log.debug("Cron scheduler couldn't be shutdown.", ex);
        }
      }

      if (_scheduler != null)
        try {
          __log.debug("shutting down scheduler.");
          _scheduler.shutdown();
          _scheduler = null;
        } catch (Exception ex) {
          __log.debug("Scheduler couldn't be shutdown.", ex);
        }

      if (_store != null)
        try {
          _store.shutdown();
          _store = null;
        } catch (Throwable t) {
          __log.debug("Store could not be shutdown.", t);
        }

      if (_daoCF != null)
        try {
          _daoCF.shutdown();
        } catch (Throwable ex) {
          __log.debug("DOA shutdown failed.", ex);
        } finally {
          _daoCF = null;
        }

      if (_db != null)
        try {
          _db.shutdown();

        } catch (Throwable ex) {
          __log.debug("DB shutdown failed.", ex);
        } finally {
          _db = null;
        }

      if (_txMgr != null) {
        __log.debug("shutting down transaction manager.");
        _txMgr = null;
      }

      if (_connector != null) {
        try {
          __log.debug("shutdown BpelConnector");
          _connector.shutdown();
          _connector = null;
        } catch (Throwable t) {
          __log.error("Unable to cleanup temp files.", t);
        }
      }
      if (httpConnectionManager != null) {
        __log.debug("shutting down HTTP connection manager.");
        try {
          httpConnectionManager.shutdown();
          httpConnectionManager = null;
        } catch (Throwable t) {
          __log.error("Unable to shut down HTTP connection manager.", t);
        }
      }
      if (idleConnectionTimeoutThread != null) {
        __log.debug("shutting down Idle Connection Timeout Thread.");
        try {
          idleConnectionTimeoutThread.shutdown();
          idleConnectionTimeoutThread = null;
        } catch (Throwable t) {
          __log.error("Unable to shut down Idle Connection Timeout Thread.", t);
        }
      }
      try {
        __log.debug("cleaning up temporary files.");
        TempFileManager.cleanup();
      } catch (Throwable t) {
        __log.error("Unable to cleanup temp files.", t);
      }

      if (_executorService != null) {
        _executorService.shutdownNow();
        _executorService = null;
      }

      __log.info(__msgs.msgOdeShutdownCompleted());
    } finally {
      Thread.currentThread().setContextClassLoader(old);
    }
  }