if (session instanceof StatefulKnowledgeSessionImpl) {
WorkingMemoryEventManager eventManager = ((StatefulKnowledgeSessionImpl) session).session;
eventManager.addEventListener( (WorkingMemoryEventListener) this );
eventManager.addEventListener( (AgendaEventListener) this );
eventManager.addEventListener( (RuleFlowEventListener) this );
eventManager.addEventListener( (RuleBaseEventListener) this );
} else if (session instanceof StatelessKnowledgeSessionImpl) {
((StatelessKnowledgeSessionImpl) session).workingMemoryEventSupport.addEventListener( this );
((StatelessKnowledgeSessionImpl) session).agendaEventSupport.addEventListener( this );
((StatelessKnowledgeSessionImpl) session).ruleFlowEventSupport.addEventListener( this );
((StatelessKnowledgeSessionImpl) session).getRuleBase().addEventListener( this );