| author | John Ross | 2012-09-11 08:16:02 (EDT) |
|---|---|---|
| committer | Thomas Watson | 2012-09-11 11:01:00 (EDT) |
| commit | 3783e7d00f031f5f2926420a9be6c883cb2b835e (patch) (side-by-side diff) | |
| tree | 402edbf7fa5af796d197577d2d3bb0c87d9cb438 | |
| parent | 3f77a1c480c98f82477d82c33a34ac703bee2fe2 (diff) | |
| download | rt.equinox.framework-3783e7d00f031f5f2926420a9be6c883cb2b835e.zip rt.equinox.framework-3783e7d00f031f5f2926420a9be6c883cb2b835e.tar.gz rt.equinox.framework-3783e7d00f031f5f2926420a9be6c883cb2b835e.tar.bz2 | |
Added the ability to get data from a report entry. The data will vary based on the type of entry. For example, a SINGLETON_SELECTION entry will include the colliding singleton. The data type was changed to Object rather than String as in the old framework for more flexibility. Is this a place for generics?
3 files changed, 16 insertions, 13 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java index 56a2c7e..7add5b4 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java @@ -684,7 +684,7 @@ final class ModuleResolver { hook.filterResolvable(Converters.asListBundleRevision((List<? extends BundleRevision>) enabledCandidates)); disabled.removeAll(enabledCandidates); for (ModuleRevision revision : disabled) - builder.addEntry(revision, Entry.Type.FILTERED_BY_RESOLVER_HOOK); + builder.addEntry(revision, Entry.Type.FILTERED_BY_RESOLVER_HOOK, null); } private void selectSingletons(ResolutionReport.Builder builder) { @@ -723,9 +723,7 @@ final class ModuleResolver { if (selected.contains(collision)) { // Must fail since there is already a selected bundle which is a collision of the singleton bundle disabled.add(singleton); - // TODO add resolver diagnostics here - //state.addResolverError(singleton.getBundleDescription(), ResolverError.SINGLETON_SELECTION, collision.getBundleDescription().toString(), null); - builder.addEntry(singleton, Type.SINGLETON_SELECTION); + builder.addEntry(singleton, Type.SINGLETON_SELECTION, collision); break; } if (!pickOneToResolve.contains(collision)) @@ -738,9 +736,7 @@ final class ModuleResolver { if (selected.contains(collisionEntry.getKey())) { // Must fail since there is already a selected bundle for which the singleton bundle is a collision disabled.add(singleton); - // TODO add resolver diagnostics here - // state.addResolverError(singleton.getBundleDescription(), ResolverError.SINGLETON_SELECTION, collisionEntry.getKey().getBundleDescription().toString(), null); - builder.addEntry(singleton, Type.SINGLETON_SELECTION); + builder.addEntry(singleton, Type.SINGLETON_SELECTION, collisionEntry.getKey()); break; } if (!pickOneToResolve.contains(collisionEntry.getKey())) @@ -795,9 +791,7 @@ final class ModuleResolver { for (ModuleRevision singleton : pickOneToResolve) { if (singleton != selectedVersion) { disabled.add(singleton); - // TODO add resolver diagnostic here. - // state.addResolverError(singleton.getBundleDescription(), ResolverError.SINGLETON_SELECTION, selectedVersion.getBundleDescription().toString(), null); - builder.addEntry(singleton, Type.SINGLETON_SELECTION); + builder.addEntry(singleton, Type.SINGLETON_SELECTION, selectedVersion); } } return selectedVersion; diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ResolutionReport.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ResolutionReport.java index 4a1fad9..07f8614 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ResolutionReport.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ResolutionReport.java @@ -10,13 +10,13 @@ public class ResolutionReport implements org.eclipse.osgi.framework.report.Resol public static class Builder { private final Map<Resource, List<Entry>> resourceToEntries = new HashMap<Resource, List<Entry>>(); - public void addEntry(Resource resource, Entry.Type type) { + public void addEntry(Resource resource, Entry.Type type, Object data) { List<Entry> entries = resourceToEntries.get(resource); if (entries == null) { entries = new ArrayList<Entry>(); resourceToEntries.put(resource, entries); } - entries.add(new EntryImpl(type)); + entries.add(new EntryImpl(type, data)); } public ResolutionReport build() { @@ -25,10 +25,17 @@ public class ResolutionReport implements org.eclipse.osgi.framework.report.Resol } private static class EntryImpl implements Entry { + private final Object data; private final Type type; - EntryImpl(Type type) { + EntryImpl(Type type, Object data) { this.type = type; + this.data = data; + } + + @Override + public Object getData() { + return data; } @Override diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/report/ResolutionReport.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/report/ResolutionReport.java index c06942a..c5ab863 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/report/ResolutionReport.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/report/ResolutionReport.java @@ -23,6 +23,8 @@ public interface ResolutionReport { FILTERED_BY_RESOLVER_HOOK, SINGLETON_SELECTION } + Object getData(); + Type getType(); } |

