[rules-users] Using JSR-94 through FIT

2007-07-06 Thread Natraj Gudla

Hi Mark,

I am using the FIT for rules to test my rules. As the code is using JSR-94 i
found a situation which you might help me resolve. Using the JSR-94
implementation classes, how can i first declare the globals on a package and
then set into the working memory. When i open up the source code i dont see
appropriate methods which can do this for me.

There is a map which can be passed while creating a RuleExecutionSet which i
suppose is allowed to carry only the "source" and the "dsl" key value pairs.

I understand that the globals concept is specific to Drools, but is there a
way we can address this within the JSR-94 implementation classes.

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


[rules-users] Drools inside Netbeans module

2007-07-06 Thread Andreas Boehm
Hello all,

I'm using Drools 4.0.0.12865MR3 , Netbeans Platform 5.5 and  JDK 1.6.

When trying to instantiate a org.drools.compiler.PackageBuilder inside a 
Netbeans module I get the following exception:

org.drools.RuntimeDroolsException: 
Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialect:java'
at 
org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry(PackageBuilderConfiguration.java:156)
at org.drools.compiler.PackageBuilder.(PackageBuilder.java:131)
at org.drools.compiler.PackageBuilder.(PackageBuilder.java:84)

Maybe this seems to be a ClassLoader issue.

Regards,
Andreas Boehm


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


Re: [rules-users] Unresolved Object Reference

2007-07-06 Thread Narendra Valada

Hello,

Any ideas on what might be causing the error I am seeing? I seem to get this
error only on inner classes that are defined within other inner classes. We
have some fairly complex schemas for which XML Beans generates deeply nested
hierarchies of inner classes.

Any suggestions would be welcome.

Thanks,

Narendra


On 7/5/07, Edson Tirelli <[EMAIL PROTECTED]> wrote:



   There was a problem with CGLIB proxies much similar to this... so
probably the same problem.

   What happens is that to shadow a fact, drools needs to extend the
actual class being asserted, and override the equals and hashcode methods.
So, the class can't be final, nor these methods can be final. Previously I
wasn't checking for final on these methods and that was the reason for the
error.

   I fixed that in trunk. It means, if XML Beans are generating methods
equals/hashCode as final, drools won't be able to shadow them (and so will
automatically disable shadowing for them), but it will not raise the error
anymore.

   Let me know if it is still a problem for you in trunk.

[]s
Edson

2007/7/5, Ronald R. DiFrango <[EMAIL PROTECTED] >:
>
> All this sounds eerily similar to the problem I am reporting.  In the
> 4.0 version I am getting the following exception on those inner classes:
>
>
> Exception in thread "main" java.lang.VerifyError: class
> 
com.circuitcity.rtvcrms.impl.DetailLineDocumentImpl$DetailLineImplShadowProxyoverrides
 final method ã Ý*h '+ .û Ý*h '+
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> at java.lang.ClassLoader.defineClass (ClassLoader.java:465)
> at org.drools.rule.MapBackedClassLoader.fastFindClass(
> MapBackedClassLoader.java:40)
> at org.drools.rule.MapBackedClassLoader.loadClass(
> MapBackedClassLoader.java:59)
> at java.lang.ClassLoader.loadClass (ClassLoader.java:251)
> at org.drools.reteoo.Rete$ObjectTypeConf.(Rete.java:352)
> at org.drools.reteoo.Rete.assertObject(Rete.java:152)
> at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
> at org.drools.reteoo.ReteooWorkingMemory.doInsert(
> ReteooWorkingMemory.java:70)
> at org.drools.common.AbstractWorkingMemory.insert(
> AbstractWorkingMemory.java:772)
> at org.drools.common.AbstractWorkingMemory.insert (
> AbstractWorkingMemory.java:584)
> at
> com.circuitcity.rtvcrms.rules.RtvDecisionEngine.processDetailLines(
> RtvDecisionEngine.java:95)
> at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.executeRules(
> RtvDecisionEngine.java :64)
> at com.circuitcity.rtvcrms.test.MainBasedTester.main(
> MainBasedTester.java:34)
>
> The catch is that XML Beans objects are auto generated based upon and
> XSD and we have limited control over what gets generated.
>
> On 7/5/07, Narendra Valada < [EMAIL PROTECTED]> wrote:
> >
> > Thank you for your quick response.
> >
> > I cannot make the Outer class static and public since it is not an
> > inner class.
> >
> > In my example, I have two inner classes : Inner and InnerInner.
> >
> > Class Inner is enclosed by Outer and class InnerInner is enclosed by
> > Inner. I get the "Unable to resolve object type"  error only on the
> > "InnerInner" class and not on the "Inner" class.
> >
> > Both the inner classes are defined as non-static.
> >
> > Thanks,
> >
> > Narendra
> >
> >
> >
> > On 7/5/07, Mark Proctor <[EMAIL PROTECTED] > wrote:
> > >
> > > you need to make your Outer class static and public. Look at the
> > > sample generated with a new drools project, that uses a static public 
class.
> > >
> > > Mark
> > > Narendra Valada wrote:
> > >
> > > ** *Hello,*
> > > * *
> > > *I am getting an "Unable to resolve object type" error on certain
> > > XML Bean generated inner classes. I get this error only on inner classes
> > > that have been defined within other inner classes. Please see example 
below.
> > > *
> > > * *
> > > *Is this a known limitation of JBoss Rules (I am using JBOSS Rules
> > > 3.0.6) or the JANINO compiler?*
> > > * *
> > > *Thanks.*
> > > *
> > >
> > > package
> > > *
> > > *com.sample;
> > >
> > > public
> > > class Outer{ public class Inner { public boolean inner =
> > > false; public class InnerInner {
> > >
> > > }
> > >
> > >  }
> > >
> > > }
> > > * *package*
> > > com.sample *
> > >
> > > import
> > > *com.sample.Outer1.Inner.InnerInner; *
> > >
> > > rule
> > > *"Hello World 1" *when*
> > >
> > > InnerInner()
> > > *then*
> > >
> > > System.out.println(
> > > "");*
> > >
> > > end
> > > *
> > >
> > > --
> > >
> > > ___
> > > 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-use

Re: [rules-users] Unresolved Object Reference

2007-07-06 Thread Edson Tirelli

  Suggestion is to try the latest source code with the fixes.

  You can get the latest successful build from here:

http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules

  Or you can checkout source code from the repository and with Maven2
installed, just type: "mvn clean install" in the command line.

  []s
  Edson


2007/7/6, Narendra Valada <[EMAIL PROTECTED]>:


Hello,

Any ideas on what might be causing the error I am seeing? I seem to get
this error only on inner classes that are defined within other inner
classes. We have some fairly complex schemas for which XML Beans generates
deeply nested hierarchies of inner classes.

Any suggestions would be welcome.

Thanks,

Narendra


On 7/5/07, Edson Tirelli <[EMAIL PROTECTED]> wrote:
>
>
>There was a problem with CGLIB proxies much similar to this... so
> probably the same problem.
>
>What happens is that to shadow a fact, drools needs to extend the
> actual class being asserted, and override the equals and hashcode methods.
> So, the class can't be final, nor these methods can be final. Previously I
> wasn't checking for final on these methods and that was the reason for the
> error.
>
>I fixed that in trunk. It means, if XML Beans are generating methods
> equals/hashCode as final, drools won't be able to shadow them (and so will
> automatically disable shadowing for them), but it will not raise the error
> anymore.
>
>Let me know if it is still a problem for you in trunk.
>
> []s
> Edson
>
> 2007/7/5, Ronald R. DiFrango <[EMAIL PROTECTED] >:
> >
> > All this sounds eerily similar to the problem I am reporting.  In the
> > 4.0 version I am getting the following exception on those inner
> > classes:
> >
> > Exception in thread "main" java.lang.VerifyError: class
> > 
com.circuitcity.rtvcrms.impl.DetailLineDocumentImpl$DetailLineImplShadowProxyoverrides
 final method ã Ý*h '+ .û Ý*h '+
> > at java.lang.ClassLoader.defineClass1 (Native Method)
> > at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> > at java.lang.ClassLoader.defineClass (ClassLoader.java:465)
> > at org.drools.rule.MapBackedClassLoader.fastFindClass(
> > MapBackedClassLoader.java :40)
> > at org.drools.rule.MapBackedClassLoader.loadClass(
> > MapBackedClassLoader.java:59)
> > at java.lang.ClassLoader.loadClass (ClassLoader.java:251)
> > at org.drools.reteoo.Rete$ObjectTypeConf.(Rete.java :352)
> > at org.drools.reteoo.Rete.assertObject(Rete.java:152)
> > at org.drools.reteoo.ReteooRuleBase.assertObject(
> > ReteooRuleBase.java :190)
> > at org.drools.reteoo.ReteooWorkingMemory.doInsert(
> > ReteooWorkingMemory.java :70)
> > at org.drools.common.AbstractWorkingMemory.insert(
> > AbstractWorkingMemory.java:772)
> > at org.drools.common.AbstractWorkingMemory.insert (
> > AbstractWorkingMemory.java:584)
> > at
> > com.circuitcity.rtvcrms.rules.RtvDecisionEngine.processDetailLines (
> > RtvDecisionEngine.java:95)
> > at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.executeRules(
> > RtvDecisionEngine.java :64)
> > at com.circuitcity.rtvcrms.test.MainBasedTester.main(
> > MainBasedTester.java:34)
> >
> > The catch is that XML Beans objects are auto generated based upon and
> > XSD and we have limited control over what gets generated.
> >
> > On 7/5/07, Narendra Valada < [EMAIL PROTECTED] > wrote:
> > >
> > > Thank you for your quick response.
> > >
> > > I cannot make the Outer class static and public since it is not an
> > > inner class.
> > >
> > > In my example, I have two inner classes : Inner and InnerInner.
> > >
> > > Class Inner is enclosed by Outer and class InnerInner is enclosed by
> > > Inner. I get the "Unable to resolve object type"  error only on the
> > > "InnerInner" class and not on the "Inner" class.
> > >
> > > Both the inner classes are defined as non-static.
> > >
> > > Thanks,
> > >
> > > Narendra
> > >
> > >
> > >
> > > On 7/5/07, Mark Proctor <[EMAIL PROTECTED] > wrote:
> > > >
> > > > you need to make your Outer class static and public. Look at the
> > > > sample generated with a new drools project, that uses a static public 
class.
> > > >
> > > > Mark
> > > > Narendra Valada wrote:
> > > >
> > > > ** *Hello,*
> > > > * *
> > > > *I am getting an "Unable to resolve object type" error on certain
> > > > XML Bean generated inner classes. I get this error only on inner classes
> > > > that have been defined within other inner classes. Please see example 
below.
> > > > *
> > > > * *
> > > > *Is this a known limitation of JBoss Rules (I am using JBOSS Rules
> > > > 3.0.6) or the JANINO compiler?*
> > > > * *
> > > > *Thanks.*
> > > > *
> > > >
> > > > package
> > > > *
> > > > *com.sample;
> > > >
> > > > public
> > > > class Outer{ public class Inner { public boolean inner =
> > > > false; public class InnerInner {
> > > >
> > > > }
> > > >
> > > >  }
> > > >
> > > > }
> > > > * *package*
> > > > com.sample *
> > > >
> > > > import
> > > > *com.sa

Re: [rules-users] Unresolved Object Reference

2007-07-06 Thread Edson Tirelli

   Ronald,

   You can't change constrained values of facts that are not shadowed.
   Exemple: if you have a rule that does:

Person( name == "someValue" )

  If person is not shadowed, you can't change the name attribute while the
object is in the working memory or you may get unexpected behavior from the
engine. But for instance, if you don't constrain another attribute, like
"age", you can change it without any problems.

  []s
  Edson

2007/7/5, Ronald R. DiFrango <[EMAIL PROTECTED]>:


Edson,

That is indeed the case, XML Beans is generating final equals/hashCdoe
methods.  I have no idea why that is case.  I may post this over on the XML
Beans board.

Is disabling the shadowing a problem from the rules execution point of
view?

Finally, I guess I need to do a source build, can I find the instructions
somewhere on this?

Ron

On 7/5/07, Edson Tirelli < [EMAIL PROTECTED]> wrote:
>
>
>There was a problem with CGLIB proxies much similar to this... so
> probably the same problem.
>
>What happens is that to shadow a fact, drools needs to extend the
> actual class being asserted, and override the equals and hashcode methods.
> So, the class can't be final, nor these methods can be final. Previously I
> wasn't checking for final on these methods and that was the reason for the
> error.
>
>I fixed that in trunk. It means, if XML Beans are generating methods
> equals/hashCode as final, drools won't be able to shadow them (and so will
> automatically disable shadowing for them), but it will not raise the error
> anymore.
>
>Let me know if it is still a problem for you in trunk.
>
> []s
> Edson
>
> 2007/7/5, Ronald R. DiFrango < [EMAIL PROTECTED] >:
> >
> > All this sounds eerily similar to the problem I am reporting.  In the
> > 4.0 version I am getting the following exception on those inner
> > classes:
> >
> > Exception in thread "main" java.lang.VerifyError: class
> > 
com.circuitcity.rtvcrms.impl.DetailLineDocumentImpl$DetailLineImplShadowProxyoverrides
 final method ã Ý*h '+ .û Ý*h '+
> > at java.lang.ClassLoader.defineClass1(Native Method)
> > at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> > at java.lang.ClassLoader.defineClass (ClassLoader.java:465)
> > at org.drools.rule.MapBackedClassLoader.fastFindClass(
> > MapBackedClassLoader.java:40)
> > at org.drools.rule.MapBackedClassLoader.loadClass(
> > MapBackedClassLoader.java:59)
> > at java.lang.ClassLoader.loadClass (ClassLoader.java:251)
> > at org.drools.reteoo.Rete$ObjectTypeConf.(Rete.java:352)
> > at org.drools.reteoo.Rete.assertObject(Rete.java:152)
> > at org.drools.reteoo.ReteooRuleBase.assertObject(
> > ReteooRuleBase.java :190)
> > at org.drools.reteoo.ReteooWorkingMemory.doInsert(
> > ReteooWorkingMemory.java:70)
> > at org.drools.common.AbstractWorkingMemory.insert(
> > AbstractWorkingMemory.java:772)
> > at org.drools.common.AbstractWorkingMemory.insert (
> > AbstractWorkingMemory.java:584)
> > at
> > com.circuitcity.rtvcrms.rules.RtvDecisionEngine.processDetailLines(
> > RtvDecisionEngine.java:95)
> > at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.executeRules(
> > RtvDecisionEngine.java :64)
> > at com.circuitcity.rtvcrms.test.MainBasedTester.main(
> > MainBasedTester.java:34)
> >
> > The catch is that XML Beans objects are auto generated based upon and
> > XSD and we have limited control over what gets generated.
> >
> > On 7/5/07, Narendra Valada < [EMAIL PROTECTED]> wrote:
> > >
> > > Thank you for your quick response.
> > >
> > > I cannot make the Outer class static and public since it is not an
> > > inner class.
> > >
> > > In my example, I have two inner classes : Inner and InnerInner.
> > >
> > > Class Inner is enclosed by Outer and class InnerInner is enclosed by
> > > Inner. I get the "Unable to resolve object type"  error only on the
> > > "InnerInner" class and not on the "Inner" class.
> > >
> > > Both the inner classes are defined as non-static.
> > >
> > > Thanks,
> > >
> > > Narendra
> > >
> > >
> > >
> > > On 7/5/07, Mark Proctor <[EMAIL PROTECTED] > wrote:
> > > >
> > > > you need to make your Outer class static and public. Look at the
> > > > sample generated with a new drools project, that uses a static public 
class.
> > > >
> > > > Mark
> > > > Narendra Valada wrote:
> > > >
> > > > * **Hello,*
> > > > * *
> > > > *I am getting an "Unable to resolve object type" error on certain
> > > > XML Bean generated inner classes. I get this error only on inner classes
> > > > that have been defined within other inner classes. Please see example 
below.
> > > > *
> > > > * *
> > > > *Is this a known limitation of JBoss Rules (I am using JBOSS Rules
> > > > 3.0.6) or the JANINO compiler?*
> > > > * *
> > > > *Thanks.*
> > > > *
> > > >
> > > > package
> > > > *
> > > > *com.sample;
> > > >
> > > > public
> > > > class Outer{ public class Inner { public boolean inner =
> > > > false; public class InnerInner {
> > >

Re: [rules-users] Unresolved Object Reference

2007-07-06 Thread Ronald R. DiFrango

Edson,

Oh, this could be bad news then.  I do have cases where I have code like the
following:

detailLine: DetailLine(status != "Matched", other stuff)

then

detailLine.setStatus("Matched")

What might the implications be then?

Ron

On 7/6/07, Edson Tirelli <[EMAIL PROTECTED]> wrote:



Ronald,

You can't change constrained values of facts that are not shadowed.
Exemple: if you have a rule that does:

Person( name == "someValue" )

   If person is not shadowed, you can't change the name attribute while
the object is in the working memory or you may get unexpected behavior from
the engine. But for instance, if you don't constrain another attribute, like
"age", you can change it without any problems.

   []s
   Edson

2007/7/5, Ronald R. DiFrango <[EMAIL PROTECTED]>:
>
> Edson,
>
> That is indeed the case, XML Beans is generating final equals/hashCdoe
> methods.  I have no idea why that is case.  I may post this over on the XML
> Beans board.
>
> Is disabling the shadowing a problem from the rules execution point of
> view?
>
> Finally, I guess I need to do a source build, can I find the
> instructions somewhere on this?
>
> Ron
>
> On 7/5/07, Edson Tirelli < [EMAIL PROTECTED]> wrote:
> >
> >
> >There was a problem with CGLIB proxies much similar to this... so
> > probably the same problem.
> >
> >What happens is that to shadow a fact, drools needs to extend the
> > actual class being asserted, and override the equals and hashcode methods.
> > So, the class can't be final, nor these methods can be final. Previously I
> > wasn't checking for final on these methods and that was the reason for the
> > error.
> >
> >I fixed that in trunk. It means, if XML Beans are generating
> > methods equals/hashCode as final, drools won't be able to shadow them (and
> > so will automatically disable shadowing for them), but it will not raise the
> > error anymore.
> >
> >Let me know if it is still a problem for you in trunk.
> >
> > []s
> > Edson
> >
> > 2007/7/5, Ronald R. DiFrango < [EMAIL PROTECTED] >:
> > >
> > > All this sounds eerily similar to the problem I am reporting.  In
> > > the 4.0 version I am getting the following exception on those inner
> > > classes:
> > >
> > > Exception in thread "main" java.lang.VerifyError: class
> > > 
com.circuitcity.rtvcrms.impl.DetailLineDocumentImpl$DetailLineImplShadowProxyoverrides 
final method ã Ý*h '+ .û Ý*h '+
> > > at java.lang.ClassLoader.defineClass1(Native Method)
> > > at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> > > at java.lang.ClassLoader.defineClass (ClassLoader.java:465)
> > > at org.drools.rule.MapBackedClassLoader.fastFindClass(
> > > MapBackedClassLoader.java:40)
> > > at org.drools.rule.MapBackedClassLoader.loadClass(
> > > MapBackedClassLoader.java:59)
> > > at java.lang.ClassLoader.loadClass (ClassLoader.java:251)
> > > at org.drools.reteoo.Rete$ObjectTypeConf.(Rete.java:352)
> > > at org.drools.reteoo.Rete.assertObject(Rete.java:152)
> > > at org.drools.reteoo.ReteooRuleBase.assertObject(
> > > ReteooRuleBase.java :190)
> > > at org.drools.reteoo.ReteooWorkingMemory.doInsert(
> > > ReteooWorkingMemory.java:70)
> > > at org.drools.common.AbstractWorkingMemory.insert(
> > > AbstractWorkingMemory.java:772)
> > > at org.drools.common.AbstractWorkingMemory.insert (
> > > AbstractWorkingMemory.java:584)
> > > at
> > > com.circuitcity.rtvcrms.rules.RtvDecisionEngine.processDetailLines(
> > > RtvDecisionEngine.java:95)
> > > at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.executeRules(
> > > RtvDecisionEngine.java :64)
> > > at com.circuitcity.rtvcrms.test.MainBasedTester.main(
> > > MainBasedTester.java:34)
> > >
> > > The catch is that XML Beans objects are auto generated based upon
> > > and XSD and we have limited control over what gets generated.
> > >
> > > On 7/5/07, Narendra Valada < [EMAIL PROTECTED]> wrote:
> > > >
> > > > Thank you for your quick response.
> > > >
> > > > I cannot make the Outer class static and public since it is not an
> > > > inner class.
> > > >
> > > > In my example, I have two inner classes : Inner and InnerInner.
> > > >
> > > > Class Inner is enclosed by Outer and class InnerInner is enclosed
> > > > by Inner. I get the "Unable to resolve object type"  error only on the
> > > > "InnerInner" class and not on the "Inner" class.
> > > >
> > > > Both the inner classes are defined as non-static.
> > > >
> > > > Thanks,
> > > >
> > > > Narendra
> > > >
> > > >
> > > >
> > > > On 7/5/07, Mark Proctor <[EMAIL PROTECTED] > wrote:
> > > > >
> > > > > you need to make your Outer class static and public. Look at the
> > > > > sample generated with a new drools project, that uses a static public 
class.
> > > > >
> > > > > Mark
> > > > > Narendra Valada wrote:
> > > > >
> > > > > * **Hello,*
> > > > > * *
> > > > > *I am getting an "Unable to resolve object type" error on
> > > > > certain XML Bean generated inner cla

[rules-users] date-effective

2007-07-06 Thread hypnosat7

I put in one of my rules :  date-effective "16-FEB-2007"
But Drools 4 MR3 dosn't parse it in my project. Any help
Thanks
-- 
View this message in context: 
http://www.nabble.com/date-effective-tf4036244.html#a11466627
Sent from the drools - user mailing list archive at Nabble.com.

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


Re: [rules-users] Unresolved Object Reference

2007-07-06 Thread Edson Tirelli

  Ronald,

  Shadow facts only role is to ensure the integrity of the working memory.
Basically what they do is to only allow the engine to "see" the changes to
facts at safe "update" points.

  Without a shadow, facts that have constrained attributes may present
undetermined behavior... sometimes rules that should fire will not fire or
vice-versa, usually there will be memory leaks, etc. So, to be brief, it
will not work, even if it may appear to be working.

   Well, we try to make shadow facts as transparent as possible to the user
and to the engine, because shadow facts obviously will add overhead to the
runtime environment. If they are transparent, advanced user can "tune
performance" by disabling shadow facts for classes that don't need them.

   To do that, we chose to go with a "proxy" strategy. So, we create a lazy
loaded cache proxy for each fact asserted into the working memory. To do
that, we need actual asserted fact classes to not be final, and also we are
required to override equals and hashCode methods.

   In the future, we may try to pursue other strategies, but for now, our
only recommendation is to not assert facts of classes that are final or have
declared equals/hashcode methods as final.

   []s
   Edson

2007/7/6, Ronald R. DiFrango <[EMAIL PROTECTED]>:


Edson,

Oh, this could be bad news then.  I do have cases where I have code like
the following:

detailLine: DetailLine(status != "Matched", other stuff)

then

detailLine.setStatus ("Matched")

What might the implications be then?

Ron

On 7/6/07, Edson Tirelli <[EMAIL PROTECTED] > wrote:
>
>
> Ronald,
>
> You can't change constrained values of facts that are not shadowed.
> Exemple: if you have a rule that does:
>
> Person( name == "someValue" )
>
>If person is not shadowed, you can't change the name attribute while
> the object is in the working memory or you may get unexpected behavior from
> the engine. But for instance, if you don't constrain another attribute, like
> "age", you can change it without any problems.
>
>[]s
>Edson
>
> 2007/7/5, Ronald R. DiFrango < [EMAIL PROTECTED]>:
> >
> > Edson,
> >
> > That is indeed the case, XML Beans is generating final equals/hashCdoe
> > methods.  I have no idea why that is case.  I may post this over on the XML
> > Beans board.
> >
> > Is disabling the shadowing a problem from the rules execution point of
> > view?
> >
> > Finally, I guess I need to do a source build, can I find the
> > instructions somewhere on this?
> >
> > Ron
> >
> > On 7/5/07, Edson Tirelli < [EMAIL PROTECTED]> wrote:
> > >
> > >
> > >There was a problem with CGLIB proxies much similar to this... so
> > > probably the same problem.
> > >
> > >What happens is that to shadow a fact, drools needs to extend the
> > > actual class being asserted, and override the equals and hashcode methods.
> > > So, the class can't be final, nor these methods can be final. Previously I
> > > wasn't checking for final on these methods and that was the reason for the
> > > error.
> > >
> > >I fixed that in trunk. It means, if XML Beans are generating
> > > methods equals/hashCode as final, drools won't be able to shadow them (and
> > > so will automatically disable shadowing for them), but it will not raise 
the
> > > error anymore.
> > >
> > >Let me know if it is still a problem for you in trunk.
> > >
> > > []s
> > > Edson
> > >
> > > 2007/7/5, Ronald R. DiFrango < [EMAIL PROTECTED] >:
> > > >
> > > > All this sounds eerily similar to the problem I am reporting.  In
> > > > the 4.0 version I am getting the following exception on those
> > > > inner classes:
> > > >
> > > > Exception in thread "main" java.lang.VerifyError: class
> > > > 
com.circuitcity.rtvcrms.impl.DetailLineDocumentImpl$DetailLineImplShadowProxyoverrides 
final method ã Ý*h '+ .û Ý*h '+
> > > > at java.lang.ClassLoader.defineClass1(Native Method)
> > > > at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> > > > at java.lang.ClassLoader.defineClass (ClassLoader.java:465)
> > > > at org.drools.rule.MapBackedClassLoader.fastFindClass(
> > > > MapBackedClassLoader.java:40)
> > > > at org.drools.rule.MapBackedClassLoader.loadClass(
> > > > MapBackedClassLoader.java:59)
> > > > at java.lang.ClassLoader.loadClass (ClassLoader.java:251)
> > > > at org.drools.reteoo.Rete$ObjectTypeConf.(Rete.java:352)
> > > > at org.drools.reteoo.Rete.assertObject(Rete.java:152)
> > > > at org.drools.reteoo.ReteooRuleBase.assertObject(
> > > > ReteooRuleBase.java :190)
> > > > at org.drools.reteoo.ReteooWorkingMemory.doInsert(
> > > > ReteooWorkingMemory.java:70)
> > > > at org.drools.common.AbstractWorkingMemory.insert(
> > > > AbstractWorkingMemory.java:772)
> > > > at org.drools.common.AbstractWorkingMemory.insert (
> > > > AbstractWorkingMemory.java:584)
> > > > at
> > > > com.circuitcity.rtvcrms.rules.RtvDecisionEngine.processDetailLines
> > > > (RtvDecisionEngine.java:

Re: [rules-users] Unresolved Object Reference

2007-07-06 Thread Ronald R. DiFrango

Thanks Edson!  I really do not like the fact that XML Beans does this, I am
trying an Castor as an alternative.

On 7/6/07, Edson Tirelli <[EMAIL PROTECTED]> wrote:



   Ronald,

   Shadow facts only role is to ensure the integrity of the working
memory. Basically what they do is to only allow the engine to "see" the
changes to facts at safe "update" points.

   Without a shadow, facts that have constrained attributes may present
undetermined behavior... sometimes rules that should fire will not fire or
vice-versa, usually there will be memory leaks, etc. So, to be brief, it
will not work, even if it may appear to be working.

Well, we try to make shadow facts as transparent as possible to the
user and to the engine, because shadow facts obviously will add overhead to
the runtime environment. If they are transparent, advanced user can "tune
performance" by disabling shadow facts for classes that don't need them.

To do that, we chose to go with a "proxy" strategy. So, we create a
lazy loaded cache proxy for each fact asserted into the working memory. To
do that, we need actual asserted fact classes to not be final, and also we
are required to override equals and hashCode methods.

In the future, we may try to pursue other strategies, but for now, our
only recommendation is to not assert facts of classes that are final or have
declared equals/hashcode methods as final.

[]s
Edson

2007/7/6, Ronald R. DiFrango <[EMAIL PROTECTED]>:
>
> Edson,
>
> Oh, this could be bad news then.  I do have cases where I have code like
> the following:
>
> detailLine: DetailLine(status != "Matched", other stuff)
>
> then
>
> detailLine.setStatus ("Matched")
>
> What might the implications be then?
>
> Ron
>
> On 7/6/07, Edson Tirelli < [EMAIL PROTECTED] > wrote:
> >
> >
> > Ronald,
> >
> > You can't change constrained values of facts that are not
> > shadowed.
> > Exemple: if you have a rule that does:
> >
> > Person( name == "someValue" )
> >
> >If person is not shadowed, you can't change the name attribute
> > while the object is in the working memory or you may get unexpected behavior
> > from the engine. But for instance, if you don't constrain another attribute,
> > like "age", you can change it without any problems.
> >
> >[]s
> >Edson
> >
> > 2007/7/5, Ronald R. DiFrango < [EMAIL PROTECTED]>:
> > >
> > > Edson,
> > >
> > > That is indeed the case, XML Beans is generating final
> > > equals/hashCdoe methods.  I have no idea why that is case.  I may post 
this
> > > over on the XML Beans board.
> > >
> > > Is disabling the shadowing a problem from the rules execution point
> > > of view?
> > >
> > > Finally, I guess I need to do a source build, can I find the
> > > instructions somewhere on this?
> > >
> > > Ron
> > >
> > > On 7/5/07, Edson Tirelli < [EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > >There was a problem with CGLIB proxies much similar to this...
> > > > so probably the same problem.
> > > >
> > > >What happens is that to shadow a fact, drools needs to extend
> > > > the actual class being asserted, and override the equals and hashcode
> > > > methods. So, the class can't be final, nor these methods can be final.
> > > > Previously I wasn't checking for final on these methods and that was the
> > > > reason for the error.
> > > >
> > > >I fixed that in trunk. It means, if XML Beans are generating
> > > > methods equals/hashCode as final, drools won't be able to shadow them 
(and
> > > > so will automatically disable shadowing for them), but it will not 
raise the
> > > > error anymore.
> > > >
> > > >Let me know if it is still a problem for you in trunk.
> > > >
> > > > []s
> > > > Edson
> > > >
> > > > 2007/7/5, Ronald R. DiFrango < [EMAIL PROTECTED] >:
> > > > >
> > > > > All this sounds eerily similar to the problem I am reporting.
> > > > > In the 4.0 version I am getting the following exception on those
> > > > > inner classes:
> > > > >
> > > > > Exception in thread "main" java.lang.VerifyError: class
> > > > > 
com.circuitcity.rtvcrms.impl.DetailLineDocumentImpl$DetailLineImplShadowProxyoverrides final 
method ã Ý*h '+ .û Ý*h '+
> > > > > at java.lang.ClassLoader.defineClass1(Native Method)
> > > > > at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> > > > > at java.lang.ClassLoader.defineClass (ClassLoader.java:465)
> > > > > at org.drools.rule.MapBackedClassLoader.fastFindClass(
> > > > > MapBackedClassLoader.java:40)
> > > > > at org.drools.rule.MapBackedClassLoader.loadClass(
> > > > > MapBackedClassLoader.java:59)
> > > > > at java.lang.ClassLoader.loadClass (ClassLoader.java:251)
> > > > > at org.drools.reteoo.Rete$ObjectTypeConf.(Rete.java
> > > > > :352)
> > > > > at org.drools.reteoo.Rete.assertObject(Rete.java:152)
> > > > > at org.drools.reteoo.ReteooRuleBase.assertObject(
> > > > > ReteooRuleBase.java :190)
> > > > > at org.drools.reteoo.ReteooWorkingMemory.doInse

[rules-users] Re: Fun with JAXB

2007-07-06 Thread Matt Geis
Suggestion:  Instead of using XMLBeans for your XML 
serialization/deserialization, use JAXB 2.0.  You can get it to use POJO's and 
annotations (a little more work than doing a straight codegen from an xml 
schema, but still doable), and JBossRules should have no problem 
subclassing/overriding, as you will be able to make sure your methods aren't 
declared 'final' .

Matt



   

Moody friends. Drama queens. Your life? Nope! - their life, your story. Play 
Sims Stories at Yahoo! Games.
http://sims.yahoo.com/  
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Re: Fun with JAXB

2007-07-06 Thread Ronald R. DiFrango

Matt,

Thanks for the suggestion.  The only problem I have with JAXB is the
annotations.  I am unfortunately working in a JDK 1.4 environment.  I am
trying Castor now to see if that works.

Ron

On 7/6/07, Matt Geis <[EMAIL PROTECTED]> wrote:


Suggestion:  Instead of using XMLBeans for your XML
serialization/deserialization, use JAXB 2.0.  You can get it to use POJO's
and annotations (a little more work than doing a straight codegen from an
xml schema, but still doable), and JBossRules should have no problem
subclassing/overriding, as you will be able to make sure your methods aren't
declared 'final' .

Matt






Moody friends. Drama queens. Your life? Nope! - their life, your story.
Play Sims Stories at Yahoo! Games.
http://sims.yahoo.com/
___
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] Generics support in conditions?

2007-07-06 Thread Emily Harsh

Hello,

I'm using Drools 4.0M3.  Several of the objects in our object model take
advantage of generics.  I was able to utilize generics in the consequences
by setting the Java language level to 1.5 in the
PackageBuilderConfiguration, however I would also like to optimize my rule
activations by using the concrete types in the conditions.  I'm assuming
this is not currently supported since I get the following error when I try
to specify the concrete type in the condition:
mismatched token: [EMAIL PROTECTED],1242:1242='<',<78>,30:15]; expecting type
LEFT_PAREN[30,45]

My working rule uses the following syntax:
rule "Test Generics"
   when
   Span () # 4.0: Can we use concrete type Span?
   then
   System.out.println("RULE: Matched Span()");
end

I would like to be able to specify the concrete type like this:
rule "Test Generics 2"
   when
   Span ()
   then
   System.out.println("RULE: Matched Span()");
end

Our object model uses the generic type "Span" heavily.  I am hoping that I
will be able to reduce the number of rule activations by specifying the
concrete type in the condition.

Any chance this will be available in the 4.0 general release?

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


[rules-users] Time constrained rules

2007-07-06 Thread Jason Vasquez

Hi all,

I need a set of rules to fire on time-based criteria.  I have a  
'Clock' object in working memory, along with an unknown number of  
'TestObject's, each of which can report its 'age'.  At some interval,  
I modify the Clock object in working memory, and then fire the  
rules.  As a start (which I'm certain shouldn't work anyway), I'm  
playing around with a rule like this:


rule "remove objects older than 2 seconds"
when
Clock()
$to : TestObject( ageInMillis > 2000 )
then
	System.out.println(new java.util.Date() + " = Retracting " +  
$to);

retract($to);
end

It appears that the RHS is never executed, presumably because  
TestObjects were not modified.  (I'm new to JBossRules, so I'm  
unclear on that )


Alternatively, I could just remove the Clock() constraint and iterate  
an external collection of TestObject's, marking each object as  
modified.  Just looking for the best way here...


Thanks,
-jason

smime.p7s
Description: S/MIME cryptographic signature
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Generics support in conditions?

2007-07-06 Thread Edson Tirelli

  Emily,

  Yes, this is not supported since generics information is not available at
runtime, and in this way, we can't constrain facts by generics information.

  []s
  Edson

2007/7/6, Emily Harsh <[EMAIL PROTECTED]>:


Hello,

I'm using Drools 4.0M3.  Several of the objects in our object model take
advantage of generics.  I was able to utilize generics in the consequences
by setting the Java language level to 1.5 in the
PackageBuilderConfiguration, however I would also like to optimize my rule
activations by using the concrete types in the conditions.  I'm assuming
this is not currently supported since I get the following error when I try
to specify the concrete type in the condition:
mismatched token: [EMAIL PROTECTED],1242:1242='<',<78>,30:15]; expecting type
LEFT_PAREN[30,45]

My working rule uses the following syntax:
rule "Test Generics"
when
Span () # 4.0: Can we use concrete type Span?
then
System.out.println("RULE: Matched Span()");
end

I would like to be able to specify the concrete type like this:
rule "Test Generics 2"
when
Span ()
then
System.out.println("RULE: Matched Span()");
end

Our object model uses the generic type "Span" heavily.  I am hoping that I
will be able to reduce the number of rule activations by specifying the
concrete type in the condition.

Any chance this will be available in the 4.0 general release?

Thanks!
Emily

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





--
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3529-6000
 Mobile: +55 11 9287-5646
 JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Time constrained rules

2007-07-06 Thread Edson Tirelli

  Jason,

  Yes, the engine does not see any change in TestObject until you call
update() for it.
  In your case, I would play that a bit different:

rule "remove objects older than 2 seconds"
when
   Clock( $cur : currentTime )
   $to : TestObject( creationTime < ( $cur - 2000 ) )
then
   System.out.println(new java.util.Date() + " = Retracting " +
$to);
   retract($to);
end

  This way you only need to update your clock object and not your
testObjects.

  []s
  Edson


2007/7/6, Jason Vasquez <[EMAIL PROTECTED]>:


Hi all,

I need a set of rules to fire on time-based criteria.  I have a
'Clock' object in working memory, along with an unknown number of
'TestObject's, each of which can report its 'age'.  At some interval,
I modify the Clock object in working memory, and then fire the
rules.  As a start (which I'm certain shouldn't work anyway), I'm
playing around with a rule like this:

rule "remove objects older than 2 seconds"
when
Clock()
$to : TestObject( ageInMillis > 2000 )
then
System.out.println(new java.util.Date() + " = Retracting "
+
$to);
retract($to);
end

It appears that the RHS is never executed, presumably because
TestObjects were not modified.  (I'm new to JBossRules, so I'm
unclear on that )

Alternatively, I could just remove the Clock() constraint and iterate
an external collection of TestObject's, marking each object as
modified.  Just looking for the best way here...

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






--
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3529-6000
 Mobile: +55 11 9287-5646
 JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Re: Fun with JAXB

2007-07-06 Thread Matt Geis
Ron,
If Castor doesn't work out for you, you could always go out on a limb and use 
retroweaver.  It uses allows you to write Java5 source that compiles to 1.4 
compatible bytecode.

http://retroweaver.sourceforge.net/

Matt




  

Shape Yahoo! in your own image.  Join our Network Research Panel today!   
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


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


[rules-users] Re: Fun with JAXB

2007-07-06 Thread Ronald R. DiFrango

All,

Castor works like a champ!

Ron

On 7/6/07, Matt Geis <[EMAIL PROTECTED]> wrote:


Ron,
If Castor doesn't work out for you, you could always go out on a limb and
use retroweaver.  It uses allows you to write Java5 source that compiles to
1.4 compatible bytecode.

http://retroweaver.sourceforge.net/

Matt





  

Shape Yahoo! in your own image.  Join our Network Research Panel today!
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7



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


Re: [rules-users] Time constrained rules

2007-07-06 Thread Jason Vasquez

Thanks Edison, that will do the trick.


On Jul 6, 2007, at 2:52 PM, Edson Tirelli wrote:



   Jason,

   Yes, the engine does not see any change in TestObject until you  
call update() for it.

   In your case, I would play that a bit different:

rule "remove objects older than 2 seconds"
when
Clock( $cur : currentTime )
$to : TestObject( creationTime < ( $cur - 2000 ) )
then
System.out.println(new java.util.Date() + " =  
Retracting " +

$to);
retract($to);
end

   This way you only need to update your clock object and not your  
testObjects.


   []s
   Edson




smime.p7s
Description: S/MIME cryptographic signature
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] toString

2007-07-06 Thread Mike D

Good morning.  I'm new to Drools and need a little assistance on how to
compare a string to a numeric.

Example:

ShipmentHeader transMode is a numeric, while the TransMode is a character. 
(We have a legacy system which we can't change... for now).  Is there an
easy way to do it w/o having to run an eval?


rule "00310 Fail"
when
#conditions
$status : SendToCustomsStatus()
exists ValidationReference(validationNo == 310) 
exists ValidationControl(validationNo == 310)   
exists ShipmentHeader(portLading == 0,$transMode : transMode)
TransMode(transMode == $transMode, portLadingRequired == "Y") 
then 
#actions
$status.fail(310);
end


Thanks,
Mike
-- 
View this message in context: 
http://www.nabble.com/toString-tf4029720.html#a11446453
Sent from the drools - user mailing list archive at Nabble.com.

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


Re: [rules-users] toString

2007-07-06 Thread Edson Tirelli

  Mike,

  Is the numeric value, the character code?
  I mean you have 65 == 'A', or something?

  I fixed today a few conversions between chars, numbers and strings... you
may want to try trunk and report back your results...

  http://jira.jboss.com/jira/browse/JBRULES-261

  []s
  Edson

2007/7/6, Mike D <[EMAIL PROTECTED]>:



Good morning.  I'm new to Drools and need a little assistance on how to
compare a string to a numeric.

Example:

ShipmentHeader transMode is a numeric, while the TransMode is a character.
(We have a legacy system which we can't change... for now).  Is there an
easy way to do it w/o having to run an eval?


rule "00310 Fail"
when
#conditions
$status : SendToCustomsStatus()
exists ValidationReference(validationNo == 310)
exists ValidationControl(validationNo == 310)
exists ShipmentHeader(portLading == 0,$transMode :
transMode)
TransMode(transMode == $transMode, portLadingRequired ==
"Y")
then
#actions
$status.fail(310);
end


Thanks,
Mike
--
View this message in context:
http://www.nabble.com/toString-tf4029720.html#a11446453
Sent from the drools - user mailing list archive at Nabble.com.

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





--
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3529-6000
 Mobile: +55 11 9287-5646
 JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Re: Missing package name for rule package.

2007-07-06 Thread Ronald R. DiFrango

Changed the loading order and now I get the following:

Exception in thread "main" java.lang.ExceptionInInitializerError
   at com.circuitcity.rtvcrms.test.MainBasedTester.testRules(
MainBasedTester.java:31)
   at com.circuitcity.rtvcrms.test.MainBasedTester.main(
MainBasedTester.java:23)
Caused by: java.lang.RuntimeException: Failure loading the Rules
   at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.(
RtvDecisionEngine.java:47)
   ... 2 more
Caused by: org.drools.rule.InvalidRulePackage: [1,0]: unknown:1:0 required
(...)+ loop (decision=2) did not match anything;
[EMAIL PROTECTED],0:6='created',<8>,1:0]
   at org.drools.rule.Package.checkValidity(Package.java:409)
   at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java
:262)
   at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.(
RtvDecisionEngine.java:43)
   ... 2 more

On 7/6/07, Ronald R. DiFrango <[EMAIL PROTECTED]> wrote:


I am getting the following exception all of a sudden:

Exception in thread "main" java.lang.ExceptionInInitializerError
at com.circuitcity.rtvcrms.test.MainBasedTester.testRules(
MainBasedTester.java:31)
at com.circuitcity.rtvcrms.test.MainBasedTester.main(
MainBasedTester.java:23)
Caused by: java.lang.RuntimeException: Failure loading the Rules
at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.(
RtvDecisionEngine.java:47)
... 2 more
Caused by: 
org.drools.compiler.PackageBuilder$MissingPackageNameException:Missing package 
name for rule package.
at org.drools.compiler.PackageBuilder.validatePackageName (
PackageBuilder.java:278)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java
:214)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(
PackageBuilder.java:147)
at com.circuitcity.rtvcrms.rules.RtvDecisionEngine .(
RtvDecisionEngine.java:40)
... 2 more


Here are my DRL files:

created on: Dec 7, 2006
package com.circuitcity.rtvcrms.rules

#list any import classes here.
import java.math.BigDecimal ;
import java.math.BigInteger;
import com.circuitcity.rtvcrms.bw.Constants;
import com.circuitcity.rtvcrms.bw.DocumentTypes;
import com.circuitcity.rtvcrms.bw.StatusConstants;

import com.circuitcity.rtvcrms.Adjustment ;
import com.circuitcity.rtvcrms.DetailLine;
import com.circuitcity.rtvcrms.EffectivePrice;
import com.circuitcity.rtvcrms.RepaymentCode;
import com.circuitcity.rtvcrms.MatchingOutput;

#declare any global variables here
global java.util.List matchedList;

rule "CM Qty EQ RTV Qty"
salience 10

when
cmDetailLine : DetailLine(cmNumber != null, lineNumber != null,
status != StatusConstants.MATCHED , cmRtvNumber : cmRtvNumber, cmBrand :
brand , cmModel : model, cmQuantity : availableQuantity  )
rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber ==
cmRtvNumber, lineNumber != null, status != StatusConstants.MATCHED , brand
== cmBrand, model == cmModel, availableQuantity == cmQuantity )
then
System.out.println(StatusConstants.MATCHED);

MatchingOutput output =
buildMatchingOutput(
rtvDetailLine.getBrand(),
rtvDetailLine.getClazz(),
cmDetailLine.getLineNumber(),
cmDetailLine.getCmNumber(),
(String)null, // defTag
rtvDetailLine.getEffectivePrice(),
(BigDecimal)null, // keyRecNo
rtvDetailLine.getItemCost(),
rtvDetailLine.getAvailableQuantity(),
rtvDetailLine.getModel (),
(String)null, // originalRepaymentCode
(BigDecimal)null, // rrLineNumber
rtvDetailLine.getLineNumber(),
rtvDetailLine.getRtvNumber(),
StatusConstants.MATCHED,
DocumentTypes.RTV_CM,
(String)null); // vendorNumber

matchedList.add(output);

cmDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY );
cmDetailLine.setStatus(StatusConstants.MATCHED);
rtvDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY);
rtvDetailLine.setStatus(StatusConstants.MATCHED);
end

rule "RNR Qty EQ RTV Qty"
salience 10

when
rnrDetailLine : DetailLine(keyRecNo != null, lineNumber != null,
status != StatusConstants.MATCHED, cmRtvNumber : cmRtvNumber, cmBrand :
brand , cmModel : model, cmQuantity : availableQuantity   )
rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber ==
cmRtvNumber, lineNumber != null, status != StatusConstants.MATCHED, brand
== cmBrand, model == cmModel, availableQuantity == cmQuantity )
then
System.out.println(StatusConstants.MATCHED);

MatchingOutput output =
buildMatchingOutput(
rtvDetailLine.getBrand(),
rtvDetailLine.getClazz (),
(BigDecimal)null, // cmDetailLine.getLineNumber(),
(String)null, // cmDetailLine.getCmNumber(),
(String)null, // defTag
rtvDetailL

[rules-users] Missing package name for rule package.

2007-07-06 Thread Ronald R. DiFrango

I am getting the following exception all of a sudden:

Exception in thread "main" java.lang.ExceptionInInitializerError
   at com.circuitcity.rtvcrms.test.MainBasedTester.testRules(
MainBasedTester.java:31)
   at com.circuitcity.rtvcrms.test.MainBasedTester.main(
MainBasedTester.java:23)
Caused by: java.lang.RuntimeException: Failure loading the Rules
   at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.(
RtvDecisionEngine.java:47)
   ... 2 more
Caused by: 
org.drools.compiler.PackageBuilder$MissingPackageNameException:Missing
package name for rule package.
   at org.drools.compiler.PackageBuilder.validatePackageName(
PackageBuilder.java:278)
   at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java
:214)
   at org.drools.compiler.PackageBuilder.addPackageFromDrl(
PackageBuilder.java:147)
   at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.(
RtvDecisionEngine.java:40)
   ... 2 more


Here are my DRL files:

created on: Dec 7, 2006
package com.circuitcity.rtvcrms.rules

#list any import classes here.
import java.math.BigDecimal;
import java.math.BigInteger;
import com.circuitcity.rtvcrms.bw.Constants;
import com.circuitcity.rtvcrms.bw.DocumentTypes;
import com.circuitcity.rtvcrms.bw.StatusConstants;

import com.circuitcity.rtvcrms.Adjustment;
import com.circuitcity.rtvcrms.DetailLine;
import com.circuitcity.rtvcrms.EffectivePrice;
import com.circuitcity.rtvcrms.RepaymentCode;
import com.circuitcity.rtvcrms.MatchingOutput;

#declare any global variables here
global java.util.List matchedList;

rule "CM Qty EQ RTV Qty"
   salience 10

   when
   cmDetailLine : DetailLine(cmNumber != null, lineNumber != null,
status != StatusConstants.MATCHED, cmRtvNumber : cmRtvNumber, cmBrand :
brand , cmModel : model, cmQuantity : availableQuantity  )
   rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber ==
cmRtvNumber, lineNumber != null, status != StatusConstants.MATCHED, brand ==
cmBrand, model == cmModel, availableQuantity == cmQuantity )
   then
   System.out.println(StatusConstants.MATCHED);

   MatchingOutput output =
   buildMatchingOutput(
   rtvDetailLine.getBrand(),
   rtvDetailLine.getClazz(),
   cmDetailLine.getLineNumber(),
   cmDetailLine.getCmNumber(),
   (String)null, // defTag
   rtvDetailLine.getEffectivePrice(),
   (BigDecimal)null, // keyRecNo
   rtvDetailLine.getItemCost(),
   rtvDetailLine.getAvailableQuantity(),
   rtvDetailLine.getModel(),
   (String)null, // originalRepaymentCode
   (BigDecimal)null, // rrLineNumber
   rtvDetailLine.getLineNumber(),
   rtvDetailLine.getRtvNumber(),
   StatusConstants.MATCHED,
   DocumentTypes.RTV_CM,
   (String)null); // vendorNumber

   matchedList.add(output);

   cmDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY);
   cmDetailLine.setStatus(StatusConstants.MATCHED);
   rtvDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY);
   rtvDetailLine.setStatus(StatusConstants.MATCHED);
end

rule "RNR Qty EQ RTV Qty"
   salience 10

   when
   rnrDetailLine : DetailLine(keyRecNo != null, lineNumber != null,
status != StatusConstants.MATCHED, cmRtvNumber : cmRtvNumber, cmBrand :
brand , cmModel : model, cmQuantity : availableQuantity   )
   rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber ==
cmRtvNumber, lineNumber != null, status != StatusConstants.MATCHED, brand ==
cmBrand, model == cmModel, availableQuantity == cmQuantity )
   then
   System.out.println(StatusConstants.MATCHED);

   MatchingOutput output =
   buildMatchingOutput(
   rtvDetailLine.getBrand(),
   rtvDetailLine.getClazz(),
   (BigDecimal)null, // cmDetailLine.getLineNumber(),
   (String)null, // cmDetailLine.getCmNumber(),
   (String)null, // defTag
   rtvDetailLine.getEffectivePrice(),
   rnrDetailLine.getKeyRecNo(), // keyRecNo
   rtvDetailLine.getItemCost(),
   rtvDetailLine.getAvailableQuantity(),
   rtvDetailLine.getModel(),
   (String)null, // originalRepaymentCode
   rnrDetailLine.getLineNumber(), // rrLineNumber
   rtvDetailLine.getLineNumber(),
   rtvDetailLine.getRtvNumber(),
   StatusConstants.MATCHED,
   DocumentTypes.RTV_RR,
   (String)null); // vendorNumber

   matchedList.add(output);

   rnrDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY);
   rnrDetailLine.setStatus(StatusConstants.MATCHED);
   rtvDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY);
   rtvDetailLine.setStatus(StatusConstants.MATCHED);
end

#created on: Apr 10, 2007
package com.circuitcity.rtvcrms.rules

#list any import classes here.
import java.math.BigDecimal;

import co

[rules-users] Re: Missing package name for rule package.

2007-07-06 Thread Ronald R. DiFrango

Please ignore this, I figured it out!

On 7/6/07, Ronald R. DiFrango <[EMAIL PROTECTED]> wrote:


Changed the loading order and now I get the following:

Exception in thread "main" java.lang.ExceptionInInitializerError
at com.circuitcity.rtvcrms.test.MainBasedTester.testRules(
MainBasedTester.java :31)
at com.circuitcity.rtvcrms.test.MainBasedTester.main(
MainBasedTester.java:23)
Caused by: java.lang.RuntimeException: Failure loading the Rules
at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.(
RtvDecisionEngine.java:47)
... 2 more
Caused by: org.drools.rule.InvalidRulePackage: [1,0]: unknown:1:0 required
(...)+ loop (decision=2) did not match anything;
[EMAIL PROTECTED],0:6='created',<8>,1:0]
at org.drools.rule.Package.checkValidity(Package.java:409)
at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java
:262)
at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.(
RtvDecisionEngine.java :43)
... 2 more

On 7/6/07, Ronald R. DiFrango <[EMAIL PROTECTED]> wrote:
>
> I am getting the following exception all of a sudden:
>
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at com.circuitcity.rtvcrms.test.MainBasedTester.testRules(
> MainBasedTester.java :31)
> at com.circuitcity.rtvcrms.test.MainBasedTester.main(
> MainBasedTester.java:23)
> Caused by: java.lang.RuntimeException: Failure loading the Rules
> at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.(
> RtvDecisionEngine.java:47)
> ... 2 more
> Caused by:
> org.drools.compiler.PackageBuilder$MissingPackageNameException: Missing
> package name for rule package.
> at org.drools.compiler.PackageBuilder.validatePackageName (
> PackageBuilder.java:278)
> at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java
> :214)
> at org.drools.compiler.PackageBuilder.addPackageFromDrl(
> PackageBuilder.java:147)
> at com.circuitcity.rtvcrms.rules.RtvDecisionEngine .(
> RtvDecisionEngine.java:40)
> ... 2 more
>
>
> Here are my DRL files:
>
> created on: Dec 7, 2006
> package com.circuitcity.rtvcrms.rules
>
> #list any import classes here.
> import java.math.BigDecimal ;
> import java.math.BigInteger;
> import com.circuitcity.rtvcrms.bw.Constants;
> import com.circuitcity.rtvcrms.bw.DocumentTypes;
> import com.circuitcity.rtvcrms.bw.StatusConstants;
>
> import com.circuitcity.rtvcrms.Adjustment ;
> import com.circuitcity.rtvcrms.DetailLine;
> import com.circuitcity.rtvcrms.EffectivePrice;
> import com.circuitcity.rtvcrms.RepaymentCode;
> import com.circuitcity.rtvcrms.MatchingOutput;
>
> #declare any global variables here
> global java.util.List matchedList;
>
> rule "CM Qty EQ RTV Qty"
> salience 10
>
> when
> cmDetailLine : DetailLine(cmNumber != null, lineNumber != null,
> status != StatusConstants.MATCHED , cmRtvNumber : cmRtvNumber, cmBrand :
> brand , cmModel : model, cmQuantity : availableQuantity  )
> rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber ==
> cmRtvNumber, lineNumber != null, status != StatusConstants.MATCHED ,
> brand == cmBrand, model == cmModel, availableQuantity == cmQuantity )
> then
> System.out.println(StatusConstants.MATCHED);
>
> MatchingOutput output =
> buildMatchingOutput(
> rtvDetailLine.getBrand(),
> rtvDetailLine.getClazz(),
> cmDetailLine.getLineNumber(),
> cmDetailLine.getCmNumber(),
> (String)null, // defTag
> rtvDetailLine.getEffectivePrice(),
> (BigDecimal)null, // keyRecNo
> rtvDetailLine.getItemCost(),
> rtvDetailLine.getAvailableQuantity(),
> rtvDetailLine.getModel (),
> (String)null, // originalRepaymentCode
> (BigDecimal)null, // rrLineNumber
> rtvDetailLine.getLineNumber(),
> rtvDetailLine.getRtvNumber(),
> StatusConstants.MATCHED,
> DocumentTypes.RTV_CM,
> (String)null); // vendorNumber
>
> matchedList.add(output);
>
> cmDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY );
> cmDetailLine.setStatus(StatusConstants.MATCHED);
> rtvDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY);
> rtvDetailLine.setStatus(StatusConstants.MATCHED);
> end
>
> rule "RNR Qty EQ RTV Qty"
> salience 10
>
> when
> rnrDetailLine : DetailLine(keyRecNo != null, lineNumber != null,
> status != StatusConstants.MATCHED, cmRtvNumber : cmRtvNumber, cmBrand :
> brand , cmModel : model, cmQuantity : availableQuantity   )
> rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber ==
> cmRtvNumber, lineNumber != null, status != StatusConstants.MATCHED,
> brand == cmBrand, model == cmModel, availableQuantity == cmQuantity )
> then
> System.out.println(StatusConstants.MATCHED);
>
> MatchingOutput output =
> bui