workingMemory.addEventListener( (RuleBaseEventListener) this );
}
public WorkingMemoryLogger(final KnowledgeRuntimeEventManager session) {
if (session instanceof StatefulKnowledgeSessionImpl) {
StatefulKnowledgeSessionImpl statefulSession = ((StatefulKnowledgeSessionImpl) session);
isPhreak = ((ReteooRuleBase)statefulSession.getRuleBase()).getConfig().isPhreakEnabled();
WorkingMemoryEventManager eventManager = statefulSession.session;
eventManager.addEventListener( (WorkingMemoryEventListener) this );
eventManager.addEventListener( (AgendaEventListener) this );
eventManager.addEventListener( (RuleBaseEventListener) this );
InternalProcessRuntime processRuntime = ((StatefulKnowledgeSessionImpl) session).session.getProcessRuntime();
if (processRuntime != null) {
processRuntime.addEventListener( this );
}
} else if (session instanceof StatelessKnowledgeSessionImpl) {
StatelessKnowledgeSessionImpl statelessSession = ((StatelessKnowledgeSessionImpl) session);
isPhreak = ((ReteooRuleBase)statelessSession.getRuleBase()).getConfig().isPhreakEnabled();
statelessSession.addWorkingMemoryEventListener( this );
statelessSession.addAgendaEventListener( this );
statelessSession.addEventListener( this );
statelessSession.getRuleBase().addEventListener( this );
} else if (session instanceof CommandBasedStatefulKnowledgeSession) {
StatefulKnowledgeSessionImpl statefulSession =
((StatefulKnowledgeSessionImpl)((KnowledgeCommandContext)((CommandBasedStatefulKnowledgeSession) session).getCommandService().getContext()).getKieSession());
isPhreak = ((ReteooRuleBase)statefulSession.getRuleBase()).getConfig().isPhreakEnabled();
ReteooWorkingMemoryInterface eventManager = statefulSession.session;
eventManager.addEventListener( (WorkingMemoryEventListener) this );
eventManager.addEventListener( (AgendaEventListener) this );
InternalProcessRuntime processRuntime = eventManager.getProcessRuntime();
eventManager.addEventListener( (RuleBaseEventListener) this );