|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
JESS: Obtaining an object from the application environmentI recently came across a problem that I can't solve using the
(excellent) Jess API.
I want to obtain an object (actually a DAO) from the
application that calls Jess
which then calls a user function.
A Java stack trace allows me to determine the class names but
not the class objects
of the classes that called Jess which then called the user
function.
(And I can't think of anything in the reflection package that
would give me an object.)
Other than using a static variable that contains the object
(or a suitable proxy),
the only way that I can see to solve the problem is to add the
object (or a proxy)
to the Jess working memory.
(Registering the application, for example with a userID, would
still require
a token to be added to working memory.)
I suspect that this must be common problem in large
systems
but I can't find anything in the Jess API that will give me an
appropriate handle.
Any suggestions would be appreciated.
Thanks
David Scuse
Department of Computer Science
University of Manitoba
|
|
|
Re: JESS: Obtaining an object from the application environmentIf the Java caller can supply the object, you could simply put it into
a Variable, put the Variable into the jess.Context and call a Jess function to pass that object to the function. Alternatively there are the Rete store() and fetch() methods for passing things in/out of the engine. But if the Java code can't or won't supply the object deliberately, this is pretty much the same problem as doing this from Java code, without Jess involved at all -- that is to say, not possible, as far as I know (except by using extreme measures like the Java VM debugger interface). On Jul 29, 2009, at 11:26 AM, David Scuse wrote: > I recently came across a problem that I can't solve using the > (excellent) Jess API. > > I want to obtain an object (actually a DAO) from the application > that calls Jess > which then calls a user function. > > A Java stack trace allows me to determine the class names but not > the class objects > of the classes that called Jess which then called the user function. > (And I can't think of anything in the reflection package that would > give me an object.) > > Other than using a static variable that contains the object (or a > suitable proxy), > the only way that I can see to solve the problem is to add the > object (or a proxy) > to the Jess working memory. > (Registering the application, for example with a userID, would still > require > a token to be added to working memory.) > > I suspect that this must be common problem in large systems > but I can't find anything in the Jess API that will give me an > appropriate handle. > Any suggestions would be appreciated. > > Thanks > > David Scuse > Department of Computer Science > University of Manitoba --------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences Phone: (925) 294-2154 Sandia National Labs PO Box 969, MS 9012 ejfried@... Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
|
|
Re: JESS: Obtaining an object from the application environmentThanks Ernest, I had forgotten about the store/fetch combination.
That is slightly nicer than using the rete.add(object) method (which involves locating the object). David ----- Original Message ----- From: "Ernest Friedman-Hill" <ejfried@...> To: "jess-users" <jess-users@...> Sent: Wednesday, July 29, 2009 10:47 AM Subject: Re: JESS: Obtaining an object from the application environment > If the Java caller can supply the object, you could simply put it into > a Variable, put the Variable into the jess.Context and call a Jess > function to pass that object to the function. Alternatively there are > the Rete store() and fetch() methods for passing things in/out of the > engine. > > But if the Java code can't or won't supply the object deliberately, > this is pretty much the same problem as doing this from Java code, > without Jess involved at all -- that is to say, not possible, as far > as I know (except by using extreme measures like the Java VM debugger > interface). > -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
| Free embeddable forum powered by Nabble | Forum Help |