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 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); } }