Restrict Certain Java Code in a Plug-in

杀马特。学长 韩版系。学妹 提交于 2020-01-03 04:44:08

问题


I am creating an application which uses the Java Plugin Framework to load plug-ins and integrate them into the program.

My question is: Is there any way to restrict certain operations (such as starting a new process) in the plug-ins? What I have in mind is something like Java WebStart, i.e when the application wants to access the FileSytem, the user is prompted whether or not to allow the action.

I was thinking of maybe creating a security manager and, if so, how can I do that?


回答1:


I suggest you look at these

http://www.google.co.uk/search?q=system+set+security+manager+example




回答2:


One question comes to my mind - why did you choose JPF and not Equinox? I was curious and looked at the JPF pages and it looks like the projects last update is two years ago.

They started the project to decouple the eclipse plugin framework of Eclipse 2.x but Eclipse itself moved to OSGi (Equinox) starting with version 3.0. Equinox has become the reference implementation of OSGi and there's a lot of good books available and even more excellent experts that can provide help on any aspect.

To my opinion: JPF was a good idea some years ago (just as the first implementations of a plug-in framework in early Eclipse releases) but the actual standard for a plug-in framework seems to be OSGi now.

Sure, that does not answer your question, but my message was just to long for a comment.

Here's a site that explains implementing security with Equinox (or at least gives some hints): http://www.eclipse.org/equinox/security/



来源:https://stackoverflow.com/questions/1184789/restrict-certain-java-code-in-a-plug-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!