0 Replies Latest reply on Aug 7, 2007 9:48 PM by Yenan Zhou

    Clean way to attach debugger for drools

    Yenan Zhou Newbie

      I'm trying to debug drools by attaching the debugger.

      This is my code:

      
      @Name("workingMemoryControl")
      @Scope(ScopeType.EVENT)
      public class WorkingMemoryControl {
      
       @In
       WorkingMemory workingMemory;
      
       @Observer("org.jboss.seam.postCreate.workingMemory")
       public void attachDebugger() {
       workingMemory.addEventListener(new DebugWorkingMemoryEventListener());
       List listeners = workingMemory.getWorkingMemoryEventListeners();
       for (Object listener: listeners) {
       System.out.println("[listener] Added in working memeory:" + listener);
       }
       }
      }
      


      And this is the security method:
       @Restrict("#{s:hasPermission('register','register',user)}")
       public String secured() {//some code }
      


      The problem is the postCreate event is always after authorization, which is not what I want.

      09:40:23,014 INFO [STDOUT] Drools rule triggered!
      09:40:23,027 INFO [STDOUT] [listener] Added in working memeory:org.drools.event.DebugWorkingMemoryEventListener@7c9c8a7b
      


      Can anyone provide some suggestions?
      Thanks in advance.