Virgo + ConditionalPermissionAdmin question [message #936603] |
Mon, 08 October 2012 06:28 |
E S Messages: 2 Registered: October 2012 |
Junior Member |
|
|
Greetings!
I need to change my application bundles permissions on the fly. I'm trying to use ConditionalPermissionAdmin inside the BundleListener in following way:
@Component
public class PermissionBundleListener implements BundleListener, InitializingBean {
@Autowired
private BundleContext bundleContext;
@Autowired
private ConditionalPermissionAdmin condPermissionAdmin;
public void afterPropertiesSet() throws Exception {
bundleContext.addBundleListener(this);
}
public void bundleChanged(BundleEvent event) {
if (event.getType() != BundleEvent.INSTALLED) {
return;
}
if (!isMyBundle(event)) {
return;
}
String location = event.getBundle().getLocation();
PermissionInfo[] permissionInfos = new PermissionInfo[1];
permissionInfos[0] = new PermissionInfo(PackagePermission.class.getName(), "org.osgi.*",
PackagePermission.IMPORT);
ConditionInfo[] conditionInfos = new ConditionInfo[1];
conditionInfos[0] = new ConditionInfo(BundleLocationCondition.class.getName(), new String[] { location });
ConditionalPermissionUpdate update = condPermissionAdmin.newConditionalPermissionUpdate();
List<ConditionalPermissionInfo> infos = update.getConditionalPermissionInfos();
infos.clear();
infos.add(condPermissionAdmin.newConditionalPermissionInfo("deny.import.org.osgi", conditionInfos,
permissionInfos, ConditionalPermissionInfo.DENY));
update.commit();
}
private boolean isMyBundle(BundleEvent event) {
return true;
}
}
But this doesnt help. Bundles are still able to Import org.osgi.*
What I'm doing wrong?
Thanks!
PS
I have read this thread http://www.eclipse.org/forums/index.php/t/279813/ and start virgo with mentioned properties.
I use Virgo 3.0.1.
[Updated on: Mon, 08 October 2012 06:46] Report message to a moderator
|
|
|
|
Re: Virgo + ConditionalPermissionAdmin question [message #936683 is a reply to message #936620] |
Mon, 08 October 2012 08:17 |
E S Messages: 2 Registered: October 2012 |
Junior Member |
|
|
Borislav, thank you for fast response!
I tried to deploy the same bundles into virgo-tomcat-350. The result is the same.
BTW vts-350 starts with out additional configuration in dmk.sh (vts-301 doesn't). Implementation of ConditionalPermissionsAdmin I obtain is org.eclipse.osgi.internal.permadmin.SecurityAdmin
Do you have any ideas?
Thanks in advance
[Updated on: Mon, 08 October 2012 08:32] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04295 seconds