From 6c0ddcd43c16250502b1df822028972c738a9604 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Sat, 17 Sep 2022 15:40:58 +0200 Subject: [PATCH 1/2] Minor clean-ups/simplifications of sisu-osgi-connect --- .../sisu/osgi/connect/DummyClassRealm.java | 5 +- .../osgi/connect/PlexusConnectFramework.java | 48 ++++---- .../PlexusFrameworkConnectServiceFactory.java | 105 +++++++----------- .../connect/PlexusFrameworkUtilHelper.java | 25 ++--- .../osgi/connect/PlexusModuleConnector.java | 31 +++--- 5 files changed, 84 insertions(+), 130 deletions(-) diff --git a/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/DummyClassRealm.java b/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/DummyClassRealm.java index 09e3d00338..f5e7fe59b6 100644 --- a/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/DummyClassRealm.java +++ b/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/DummyClassRealm.java @@ -21,7 +21,6 @@ import org.codehaus.plexus.classworlds.ClassWorld; import org.codehaus.plexus.classworlds.realm.ClassRealm; -import org.codehaus.plexus.logging.Logger; final class DummyClassRealm extends ClassRealm { @@ -30,7 +29,7 @@ final class DummyClassRealm extends ClassRealm { private ClassLoader classLoader; private List urls; - DummyClassRealm(String id, ClassLoader classLoader, Logger log) { + DummyClassRealm(String id, ClassLoader classLoader) { super(new ClassWorld(), id, classLoader); this.classLoader = classLoader; } @@ -38,7 +37,7 @@ final class DummyClassRealm extends ClassRealm { @Override public URL[] getURLs() { if (urls == null) { - urls = new ArrayList(); + urls = new ArrayList<>(); try { Enumeration resources = classLoader.getResources(JarFile.MANIFEST_NAME); while (resources.hasMoreElements()) { diff --git a/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusConnectFramework.java b/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusConnectFramework.java index d40a4937e1..c7cb45b63c 100644 --- a/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusConnectFramework.java +++ b/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusConnectFramework.java @@ -50,14 +50,14 @@ * created by plexus * */ -class PlexusConnectFramework +class PlexusConnectFramework // implements Logger, EmbeddedEquinox, EquinoxServiceFactory, FrameworkUtilHelper, FrameworkListener, LogListener, BundleActivator { private final Framework framework; private final Logger logger; private final String uuid = UUID.randomUUID().toString(); - private final Map, ServiceTracker> trackerMap = new ConcurrentHashMap, ServiceTracker>(); + private final Map, ServiceTracker> trackerMap = new ConcurrentHashMap<>(); private final ClassRealm realm; final PlexusFrameworkConnectServiceFactory factory; final boolean foreign; @@ -313,29 +313,27 @@ public void logged(LogEntry entry) { @Override public void start(BundleContext context) { context.addFrameworkListener(this); - serviceTracker = new ServiceTracker( - context, LogReaderService.class, new ServiceTrackerCustomizer() { - - @Override - public LogReaderService addingService(ServiceReference reference) { - LogReaderService service = context.getService(reference); - if (service != null) { - service.addLogListener(PlexusConnectFramework.this); - } - return service; - } - - @Override - public void modifiedService(ServiceReference reference, - LogReaderService service) { - } - - @Override - public void removedService(ServiceReference reference, LogReaderService service) { - service.removeLogListener(PlexusConnectFramework.this); - context.ungetService(reference); - } - }); + serviceTracker = new ServiceTracker<>(context, LogReaderService.class, new ServiceTrackerCustomizer<>() { + + @Override + public LogReaderService addingService(ServiceReference reference) { + LogReaderService service = context.getService(reference); + if (service != null) { + service.addLogListener(PlexusConnectFramework.this); + } + return service; + } + + @Override + public void modifiedService(ServiceReference reference, LogReaderService service) { + } + + @Override + public void removedService(ServiceReference reference, LogReaderService service) { + service.removeLogListener(PlexusConnectFramework.this); + context.ungetService(reference); + } + }); serviceTracker.open(); } diff --git a/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusFrameworkConnectServiceFactory.java b/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusFrameworkConnectServiceFactory.java index e373b9daba..f4892240ba 100644 --- a/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusFrameworkConnectServiceFactory.java +++ b/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusFrameworkConnectServiceFactory.java @@ -15,10 +15,8 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; @@ -26,9 +24,8 @@ import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.NoSuchElementException; import java.util.Objects; import java.util.Properties; import java.util.ServiceLoader; @@ -44,6 +41,7 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; +import org.codehaus.plexus.util.StringUtils; import org.eclipse.sisu.equinox.EquinoxServiceFactory; import org.eclipse.sisu.equinox.embedder.EquinoxLifecycleListener; import org.osgi.framework.Bundle; @@ -73,7 +71,7 @@ public class PlexusFrameworkConnectServiceFactory implements Initializable, Disp private Logger log; private static final Map frameworkMap = new HashMap<>(); - + private static final Map loaderMap = new HashMap<>(); @Requirement(role = EquinoxLifecycleListener.class) @@ -109,15 +107,15 @@ synchronized PlexusConnectFramework getFramework(ClassRealm realm) throws Bundle } Framework foreignFramework = getForeignFramework(realm); if (foreignFramework != null) { - PlexusConnectFramework connectFramework = new PlexusConnectFramework(foreignFramework, log, this, realm, - true); - frameworkMap.put(realm, connectFramework); - return connectFramework; + PlexusConnectFramework connectFwk = new PlexusConnectFramework(foreignFramework, log, this, realm, true); + frameworkMap.put(realm, connectFwk); + return connectFwk; } if (log.isDebugEnabled()) { - printRealm(realm, 0, new HashSet()); + printRealm(realm, 0, new HashSet<>()); } - Collection realms = collectRealms(realm, new LinkedHashSet()); + Collection realms = collectRealms(realm, new LinkedHashSet<>()); + log.debug("Create framework for " + this + " with realm " + realm); Logger fwLogger = new PlexusConnectFramework(null, log, this, realm, false); Map p = readProperties(realm, fwLogger); @@ -129,23 +127,25 @@ synchronized PlexusConnectFramework getFramework(ClassRealm realm) throws Bundle p.put(Constants.FRAMEWORK_STORAGE, storagePath + File.separator + "storage"); p.put(Constants.FRAMEWORK_BEGINNING_STARTLEVEL, "6"); p.put("osgi.instance.area", storagePath + File.separator + "instance"); - ServiceLoader sl = ServiceLoader.load(ConnectFrameworkFactory.class, - getClass().getClassLoader()); - ConnectFrameworkFactory factory = sl.iterator().next(); + + var loader = ServiceLoader.load(ConnectFrameworkFactory.class, getClass().getClassLoader()); + ConnectFrameworkFactory factory = loader.findFirst() + .orElseThrow(() -> new NoSuchElementException("No ConnectFrameworkFactory found")); + PlexusModuleConnector connector = new PlexusModuleConnector(factory); Framework osgiFramework = factory.newFramework(p, connector); PlexusConnectFramework connectFramework = new PlexusConnectFramework(osgiFramework, log, this, realm, false); PlexusFrameworkUtilHelper.registerHelper(connectFramework); osgiFramework.init(connectFramework); frameworkMap.put(realm, connectFramework); + connectFramework.start(osgiFramework.getBundleContext()); for (ClassRealm r : realms) { connector.installRealm(r, osgiFramework.getBundleContext(), connectFramework); } osgiFramework.start(); - Collection values = lifecycleListeners.values(); - for (EquinoxLifecycleListener listener : values) { + for (EquinoxLifecycleListener listener : lifecycleListeners.values()) { connectFramework.debug("Calling " + listener + "..."); listener.afterFrameworkStarted(connectFramework); } @@ -163,17 +163,11 @@ private void printRealm(ClassRealm realm, int indent, Set printed) { printRealm(parentRealm, indent, printed); indent += 2; } - for (int j = 0; j < indent; j++) { - System.out.print(' '); - } - System.out.println("> " + realm.getId() + " (parent = " + realm.getParentRealm() + ")"); + String indentation = StringUtils.repeat(" ", indent); + System.out.println(indentation + "> " + realm.getId() + " (parent = " + realm.getParentRealm() + ")"); Enumeration resources = realm.loadResourcesFromSelf(PlexusModuleConnector.MAVEN_EXTENSION_DESCRIPTOR); - while (resources != null && resources.hasMoreElements()) { - URL url = resources.nextElement(); - for (int j = 0; j < indent; j++) { - System.out.print(' '); - } - System.out.println(" " + url); + if (resources != null) { + resources.asIterator().forEachRemaining(url -> System.out.println(indentation + " " + url)); } realm.display(); for (ClassRealm imports : realm.getImportRealms()) { @@ -195,24 +189,22 @@ private static Collection collectRealms(ClassRealm realm, Collection return realms; } - protected ClassRealm getRealm(ClassLoader classloader) throws BundleException { + protected ClassRealm getRealm(ClassLoader classloader) { if (classloader instanceof ClassRealm) { return (ClassRealm) classloader; } - return loaderMap.computeIfAbsent(classloader, - cl -> new DummyClassRealm("Not called from a ClassRealm", cl, log)); + return loaderMap.computeIfAbsent(classloader, cl -> new DummyClassRealm("Not called from a ClassRealm", cl)); } private static Map readProperties(ClassLoader classloader, Logger logger) { - Map frameworkProperties = new HashMap(); + Map frameworkProperties = new HashMap<>(); Enumeration resources; try { resources = classloader.getResources("META-INF/sisu-connect.properties"); } catch (IOException e1) { return frameworkProperties; } - while (resources.hasMoreElements()) { - URL url = resources.nextElement(); + resources.asIterator().forEachRemaining(url -> { logger.debug("Reading properties from " + url); Properties properties = new Properties(); try (InputStream stream = url.openStream()) { @@ -221,14 +213,10 @@ private static Map readProperties(ClassLoader classloader, Logge logger.warn("Can't read properties from url " + url); } for (String property : properties.stringPropertyNames()) { - String existing = frameworkProperties.get(property); - if (existing == null) { - frameworkProperties.put(property, properties.getProperty(property)); - } else { - frameworkProperties.put(property, existing + "," + properties.getProperty(property)); - } + String value = properties.getProperty(property); + frameworkProperties.merge(property, value, (v1, v2) -> v1 + "," + v2); } - } + }); return frameworkProperties; } @@ -239,10 +227,10 @@ private static void printFrameworkState(Framework framework, Logger log) { String.CASE_INSENSITIVE_ORDER); Comparator byState = Comparator.comparingInt(Bundle::getState); Arrays.stream(bundles).sorted(byState.thenComparing(bySymbolicName)).forEachOrdered(bundle -> { - log.info(toBundleState(bundle.getState()) + " | " + bundle.getSymbolicName() + " (" + bundle.getVersion() - + ")"); + String state = toBundleState(bundle.getState()); + log.info(state + " | " + bundle.getSymbolicName() + " (" + bundle.getVersion() + ")"); }); - ServiceTracker st = new ServiceTracker( + ServiceTracker st = new ServiceTracker<>( framework.getBundleContext(), ServiceComponentRuntime.class, null); st.open(); try { @@ -273,8 +261,8 @@ private static void printFrameworkState(Framework framework, Logger log) { st.close(); } log.info("============ Registered Services =================="); - Arrays.stream(bundles).map(bundle -> bundle.getRegisteredServices()).filter(Objects::nonNull) - .flatMap(Arrays::stream).forEach(reference -> { + Arrays.stream(bundles).map(Bundle::getRegisteredServices).filter(Objects::nonNull).flatMap(Arrays::stream) + .forEach(reference -> { Object service = reference.getProperty(Constants.OBJECTCLASS); if (service instanceof Object[]) { Object[] objects = (Object[]) service; @@ -324,14 +312,11 @@ private static String toBundleState(int state) { @Override public void dispose() { - List> cleared = new ArrayList<>(); - frameworkMap.entrySet().forEach(entry -> { - PlexusConnectFramework connect = entry.getValue(); - if (connect.factory == this) { - cleared.add(entry); - if (connect.foreign) { - return; - } + frameworkMap.values().removeIf(connect -> { + if (connect.factory != this) { + return false; + } + if (!connect.foreign) { Framework fw = connect.getFramework(); connect.stop(fw.getBundleContext()); String storage = fw.getBundleContext().getProperty(Constants.FRAMEWORK_STORAGE); @@ -348,15 +333,12 @@ public void dispose() { FileUtils.deleteQuietly(new File(storage)); } } + return true; }); - for (Entry entry : cleared) { - frameworkMap.remove(entry.getKey(), entry.getValue()); - } } @Override public void initialize() throws InitializationException { - log.debug("Init instance " + this + " [" + getClass().getClassLoader() + "]"); } @@ -399,18 +381,9 @@ public static Framework getForeignFramework(ClassRealm realm) { try { Method method = foreignFactoryClass.getMethod("getOsgiFramework", ClassRealm.class); return (Framework) method.invoke(null, realm); - } catch (IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException | SecurityException e) { + } catch (ReflectiveOperationException e) { } } return null; } - - public static Framework getOsgiFramework(ClassRealm realm) { - PlexusConnectFramework cachedFramework = frameworkMap.get(realm); - if (cachedFramework != null) { - return cachedFramework.getFramework(); - } - return null; - } } diff --git a/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusFrameworkUtilHelper.java b/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusFrameworkUtilHelper.java index fece300556..3d9c9b921d 100644 --- a/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusFrameworkUtilHelper.java +++ b/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusFrameworkUtilHelper.java @@ -12,7 +12,6 @@ *******************************************************************************/ package org.eclipse.sisu.osgi.connect; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Optional; import java.util.ServiceLoader; @@ -45,23 +44,14 @@ public Optional getBundle(Class classFromBundle) { } public static void registerHelper(FrameworkUtilHelper helper) { - for (FrameworkUtilHelper spi : ServiceLoader.load(FrameworkUtilHelper.class, - FrameworkUtilHelper.class.getClassLoader())) { - Class spiHelperClass = spi.getClass(); - Class thisClass = PlexusFrameworkUtilHelper.class; - if (spiHelperClass.getName().equals(thisClass.getName())) { - if (spiHelperClass == thisClass) { - // register our instance here... - helpers.add(helper); - } else { - invokeForeignMethod(spiHelperClass, "registerHelper", helper); - } - break; - } - } + modifyHelperRegistry(helper, "registerHelper"); } public static void unregisterHelper(FrameworkUtilHelper helper) { + modifyHelperRegistry(helper, "unregisterHelper"); + } + + private static void modifyHelperRegistry(FrameworkUtilHelper helper, String methodName) { for (FrameworkUtilHelper spi : ServiceLoader.load(FrameworkUtilHelper.class, FrameworkUtilHelper.class.getClassLoader())) { Class spiHelperClass = spi.getClass(); @@ -71,7 +61,7 @@ public static void unregisterHelper(FrameworkUtilHelper helper) { // register our instance here... helpers.add(helper); } else { - invokeForeignMethod(spiHelperClass, "unregisterHelper", helper); + invokeForeignMethod(spiHelperClass, methodName, helper); } break; } @@ -82,8 +72,7 @@ private static void invokeForeignMethod(Class clazz, String methodName, Objec try { Method method = clazz.getMethod(methodName, FrameworkUtilHelper.class); method.invoke(null, parameter); - } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { + } catch (ReflectiveOperationException e) { } } diff --git a/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusModuleConnector.java b/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusModuleConnector.java index 6199b2af44..f26f586e5e 100644 --- a/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusModuleConnector.java +++ b/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusModuleConnector.java @@ -30,7 +30,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Objects; import java.util.Optional; import java.util.Properties; @@ -73,7 +72,7 @@ final class PlexusModuleConnector implements ModuleConnector { private URI frameworkBundle; - private Set installedSingletons = new HashSet(); + private Set installedSingletons = new HashSet<>(); public PlexusModuleConnector(ConnectFrameworkFactory factory) { frameworkBundle = PlexusConnectFramework.getLocationFromClass(factory.getClass()); @@ -118,17 +117,17 @@ public synchronized void installRealm(ClassRealm realm, BundleContext bundleCont installRealm(parentRealm, bundleContext, logger); } // make the realm available as a bundle exporting any packages it provides... - List installed = new ArrayList(); + List installed = new ArrayList<>(); realmBundles.put(realm, installed); RealmExports realmExports = readCoreExports(logger, realm); - LinkedHashMap headers = new LinkedHashMap<>(); + Map headers = new LinkedHashMap<>(); headers.put("Manifest-Version", "1.0"); headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); String realmBundleName = getRealmBundle(realm); headers.put(Constants.BUNDLE_SYMBOLICNAME, realmBundleName); headers.put(Constants.BUNDLE_VERSION, "1.0.0." + System.identityHashCode(realm)); if (!realmExports.packages.isEmpty()) { - headers.put(Constants.EXPORT_PACKAGE, realmExports.packages.stream().collect(Collectors.joining(","))); + headers.put(Constants.EXPORT_PACKAGE, String.join(",", realmExports.packages)); } Collection importRealms = realm.getImportRealms(); if (!importRealms.isEmpty()) { @@ -141,15 +140,14 @@ public synchronized void installRealm(ClassRealm realm, BundleContext bundleCont if (installBundle(bundleContext, realmBundleName, logger) != null) { installed.add(realmBundleName); } - boolean isExtensionRealm = !realmExports.artifacts.isEmpty() || !realmExports.artifacts.isEmpty() - || !realmExports.bundleStartMap.isEmpty(); + boolean isExtensionRealm = !realmExports.artifacts.isEmpty() || !realmExports.bundleStartMap.isEmpty(); if (isExtensionRealm && realmExports.artifacts.isEmpty() && realmExports.bundleStartMap.isEmpty()) { // nothing more to do... return; } // now scan the URLs for (URL url : realm.getURLs()) { - File file = getFile(logger, url); + File file = getFile(url); if (file == null) { logger.debug("Can't convert url " + url + " to file!"); continue; @@ -323,10 +321,8 @@ private void parseCoreExports(InputStream stream, RealmExports exports) throws I private Map getHeaderFromManifest(JarFile jarFile) throws IOException { Attributes attributes = jarFile.getManifest().getMainAttributes(); - Map headers = new LinkedHashMap(); - for (Entry entry : attributes.entrySet()) { - headers.put(entry.getKey().toString(), entry.getValue().toString()); - } + Map headers = new LinkedHashMap<>(); + attributes.forEach((key, value) -> headers.put(key.toString(), value.toString())); return Collections.unmodifiableMap(headers); } @@ -366,11 +362,10 @@ private Attributes getAttributes(JarFile jarFile) throws IOException { if (manifest == null) { return null; } - Attributes mainAttributes = manifest.getMainAttributes(); - return mainAttributes; + return manifest.getMainAttributes(); } - private static File getFile(Logger logger, URL url) { + private static File getFile(URL url) { if ("file".equalsIgnoreCase(url.getProtocol())) { try { File file = new File(url.toURI()); @@ -384,9 +379,9 @@ private static File getFile(Logger logger, URL url) { } private static final class RealmExports { - final Set packages = new HashSet(); - final Set artifacts = new HashSet(); - final Map bundleStartMap = new LinkedHashMap(); + final Set packages = new HashSet<>(); + final Set artifacts = new HashSet<>(); + final Map bundleStartMap = new LinkedHashMap<>(); } private static void readBundles(ClassRealm realm, Map map, Logger logger) { From 34712da83f007d23d41a34f4f0ca28719c1b0e85 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Thu, 15 Sep 2022 21:55:32 +0200 Subject: [PATCH 2/2] Unify connect.properties location and fix release-notes of OSGi-Connect --- RELEASE_NOTES.md | 2 +- .../osgi/connect/PlexusFrameworkConnectServiceFactory.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 0a71e44c44..2e83ad457f 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -80,7 +80,7 @@ public class MyPlexusComponent { For the setup you need to do the following: 1. include any bundle you like to make up your plexus-osgi-connect framework as a dependency of your maven plugin -2. include a file `META-INF/sisu-connect.bundles` that list all your bundles you like to have installed in the format `bsn[,true]`, where `bsn` is the symbolid name and optionally you can control if your bundle has to be started or not +2. include a file `META-INF/sisu/connect.bundles` that list all your bundles you like to have installed in the format `bsn[,true]`, where `bsn` is the symbolid name and optionally you can control if your bundle has to be started or not 3. include the following additional dependency ``` diff --git a/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusFrameworkConnectServiceFactory.java b/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusFrameworkConnectServiceFactory.java index f4892240ba..97fe37e117 100644 --- a/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusFrameworkConnectServiceFactory.java +++ b/sisu-osgi/sisu-osgi-connect/src/main/java/org/eclipse/sisu/osgi/connect/PlexusFrameworkConnectServiceFactory.java @@ -200,7 +200,7 @@ private static Map readProperties(ClassLoader classloader, Logge Map frameworkProperties = new HashMap<>(); Enumeration resources; try { - resources = classloader.getResources("META-INF/sisu-connect.properties"); + resources = classloader.getResources("META-INF/sisu/connect.properties"); } catch (IOException e1) { return frameworkProperties; } @@ -228,7 +228,8 @@ private static void printFrameworkState(Framework framework, Logger log) { Comparator byState = Comparator.comparingInt(Bundle::getState); Arrays.stream(bundles).sorted(byState.thenComparing(bySymbolicName)).forEachOrdered(bundle -> { String state = toBundleState(bundle.getState()); - log.info(state + " | " + bundle.getSymbolicName() + " (" + bundle.getVersion() + ")"); + log.info(state + " | " + bundle.getSymbolicName() + " (" + bundle.getVersion() + ") at " + + bundle.getLocation()); }); ServiceTracker st = new ServiceTracker<>( framework.getBundleContext(), ServiceComponentRuntime.class, null);