<div dir="ltr">hi,<div>im new to drools..im trying to create a project as follows. i have a class called Monitor  which monitors a folder and creates two lists called fileOld( which is the list of filenames in that folder at time t1)  and fileNew(which is the list of filenames in that folder at time t2). i have another class called FileData which contains two members fileOld and fileNew (list of strings) with getters,setters and constructor. fileOld and fileNew from Monitor Class are passed to FileData class.</div>
<div><br></div><div>now i have to compare these two lists in a rule file and if they are not equal i have to print the lists of files added/ deleted. how to do this in drools.</div><div><br></div><div>here is my rule file:</div>
<div><br></div><div><div>rule &quot;files are equal&quot;</div><div> </div><div>    when </div><div>        FileData(fileOld == fileNew)        </div><div>        </div><div>    then</div><div>       System.out.println(&quot;files are equal&quot;);</div>
<div>       </div><div><br></div><div>end</div><div><br></div><div>rule &quot;files not equal&quot;</div><div><br></div><div>  when</div><div>        not FileData(fileOld == fileNew)</div><div>    then</div><div>       System.out.println(&quot;files are not equal&quot;);</div>
<div>       difference(FileData.getFileOld(),FileData.getFileNew()); </div><div><br></div><div>end</div><div><br></div><div><br></div><div>function void difference(List fileOld, List fileNew)</div><div>{</div><div>      </div>
<div><br></div><div><span class="" style="white-space:pre">        </span>   ArrayList&lt;String&gt; add = new ArrayList&lt;String&gt;(fileNew);</div><div><span class="" style="white-space:pre">        </span>   add.removeAll(fileOld);</div>
<div><span class="" style="white-space:pre">        </span>   System.out.println(&quot;files Added: &quot; + add);</div><div><br></div><div><span class="" style="white-space:pre">        </span>   ArrayList&lt;String&gt; remove = new ArrayList&lt;String&gt;(fileOld);</div>
<div><span class="" style="white-space:pre">        </span>   remove.removeAll(fileNew);</div><div><span class="" style="white-space:pre">        </span>   System.out.println(&quot;files Removed: &quot; + remove);</div><div>}   </div><div>
       </div></div><div><br></div><div>but this displays the following error...</div><div><br></div><div><div>Rule Compilation error : [Rule name=&#39;files not equal&#39;]</div><div>Cannot make a static reference to the non-static method getFileOld() from the type FileData</div>
<div>Cannot make a static reference to the non-static method getFileNew() from the type FileData</div></div><div><br></div><div><br></div><div><br></div><div>what can be done??</div></div>