protected Object invokeAPIInTransaction(final Object[] parametersValues, final Object apiImpl, final Method method, final Session session, final String apiInterfaceName) throws Throwable { if (session == null) { throw new BonitaRuntimeException("session is null"); } final UserTransactionService userTransactionService = selectUserTransactionService(session, getSessionType(session)); final Callable<Object> callable = new Callable<Object>() { @Override public Object call() throws Exception { try { checkMethodAccessibility(apiImpl, apiInterfaceName, method, session, /* Already in a transaction */true); return invokeAPI(method, apiImpl, parametersValues); } catch (final Throwable cause) { throw new ServerAPIRuntimeException(cause); } } }; return userTransactionService.executeInTransaction(callable); }
protected Object invokeAPIInTransaction(final Object[] parametersValues, final Object apiImpl, final Method method, final Session session, final String apiInterfaceName) throws Throwable { if (session == null) { throw new BonitaRuntimeException("session is null"); } final UserTransactionService userTransactionService = selectUserTransactionService(session, getSessionType(session)); final Callable<Object> callable = new Callable<Object>() { @Override public Object call() throws Exception { try { checkMethodAccessibility(apiImpl, apiInterfaceName, method, session, /* Already in a transaction */true); return invokeAPI(method, apiImpl, parametersValues); } catch (final Throwable cause) { throw new ServerAPIRuntimeException(cause); } } }; return userTransactionService.executeInTransaction(callable); }
SessionAccessor beforeInvokeMethod(final Session session, final String apiInterfaceName) throws BonitaHomeNotSetException, InstantiationException, IllegalAccessException, ClassNotFoundException, BonitaHomeConfigurationException, IOException, NoSuchMethodException, InvocationTargetException, SBonitaException { SessionAccessor sessionAccessor = null; final ServiceAccessorFactory serviceAccessorFactory = getServiceAccessorFactoryInstance(); final PlatformServiceAccessor platformServiceAccessor = serviceAccessorFactory.createPlatformServiceAccessor(); ClassLoader serverClassLoader = null; if (session != null) { final SessionType sessionType = getSessionType(session); sessionAccessor = serviceAccessorFactory.createSessionAccessor(); switch (sessionType) { case PLATFORM: serverClassLoader = beforeInvokeMethodForPlatformSession(sessionAccessor, platformServiceAccessor, session); break; case API: serverClassLoader = beforeInvokeMethodForAPISession(sessionAccessor, serviceAccessorFactory, platformServiceAccessor, session); break; default: throw new InvalidSessionException("Unknown session type: " + session.getClass().getName()); } } else if (accessResolver.needSession(apiInterfaceName)) { throw new InvalidSessionException("Session is null!"); } if (serverClassLoader != null) { Thread.currentThread().setContextClassLoader(serverClassLoader); } return sessionAccessor; }
SessionAccessor beforeInvokeMethod(final Session session, final String apiInterfaceName) throws BonitaHomeNotSetException, InstantiationException, IllegalAccessException, ClassNotFoundException, BonitaHomeConfigurationException, IOException, NoSuchMethodException, InvocationTargetException, SBonitaException { SessionAccessor sessionAccessor = null; final ServiceAccessorFactory serviceAccessorFactory = getServiceAccessorFactoryInstance(); final PlatformServiceAccessor platformServiceAccessor = serviceAccessorFactory.createPlatformServiceAccessor(); ClassLoader serverClassLoader = null; if (session != null) { final SessionType sessionType = getSessionType(session); sessionAccessor = serviceAccessorFactory.createSessionAccessor(); switch (sessionType) { case PLATFORM: serverClassLoader = beforeInvokeMethodForPlatformSession(sessionAccessor, platformServiceAccessor, session); break; case API: serverClassLoader = beforeInvokeMethodForAPISession(sessionAccessor, serviceAccessorFactory, platformServiceAccessor, session); break; default: throw new InvalidSessionException("Unknown session type: " + session.getClass().getName()); } } else if (accessResolver.needSession(apiInterfaceName)) { throw new InvalidSessionException("Session is null!"); } if (serverClassLoader != null) { Thread.currentThread().setContextClassLoader(serverClassLoader); } return sessionAccessor; }
paused = (Boolean) invokeAPI(method, apiImpl); } else { final UserTransactionService userTransactionService = selectUserTransactionService(session, getSessionType(session));
paused = (Boolean) invokeAPI(method, apiImpl); } else { final UserTransactionService userTransactionService = selectUserTransactionService(session, getSessionType(session));