Daling Xu wrote:
> This explains the reason of the exception I ran into.
> Now my question is
> (1) Why BSFFunctions doesn't support the getObjectRegistry method?
Don't really know what the developers had in mind here.
> (2) How can I retrieve the bean objects from the ObjectRegiestry inside the script code?
You can't. The real reason is with the original authors, maybe Sanjiva,
if he reads this, could shed some light on this.
However there may be one (good) reason: security. One never can be sure
who writes which scripts. So for security reasons it makes sense to give
no one the ability to figure out what the ObjectRegistry holds. The Java
hosts (Java programs that dispatch scripts via BSF) would know what they
put into the registry for the scripts to interact/work with, so for the
scripts that would not really be a shortcoming. In the case that one
needs to make a collection of Java objects available to the scripts,
then one is able to register a collection object for the script.
P.S.: The nice thing about FOSS is that in the case that you really hit
a barrier you do not want to cope with, that you can go back to the
sources and enhance/change/tailor the code to your needs.