//look for plugin def
final PluginMeta pluginMeta;
try {
pluginMeta = getPluginMeta();
} catch (IOException e) {
throw new ProviderLoaderException(e, service.getName(), providerName);
}
if (null == pluginMeta) {
throw new ProviderLoaderException("Unable to load plugin metadata for file: " + file, service.getName(),
providerName);
}
for (final ProviderDef pluginDef : pluginMeta.getPluginDefs()) {
if (matchesProvider(ident, pluginDef)) {
final ScriptPluginProvider provider;
try {
provider = getPlugin(file, pluginDef, ident);
} catch (PluginException e) {
throw new ProviderLoaderException(e, service.getName(), providerName);
}
pluginProviderDefs.put(ident, provider);
break;
}
}
}
final ScriptPluginProvider scriptPluginProvider = pluginProviderDefs.get(ident);
if (null != scriptPluginProvider) {
try {
return service.createScriptProviderInstance(scriptPluginProvider);
} catch (PluginException e) {
throw new ProviderLoaderException(e, service.getName(), providerName);
}
}
return null;
}