Re: [rules-users] Hot Deployment

2008-04-04 Thread Paul Browne

Brian,

I'm guessing that you mean the RuleAgent Class. The Javadoc on this 
class gives more info.


Code sample (assuming that you have the BRMS setup as per the doc). 
You'll need to change to whatever settings are appropriate for your BRMS.


   Properties prop = new Properties();
   prop.setProperty("url",uri);
   prop.setProperty("newInstance", "true");
   prop.setProperty("localCacheDir", ".");
   prop.setProperty("poll", "300"); // poll every 300 seconds 
for hot deployment.
  
   //Get a new RuleBase using these properties

   RuleAgent agent = RuleAgent.newRuleAgent(prop);
   RuleBase rb = agent.getRuleBase();

Then use the RuleBase as normal

Paul

Brian Trezise wrote:


In the What's New? Section of the Drools 4.0 documentation there is a 
reference in 1.1.2 to a "Rules Engine Agent for hot deployment and 
BRMS integration".  This would be ideal for the application I am 
currently developing.  However, this is the only mention of this agent 
anywhere in the documentation.  Does anybody know anything about this, 
how to use it, any documentation about it?


Thanks,

 


*___
Brian Trezise
Staff Software Engineer
IntelliData, Inc
*3173 s. uravan way
aurora, colorado 80013
T: 720.524.4864
[EMAIL PROTECTED]

 




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
  


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Hot Deployment

2008-04-04 Thread Brian Trezise
In the What's New? Section of the Drools 4.0 documentation there is a
reference in 1.1.2 to a "Rules Engine Agent for hot deployment and BRMS
integration".  This would be ideal for the application I am currently
developing.  However, this is the only mention of this agent anywhere in the
documentation.  Does anybody know anything about this, how to use it, any
documentation about it?

Thanks,

 

___
Brian Trezise
Staff Software Engineer
IntelliData, Inc
3173 s. uravan way
aurora, colorado 80013
T: 720.524.4864
[EMAIL PROTECTED]

 

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Re: What the.... is happening?

2008-04-04 Thread Massi Gmail

Sorry,

U r right.

I did not noticed the last posts.

sorry again.

Looking forward for 4.0.7

ah any news about the BRMS\IDE integration In case I would like to 
develop it
could u advice me which APIs should I use in order to generate a .pkg file from
Eclipse generated assets?

Bye!

Massi
  - Original Message - 
  From: Knapp, Barry 
  Newsgroups: gmane.comp.java.drools.user
  To: Rules Users List 
  Sent: Friday, April 04, 2008 12:06 PM
  Subject: RE: What the is happening?


  I think this has already been answered. a few times.

   

   

  "Both 4.0.5 and 4.0.6 where bad releases, poor QA, so we rolled back to 
4.0.4."

   

  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of mmquelo massi
  Sent: Friday, April 04, 2008 5:52 AM
  To: Rules Users List; [EMAIL PROTECTED]
  Subject: [rules-users] What the is happening?

   

   

  Sorry guys,

   

  but I can't understand why u released 4.0.5 a couple of weeks ago, then u 
suddenly released

  a brand new "4.0.6" release few days ago (which I promptly downloaded) and 
now u put back again

  the "4.0.4"???

   

  Why???

   

  What is the stable one

   

  Does the svn is working?? Should we build from repository or shouldn't we?

   

  Looking forward to hearing any news on this matter

   

  Thank you anyway.

   

  Bye.

   

  Massimiliano



--


  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Does anyone know the answer to this ?

2008-04-04 Thread Saleem Lakhani
Hi,

 

Can I keep two instances of the same class in working memory? I guess
'Yes'. 

 

If yes then how do I access each instance separately in DSL? 

 

I am doing this:workingMemory.assertObject(personA),
workingMemory.assertObject(personB);

 

e.g; Person exists = personA:Person()

 

 

Thanks

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] (no subject)

2008-04-04 Thread Jonathan Guéhenneux

hi,

I have no problem for this kind of rule :

rule "Primitive support"
when
$c : Cheese( price < 10 )
then
$c.setPrice( 10 )
end 

but I would like to know what is the decision table for this small rule

rule "Primitive support"
when
$c : Cheese( $price : price )
then
$c.setPrice( $price * 2 )
end

I've tried a lot of syntax and I read the section abour the decision table in 
the manual but ididnt find anything.

_
Recevez tous vos e-mails sur un seul compte ! Créez une adresse Hotmail !
http://www.windowslive.fr/hotmail/default.asp___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Identify attributes with decision tables

2008-04-04 Thread Jonathan Guéhenneux

hi,

I have no problem for this kind of rule :

rule "Primitive support"
when
$c : Cheese( price < 10 )
then
$c.setPrice( 10 )
end 

but I would like to know what is the decision table for this small rule

rule "Primitive support"
when
$c : Cheese( $price : price )
then
$c.setPrice( $price * 2 )
end

I've tried a lot of syntax and I read the section abour the decision table in 
the manual but ididnt find anything.

_
Créez votre disque dur virtuel Windows Live SkyDrive, 5Go de stockage gratuit !
http://www.windowslive.fr/skydrive/___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] RCP and Drools

2008-04-04 Thread J Michael Dean
I have continued to try to isolate the problem that I have previously  
described, where my RCP application that calls Drools runs properly,  
but am unable to Unit test.  Can reproduce the problem simply and am  
hoping someone can lend some insight.


I started by creating a simple Drools project that had a JUnit 4 test  
in it;  this runs.  It contains two java files and a DRL file. (Shown  
at very bottom of this post)


I then created a Hello World RCP application from the Eclipse  
templates.  I copied the Drools project files (2 Java files and 1 DRL  
file) into the same package as my RCP stuff.  When I run the test, I  
get the following error, which is exactly the same error I have been  
getting with my much more complicated project:


java.lang.NullPointerException
	at  
org.mvel.optimizers.OptimizerFactory.(OptimizerFactory.java:43)
	at  
org.drools.rule.builder.dialect.mvel.MVELDialect.init(MVELDialect.java: 
142)

at org.drools.compiler.DialectRegistry.initAll(DialectRegistry.java:49)
at org.drools.compiler.PackageBuilder.(PackageBuilder.java:146)
at org.drools.compiler.PackageBuilder.(PackageBuilder.java:108)
at rcp_with_drool.mikeTest..setUp(mikeTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at  
sun 
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 
39)
	at  
sun 
.reflect 
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 
25)

at java.lang.reflect.Method.invoke(Method.java:585)
	at  
org 
.junit 
.internal 
.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
	at  
org 
.junit 
.internal 
.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
	at  
org 
.junit 
.internal 
.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
	at  
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
	at  
org 
.eclipse 
.jdt 
.internal 
.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at  
org 
.eclipse 
.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at  
org 
.eclipse 
.jdt 
.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 
460)
	at  
org 
.eclipse 
.jdt 
.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 
673)
	at  
org 
.eclipse 
.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java: 
386)
	at  
org 
.eclipse 
.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java: 
196)
[MVEL] Notice: Possible incorrect version of ASM present (3.0  
required).  Disabling JIT compiler.  Reflective Optimizer will be used.


I then removed all the source files relating to the RCP itself, and  
the error persists.  If I now remove the plugin dependencies from this  
project from the build path, the problem goes away and the tests run.   
If I add the plugin dependencies back into the project, the error  
resumes.  Finally, if I make my ORIGINAL Drools project depend on this  
second one with the plugin dependencies, the test fails there too.  If  
I remove the plugin dependencies, the tests run.


The plugin dependencies are:
org.eclipse.ui
org.eclipse.swt
CodeProSWTFragment
org.eclipse.swt.carbon.macosx
org.eclipse.jface
org.eclipse.core.commands
org.eclipse.ui.workbench
org.eclipse.core.runtime
org.eclipse.osgi
org.eclipse.equinox.common
org.eclipse.core.jobs
runtime_registry_compatibility
org.eclipse.equinox.registry
org.eclipse.equinox.preferences
org.eclipse.core.contenttype
org.eclipse.equinox.app

Thanks for any assistance.

Here are the two java files and the rules file:

package rcp_with_drool;

import static org.junit.Assert.*;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;

import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.DroolsParserException;
import org.drools.compiler.PackageBuilder;
import org.drools.rule.Package;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import rcp_with_drool.DroolsTest.Message;

public class mikeTest {
public static RuleBase ruleBase;
public static WorkingMemory workingMemory;
public static Message message;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
message = new Message();
}

@AfterClass
public static void tearDownAfterClass() throws Exception {
}

@Before
public void setUp() throws Exception {
		Reader source = new  
InputStreamReader 
( DroolsTest.class.getResourceAsStream( "Sample.drl" ) );

PackageBuilder builder = new PackageBuilder();
try {
builder.addPackageFromDrl(source);
} catch (DroolsParserException e1) {
e1.printStackTrace();

[rules-users] Problem when compiling rules in Jetty + Eclipse

2008-04-04 Thread Augusto Rodriguez




Hi Everyone!

We've been using the engine for quite a while in the project (a web
app) and now we're switching from Tomcat to Jetty in our local dev
environments. This change triggered a strange error when it compiles
the rules (both with the eclipse and janino dialects).

I'm using eclipse 3.3.2, Jetty 7.1.7 and the error happened in Drools
4.0.4 to 4.0.6 (may be in other versions too).

The exception I'm getting with the janino dialect (which is more
verbose) is attached and the rule (here's a small snippet)

  

  org.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryRule
Compilation error : [Rule name=insertion of versions, agendaGroup=MAIN,
salience=0, no-loop=false]
    com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) :
Imported class "org.slf4j.LoggerFactory" could not be loaded
    com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A
method named "getLogger" is not declared in any enclosing class nor any
supertype, nor through a static import
    com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A
method named "info" is not declared in any enclosing class nor any
supertype, nor through a static import
    com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A
method named "getLogger" is not declared in any enclosing class nor any
supertype, nor through a static import
    com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) :
Imported class "org.slf4j.LoggerFactory" could not be loaded
    com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) :
Instance method "getLogger" cannot be invoked in static context
  
  

  


 And I'm executing the following rule:

  

  package com.elixir
  
#list any import classes here.
import com.elixir.model.*;
import java.util.HashSet;
import java.util.Date;
  
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
  
rule "insertion of versions" 
    ruleflow-group "fact-insertion"
    when
        $a: Artifact(versions != null)
        $v: ArtifactVersion() from $a.getVersions()
    then
        insert ($v);
        LoggerFactory.getLogger("factinsertion.drl").info("Entered:
insertion of versions");        
end

  


And the PackageBuilder get's instantiated like this:

  

          PackageBuilderConfiguration
pkgBuilderCfg = new PackageBuilderConfiguration();
        JavaDialectConfiguration javaConf = (JavaDialectConfiguration)
pkgBuilderCfg.getDialectConfiguration( "java" );
        javaConf.setCompiler( JavaDialectConfiguration.JANINO );
        PackageBuilder builder = new PackageBuilder(pkgBuilderCfg);
  

  


I'm quite sure that this is a mistake in how I'm running this, but I
can't find the solution :S.

Oh, and just in case, we're running the application without any
problems in jetty but not from inside eclipse.


Thanks in advance,
Augusto







org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule 
name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported 
class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method 
named "getLogger" is not declared in any enclosing class nor any supertype, nor 
through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method 
named "info" is not declared in any enclosing class nor any supertype, nor 
through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method 
named "getLogger" is not declared in any enclosing class nor any supertype, nor 
through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported 
class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : Instance 
method "getLogger" cannot be invoked in static context
org.slf4j.Loggerorg.slf4j.LoggerFactoryRule Compilation error : [Rule 
name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported 
class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method 
named "getLogger" is not declared in any enclosing class nor any supertype, nor 
through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method 
named "info" is not declared in any enclosing class nor any supertype, nor 
through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method 
named "getLogger" is not declared in any enclosing class nor any supertype, nor 
through a static import
com/e

[rules-users] Re: [rules-dev] What the.... is happening?

2008-04-04 Thread Mark Proctor
Yes I'm very sorry about this, we have problems with our QA person - 
very embarassing. We've rolled back to 4.0.4 and Edson and myself will 
take care of QA for 4.0.7 which we will release on monday, once I'm 
recovered from my flu.


Mark
mmquelo massi wrote:
 
Sorry guys,
 
but I can't understand why u released 4.0.5 a couple of weeks ago, 
then u suddenly released
a brand new "4.0.6" release few days ago (which I promptly downloaded) 
and now u put back again

the "4.0.4"???
 
*Why???*
 
What is the stable one
 
Does the svn is working?? Should we build from repository or shouldn't we?
 
Looking forward to hearing any news on this matter
 
Thank you anyway.
 
Bye.
 
Massimiliano



___
rules-dev mailing list
[EMAIL PROTECTED]
https://lists.jboss.org/mailman/listinfo/rules-dev
  


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


RE: [rules-users] What the.... is happening?

2008-04-04 Thread Knapp, Barry
I think this has already been answered... a few times.

 

 

"Both 4.0.5 and 4.0.6 where bad releases, poor QA, so we rolled back to
4.0.4."

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of mmquelo massi
Sent: Friday, April 04, 2008 5:52 AM
To: Rules Users List; [EMAIL PROTECTED]
Subject: [rules-users] What the is happening?

 

 

Sorry guys,

 

but I can't understand why u released 4.0.5 a couple of weeks ago, then
u suddenly released

a brand new "4.0.6" release few days ago (which I promptly downloaded)
and now u put back again

the "4.0.4"???

 

Why???

 

What is the stable one

 

Does the svn is working?? Should we build from repository or shouldn't
we?

 

Looking forward to hearing any news on this matter

 

Thank you anyway.

 

Bye.

 

Massimiliano

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Rules File Design Consideration

2008-04-04 Thread Chong Minsk Goh
Hi,

Any help to the problem below is much appreciated : )

Here is the problem:

I have a set of rules. Intially these rules are evaluated individually.
However, now there is a need to fire these rules in groups which is similar
to a logic gate AND or OR. And, the results of this "groups of rules" are
collected and returned to the user/

For example:

There are 4 rules:
Rule 1
Rule 2
Rule 3
Rule 4

Now, need to evaluate (Rule 1 AND Rule 2 AND Rule 3) OR Rule 4
And I need to know what are the results of Rule 1 to Rule 4 individually.


What is the best way to implement a AND or OR using Drools?


Best regards
Chong Minsk
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] What the.... is happening?

2008-04-04 Thread mmquelo massi
Sorry guys,

but I can't understand why u released 4.0.5 a couple of weeks ago, then u
suddenly released
a brand new "4.0.6" release few days ago (which I promptly downloaded) and
now u put back again
the "4.0.4"???

*Why???*

What is the stable one

Does the svn is working?? Should we build from repository or shouldn't we?

Looking forward to hearing any news on this matter

Thank you anyway.

Bye.

Massimiliano
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Unable to fire Rules

2008-04-04 Thread Markus Helbig
Hi,

your rules represent the following Java Code (the system.out are just
to see the result of matches)

public static void main(String[] args)
{
// You're rule

System.out.println("ABC-834".matches("ABC-834-test-100.edi")); 
//false
System.out.println("XYZ-834".matches("ABC-834-test-100.edi"));  
// false
System.out.println("834".matches("ABC-834-test-100.edi"));  // 
false

so it could never work  

but maybe this is what you want to have


// m.fileName matches .*+fileMask+.*



System.out.println("ABC-834-test-100.edi".matches(".*ABC-834.*")); //true

System.out.println("ABC-834-test-100.edi".matches(".*XYZ-834.*"));
//false, if this should also be true because fo the 834 you have to
use regex grouping with an optional group before the -
System.out.println("ABC-834-test-100.edi".matches(".*834.*")); 
//true
}

Cheers

Markus

On Fri, Apr 4, 2008 at 9:28 AM, hanumesh.m <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
>   I am inserting message(fileName, fromQ,toQ,transType) to WorkingMemory.
>  fileName as "ABC-834-test-100.edi"
>
>   I am inserting 3 instances of TrasactionVO's to workingmemory as follows:
>   TransactionVO transVO = new TransactionVO("ABC-834", "ABC.834.EDI",
>  "ABC.834.XML", "834");
>   TransactionVO transVO1 = new TransactionVO("XYZ-834", "XYZ.834.EDI",
>  "XYZ.834.XML", "834");
>   TransactionVO transVO2 = new TransactionVO("834", "INBOUND.834.EDI",
>  "INBOUND.834.XML", "834");
>
>   In drl, which ever object of TransactionVO matches the fileName of Message,
>  then update Message's rest of the details with TransactionVO. But the rules
>  are not getting fired.
>
>   Follewed is the testCase and .drl file along with FactObjects.
>
>  TestCase:
>  -
>  package com.sample;
>
>  import java.io.InputStreamReader;
>  import java.io.Reader;
>
>  import org.drools.FactException;
>  import org.drools.RuleBase;
>  import org.drools.RuleBaseFactory;
>  import org.drools.WorkingMemory;
>  import org.drools.compiler.PackageBuilder;
>  import org.drools.rule.Package;
>  import com.sample.MessageEA;
>  import com.sample.TransactionVO;
>
>  /**
>   * This is a sample file to launch a rule package from a rule source file.
>   */
>  public class DroolsTest2 {
>
> public static final void main(String[] args) {
> try {
>
> //load up the rulebase
> RuleBase ruleBase = readRule();
> WorkingMemory workingMemory = ruleBase.newStatefulSession();
> MessageEA messageEA = new MessageEA();
> messageEA.setFileName("ABC-834-test-100.edi");
> workingMemory.insert( messageEA );
>
> TransactionVO transVO = new TransactionVO("ABC-834",
>  "ABC.834.EDI", "ABC.834.XML", "834");
> TransactionVO transVO1 = new TransactionVO("XYZ-834",
>  "XYZ.834.EDI", "XYZ.834.XML", "834");
> TransactionVO transVO2 = new TransactionVO("834",
>  "INBOUND.834.EDI", "INBOUND.834.XML", "834");
> workingMemory.insert( transVO );
> workingMemory.insert( transVO1 );
> workingMemory.insert( transVO2);
> try{
> workingMemory.fireAllRules();
> }catch (FactException e ){
> System.out.println("err: "+e.getMessage());
> }catch(Exception ee){
> System.out.println("Err2 : "+ee.getMessage());
> }
>
> System.out.println("fName: "+messageEA.getFileName());
> System.out.println("frQ: "+messageEA.getFromQ());
> System.out.println("toQ: "+messageEA.getToQ());
>
>
> } catch (Throwable t) {
> t.printStackTrace();
> }
> }
>
> /**
>  * Please note that this is the "low level" rule assembly API.
>  */
> private static RuleBase readRule() throws Exception {
> //read in the source
> Reader source = new InputStreamReader(
>  DroolsTest.class.getResourceAsStream( "/EATech.drl" ) );
>
> //optionally read in the DSL (if you are using it).
> //Reader dsl = new InputStreamReader(
>  DroolsTest.class.getResourceAsStream( "/mylang.dsl" ) );
>
> //Use package builder to build up a rule package.
> //An alternative lower level class called "DrlParser" can 
> also be used...
>
> PackageBuilder builder = new PackageBuilder();
>
> //this wil parse and compile in one step
> //NOTE: There are 2 methods here, the one argument one is for 
> normal DRL.
> builder.addPackageFromDrl( source );
>
> //Use the following instead of above if you are using a DSL:
>

[rules-users] anonsvn down?

2008-04-04 Thread Markus Helbig
Hi,

i could not connect to the anonymous svn with subclipse plugin?

  RA layer request failed
svn: PROPFIND request failed on '/labs/jbossrules/trunk'
svn: PROPFIND of '/labs/jbossrules/trunk': could not connect to server
(http://anonsvn.labs.jboss.com)

Cheers

Markus
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Unable to fire Rules

2008-04-04 Thread hanumesh.m

Hi,

  I am inserting message(fileName, fromQ,toQ,transType) to WorkingMemory.
fileName as "ABC-834-test-100.edi"

  I am inserting 3 instances of TrasactionVO's to workingmemory as follows:
  TransactionVO transVO = new TransactionVO("ABC-834", "ABC.834.EDI",
"ABC.834.XML", "834");
  TransactionVO transVO1 = new TransactionVO("XYZ-834", "XYZ.834.EDI",
"XYZ.834.XML", "834");
  TransactionVO transVO2 = new TransactionVO("834", "INBOUND.834.EDI",
"INBOUND.834.XML", "834");

 In drl, which ever object of TransactionVO matches the fileName of Message,
then update Message's rest of the details with TransactionVO. But the rules
are not getting fired.

 Follewed is the testCase and .drl file along with FactObjects.

TestCase:
-
package com.sample;

import java.io.InputStreamReader;
import java.io.Reader;

import org.drools.FactException;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.PackageBuilder;
import org.drools.rule.Package;
import com.sample.MessageEA;
import com.sample.TransactionVO;

/**
 * This is a sample file to launch a rule package from a rule source file.
 */
public class DroolsTest2 {

public static final void main(String[] args) {
try {

//load up the rulebase
RuleBase ruleBase = readRule();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
MessageEA messageEA = new MessageEA();
messageEA.setFileName("ABC-834-test-100.edi");
workingMemory.insert( messageEA );

TransactionVO transVO = new TransactionVO("ABC-834",
"ABC.834.EDI", "ABC.834.XML", "834");
TransactionVO transVO1 = new TransactionVO("XYZ-834",
"XYZ.834.EDI", "XYZ.834.XML", "834");
TransactionVO transVO2 = new TransactionVO("834",
"INBOUND.834.EDI", "INBOUND.834.XML", "834");
workingMemory.insert( transVO );
workingMemory.insert( transVO1 );
workingMemory.insert( transVO2);
try{
workingMemory.fireAllRules();
}catch (FactException e ){
System.out.println("err: "+e.getMessage());
}catch(Exception ee){
System.out.println("Err2 : "+ee.getMessage());
}

System.out.println("fName: "+messageEA.getFileName());
System.out.println("frQ: "+messageEA.getFromQ());
System.out.println("toQ: "+messageEA.getToQ());


} catch (Throwable t) {
t.printStackTrace();
}
}

/**
 * Please note that this is the "low level" rule assembly API.
 */
private static RuleBase readRule() throws Exception {
//read in the source
Reader source = new InputStreamReader(
DroolsTest.class.getResourceAsStream( "/EATech.drl" ) );

//optionally read in the DSL (if you are using it).
//Reader dsl = new InputStreamReader(
DroolsTest.class.getResourceAsStream( "/mylang.dsl" ) );

//Use package builder to build up a rule package.
//An alternative lower level class called "DrlParser" can also 
be used...

PackageBuilder builder = new PackageBuilder();

//this wil parse and compile in one step
//NOTE: There are 2 methods here, the one argument one is for 
normal DRL.
builder.addPackageFromDrl( source );

//Use the following instead of above if you are using a DSL:
//builder.addPackageFromDrl( source, dsl );

//get the compiled package (which is serializable)
Package pkg = builder.getPackage();

//add the package to a rulebase (deploy the rule package).
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
return ruleBase;
}

}
---
.drl file

package com.sample;
 
import com.sample.MessageEA;
import com.sample.TransactionVO;

rule "Process ALL"
 no-loop 
 when
m:MessageEA()
p: TransactionVO(fileMask matches m.fileName)
then
System.out.println( "Reading Rule for ..." + p.getFileMask() ); 
m.setFromQ(p.getFrom_Q());
m.setToQ(p.getTo_Q());
m.setTransType(p.getTransType());
update( m );
end
--
MessageEA (private String transType,private String fileName,private String
fromQ, private String toQ)
TransactionVO(private String fileMask,  private String from_Q,private String
to_Q,private String transType);
)


This testCase has executed only Once accurately. But from later on it
stopped working.