/** * Deploys a process. */ public Collection<QName> deploy(final File deploymentUnitDirectory, boolean autoincrementVersion) { return deploy(deploymentUnitDirectory, true, null, autoincrementVersion); }
public void refreshSchedules(String packageName) { List<QName> pids = listProcesses(packageName); if (pids != null) { for( QName pid : pids ) { fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.SCHEDULE_SETTINGS_CHANGED, pid, packageName)); } } }
public Collection<QName> undeploy(final File dir) { return undeploy(dir.getName()); }
if (autoincrementVersion || du.getStaticVersion() == -1) { version = exec(new Callable<Long>() { public Long call(ConfStoreDAOConnection conn) { return conn.getNextVersion(); retirePreviousPackageVersions(du); QName pid = toPid(processDD.getName(), version); ProcessState state = calcInitialState(processDD); _processStates.put(pid.toString(), state.toString()); ProcessConfImpl pconf = new ProcessConfImpl(pid, processDD.getName(), version, du, processDD, deployDate, calcInitialProperties(du.getProperties(), processDD), _processStates, _eprContext, _configDir, generateProcessEventsAll); processes.add(pconf); deployed = exec(new Callable<Collection<QName>>() { public Collection<QName> call(ConfStoreDAOConnection conn) { fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.DEPLOYED, process.getProcessId(), process.getDeploymentUnit() .getName())); fireStateChange(process.getProcessId(), process.getState(), process.getDeploymentUnit().getName()); undeploy(deploymentUnitDirectory); if (e instanceof ContextException) throw (ContextException) e; else throw new ContextException("Deployment failed within the engine.", e);
public Collection<QName> undeploy(final String duName) { try { exec(new Callable<Collection<QName>>() { public Collection<QName> call(ConfStoreConnection conn) { DeploymentUnitDAO dudao = conn.getDeploymentUnit(duName); du = _deploymentUnits.remove(duName); if (du != null) { undeployed = toPids(du.getProcessNames(), du.getVersion()); fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.UNDEPLOYED, pn, du.getName())); __log.info(__msgs.msgProcessUndeployed(pn));
!pid.equals(other_pid)) setState(other_pconf.getProcessId(),ProcessState.RETIRED); ProcessState old = exec(new Callable<ProcessState>() { public ProcessState call(ConfStoreDAOConnection conn) { DeploymentUnitDAO dudao = conn.getDeploymentUnit(dudir.getName()); fireStateChange(pid, state, pconf.getDeploymentUnit().getName());
ProcessState old = exec(new Callable<ProcessState>() { public ProcessState call(ConfStoreConnection conn) { DeploymentUnitDAO dudao = conn.getDeploymentUnit(dudir.getName()); fireStateChange(pid, state, pconf.getDeploymentUnit().getName());
public void setProperty(final QName pid, final QName propName, final String value) { if (__log.isDebugEnabled()) __log.debug("Setting property " + propName + " on process " + pid); ProcessConfImpl pconf = _processes.get(pid); if (pconf == null) { String msg = __msgs.msgProcessNotFound(pid); __log.info(msg); throw new ContextException(msg); } final DeploymentUnitDir dudir = pconf.getDeploymentUnit(); exec(new ProcessStoreImpl.Callable<Object>() { public Object call(ConfStoreDAOConnection conn) { DeploymentUnitDAO dudao = conn.getDeploymentUnit(dudir.getName()); if (dudao == null) return null; ProcessConfDAO proc = dudao.getProcess(pid); if (proc == null) return null; proc.setProperty(propName, value); return null; } }); fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.PROPERTY_CHANGED, pid, dudir.getName())); }
__log.debug("Loading deployment unit record from db: " + dudao.getName()); File dudir = findDeployDir(dudao); Map<QName, Node> props = calcInitialProperties(dud.getProperties(), pinfo);
public void start() throws Exception { List<QName> pids = _ode._store.listProcesses(_serviceUnitRootPath.getName()); if (pids == null) { __log.error(_serviceUnitRootPath.getName() + " not found in process store. "); throw new IllegalStateException("Process store and JBI out of synch."); } Exception e = null; for (QName pid : pids) { try { _ode._server.register(_ode._store.getProcessConfiguration(pid)); _registered.add(pid); } catch (Exception ex) { e = ex; __log.error("Unable to load " + pid, ex); break; } } if (_registered.size() != pids.size()) { for (QName pid : new ArrayList<QName>(_registered)) try { _ode._server.unregister(pid); _registered.remove(pid); } catch (Exception ex) { __log.error("Unable to unload " + pid, ex); } } if (e != null) throw e; }
public long getCurrentVersion() { long version = exec(new Callable<Long>() { public Long call(ConfStoreDAOConnection conn) { return conn.getNextVersion(); } }); return version; }
private void initBpelServer() throws JBIException { if (__log.isDebugEnabled()) { __log.debug("ODE initializing"); } _ode._server = new BpelServerImpl(); // We don't want the server to automatically load deployed processes, // we'll do that explcitly _ode._eprContext = new EndpointReferenceContextImpl(_ode); _ode._mexContext = new MessageExchangeContextImpl(_ode); if (_ode._config.getThreadPoolMaxSize() == 0) _ode._executorService = Executors.newCachedThreadPool(); else _ode._executorService = Executors.newFixedThreadPool(_ode._config.getThreadPoolMaxSize()); _ode._scheduler = new SimpleScheduler(new GUID().toString(),new JdbcDelegate(_ode._dataSource), _ode._config.getProperties()); _ode._scheduler.setJobProcessor(_ode._server); _ode._scheduler.setExecutorService(_ode._executorService); _ode._scheduler.setTransactionManager((TransactionManager) _ode.getContext().getTransactionManager()); _ode._store = new ProcessStoreImpl(_ode._eprContext , _ode._dataSource, _ode._config.getDAOConnectionFactory(), _ode._config, false); registerExternalVariableModules(); _ode._store.loadAll(); _ode._server.setInMemDaoConnectionFactory(new org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl( _ode._scheduler, _ode._config.getInMemMexTtl())); _ode._server.setDaoConnectionFactory(_ode._daocf); _ode._server.setEndpointReferenceContext(_ode._eprContext); _ode._server.setMessageExchangeContext(_ode._mexContext); _ode._server.setBindingContext(new BindingContextImpl(_ode)); _ode._server.setScheduler(_ode._scheduler); _ode._server.setConfigProperties(_ode._config.getProperties()); _ode._server.init(); }
private void fireStateChange(QName processId, ProcessState state, String duname) { switch (state) { case ACTIVE: fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.ACTIVATED, processId, duname)); break; case DISABLED: fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.DISABLED, processId, duname)); break; case RETIRED: fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.RETIRED, processId, duname)); break; } }
private Map<String, Object> prepareCompileProperties(File bpelFile) { List<Process> plist = getDeploymentDescriptor().getDeploy().getProcessList(); for (Process process : plist) { if (process.getFileName() == null || "".equals(process.getFileName())) continue; if (bpelFile.getName().equals(process.getFileName())) { Map<QName, Node> props = ProcessStoreImpl.calcInitialProperties(_properties, process); Map<String, Object> result = new HashMap<String, Object>(); result.put(BpelC.PROCESS_CUSTOM_PROPERTIES, props); return result; } } return null; }
scheduler.setJobProcessor(_server); scheduler.setExecutorService(executorService); store = new ProcessStoreImpl(null, _dataSource, "hib", new OdeConfigProperties(new Properties(), ""), true); store.registerListener(new ProcessStoreListener() { public void onProcessStoreEvent(ProcessStoreEvent event) {
if (autoincrementVersion || du.getStaticVersion() == -1) { version = exec(new Callable<Long>() { public Long call(ConfStoreConnection conn) { return conn.getNextVersion(); retirePreviousPackageVersions(du); QName pid = toPid(processDD.getName(), version); calcInitialProperties(du.getProperties(), processDD), calcInitialState(processDD), eprContext, _configDir, generateProcessEventsAll); processes.add(pconf); deployed = exec(new Callable<Collection<QName>>() { public Collection<QName> call(ConfStoreConnection conn) { fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.DEPLOYED, process.getProcessId(), process.getDeploymentUnit() .getName())); fireStateChange(process.getProcessId(), process.getState(), process.getDeploymentUnit().getName()); undeploy(deploymentUnitDirectory); if (e instanceof ContextException) throw (ContextException) e; else throw new ContextException("Deployment failed within the engine.", e);
public Collection<QName> undeploy(final String duName) { try { exec(new Callable<Collection<QName>>() { public Collection<QName> call(ConfStoreDAOConnection conn) { DeploymentUnitDAO dudao = conn.getDeploymentUnit(duName); du = _deploymentUnits.remove(duName); if (du != null) { undeployed = toPids(du.getProcessNames(), du.getVersion()); fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.UNDEPLOYED, pn, du.getName())); __log.info(__msgs.msgProcessUndeployed(pn));
exec(new Callable<Object>() { public Object call(ConfStoreConnection conn) { Collection<DeploymentUnitDAO> dus = conn.getDeploymentUnits(); for (ProcessConfImpl p : loaded) { try { fireStateChange(p.getProcessId(), p.getState(), p.getDeploymentUnit().getName()); } catch (Exception except) { __log.error("Error while activating process: pid=" + p.getProcessId() + " package="+p.getDeploymentUnit().getName(), except);
public void setProperty(final QName pid, final QName propName, final String value) { if (__log.isDebugEnabled()) __log.debug("Setting property " + propName + " on process " + pid); ProcessConfImpl pconf = _processes.get(pid); if (pconf == null) { String msg = __msgs.msgProcessNotFound(pid); __log.info(msg); throw new ContextException(msg); } final DeploymentUnitDir dudir = pconf.getDeploymentUnit(); exec(new ProcessStoreImpl.Callable<Object>() { public Object call(ConfStoreConnection conn) { DeploymentUnitDAO dudao = conn.getDeploymentUnit(dudir.getName()); if (dudao == null) return null; ProcessConfDAO proc = dudao.getProcess(pid); if (proc == null) return null; proc.setProperty(propName, value); return null; } }); fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.PROPERTY_CHANGED, pid, dudir.getName())); }
__log.debug("Loading deployment unit record from db: " + dudao.getName()); File dudir = findDeployDir(dudao); Map<QName, Node> props = calcInitialProperties(dud.getProperties(), pinfo);