<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hello,<br>
<br>
I am using Drools engine 4.0.7 and Eclipse 3.3 drools plugin.<br>
<br>
I have a very basic/dumb problem but I do not understand where my error
is :<br>
<br>
I have 2 rules <br>
---------------------------------<br>
<blockquote>package poc<br>
  <br>
import poc.FlashFact;<br>
  <br>
  <b>rule "HP one"</b><br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FlashFact( homepage == "one");<br>
&nbsp;&nbsp;&nbsp; then<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println("*** HP one");<br>
end<br>
  <br>
  <b>rule "HP commons"</b><br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FlashFact();<br>
&nbsp;&nbsp;&nbsp; then<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println("*** HP commons ");<br>
end<br>
</blockquote>
----------------------------------<br>
<br>
I insert a FlashFact which homepage is set with "one" value.<br>
<br>
In my understanding, both rules "HP one" and "HP commons" should be
fired. Instead, only "HP commons" is launched. I have compared with the
Drools State example (which works fine), but I do not notice nothing.<br>
<br>
Thanks for your help.<br>
<br>
The code of the FlashFact class<br>
---------------------------------<br>
<blockquote>package poc;<br>
  <br>
public class FlashFact {<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; public FlashFact() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this(null);<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; public FlashFact(String homepage) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this.setHomepage(homepage);<br>
&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; private String homepage;<br>
  <br>
&nbsp;&nbsp;&nbsp; /**<br>
&nbsp;&nbsp;&nbsp; &nbsp;* @return the homepage<br>
&nbsp;&nbsp;&nbsp; &nbsp;*/<br>
&nbsp;&nbsp;&nbsp; public final String getHomepage() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return this.homepage;<br>
&nbsp;&nbsp;&nbsp; }<br>
  <br>
&nbsp;&nbsp;&nbsp; /**<br>
&nbsp;&nbsp;&nbsp; &nbsp;* @param homepage the homepage to set<br>
&nbsp;&nbsp;&nbsp; &nbsp;*/<br>
&nbsp;&nbsp;&nbsp; public final void setHomepage(String homepage) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this.homepage = homepage;<br>
&nbsp;&nbsp;&nbsp; }<br>
  <br>
}<br>
</blockquote>
---------------------------------<br>
<br>
The code of the launcher<br>
---------------------------------<br>
package poc;<br>
<br>
import java.io.InputStreamReader;<br>
<br>
import org.drools.RuleBase;<br>
import org.drools.RuleBaseFactory;<br>
import org.drools.StatefulSession;<br>
import org.drools.audit.WorkingMemoryFileLogger;<br>
import org.drools.compiler.PackageBuilder;<br>
<br>
public class FlashUndeployedRulesMain {<br>
<br>
&nbsp;&nbsp;&nbsp; public static void main(String[] args) throws Exception {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; StatefulSession session = null;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; WorkingMemoryFileLogger logger = null;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PackageBuilder builder = new PackageBuilder();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; builder.addPackageFromDrl(new InputStreamReader(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FlashUndeployedRulesMain.class.getClassLoader()<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; .getResourceAsStream(RULE)));<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; final RuleBase ruleBase = RuleBaseFactory.newRuleBase();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ruleBase.addPackage(builder.getPackage());<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; session = ruleBase.newStatefulSession();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger = new WorkingMemoryFileLogger(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; session);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.setFileName("log/flash");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // inserting facts<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FlashFact HPFrance = new FlashFact("one"); <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; session.insert(HPFrance);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; session.fireAllRules();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } finally {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(session != null) {session.dispose();}<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(logger != null) {logger.writeToDisk();}<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; private static final String RULE = "poc/Flash.drl";<br>
---------------------------------<br>
<br>
<br>
</body>
</html>