}
// funnel the results through the discovery callbacks that are defined on the discovered resource type
// we do them one discovered resource details as a time, giving each callback the opportunity to handle each
ResourceDiscoveryCallback.DiscoveryCallbackResults callbackResults;
PluginComponentFactory pluginComponentFactory = PluginContainer.getInstance().getPluginComponentFactory();
ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader();
for (Iterator<DiscoveredResourceDetails> detailsIterator = results.iterator(); detailsIterator.hasNext();) {
DiscoveredResourceDetails details = detailsIterator.next();
int callbackCount = 0;
boolean stopProcessing = false; // if true, a callback told us he found a details that he modified and we should stop
boolean abortDiscovery = false; // if true, multiple callbacks claimed ownership which isn't allowed - its discovery will be aborted
boolean vetoDiscovery = false; // if true, a callback veto'ed the resource - it should not be discovered at all
for (Map.Entry<String, List<String>> entry : callbacks.entrySet()) {
String pluginName = entry.getKey();
List<String> callbackClassNames = entry.getValue();
for (String className : callbackClassNames) {
ResourceDiscoveryCallback callback = pluginComponentFactory.getDiscoveryCallback(pluginName,
className);
try {
Thread.currentThread().setContextClassLoader(callback.getClass().getClassLoader());
callbackResults = callback.discoveredResources(details);// inline in our calling thread - no time outs or anything; hopefully the plugin plays nice
callbackCount++;