Your object (as written) must be definstanced as static (see
http://herzberg.ca.sandia.gov/jess/docs/language.html)
If you want a "dynamic" bean to cause rules to fire etc., your object must
implement the usual bean event methods (ie. PropertyChangeListeners). Also,
please make sure you implement the event firing properly:
>From Ernest's previous post:
Two possibilities.
1) Jess only works properly if you write your PropertyChangeEvents
"correctly." The letter of the law is, according to the Java Beans
spec, that at the time the event is received, the property in the Bean
has already been changed. Jess depends on this. Unfortunately the most
convenient way to implement PropertyChangedEvents sets the Bean's
property AFTER the event is sent. Use a temporary variable to stash
the old value, then set the new one, then send the event.
2) If you've got that right, you might have used (defclass X static)
for some reason. The 'static' here implies that updated values will
only be fetched from a Bean at (reset) time.
Good luck!
alan
> -----Original Message-----
> From: Leo Ly [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 05, 2000 7:05 AM
> To: Jess-users
> Subject: JESS: Newby with a problem
>
>
> Good day everyone,
> I am a new jess user. I was trying to learn how to use
> Jess in Java
> off the Jess webpage. In section 4.6 (the jess.Funcall
> class), there is
> an example that teaches new users how to use the jess.Funcall
> class. I
> copied the example, and it works, but when i tried to use my own class
> (Event.java) instead of the button class in the
> java.awt.button, I got
> some weird error. Thank you in advance. Here is my code...
>
> package Test;
> import jess.*;
> import java.awt.Button;
>
> public class Main
> {
>
> public Main()
> {
> try
> {
> Rete engine = new Rete();
> engine.addUserpackage(new MiscFunctions());
> engine.addUserpackage(new jess.ReflectFunctions());
> Context con = engine.getGlobalContext();
> //Value myButton = new Value("button", RU.ATOM);
> Value aValue = new Value("event", RU.ATOM);
>
> Funcall f = new Funcall("batch", engine);
> f.add(new Value("jess/scriptlib.clp", RU.STRING));
> f.execute(con);
>
> /*
> f = new Funcall("defclass", engine);
> f.add(myButton).add(new Value("java.awt.Button", RU.ATOM));
> f.execute(con); */
> f = new Funcall("defclass", engine);
> f.add(aValue).add(new Value("Event", RU.ATOM));
> f.execute(con);
>
> f = new Funcall("definstance", engine);
> f.add(aValue);
> f.add(new Value(new Event("one", "two")));
> f.execute(con);
> //new Funcall("definstance", engine).arg(myButton).arg(new
> Value(new Button("Press Me!"))).execute(con);
> f = new Funcall("facts", engine);
> f.execute(con);
> }
> catch(JessException e)
> {
> System.out.println("error " + e);
> }
> }
> public static void main(String[] arg)
> {
> new Main();
> }
> }
>
> and the error....
>
> Jess reported an error in routine definstance while executing
> (definstance event
> <External-Address: Test.Event>).
> Message: Obj doesn't accept PropertyChangeListeners.
>
> My event class is just a class with three string instance
> variable and a
> constructor
> tha takes in two string parameters.
>
> Thank you for your patience
> Leo
>
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users
> [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list (use your own address!) List problems? Notify
> [EMAIL PROTECTED]
> ---------------------------------------------------------------------
>
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------