List<ExtensionWrapper<T>> result = new ArrayList<ExtensionWrapper<T>>();
for (Map.Entry<String, Set<String>> entry : entries.entrySet()) {
String pluginId = entry.getKey();
+
+ PluginWrapper pluginWrapper = pluginManager.getPlugin(pluginId);
+ if (PluginState.STARTED != pluginWrapper.getPluginState()) {
+ continue;
+ }
+
Set<String> extensionClassNames = entry.getValue();
for (String className : extensionClassNames) {
@Override
public Set<String> findClassNames(String pluginId) {
+ readIndexFiles();
return entries.get(pluginId);
}
- public void pluginStateChanged(PluginStateEvent event) {
+ @Override
+ public void pluginStateChanged(PluginStateEvent event) {
// TODO optimize (do only for some transitions)
// clear cache
entries = null;
entries = new HashMap<String, Set<String>>();
- List<PluginWrapper> startedPlugins = pluginManager.getStartedPlugins();
- for (PluginWrapper plugin : startedPlugins) {
+ List<PluginWrapper> plugins = pluginManager.getPlugins();
+ for (PluginWrapper plugin : plugins) {
String pluginId = plugin.getDescriptor().getPluginId();
log.debug("Reading extensions index file for plugin '{}'", pluginId);
Set<String> entriesPerPlugin = new HashSet<String>();
return entries;
}
- private boolean isExtensionPoint(Class type) {
+ private boolean isExtensionPoint(Class<?> type) {
return ExtensionPoint.class.isAssignableFrom(type);
}
*/
package ro.fortsoft.pf4j;
-import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
-import java.util.Collections;
-import java.util.Enumeration;
import java.util.List;
/**
// use the standard URLClassLoader (which follows normal parent delegation)
return super.loadClass(className);
}
-
- @Override
- public URL getResource(String name) {
- if (PluginState.DISABLED == getPlugin().getPluginState()) {
- return null;
- }
-
- return super.getResource(name);
- }
-
- @Override
- public Enumeration<URL> getResources(String name) throws IOException {
- if (PluginState.DISABLED == getPlugin().getPluginState()) {
- return Collections.emptyEnumeration();
- }
-
- return super.getResources(name);
- }
-
- private PluginWrapper getPlugin() {
- return pluginManager.getPlugin(pluginDescriptor.getPluginId());
- }
-
}