]> source.dussan.org Git - pf4j.git/commitdiff
Add getExtensionFactory in PluginManager interface
authorDecebal Suiu <decebal.suiu@gmail.com>
Mon, 28 Dec 2015 20:35:34 +0000 (22:35 +0200)
committerDecebal Suiu <decebal.suiu@gmail.com>
Mon, 28 Dec 2015 20:35:34 +0000 (22:35 +0200)
pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java
pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java
pf4j/src/main/java/ro/fortsoft/pf4j/PluginManager.java

index 8525e8c6da359b873ac8906193d71d475ed050a5..9ff571a8183031ca86201f44789efb90ac0605e4 100644 (file)
@@ -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 {
index e3943f2aae44b977201647cd827acf5934bb7a35..bdedc88bebe5d91d055ef623c04fce0dee8aa509 100644 (file)
@@ -566,6 +566,11 @@ public class DefaultPluginManager implements PluginManager {
         return extensionFinder.findClassNames(pluginId);
     }
 
+    @Override
+    public ExtensionFactory getExtensionFactory() {
+        return extensionFactory;
+    }
+
     @Override
        public RuntimeMode getRuntimeMode() {
        if (runtimeMode == null) {
@@ -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;
index 9792979a64102806d271a910495682ed71e2145e..2cb2adb8ce63ad5f70e133017436ee0571672634 100644 (file)
@@ -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.
         */