>we are currently trying to use Jython to give users the possibility to
>enter python scripts to automate some steps in a Java application we are
>developing. We want to provide the users an API with Java Classes. But we
>want to restrict the user that he can only use these public Classes from
Just to make sure that I understand: you want to add further
restrictions than the normal java access modifiers. Your java classes
have public methods which you do *not* want the users to call. Right?
How would your application decide which methods to restrict? Do you
expect this feature to be truely secure? Or is it mainly a way of hiding
unwanted methods from eyes of the casual user?
>For this we first set Options.respectJavaAccessibility to true.
As you note later, a hook into the access check should not be tied
together with the respectJavaAccessibility flag. It is two different
>be able to restrict the user to the API the introduced a new interface
>JavaAccessInterceptor and made some small changes to class PyJavaClass.
>Mainly a new method setJavaAccessInterceptor(JavaAccessInterceptor
>anInterceptor) to set an interceptor and a call of the interceptor in the
>methods getAccessibleConstructors, getAccessibleFields and
I don't like the patch in its current form. Setting an intercepter is
too global and the java API (PyJavaClass.setJavaAccessInterceptor)
I think the java API should set the interceptor on the PySystemState
instance. That should be the right place for this kind of information
and it will allow an independent system state to run without an
interceptor or with a different interceptor.
>I did this changes in the python version 2.0. but I think it is also
>possible in the version 2.1a3.
>We think the change can be useful for other jython users and would like if
>you are able to ingrate the changes or provide something similar.
>What do you think about this ?
If there are others that could use such a feature, please raise your
>Probably it would be better to call the interceptor also in the case when
>Options.respectJavaAccessibility is set to false.....