aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2015-10-07 14:07:08 +0300
committerDecebal Suiu <decebal.suiu@gmail.com>2015-10-07 14:07:08 +0300
commitc7d6a98d991b49f5012866f0c8df89c6fd8c332c (patch)
treeff028e5f7c249527ed41e49321702179a63972a4
parentccd8a0efe59e0d3915e7b4c81964dc07a18bdf0f (diff)
downloadpf4j-c7d6a98d991b49f5012866f0c8df89c6fd8c332c.tar.gz
pf4j-c7d6a98d991b49f5012866f0c8df89c6fd8c332c.zip
make PluginManager available in Plugin via PluginWrapper
-rw-r--r--pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java2
-rw-r--r--pf4j/src/main/java/ro/fortsoft/pf4j/PluginWrapper.java11
2 files changed, 11 insertions, 2 deletions
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java
index 865bc5f..3563cde 100644
--- a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java
+++ b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java
@@ -780,7 +780,7 @@ public class DefaultPluginManager implements PluginManager {
// create the plugin wrapper
log.debug("Creating wrapper for plugin '{}'", pluginPath);
- PluginWrapper pluginWrapper = new PluginWrapper(pluginDescriptor, pluginPath, pluginClassLoader);
+ PluginWrapper pluginWrapper = new PluginWrapper(this, pluginDescriptor, pluginPath, pluginClassLoader);
pluginWrapper.setPluginFactory(pluginFactory);
pluginWrapper.setRuntimeMode(getRuntimeMode());
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/PluginWrapper.java b/pf4j/src/main/java/ro/fortsoft/pf4j/PluginWrapper.java
index 45dbc1e..8046be5 100644
--- a/pf4j/src/main/java/ro/fortsoft/pf4j/PluginWrapper.java
+++ b/pf4j/src/main/java/ro/fortsoft/pf4j/PluginWrapper.java
@@ -19,6 +19,7 @@ package ro.fortsoft.pf4j;
*/
public class PluginWrapper {
+ PluginManager pluginManager;
PluginDescriptor descriptor;
String pluginPath;
PluginClassLoader pluginClassLoader;
@@ -27,7 +28,8 @@ public class PluginWrapper {
RuntimeMode runtimeMode;
Plugin plugin; // cache
- public PluginWrapper(PluginDescriptor descriptor, String pluginPath, PluginClassLoader pluginClassLoader) {
+ public PluginWrapper(PluginManager pluginManager, PluginDescriptor descriptor, String pluginPath, PluginClassLoader pluginClassLoader) {
+ this.pluginManager = pluginManager;
this.descriptor = descriptor;
this.pluginPath = pluginPath;
this.pluginClassLoader = pluginClassLoader;
@@ -36,6 +38,13 @@ public class PluginWrapper {
}
/**
+ * Returns the plugin manager.
+ */
+ public PluginManager getPluginManager() {
+ return pluginManager;
+ }
+
+ /**
* Returns the plugin descriptor.
*/
public PluginDescriptor getDescriptor() {