1

I have a function(MonitorLOg) that contains an infinite loop; it's necessary because I want to monitor a file and do an action when there is a modification. However, myRules in Drools doesn't want to start("WS is updated" don't appear). Any suggestion?

rule "SmartWssec"
when
PolicyUpdateWssec(changelog == true)
then
System.out.println("WS is updated");
end

//////////////////////////////////////////////////////

PolicyUpdateWssec LogModSecurity = new PolicyUpdateWssec();
LogModSecurity.MonitorLog("D:\\Mod");
kSession.insert(LogModSecurity);
kSession.fireAllRules();
LogModSecurity 

///////////////////////////

        while(true){
            WatchKey key;
            try {

            // wait for a key to be available

                key = watcher.take();
            } catch (InterruptedException ex) {
                return;
            }

            for (WatchEvent<?> event : key.pollEvents()) {
                // get event type
                WatchEvent.Kind<?> kind = event.kind();

                // get file name
                @SuppressWarnings("unchecked")
                WatchEvent<Path> ev = (WatchEvent<Path>) event;
                Path fileName = ev.context();

                System.out.println(kind.name() + ": " + fileName);

                if (kind == ENTRY_MODIFY ) {
                    changelog=true;
                    setChangelog(changelog);
                    System.out.println("WS-Policy is being Update.......");
Ahmed
  • 41
  • 4

0 Answers0