Hi Ariel,
Ariel Constenla-Haile wrote:
[thanks for the flowers on your previous mail :-) ]
Ehre, wem Ehre gebührt!
:)
as we have it in OOo Basic and ooRexx, here is in Java:
Thanks, great!
the output in Linux/SuSe is
Great, thank you for that as well!
in all the cases the "physical" LibraryContainer/Script [for example
user/basic/Standard/Module1.xba] seems to turns to
LibraryContainer.Script with getStorageURI()
* in OOo Basic
vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=application
turns to
file:///home/ariel/.openoffice.org2/user/Scripts/basic/Standard.Module1.Main
instead of
file:///home/ariel/.openoffice.org2/user/Scripts/basic/Standard/Module1.Main
* BeanShell
vnd.sun.star.script:HelloWorld.helloworld.bsh?language=BeanShell&location=share
file:///opt/openoffice.org2.4/program/../share/Scripts/beanshell/HelloWorld.helloworld.bsh
instead of ../share/Scripts/beanshell/HelloWorld/helloworld.bsh
* JavaScript
vnd.sun.star.script:HelloWorld.helloworld.js?language=JavaScript&location=share
file:///opt/openoffice.org2.4/program/../share/Scripts/javascript/HelloWorld.helloworld.js
instead of ../share/Scripts/javascript/HelloWorld/helloworld.js
* Java
vnd.sun.star.script:HelloWorld.HelloWorld.printHW?language=Java&location=share
file:///opt/openoffice.org2.4/program/../share/Scripts/java/HelloWorld.HelloWorld.printHW
instead of ../share/Scripts/java/HelloWorld/HelloWorld.printHW
The Python example may look special:
vnd.sun.star.script:pythonSamples|TableSample.py$createTable?language=Python&location=share
turns to
file:///opt/openoffice.org2.4/program/../share/Scripts/python/pythonSamples/TableSample.py$createTable
while the "real" location is
/opt/openoffice.org2.4/share/Scripts/python/pythonSamples/TableSample.py
The bottom line: I've no idea what rule it follows
* for using the dot instead of the slash
* for using "$" in the Python example instead of the point, as in
Standard.Module1.Main (instead of Standard.Module1$Main)
It seems to me that the dollar sign is just a delimiter between the file
name containing the Python code and the Python function that should be
run within that file.
Here is the output of running a Python script URL using the dot between
the root directory and the subdirectory where the Python script is located:
[vnd.sun.star.script:pythonSamples.TableSample.py$createTable?language=Python&location=share]:
file:///D:/Programme/OpenOffice.org%202.4/share/Scripts/oorexx/pythonSamples.TableSample.py$createTable
vnd.sun.star.script:pythonSamples.TableSample.py$createTable?language=ooRexx&location=share
Another good question I didn't try yet is: what are we allowed to do
with this storage URI? can it be used with UCB methods to access the
storage?
Well, it is helpful already to turn a script with a physical path into
the script URI OOo expects us to use.
I found this ScriptURIHelper looking for a better way to embedded Java
Archives (JARs) and Python scripts inside OOo documents, as the
Scripting Framework has left them alone [can ooRexx be also embedded
inside OOo docs.?].
Yes.
Currently I'm using the embed API
(http://api.openoffice.org/docs/common/ref/com/sun/star/embed/module-ix.html)
to store the JAR and the parcel descriptor.
Well, ooRexx is using the Java scripting framework of OOo, which is also
used for BeanShell or JavaScript (Rhino, the Java implementation by
Mozilla), if I am not mistaken. This framework will allow to create and
store scripts with "user", "share" or "document".
The ooRexx (written in C++) support uses the Java scripting framework
BSF (Bean Scripting Framework) from Apache, cf.
<http://jakarta.apache.org/bsf/>, which allows Java programs to easily
employ any of its supported scripting languages, and vice versa,
BSFEngine implementations may allow scripting languages to interact with
Java objects. So in essence this is what happens:
ooRexx-script <-> BSF4Rexx <-> OOo Scripting Framework <-> OOo
Again, the BSF framework is a Java framework and could be used to make
more scirpting languages available to OOo. The ooRexx support could
serve as a model for it.
Was thinking about offering/submitting a talk on the architecture and
what one could do with it for UNO/OOo for the OOo-Con, but am unsure
whether such a topic would be interesting for the attendees. (Although
it may be interesting for developers for learning how one would proceed
in order to add new scripting languages to OOo. Having all nuts and
bolts put on the table and learning how the parts play together could
help jump-start others.)
Another thing I didn't try is if/how the ScriptURIHelper works when the
script is located inside a document.
Just tested this: there will be an exception thrown, if you try to use
"document" as location. Currently the valid argument values for
"location" seem to be "user" and "share".
Regards,
---rony