summaryrefslogtreecommitdiffstats
path: root/pf4j
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2013-02-20 11:22:24 +0200
committerDecebal Suiu <decebal.suiu@gmail.com>2013-02-20 11:22:24 +0200
commit2d971079be8f0a95f63be390601c5cc74f70e951 (patch)
tree80a09215d5b9d7426d9fc3fd7e37d28f30b5b1d0 /pf4j
parent16ff4a3173f3373aae5a267346f5873ad35d7c1e (diff)
downloadpf4j-2d971079be8f0a95f63be390601c5cc74f70e951.tar.gz
pf4j-2d971079be8f0a95f63be390601c5cc74f70e951.zip
factory method pattern for PluginDescriptorFinder and ExtensionFinder
Diffstat (limited to 'pf4j')
-rw-r--r--pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java21
1 files changed, 11 insertions, 10 deletions
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java
index 067264f..5befbc2 100644
--- a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java
+++ b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java
@@ -85,7 +85,7 @@ public class DefaultPluginManager implements PluginManager {
/**
* A compound class loader of resolved plugins.
*/
- private CompoundClassLoader compoundClassLoader;
+ protected CompoundClassLoader compoundClassLoader;
/**
* Th plugins directory is supplied by System.getProperty("pf4j.pluginsDir", "plugins").
@@ -110,20 +110,21 @@ public class DefaultPluginManager implements PluginManager {
resolvedPlugins = new ArrayList<PluginWrapper>();
disabledPlugins = new ArrayList<PluginWrapper>();
startedPlugins = new ArrayList<PluginWrapper>();
- pluginDescriptorFinder = new DefaultPluginDescriptorFinder();
compoundClassLoader = new CompoundClassLoader();
- extensionFinder = new DefaultExtensionFinder(compoundClassLoader);
+
+ pluginDescriptorFinder = createPluginDescriptorFinder();
+ extensionFinder = createExtensionFinder();
System.setProperty("pf4j.pluginsDir", pluginsDirectory.getAbsolutePath());
}
- public PluginDescriptorFinder getPluginDescriptorFinder() {
- return pluginDescriptorFinder;
- }
+ protected PluginDescriptorFinder createPluginDescriptorFinder() {
+ return new DefaultPluginDescriptorFinder();
+ }
- public void setPluginDescriptorFinder(PluginDescriptorFinder pluginDescriptorFinder) {
- this.pluginDescriptorFinder = pluginDescriptorFinder;
- }
+ protected ExtensionFinder createExtensionFinder() {
+ return new DefaultExtensionFinder(compoundClassLoader);
+ }
@Override
public List<PluginWrapper> getPlugins() {
@@ -349,5 +350,5 @@ public class DefaultPluginManager implements PluginManager {
log.info("Plugin '" + pluginWrapper.getDescriptor().getPluginId() + "' resolved");
}
}
-
+
}