From: Mathieu Baudier Date: Sat, 9 Mar 2024 11:08:36 +0000 (+0100) Subject: Remove dependency to OSGi Configuration API X-Git-Tag: v2.3.28~17 X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=19c1f40db3d956391bb658b93cd76b9a698e4c1c Remove dependency to OSGi Configuration API --- diff --git a/org.argeo.cms/bnd.bnd b/org.argeo.cms/bnd.bnd index a183784c1..bcba7939e 100644 --- a/org.argeo.cms/bnd.bnd +++ b/org.argeo.cms/bnd.bnd @@ -1,7 +1,6 @@ Bundle-Activator: org.argeo.cms.internal.osgi.CmsActivator Import-Package: \ -org.osgi.*;version=0.0.0,\ * Export-Package:\ diff --git a/org.argeo.cms/src/org/argeo/cms/internal/osgi/CmsOsgiLogger.java b/org.argeo.cms/src/org/argeo/cms/internal/osgi/CmsOsgiLogger.java index 5fc6fcb4f..6da1cdd8a 100644 --- a/org.argeo.cms/src/org/argeo/cms/internal/osgi/CmsOsgiLogger.java +++ b/org.argeo.cms/src/org/argeo/cms/internal/osgi/CmsOsgiLogger.java @@ -9,7 +9,6 @@ import org.argeo.cms.runtime.DirectoryConf; import org.osgi.framework.Bundle; import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.ConfigurationAdmin; import org.osgi.service.log.LogEntry; import org.osgi.service.log.LogLevel; import org.osgi.service.log.LogListener; @@ -92,9 +91,9 @@ public class CmsOsgiLogger implements LogListener { Object cn = sr.getProperty(CmsConstants.CN); if (cn != null) sb.append(" " + CmsConstants.CN + ": " + cn); - Object factoryPid = sr.getProperty(ConfigurationAdmin.SERVICE_FACTORYPID); - if (factoryPid != null) - sb.append(" " + ConfigurationAdmin.SERVICE_FACTORYPID + ": " + factoryPid); +// Object factoryPid = sr.getProperty(ConfigurationAdmin.SERVICE_FACTORYPID); +// if (factoryPid != null) +// sb.append(" " + ConfigurationAdmin.SERVICE_FACTORYPID + ": " + factoryPid); // else { // Object servicePid = sr.getProperty(Constants.SERVICE_PID); // if (servicePid != null) diff --git a/org.argeo.cms/src/org/argeo/cms/internal/osgi/SecurityProfile.java b/org.argeo.cms/src/org/argeo/cms/internal/osgi/SecurityProfile.java index 7055538c3..ae29bd930 100644 --- a/org.argeo.cms/src/org/argeo/cms/internal/osgi/SecurityProfile.java +++ b/org.argeo.cms/src/org/argeo/cms/internal/osgi/SecurityProfile.java @@ -13,7 +13,6 @@ import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.ServicePermission; -import org.osgi.service.cm.ConfigurationPermission; import org.osgi.service.condpermadmin.BundleLocationCondition; import org.osgi.service.condpermadmin.ConditionInfo; import org.osgi.service.condpermadmin.ConditionalPermissionAdmin; @@ -125,20 +124,22 @@ public interface SecurityProfile { // DS Bundle dsBundle = findBundle("org.eclipse.equinox.ds"); - update.getConditionalPermissionInfos().add(permissionAdmin.newConditionalPermissionInfo(null, - new ConditionInfo[] { new ConditionInfo(BundleLocationCondition.class.getName(), - new String[] { dsBundle.getLocation() }) }, - new PermissionInfo[] { new PermissionInfo(ConfigurationPermission.class.getName(), "*", "configure"), - new PermissionInfo(AdminPermission.class.getName(), "*", "*"), - new PermissionInfo(ServicePermission.class.getName(), "*", "get"), - new PermissionInfo(ServicePermission.class.getName(), "*", "register"), - new PermissionInfo(PropertyPermission.class.getName(), "osgi.*", "read"), - new PermissionInfo(PropertyPermission.class.getName(), "xml.*", "read"), - new PermissionInfo(PropertyPermission.class.getName(), "equinox.*", "read"), - new PermissionInfo(RuntimePermission.class.getName(), "accessDeclaredMembers", null), - new PermissionInfo(RuntimePermission.class.getName(), "getClassLoader", null), - new PermissionInfo(ReflectPermission.class.getName(), "suppressAccessChecks", null), }, - ConditionalPermissionInfo.ALLOW)); + update.getConditionalPermissionInfos() + .add(permissionAdmin.newConditionalPermissionInfo(null, + new ConditionInfo[] { new ConditionInfo(BundleLocationCondition.class.getName(), + new String[] { dsBundle.getLocation() }) }, + new PermissionInfo[] { + new PermissionInfo("org.osgi.service.cm.ConfigurationPermission", "*", "configure"), + new PermissionInfo(AdminPermission.class.getName(), "*", "*"), + new PermissionInfo(ServicePermission.class.getName(), "*", "get"), + new PermissionInfo(ServicePermission.class.getName(), "*", "register"), + new PermissionInfo(PropertyPermission.class.getName(), "osgi.*", "read"), + new PermissionInfo(PropertyPermission.class.getName(), "xml.*", "read"), + new PermissionInfo(PropertyPermission.class.getName(), "equinox.*", "read"), + new PermissionInfo(RuntimePermission.class.getName(), "accessDeclaredMembers", null), + new PermissionInfo(RuntimePermission.class.getName(), "getClassLoader", null), + new PermissionInfo(ReflectPermission.class.getName(), "suppressAccessChecks", null), }, + ConditionalPermissionInfo.ALLOW)); // Jetty // Bundle jettyUtilBundle = findBundle("org.eclipse.equinox.http.jetty");