X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.osgi.boot%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fa2%2FOsgiContext.java;fp=org.argeo.osgi.boot%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fa2%2FOsgiContext.java;h=0000000000000000000000000000000000000000;hb=b7d8618ce593bbeca7e311d32a4d98988e27f877;hp=8630dc26d9585246e0f4a3d0c7fa249325c657b9;hpb=25a31ea46e5de6ce0de366fdb999588c6788c540;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.osgi.boot/src/org/argeo/osgi/a2/OsgiContext.java b/org.argeo.osgi.boot/src/org/argeo/osgi/a2/OsgiContext.java deleted file mode 100644 index 8630dc26d..000000000 --- a/org.argeo.osgi.boot/src/org/argeo/osgi/a2/OsgiContext.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.argeo.osgi.a2; - -import org.argeo.osgi.boot.OsgiBootUtils; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.Version; - -/** A running OSGi bundle context seen as a {@link AbstractProvisioningSource}. */ -class OsgiContext extends AbstractProvisioningSource { - private final BundleContext bc; - - public OsgiContext(BundleContext bc) { - super(); - this.bc = bc; - } - - public OsgiContext() { - Bundle bundle = FrameworkUtil.getBundle(OsgiContext.class); - if (bundle == null) - throw new IllegalArgumentException( - "OSGi Boot bundle must be started or a bundle context must be specified"); - this.bc = bundle.getBundleContext(); - } - - void load() { - A2Contribution runtimeContribution = getOrAddContribution( A2Contribution.RUNTIME); - for (Bundle bundle : bc.getBundles()) { - // OsgiBootUtils.debug(bundle.getDataFile("/")); - String componentId = bundle.getSymbolicName(); - Version version = bundle.getVersion(); - A2Component component = runtimeContribution.getOrAddComponent(componentId); - A2Module module = component.getOrAddModule(version, bundle); - if (OsgiBootUtils.isDebug()) - OsgiBootUtils.debug("Registered " + module + " (location id: " + bundle.getLocation() + ")"); - } - - } -}