protected void initializeAndStartPlatformWithDefaultTenant(final PlatformAPI platformAPI) throws BonitaException { platformAPI.initializePlatform(); platformAPI.startNode(); }
protected void deleteTenantAndPlatform() throws BonitaException { LOGGER.info("========= CLEAN PLATFORM ======="); final PlatformSession session = loginOnPlatform(); final PlatformAPI platformAPI = getPlatformAPI(session); if (platformAPI.isNodeStarted()) { platformAPI.stopNode(); if (dropOnStop) { platformAPI.cleanPlatform(); } } logoutOnPlatform(session); }
public void initializeEngine() throws Exception { LOGGER.log(Level.INFO, "Initializing Bonita Engine..."); final long before = System.currentTimeMillis(); // create a session to call the engine final PlatformSessionService platformSessionService = getPlatformSessionService(); final SessionAccessor sessionAccessor = getSessionAccessor(); final long sessionId = createPlatformSession(platformSessionService, sessionAccessor); final PlatformAPI platformAPI = getPlatformAPI(); try { if (!platformAPI.isPlatformCreated()) { throw new PlatformNotFoundException("Can't start or stop platform if it is not created."); } // initialization of the platform if (!platformAPI.isPlatformInitialized()) { LOGGER.log(Level.INFO, "First run on this platform, initializing it..."); platformAPI.initializePlatform(); LOGGER.log(Level.INFO, "Platform initialized successfully."); } else { LOGGER.log(Level.INFO, "Platform is already initialized."); } LOGGER.log(Level.INFO, "Starting node..."); platformAPI.startNode(); LOGGER.log(Level.INFO, "Node started successfully."); final long after = System.currentTimeMillis(); LOGGER.log(Level.INFO, "Initialization of Bonita Engine done! ( took " + (after - before) + "ms)"); } finally { deletePlatformSession(platformSessionService, sessionAccessor, sessionId); } }
public void unloadEngine() throws Exception { LOGGER.log(Level.INFO, "Stopping Bonita Engine..."); // create a session to call the engine final SessionAccessor sessionAccessor = getSessionAccessor(); PlatformSessionService platformSessionService = getPlatformSessionService(); final long sessionId = createPlatformSession(platformSessionService, sessionAccessor); final PlatformAPI platformAPI = getPlatformAPI(); try { if (!platformAPI.isNodeStarted()) { LOGGER.log(Level.INFO, "Node is not started, nothing to do."); return; } LOGGER.log(Level.INFO, "Stopping node..."); platformAPI.stopNode(); } catch (final Throwable e) { LOGGER.log(Level.SEVERE, "Issue while stopping the platform", e); } finally { deletePlatformSession(platformSessionService, sessionAccessor, sessionId); // after that the engine is unloaded getServiceAccessorFactory().destroyAccessors(); LOGGER.log(Level.INFO, "Bonita Engine stopped!"); } }
protected void initPlatformAndTenant() throws Exception { final PlatformLoginAPI platformLoginAPI = getPlatformLoginAPI(); final PlatformSession session = platformLoginAPI.login("platformAdmin", "platform"); final PlatformAPI platformAPI = getPlatformAPI(session); if (!platformAPI.isPlatformInitialized()) { LOGGER.info("========= INIT PLATFORM ======="); createPlatformAndTenant(platformAPI); } else { LOGGER.info("========= REUSING EXISTING PLATFORM ======="); platformAPI.startNode(); } platformLoginAPI.logout(session); }
public void initializeEngine() throws Exception { LOGGER.log(Level.INFO, "Initializing Bonita Engine..."); final long before = System.currentTimeMillis(); // create a session to call the engine final PlatformSessionService platformSessionService = getPlatformSessionService(); final SessionAccessor sessionAccessor = getSessionAccessor(); final long sessionId = createPlatformSession(platformSessionService, sessionAccessor); final PlatformAPI platformAPI = getPlatformAPI(); try { if (!platformAPI.isPlatformCreated()) { throw new PlatformNotFoundException("Can't start or stop platform if it is not created."); } // initialization of the platform if (!platformAPI.isPlatformInitialized()) { LOGGER.log(Level.INFO, "First run on this platform, initializing it..."); platformAPI.initializePlatform(); LOGGER.log(Level.INFO, "Platform initialized successfully."); } else { LOGGER.log(Level.INFO, "Platform is already initialized."); } LOGGER.log(Level.INFO, "Starting node..."); platformAPI.startNode(); LOGGER.log(Level.INFO, "Node started successfully."); final long after = System.currentTimeMillis(); LOGGER.log(Level.INFO, "Initialization of Bonita Engine done! ( took " + (after - before) + "ms)"); } finally { deletePlatformSession(platformSessionService, sessionAccessor, sessionId); } }
public void unloadEngine() throws Exception { LOGGER.log(Level.INFO, "Stopping Bonita Engine..."); // create a session to call the engine final SessionAccessor sessionAccessor = getSessionAccessor(); PlatformSessionService platformSessionService = getPlatformSessionService(); final long sessionId = createPlatformSession(platformSessionService, sessionAccessor); final PlatformAPI platformAPI = getPlatformAPI(); try { if (!platformAPI.isNodeStarted()) { LOGGER.log(Level.INFO, "Node is not started, nothing to do."); return; } LOGGER.log(Level.INFO, "Stopping node..."); platformAPI.stopNode(); } catch (final Throwable e) { LOGGER.log(Level.SEVERE, "Issue while stopping the platform", e); } finally { deletePlatformSession(platformSessionService, sessionAccessor, sessionId); // after that the engine is unloaded getServiceAccessorFactory().destroyAccessors(); LOGGER.log(Level.INFO, "Bonita Engine stopped!"); } }
public void initializeAndStartPlatformWithDefaultTenant(final PlatformAPI platformAPI, final boolean deployCommands) throws BonitaException { platformAPI.initializePlatform(); platformAPI.startNode(); if (deployCommands) { deployCommandsOnDefaultTenant(); } }