aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2015-12-28 22:35:34 +0200
committerDecebal Suiu <decebal.suiu@gmail.com>2015-12-28 22:35:34 +0200
commit0dd5e53dffbf246742a67d8072bc69da08b45773 (patch)
tree18db20f5e6bcac70da31d75154132dc0e62a1a1a
parent400e0f74bd054f9e7a47788cd6af85ea9c4721cf (diff)
downloadpf4j-0dd5e53dffbf246742a67d8072bc69da08b45773.tar.gz
pf4j-0dd5e53dffbf246742a67d8072bc69da08b45773.zip
Add getExtensionFactory in PluginManager interface
-rw-r--r--pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java6
-rw-r--r--pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java7
-rw-r--r--pf4j/src/main/java/ro/fortsoft/pf4j/PluginManager.java2
3 files changed, 10 insertions, 5 deletions
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java
index 8525e8c..9ff571a 100644
--- a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java
+++ b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java
@@ -43,12 +43,10 @@ public class DefaultExtensionFinder implements ExtensionFinder, PluginStateListe
private static final Logger log = LoggerFactory.getLogger(DefaultExtensionFinder.class);
protected PluginManager pluginManager;
- protected ExtensionFactory extensionFactory;
protected volatile Map<String, Set<String>> entries; // cache by pluginId
- public DefaultExtensionFinder(PluginManager pluginManager, ExtensionFactory extensionFactory) {
+ public DefaultExtensionFinder(PluginManager pluginManager) {
this.pluginManager = pluginManager;
- this.extensionFactory = extensionFactory;
}
@Override
@@ -93,7 +91,7 @@ public class DefaultExtensionFinder implements ExtensionFinder, PluginStateListe
descriptor.setExtensionClass(extensionClass);
ExtensionWrapper extensionWrapper = new ExtensionWrapper<>(descriptor);
- extensionWrapper.setExtensionFactory(extensionFactory);
+ extensionWrapper.setExtensionFactory(pluginManager.getExtensionFactory());
result.add(extensionWrapper);
log.debug("Added extension '{}' with ordinal {}", className, extension.ordinal());
} else {
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java
index e3943f2..bdedc88 100644
--- a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java
+++ b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java
@@ -567,6 +567,11 @@ public class DefaultPluginManager implements PluginManager {
}
@Override
+ public ExtensionFactory getExtensionFactory() {
+ return extensionFactory;
+ }
+
+ @Override
public RuntimeMode getRuntimeMode() {
if (runtimeMode == null) {
// retrieves the runtime mode from system
@@ -631,7 +636,7 @@ public class DefaultPluginManager implements PluginManager {
* Add the possibility to override the ExtensionFinder.
*/
protected ExtensionFinder createExtensionFinder() {
- DefaultExtensionFinder extensionFinder = new DefaultExtensionFinder(this, extensionFactory);
+ DefaultExtensionFinder extensionFinder = new DefaultExtensionFinder(this);
addPluginStateListener(extensionFinder);
return extensionFinder;
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/PluginManager.java b/pf4j/src/main/java/ro/fortsoft/pf4j/PluginManager.java
index 9792979..2cb2adb 100644
--- a/pf4j/src/main/java/ro/fortsoft/pf4j/PluginManager.java
+++ b/pf4j/src/main/java/ro/fortsoft/pf4j/PluginManager.java
@@ -136,6 +136,8 @@ public interface PluginManager {
public Set<String> getExtensionClassNames(String pluginId);
+ public ExtensionFactory getExtensionFactory();
+
/**
* The runtime mode. Must currently be either DEVELOPMENT or DEPLOYMENT.
*/