|
From: Klaus N. <ji...@ra...> - 2002-01-21 19:09:21
|
Hi,
I am writing a Home Automation server in Java and would like to add some
scripting. There is no better choice than Python IMHO.
Basically the server contains a number of objects, each of which represents a
switch, relay, sensor, etc. I would then like for the user to be able to add
a Python script to each of these objects.
The scripts will be saved in a MYSQL database (possibly cached in the server
for speed) and when an object changes state the associated script be executed
by Jython in it's own thread, doing interactions with the home automation
state event process ("Sensor fired: Activate Foghorn Object") in the server
over a threadsafe synchronized event queue.
I would appreciate any thoughts on using Jython for scripting in such
embedded app (I am very new to Jython).
The best way to do it, thoughts? Are there examples out there?
Can Jython validate the code without executing it to give the user a chance to
correct superficial errors (e.g. syntax, semantics)?
Will the Jython machine make available errors of the interpretation I can
give to the user or put in a log (hmm, maybe it goes to the outputstream)?
What is the best way to make the script communicate with the underlying
Java-app (I understand there might be several)?
Best regards,
Klaus
|