From: Seabloom, J. <jo...@ai...> - 2002-03-13 16:27:19
|
Hello all, I'm working to embed jython within an in-house distributed java application. I'm really looking to solve two major problems and haven't come to any answers from looking over the javadoc or the source code. - I need a hook into the import functionality of the interpreter. We store scripts in JAR files that are 'hot-pluggable' into a running system, so when interpreting a python script that imports another module, I would like to be able to handle such an event so that I may look through these 'hot-pluggable' JAR files instead of relying on the sys.path or PYTHONPATH variables. - I would also like to expose some python functions into the global namespace of any executed python script. These functions are actually implemented in Java and provide some app-specific functionality to the python environment. The only way I've been able to accomplish this so far is to write a Java class to implement the functions via methods, and then insert the Java class as PyJavaInstance in the globals dictionary passed into the PythonInterpreter constructor. This has the side effect of requiring syntax of the nature : THE_APP.functionName() Where 'THE_APP' is the name I used to register the object in the globals dictionary. Where I would prefer syntax like: functionName() That is it. I've solved these problems with Rhino and JavaScript, but the javadoc provided with the rhino interpreter is much more complete than the Jython javadoc. Thank you to everyone ahead of time for you help. Josh Seabloom Applied Innovation |