InternalProcessRuntime processRuntime = ((StatefulKnowledgeSessionImpl) session).session.getProcessRuntime();
if (processRuntime != null) {
processRuntime.addEventListener( (ProcessEventListener) this );
}
} else if (session instanceof StatelessKnowledgeSessionImpl) {
StatelessKnowledgeSessionImpl statelessSession = ((StatelessKnowledgeSessionImpl) session);
statelessSession.addWorkingMemoryEventListener( this );
statelessSession.addAgendaEventListener( this );
statelessSession.addEventListener( this );
statelessSession.getRuleBase().addEventListener( this );
} else if (session instanceof CommandBasedStatefulKnowledgeSession) {
ReteooWorkingMemoryInterface eventManager =
((StatefulKnowledgeSessionImpl)((KnowledgeCommandContext)((CommandBasedStatefulKnowledgeSession) session).getCommandService().getContext()).getKieSession()).session;
eventManager.addEventListener( (WorkingMemoryEventListener) this );
eventManager.addEventListener( (AgendaEventListener) this );