}
private void finishResolution(Solution solution) throws BundleException
{
BundleGeneration bundleGeneration = solution.getBundle();
ArchiveStore currentStore = bundleGeneration.getArchiveStore();
Set<Wire> wires = solution.getWires();
for (Wire wire : wires)
{
wire.getExportDescription().incrementReferenceCount();
}
Set<String> exportedPackages = new HashSet<String>();
for (ExportDescription desc : currentStore.getExportDescriptions())
{
exportedPackages.addAll(desc.getPackageNames());
}
List<Wire> requiredBundles = new ArrayList<Wire>();
for (Solution.RequiredBundleWrapper wrapper : solution.getRequiredBundles())
{
Wire wire = wrapper.getWire();
requiredBundles.add(wire);
bundleGeneration.getRequiredBundles().add(wire.getBundleGeneration());
if (wrapper.isReExport())
{
exportedPackages.add(wire.getPackageName());
}
}
Set<ArchiveStore> archiveStores = new HashSet<ArchiveStore>();
archiveStores.add(currentStore);
for (FragmentGeneration fragment : solution.getFragments()) archiveStores.add(fragment.getArchiveStore());
List<ResourceLocation> resourceLocations = new ArrayList<ResourceLocation>();
for (String element : currentStore.getBundleClassPath())
{
ResourceLocation resourceLocation = currentStore.registerClassPathElement(element);
if (resourceLocation == null)
{
for (FragmentGeneration fragment : solution.getFragments())
{
resourceLocation = fragment.getArchiveStore().registerClassPathElement(element);
if (resourceLocation != null) break;
}
}
if (resourceLocation != null) resourceLocations.add(resourceLocation);
}
for (FragmentGeneration fragment : solution.getFragments())
{
ArchiveStore archiveStore = fragment.getArchiveStore();
for (String element : archiveStore.getBundleClassPath())
{
ResourceLocation resourceLocation = archiveStore.registerClassPathElement(element);
if (resourceLocation != null) resourceLocations.add(resourceLocation);
}
fragment.setHost(bundleGeneration);
bundleGeneration.getFragments().add(fragment);