restricting package access in loaded code

G

Graham Matthews

Hi

I am writing an app which has a plugin architecture. I have split my apps
classes into two packages, core and sdk. Plugins that other people write
are welcome to use the classes in the sdk package, but should not use
the classes in the core package.

At present someone can write a plugin and declare it to be in package
core, and hence access code that I do not wish them to access.

So how do I enforce this separation? I have been looking at the
security manager class, and the checkPackageAccess() and
checkPackageDefinition() methods. But it's all kinda mysterious and
I haven't made much progress.

Can anyone point me at a resource to show me how to dynamically
restrict package access in the way I wish.

thanks
graham
 
C

Chris Smith

Graham said:
At present someone can write a plugin and declare it to be in package
core, and hence access code that I do not wish them to access.

So how do I enforce this separation? I have been looking at the
security manager class, and the checkPackageAccess() and
checkPackageDefinition() methods. But it's all kinda mysterious and
I haven't made much progress.

Google for sealed packages. That does exactly what you want. You can
seal the core package to prevent additional classes from being added.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

rio

Joined
Aug 16, 2006
Messages
1
Reaction score
0
Hi Graham,

Did you find a way to solve your problem. I think I have the same
question here. Imo Chris went 2 steps ahead by advising his solution.

What my problem is that I want to restrict certain packages (imported ones)
to access any(also public) methods or members of classes than run within
the same JVM.

Is that possible? How? You have any code snappets?

Thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top