It's very easy. See

http://www.jessrules.com/jess/docs/71/library.html#jess.Jesp

Follow the first example, but use a StringReader instead of the FileReader.


On Oct 23, 2009, at 10:28 PM, Andrew Meng wrote:


Thanks a lot for the quick reply!

As a workaround, I did copy the xxx.clp over to the remote machine.



However I want to make a generic remote worker who just takes a task from JavaSpace and execute task.execute(). My task is like:



class task{

 ...

public Object execute(){

   ...

   engine.batch("xxx.clp");

   if (engine.run() > 1) { does something and return}

}

}


Yes, I can read the xxx.clp into a string as a part of the task object which will be serialized to the remote host by RMI. After reading Jesp API and JIA book, I still could not figure out the Jesp syntax to do what I want to do.



Can you please elaborate more?



Thanks a lot,

Andrew


From: [email protected]
To: [email protected]
Subject: Re: JESS: How to load a rule file in a remote RMI client.
Date: Fri, 23 Oct 2009 20:46:09 -0400

If you want a process on a remote machine to open a file by name, then
of course you'd need to transmit the file. But you can instead read
the file into a String and send the String around; then use a
StringReader and the jess.Jesp class to run the code on the remote
machines (see the Jess manual on how to use jess.Jesp to parse Jess
code.)


On Oct 18, 2009, at 10:41 PM, ameng wrote:


Hello,

I am trying to integrate Jess with JavaSpace(RMI). Tasks(running
rete.batch("rule.clp")) put into a JavaSpace got following
exception on
the remote machine:

Jess reported an error in routine batch.
Message: Cannot open file.
at jess.Batch.findDocument(Batch.java:221)
at jess.Batch.batch(Batch.java:122)
at jess.Batch.batch(Batch.java:113)
at jess.Batch.batch(Batch.java:75)
at jess.Batch.batch(Batch.java:40)
at jess.Rete.batch(Rete.java:2791)

What are the options here to pass the rules file to remote rete
engine?

Thanks a lot,
Andrew
--
View this message in context: 
http://www.nabble.com/How-to-load-a-rule-file-in-a-remote-RMI-client.-tp25952603p25952603.html
Sent from the Jess mailing list archive at Nabble.com.



--------------------------------------------------------------------
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]
.
--------------------------------------------------------------------

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







--------------------------------------------------------------------
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]

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







--------------------------------------------------------------------
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].
--------------------------------------------------------------------

Reply via email to