systemSet.add(descr.getId());
}
}
// Remove those plugin where some prerequisites do not exist
for (Iterator<PluginDescriptor> i = all.values().iterator(); i.hasNext();) {
final PluginDescriptor descr = (PluginDescriptor) i.next();
if (!prerequisitesExist(descr, all)) {
BootLogInstance.get().info("Skipping plugin " + descr.getId());
all.remove(descr.getId());
systemSet.remove(descr.getId());
i = all.values().iterator();
}
}
// Now create a sorted list
final ArrayList<PluginDescriptor> list = new ArrayList<PluginDescriptor>();
final HashSet<String> nameSet = new HashSet<String>();
while (all.size() > 0) {
int additions = 0;
for (Iterator<PluginDescriptor> i = all.values().iterator(); i.hasNext();) {
final PluginDescriptor descr = (PluginDescriptor) i.next();
if (canAdd(descr, nameSet, systemSet)) {
list.add(descr);
nameSet.add(descr.getId());
all.remove(descr.getId());
systemSet.remove(descr.getId());
additions++;
i = all.values().iterator();
}
}