systemBundleContext.getBundle().adapt(FrameworkWiring.class).resolveBundles(bundles);
}
@Override
public void replaceDigraph(Map<String, Map<String, Map<String, Set<String>>>> policies, Map<String, Set<Long>> bundles) throws BundleException, InvalidSyntaxException {
RegionDigraph temp = digraph.copy();
// Remove everything
for (Region region : temp.getRegions()) {
temp.removeRegion(region);
}
// Re-create regions
for (String name : policies.keySet()) {
temp.createRegion(name);
}
// Dispatch bundles
for (Map.Entry<String, Set<Long>> entry : bundles.entrySet()) {
Region region = temp.getRegion(entry.getKey());
for (long bundleId : entry.getValue()) {
region.addBundle(bundleId);
}
}
// Add policies
for (Map.Entry<String, Map<String, Map<String, Set<String>>>> entry1 : policies.entrySet()) {
Region region1 = temp.getRegion(entry1.getKey());
for (Map.Entry<String, Map<String, Set<String>>> entry2 : entry1.getValue().entrySet()) {
Region region2 = temp.getRegion(entry2.getKey());
RegionFilterBuilder rfb = temp.createRegionFilterBuilder();
for (Map.Entry<String, Set<String>> entry3 : entry2.getValue().entrySet()) {
for (String flt : entry3.getValue()) {
rfb.allow(entry3.getKey(), flt);
}
}