public Context getContext() { return next.getContext(); }
protected <T> T executeNext(Command<T> command) { return next.execute(command); }
public <T> T execute(Command<T> command) { return (T) this.commandService.execute( command ); }
public KnowledgeSessionConfiguration getSessionConfiguration() { return ((KnowledgeCommandContext) commandService.getContext()).getStatefulKnowledgesession().getSessionConfiguration(); }
/** * @deprecated Use {@link #registerChannel(String, Channel)} instead */ @Deprecated public void registerExitPoint(String name, ExitPoint exitPoint) { this.commandService.execute( new RegisterExitPointCommand( name, exitPoint ) ); }
protected void processEventListeners(StatefulKnowledgeSession ksession, Map<String, Object> variables, SessionTemplate template) { List<String> eventListeners = template.getEventListeners(); if (eventListeners != null) { for (String eventListenerDef : eventListeners) { try { EventListener listener = (EventListener) eval(eventListenerDef, variables); if (listener instanceof WorkingMemoryLogger) { // it is enough to create instance of it as it will register all the listeners internally } else if (listener instanceof ProcessEventListener) { ksession.addEventListener((ProcessEventListener) listener); } else if (listener instanceof AgendaEventListener) { ksession.addEventListener((AgendaEventListener) listener); } else if (listener instanceof WorkingMemoryEventListener) { ksession.addEventListener((WorkingMemoryEventListener) listener); } else if (listener instanceof org.drools.event.AgendaEventListener) { ((StatefulKnowledgeSessionImpl) ((KnowledgeCommandContext) ((CommandBasedStatefulKnowledgeSession) ksession) .getCommandService().getContext()).getStatefulKnowledgesession() ) .session.addEventListener((org.drools.event.AgendaEventListener)listener); } } catch (Exception e) { logger.error("Addition of event listener " + eventListenerDef + " failed due to " + e.getMessage(), e); } } } }
public void update(FactHandle handle, Object object) { commandService.execute( new UpdateCommand( handle, object ) ); }
public WorkingMemoryLogger(final KnowledgeRuntimeEventManager session) { if (session instanceof StatefulKnowledgeSessionImpl) { WorkingMemoryEventManager eventManager = ((StatefulKnowledgeSessionImpl) session).session; eventManager.addEventListener( (WorkingMemoryEventListener) this ); eventManager.addEventListener( (AgendaEventListener) this ); eventManager.addEventListener( (RuleBaseEventListener) this ); InternalProcessRuntime processRuntime = ((StatefulKnowledgeSessionImpl) session).session.getProcessRuntime(); if (processRuntime != null) { processRuntime.addEventListener( (ProcessEventListener) this ); } } else if (session instanceof StatelessKnowledgeSessionImpl) { ((StatelessKnowledgeSessionImpl) session).workingMemoryEventSupport.addEventListener( this ); ((StatelessKnowledgeSessionImpl) session).agendaEventSupport.addEventListener( this ); ((StatelessKnowledgeSessionImpl) session).processEventSupport.addEventListener( this ); ((StatelessKnowledgeSessionImpl) session).getRuleBase().addEventListener( this ); } else if (session instanceof CommandBasedStatefulKnowledgeSession) { ReteooWorkingMemoryInterface eventManager = ((StatefulKnowledgeSessionImpl)((KnowledgeCommandContext)((CommandBasedStatefulKnowledgeSession) session).getCommandService().getContext()).getStatefulKnowledgesession()).session; eventManager.addEventListener( (WorkingMemoryEventListener) this ); eventManager.addEventListener( (AgendaEventListener) this ); InternalProcessRuntime processRuntime = eventManager.getProcessRuntime(); eventManager.addEventListener( (RuleBaseEventListener) this ); if (processRuntime != null) { processRuntime.addEventListener( (ProcessEventListener) this ); } } else { throw new IllegalArgumentException("Not supported session in logger: " + session.getClass()); } }
public void setGlobal(String identifier, Object object) { this.commandService.execute( new SetGlobalCommand( identifier, object ) ); }
ReteooWorkingMemoryInterface rwmi = ((StatefulKnowledgeSessionImpl)((KnowledgeCommandContext)cbsks.getCommandService().getContext()).getStatefulKnowledgesession()).session; if (el instanceof WorkingMemoryEventListener) { rwmi.addEventListener((WorkingMemoryEventListener)el);
public void signalEvent(String type, Object event) { SignalEventCommand command = new SignalEventCommand( type, event ); commandService.execute( command ); }
/** * @deprecated Use {@link #unregisterChannel(String)} instead. */ @Deprecated public void unregisterExitPoint(String name) { this.commandService.execute( new UnregisterExitPointCommand( name ) ); }
public void registerChannel(String name, Channel channel) { this.commandService.execute( new RegisterChannelCommand( name, channel ) ); }
public void signalEvent(String type, Object event, long processInstanceId) { SignalEventCommand command = new SignalEventCommand( processInstanceId, type, event ); commandService.execute( command ); }
public QueryResults getQueryResults(String query, Object... arguments) { QueryCommand cmd = new QueryCommand( (String)null, query, arguments ); return this.commandService.execute( cmd ); }
@SuppressWarnings("unchecked") public Map<String, Channel> getChannels() { return (Map<String, Channel>) this.commandService.execute( new GetChannelsCommand() ); }
@SuppressWarnings("unchecked") public <T extends SessionClock> T getSessionClock() { return (T) this.commandService.execute( new GetSessionClockCommand() ); }
public int fireAllRules(AgendaFilter agendaFilter, int max) { return this.commandService.execute( new FireAllRulesCommand( agendaFilter, max ) ); }
public Collection<WorkingMemoryEventListener> getWorkingMemoryEventListeners() { return commandService.execute( new GetWorkingMemoryEventListenersCommand() ); }
public void addEventListener(ProcessEventListener listener) { commandService.execute( new AddEventListenerCommand( listener ) ); }