[rules-users] Trouble with insertlogical

2008-03-19 Thread XIAOTAO

Hi,

i modified the shopping example from drool 4.0.4 example downloaded from jboss 
website in order to have a better understanding of insertlogical.

the rule is as follows

package org.drools.examples

dialect mvel

import org.drools.examples.ShoppingExample.Customer
import org.drools.examples.ShoppingExample.Product
import org.drools.examples.ShoppingExample.Purchase
import org.drools.examples.ShoppingExample.Discount

rule Purchase notification
salience 10

when
$c : Customer()
$p : Purchase( customer == $c)  
then
System.out.println( Customer  + $c.name +  just purchased  + 
$p.product.name );
end  

rule Discount removed notification
when
$c : Customer()
not Discount( customer == $c )
then
$c.discount = 0 ;
System.out.println( Customer  + $c.name +  now has a 
discount of  + $c.discount );
end

rule Discount awarded notification
when
$c : Customer()
$d : Discount( customer == $c )
then
System.out.println( Customer  + $c.name +  now has a 
discount of  + $d.amount );
end

rule Apply 10% discount if total purcahses is over 100
no-loop true
dialect java
when
$c : Customer()
$i : Double(doubleValue  100) from accumulate ( Purchase( 
customer == $c, $price : product.price ), 

sum( $price ) )
then
$c.setDiscount( 10 );
insertLogical( new Discount($c, 10) );  
System.out.println( Customer  + $c.getName() +  now has a 
shopping total of  + $i );
end




my java lanucher

package org.drools.examples;

import java.io.InputStreamReader;

import org.drools.FactHandle;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.StatefulSession;
import org.drools.audit.WorkingMemoryFileLogger;
import org.drools.compiler.PackageBuilder;

public class ShoppingExample {

public static final void main(String[] args) throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( 
ShoppingExample.class.getResourceAsStream( Shopping.drl ) ) );

final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( builder.getPackage() );

final StatefulSession session = ruleBase.newStatefulSession();

final WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger( 
session );
logger.setFileName( log/shoppingExample );

Customer mark = new Customer( mark,
  0 );
session.insert( mark );

Product shoes = new Product( shoes,
 900 );
session.insert( shoes );

Product hat = new Product( hat,
   160 );
session.insert( hat );

session.insert( new Purchase( mark,
  shoes ) );
session.insert( new Purchase( mark,
hat ) );
session.fireAllRules();

Product pent = new Product(pent, 100);
session.insert(new Purchase(mark, pent));

System.out.println( Customer mark also buy the pent );
session.fireAllRules();

logger.writeToDisk();
}

public static class Customer {
private String name;

private int discount;

public Customer(String name,
int discount) {
this.name = name;
this.discount = discount;
}

public String getName() {
return name;
}

public int getDiscount() {
return discount;
}

public void setDiscount(int discount) {
this.discount = discount;
}
   
}

public static class Discount {
private Customer customer;
private int amount;

public Discount(Customer customer,
int amount) {
this.customer = customer;
this.amount = amount;
}

public Customer getCustomer() {
return customer;
}

public int getAmount() {
return amount;
}

}

public static class Product {
private String name;
private float price;

public Product(String name,
   float price) {
this.name = name;
this.price = price;
}

public String getName() {
return name;
}

public float getPrice() {
return price;
}


}

public static class Purchase {

[rules-users] Uploading the fact model to the DRools BRMS

2008-03-19 Thread Felbecker, Tobias
Hi, I fixed the Problem.

First I got rid of the Error 

[STDOUT] ERROR 16-01 11:42:25,609 (Contexts.java:flushAndDest
royContexts:335) could not discover transaction status ...
 
by editing the web.xml of drools-jbrms ear. I found that earlier in this
list. 
After that my exception changed into 

java.lang.UnsupportedClassVersionError: Bad version number in .class
file  

So I created my jars with some different Java versions and with jdk 1.6
the exception was gone. I don't why this is, cause drools and JBoss
should work with 1.5.

Cheers Tobi




Message: 2
Date: Tue, 18 Mar 2008 18:11:31 +0100
From: Felbecker, Tobias [EMAIL PROTECTED]
Subject: 
To: rules-users@lists.jboss.org
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii

Hi ,

I got the same problem and wonder if there is a solution for that yet.
I'am using 

JBOSS: AS 4.2.2 GA
DBMR: 4.0.4
JAVA: 1.5.0_15

After uploading the jar, editing the import in the package configuration
and  finally validating the package I get the following exception:

java.lang.reflect.InvocationTargetException at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at
org.jboss.seam.util.Reflections.invoke(Reflections.java:21) at.

The import statement should and the packaging of the jar file seems to
be correct. Otherwise there would be a Class not found error but no
exception.
I tried all kinds of packaging: binaries, source and binaries, creating
the jar through eclipse and from cmd.

This is my very simple java class:

package test;

public class MyBean{


public MyBean(){
}

private int number;

public int getNumber() {
return number;
}

public void setNumber(int number) {
this.number = number;
}
}

 Cheers Tobi





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


[rules-users] JBoss Drools - Version 4.0.5

2008-03-19 Thread Fernando Meyer
We just released Drools v4.0.5. This is a minor release with a few
improvements on existing features and some bug fixes.

Release Notes - JBoss Drools - Version 4.0.5

We would like to really thanks all the contributors that helped on getting
this release out. From those contributing patches and docs, to those testing
and reporting bugs and providing feedback. The list is a bit long to post
all names here and I may incur in a mistake forgetting someone, so our open
public thank you to you all!

Follows the release notes.
Release Notes - JBoss Drools - Version 4.0.5

Bug

   - [JBRULES-1286 http://jira.jboss.com/jira/browse/JBRULES-1286] -
   Incorrect information in section 2.5.7.3. Agenda Filters
   - [JBRULES-1315 http://jira.jboss.com/jira/browse/JBRULES-1315] -
   Rule that uses a 'collect' and 'from' clause together causes problem
   - [JBRULES-1327 http://jira.jboss.com/jira/browse/JBRULES-1327] -
   drools-ant task and java.lang.ClassCastException:
   org.drools.reteoo.ReteooRuleBase
   - [JBRULES-1329 http://jira.jboss.com/jira/browse/JBRULES-1329] -
   RuleBase.removeRule() prevents other rules from being applied
   - [JBRULES-1330 http://jira.jboss.com/jira/browse/JBRULES-1330] -
   Using RuleBase in multithread application server environment
   - [JBRULES-1357 http://jira.jboss.com/jira/browse/JBRULES-1357] -
   RuleBuildContext does not initialize package of rule
   - [JBRULES-1388 http://jira.jboss.com/jira/browse/JBRULES-1388] -
   Eval error when using multiple declarations
   - [JBRULES-1389 http://jira.jboss.com/jira/browse/JBRULES-1389] -
   using eval after using or causes ClassCastException
   - [JBRULES-1392 http://jira.jboss.com/jira/browse/JBRULES-1392] -
   Rules behave incorrectly (randomly) in multi-threaded environment
   - [JBRULES-1414 http://jira.jboss.com/jira/browse/JBRULES-1414] -
   Cannot build from source -- missing directory or pom file
   - [JBRULES-1415 http://jira.jboss.com/jira/browse/JBRULES-1415] -
   Certain uses of from causes NullPointerException in WorkingMemoryLogger
   - [JBRULES-1423 http://jira.jboss.com/jira/browse/JBRULES-1423] -
   ObjectFactory$ObjectEqualsComparator.equals throws NPE if second arg is null
   - [JBRULES-1426 http://jira.jboss.com/jira/browse/JBRULES-1426] -
   NPE in ObjectFactory$ObjectEqualsComparator
   - [JBRULES-1428 http://jira.jboss.com/jira/browse/JBRULES-1428] -
   ClassCastException when comparing BigDecimal fields
   - [JBRULES-1429 http://jira.jboss.com/jira/browse/JBRULES-1429] -
   NPE in ObjectEqualsComparator
   - [JBRULES-1435 http://jira.jboss.com/jira/browse/JBRULES-1435] -
   NPE if rule checks a Long field for null, and a fact is passed in with Long
   field that is NOT null.
   - [JBRULES-1436 http://jira.jboss.com/jira/browse/JBRULES-1436] -
   Filescanner throws NPE when there's a compile error.
   - [JBRULES-1446 http://jira.jboss.com/jira/browse/JBRULES-1446] -
   ClassCastException when iterating over an array using from
   - [JBRULES-1447 http://jira.jboss.com/jira/browse/JBRULES-1447] -
   Parser error when using keyword operators
   - [JBRULES-1448 http://jira.jboss.com/jira/browse/JBRULES-1448] -
   MVELDataProver throws nullpointer on null return value from expression
   - [JBRULES-1451 http://jira.jboss.com/jira/browse/JBRULES-1451] -
   LHS expression comparing a Boolean to a String does not fail but always
   returns true
   - [JBRULES-1456 http://jira.jboss.com/jira/browse/JBRULES-1456] - Or
   using DSL language
   - [JBRULES-1459 http://jira.jboss.com/jira/browse/JBRULES-1459] -
   parser/scanner bug: unterminated literal
   - [JBRULES-1464 http://jira.jboss.com/jira/browse/JBRULES-1464] -
   Comilation error : 'Syntax error on token ,, delete this token' when
   referencing a global in an accumulate block
   - [JBRULES-1467 http://jira.jboss.com/jira/browse/JBRULES-1467] -
   Concurrency errors when parsing strings to dates in rules
   - [JBRULES-1472 http://jira.jboss.com/jira/browse/JBRULES-1472] -
   Problem when mixing alpha and beta constraints in a composite constraint
   - [JBRULES-1477 http://jira.jboss.com/jira/browse/JBRULES-1477] -
   User exception thrown from inside a rule always causes a stackTrace to
   console
   - [JBRULES-1479 http://jira.jboss.com/jira/browse/JBRULES-1479] -
   Exception compiling rules
   - [JBRULES-1480 http://jira.jboss.com/jira/browse/JBRULES-1480] -
   Potential multithreaded problem in MVELClassFieldExtractor
   - [JBRULES-1481 http://jira.jboss.com/jira/browse/JBRULES-1481] -
   Stop actionQueue recursion in working memory
   - [JBRULES-1482 http://jira.jboss.com/jira/browse/JBRULES-1482] -
   Bug with ReeteoRuleBase and merged package
   - [JBRULES-1487 http://jira.jboss.com/jira/browse/JBRULES-1487] -
   access to store property in MapBackedClassLoader should be synchronized
   - [JBRULES-1489 http://jira.jboss.com/jira/browse/JBRULES-1489] -
   Working Memory deserialization causes NPE
   - [JBRULES-1490 http://jira.jboss.com/jira/browse/JBRULES-1490] 

[rules-users] Atlanta area contact?

2008-03-19 Thread Benjamin McMillan
Hi all,

 

Is anyone involved in (as in, an actual dev or lead) Drools residing in
the Atlanta area, by any chance?

 

Thanks,

Benjamin J McMillan | Application Development Analyst
Software Research Center
Aflac Incorporated

Tel: 770-448-9823 x. 8964 | Fax: 770-448-4770
3720 DaVinci Court, Suite 225, Norcross GA 30092

[EMAIL PROTECTED] | aflac.com

This e-mail and any attachments may contain confidential information
intended solely for the use of the addressee. If the reader of this
message is not the intended recipient, any distribution, copying, or use
of this e-mail or its attachments is prohibited.  If you received this
message in error, please notify the sender immediately by e-mail and
delete this message and any copies.  Thank you
Confidentiality Notice: 
This e-mail and any attachments may contain confidential information intended 
solely for the use of the addressee.  If the reader of this message is not the 
intended recipient, any distribution, copying, or use of this e-mail or its 
attachments is prohibited.  If you received this message in error, please 
notify the sender immediately by e-mail and delete this message and any copies. 
Thank you.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Atlanta area contact?

2008-03-19 Thread Edson Tirelli
   Nope, but I there are a couple consultants in USA that I think are in
Atlanta area... Jeff and Paul I think...
   Join the IRC and talk to Mark (conan).. he can point you in the right
direction.

  []s
  Edson

2008/3/19, Benjamin McMillan [EMAIL PROTECTED]:

   Hi all,



 Is anyone involved in (as in, an actual dev or lead) Drools residing in
 the Atlanta area, by any chance?



 Thanks,

 Benjamin J McMillan | Application Development Analyst
 Software Research Center
 *Aflac Incorporated*

 Tel: 770-448-9823 x. 8964 | Fax: 770-448-4770
 3720 DaVinci Court, Suite 225, Norcross GA 30092

 [EMAIL PROTECTED] | aflac.com

 This e-mail and any attachments may contain confidential information
 intended solely for the use of the addressee. If the reader of this message
 is not the intended recipient, any distribution, copying, or use of this
 e-mail or its attachments is prohibited.  If you received this message in
 error, please notify the sender immediately by e-mail and delete this
 message and any copies.  Thank you


   Confidentiality Notice:
  This e-mail and any attachments may contain confidential information
 intended solely for the use of the addressee.  If the reader of this message
 is not the intended recipient, any distribution, copying, or use of this
 e-mail or its attachments is prohibited.  If you received this message in
 error, please notify the sender immediately by e-mail and delete this
 message and any copies. Thank you.

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




-- 
  Edson Tirelli
  JBoss Drools Core Development
  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] Atlanta area contact?

2008-03-19 Thread Mark Proctor

Benjamin McMillan wrote:


Hi all,

 

Is anyone involved in (as in, an actual dev or lead) Drools residing 
in the Atlanta area, by any chance?



Burrr Sutter, in CC, is an organiser of the ATL JUGs - I beleive.


 


Thanks,

Benjamin J McMillan | Application Development Analyst
Software Research Center
**Aflac Incorporated**

Tel: 770-448-9823 x. 8964 | Fax: 770-448-4770
3720 DaVinci Court, Suite 225, Norcross GA 30092

[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] | aflac.com

This e-mail and any attachments may contain confidential information 
intended solely for the use of the addressee. If the reader of this 
message is not the intended recipient, any distribution, copying, or 
use of this e-mail or its attachments is prohibited.  If you received 
this message in error, please notify the sender immediately by e-mail 
and delete this message and any copies.  Thank you


 


Confidentiality Notice:
This e-mail and any attachments may contain confidential information 
intended solely for the use of the addressee.  If the reader of this 
message is not the intended recipient, any distribution, copying, or 
use of this e-mail or its attachments is prohibited.  If you received 
this message in error, please notify the sender immediately by e-mail 
and delete this message and any copies. Thank you.



___
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