clean up OSGi state reporting and help page

This commit is contained in:
Jason P. Leasure 2020-06-25 13:37:46 -04:00
parent fbd564caca
commit a3320ef3ab
3 changed files with 24 additions and 17 deletions

View file

@ -162,8 +162,16 @@
<li> <span style="font-weight:bold;color:#009900">active</span> - the bundle is built and classes within
can be loaded
</ul>
</p>
<p>The normally hidden column "OSGi State" is also available.</p>
<p>The normally hidden column "OSGi State" is also available. In addition to the Bundle
state, this column will report</p>
<ul style="padding-left:8em">
<li> (DISABLED) - if the bundle is disabled
<li> (ENABLED) - if the bundle is enabled, but the bundle manager has no handle to it.
If this state persists, there is likely an internal error
<li> (UNINSTALLED) - if the bundle is enabled, but the framework has released its handle.
This is typical for an inactive bundle
</ul>
<h2><a name="AddBundles"/><a name="RemoveBundles"/>Adding and removing bundles from the manager</h2>

View file

@ -193,14 +193,14 @@ public class BundleHost {
public Collection<GhidraBundle> add(List<ResourceFile> bundleFiles, boolean enabled,
boolean systemBundle) {
Map<ResourceFile, GhidraBundle> newBundleMap = bundleFiles.stream()
.collect(Collectors.toUnmodifiableMap(Function.identity(),
bundleFile -> createGhidraBundle(BundleHost.this, bundleFile, enabled,
systemBundle)));
.collect(Collectors.toUnmodifiableMap(Function.identity(),
bundleFile -> createGhidraBundle(BundleHost.this, bundleFile, enabled,
systemBundle)));
fileToBundleMap.putAll(newBundleMap);
bundleLocationToBundleMap.putAll(newBundleMap.values()
.stream()
.collect(Collectors.toUnmodifiableMap(GhidraBundle::getLocationIdentifier,
Function.identity())));
.stream()
.collect(Collectors.toUnmodifiableMap(GhidraBundle::getLocationIdentifier,
Function.identity())));
Collection<GhidraBundle> newBundles = newBundleMap.values();
fireBundlesAdded(newBundles);
return newBundles;
@ -482,7 +482,7 @@ public class BundleHost {
}
frameworkBundleContext
.addBundleListener(new MyBundleListener(frameworkBundleContext.getBundle()));
.addBundleListener(new MyBundleListener(frameworkBundleContext.getBundle()));
try {
felixFramework.start();
@ -659,8 +659,8 @@ public class BundleHost {
monitor.setMaximum(bundlesRemaining.size());
while (!bundlesRemaining.isEmpty() && !monitor.isCancelled()) {
List<GhidraBundle> resolvableBundles = bundlesRemaining.stream()
.filter(bundle -> canResolveAll(bundle.getAllRequirements()))
.collect(Collectors.toList());
.filter(bundle -> canResolveAll(bundle.getAllRequirements()))
.collect(Collectors.toList());
if (resolvableBundles.isEmpty()) {
// final round, try everything we couldn't resolve to generate errors
resolvableBundles = bundlesRemaining;
@ -881,7 +881,8 @@ public class BundleHost {
String.format("not a GhidraBundle: %s\n", osgiBundle.getLocation()));
}
break;
case BundleEvent.UNINSTALLED:
// force "inactive" updates for all other states
default:
bundle = bundleLocationToBundleMap.get(osgiBundle.getLocation());
if (bundle != null) {
fireBundleActivationChange(bundle, false);
@ -891,8 +892,6 @@ public class BundleHost {
String.format("not a GhidraBundle: %s\n", osgiBundle.getLocation()));
}
break;
default:
break;
}
}
}

View file

@ -411,7 +411,7 @@ public class BundleStatusTableModel
public String getValue(BundleStatus status, Settings settings, List<BundleStatus> data,
ServiceProvider serviceProvider0) throws IllegalArgumentException {
if (!status.isEnabled()) {
return "(disabled)";
return "(DISABLED)";
}
GhidraBundle bundle = bundleHost.getExistingGhidraBundle(status.getFile());
if (bundle != null) {
@ -419,9 +419,9 @@ public class BundleStatusTableModel
if (osgiBundle != null) {
return OSGiUtils.getStateString(osgiBundle);
}
return "uninstalled";
return "(UNINSTALLED)";
}
return "(enabled)";
return "(ENABLED)";
}
@Override