public StatefulKnowledgeSession loadKieSession(int id, KieBase kbase, KieSessionConfiguration configuration, Environment environment) { if ( configuration == null ) { configuration = SessionConfiguration.newInstance(); } if ( environment == null ) { throw new IllegalArgumentException( "Environment cannot be null" ); } ExecutableRunner runner = (ExecutableRunner) buildCommandService( new Long( id), kbase, mergeConfig( configuration ), environment ); return new CommandBasedStatefulKnowledgeSession( runner ); }
public StatefulKnowledgeSession newKieSession(KieBase kbase, KieSessionConfiguration configuration, Environment environment) { if ( configuration == null ) { configuration = SessionConfiguration.newInstance(); } if ( environment == null ) { throw new IllegalArgumentException( "Environment cannot be null" ); } ExecutableRunner runner = (ExecutableRunner) buildCommandService( kbase, mergeConfig( configuration ), environment ); return new CommandBasedStatefulKnowledgeSession( runner ); }
public StatefulKnowledgeSession loadKieSession(Long id, KieBase kbase, KieSessionConfiguration configuration, Environment environment) { if ( configuration == null ) { configuration = SessionConfiguration.newInstance(); } if ( environment == null ) { throw new IllegalArgumentException( "Environment cannot be null" ); } ExecutableRunner runner = (ExecutableRunner) buildCommandService( id, kbase, mergeConfig( configuration ), environment ); return new CommandBasedStatefulKnowledgeSession( runner ); }
public StatefulKnowledgeSession loadKieSession(int id, KieBase kbase, KieSessionConfiguration configuration, Environment environment) { if ( configuration == null ) { configuration = SessionConfiguration.newInstance(); } if ( environment == null ) { throw new IllegalArgumentException( "Environment cannot be null" ); } CommandExecutor commandService = buildCommandService( new Long(id), kbase, mergeConfig( configuration ), environment ); if (commandService instanceof SingleSessionCommandService) { ((PersistableRunner) commandService).addInterceptor(new ManualPersistInterceptor((SingleSessionCommandService) commandService)); try { Class<?> clazz = Class.forName("org.jbpm.persistence.ManualPersistProcessInterceptor"); Constructor<?> c = clazz.getConstructor(PersistableRunner.class); ChainableRunner interceptor = (ChainableRunner) c.newInstance(commandService); ((PersistableRunner) commandService).addInterceptor(interceptor); } catch (ClassNotFoundException e) { //Expected of non-jbpm based projects } catch (Exception e) { //something unexpected happened throw new RuntimeException("Something wrong initializing manual process persistor interceptor", e); } } return new CommandBasedStatefulKnowledgeSession( (ExecutableRunner) commandService ); }
public StatefulKnowledgeSession newKieSession(KieBase kbase, KieSessionConfiguration configuration, Environment environment) { if ( configuration == null ) { configuration = SessionConfiguration.newInstance(); } if ( environment == null ) { throw new IllegalArgumentException( "Environment cannot be null" ); } CommandExecutor commandService = buildCommandService( kbase, mergeConfig( configuration ), environment ); if (commandService instanceof SingleSessionCommandService) { ((PersistableRunner) commandService).addInterceptor(new ManualPersistInterceptor((SingleSessionCommandService) commandService)); try { Class<?> clazz = Class.forName("org.jbpm.persistence.ManualPersistProcessInterceptor"); Constructor<?> c = clazz.getConstructor(SingleSessionCommandService.class); ChainableRunner interceptor = (ChainableRunner) c.newInstance( commandService ); ((PersistableRunner) commandService).addInterceptor((ChainableRunner) interceptor ); } catch (ClassNotFoundException e) { //Expected of non-jbpm based projects } catch (Exception e) { //something unexpected happened throw new RuntimeException("Something wrong initializing manual process persistor interceptor", e); } } return new CommandBasedStatefulKnowledgeSession( (ExecutableRunner) commandService ); }
public StatefulKnowledgeSession loadKieSession(Long id, KieBase kbase, KieSessionConfiguration configuration, Environment environment) { if ( configuration == null ) { configuration = SessionConfiguration.newInstance(); } if ( environment == null ) { throw new IllegalArgumentException( "Environment cannot be null" ); } CommandExecutor commandService = buildCommandService( id, kbase, mergeConfig( configuration ), environment ); if (commandService instanceof SingleSessionCommandService) { ((PersistableRunner) commandService).addInterceptor(new ManualPersistInterceptor((SingleSessionCommandService) commandService)); try { Class<?> clazz = Class.forName("org.jbpm.persistence.ManualPersistProcessInterceptor"); Constructor<?> c = clazz.getConstructor(SingleSessionCommandService.class); ChainableRunner interceptor = (ChainableRunner) c.newInstance(commandService); ((PersistableRunner) commandService).addInterceptor(interceptor); } catch (ClassNotFoundException e) { //Expected of non-jbpm based projects } catch (Exception e) { //something unexpected happened throw new RuntimeException("Something wrong initializing manual process persistor interceptor", e); } } return new CommandBasedStatefulKnowledgeSession( (ExecutableRunner) commandService ); }