diff options
author | decebals <decebal.suiu@gmail.com> | 2019-05-02 21:44:36 +0300 |
---|---|---|
committer | decebals <decebal.suiu@gmail.com> | 2019-05-02 21:44:36 +0300 |
commit | 73ac9c0d2bef43362719c3857648831d59f3480f (patch) | |
tree | 1a53a1af2e3a45e93af6a6eae640a6ff2f015ba5 | |
parent | 1d36fcff75cfe38639fc1a8a28eefc79e8e7286f (diff) | |
download | pf4j-73ac9c0d2bef43362719c3857648831d59f3480f.tar.gz pf4j-73ac9c0d2bef43362719c3857648831d59f3480f.zip |
Extract constants for some system property namse
-rw-r--r-- | pf4j/src/main/java/org/pf4j/AbstractPluginManager.java | 6 | ||||
-rw-r--r-- | pf4j/src/main/java/org/pf4j/DefaultPluginManager.java | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java index 478149d..a940610 100644 --- a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java +++ b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java @@ -44,6 +44,8 @@ public abstract class AbstractPluginManager implements PluginManager { private static final Logger log = LoggerFactory.getLogger(AbstractPluginManager.class); + public static final String PLUGINS_DIR_PROPERTY_NAME = "pf4j.pluginsDir"; + private Path pluginsRoot; protected ExtensionFinder extensionFinder; @@ -682,14 +684,14 @@ public abstract class AbstractPluginManager implements PluginManager { /** * Add the possibility to override the plugins root. - * If a {@code pf4j.pluginsDir} system property is defined than this method returns that root. + * If a {@link #PLUGINS_DIR_PROPERTY_NAME} system property is defined than this method returns that root. * If {@link #getRuntimeMode()} returns {@link RuntimeMode#DEVELOPMENT} than {@code ../plugins} * is returned else this method returns {@code plugins}. * * @return the plugins root */ protected Path createPluginsRoot() { - String pluginsDir = System.getProperty("pf4j.pluginsDir"); + String pluginsDir = System.getProperty(PLUGINS_DIR_PROPERTY_NAME); if (pluginsDir == null) { if (isDevelopment()) { pluginsDir = "../plugins"; diff --git a/pf4j/src/main/java/org/pf4j/DefaultPluginManager.java b/pf4j/src/main/java/org/pf4j/DefaultPluginManager.java index b64ddbb..db5678b 100644 --- a/pf4j/src/main/java/org/pf4j/DefaultPluginManager.java +++ b/pf4j/src/main/java/org/pf4j/DefaultPluginManager.java @@ -35,6 +35,8 @@ public class DefaultPluginManager extends AbstractPluginManager { private static final Logger log = LoggerFactory.getLogger(DefaultPluginManager.class); + public static final String PLUGINS_DIR_CONFIG_PROPERTY_NAME = "pf4j.pluginsConfigDir"; + protected PluginClasspath pluginClasspath; public DefaultPluginManager() { @@ -72,7 +74,7 @@ public class DefaultPluginManager extends AbstractPluginManager { @Override protected PluginStatusProvider createPluginStatusProvider() { - String configDir = System.getProperty("pf4j.pluginsConfigDir"); + String configDir = System.getProperty(PLUGINS_DIR_CONFIG_PROPERTY_NAME); Path configPath = configDir != null ? Paths.get(configDir) : getPluginsRoot(); return new DefaultPluginStatusProvider(configPath); } @@ -97,9 +99,8 @@ public class DefaultPluginManager extends AbstractPluginManager { } /** - * By default if {@link DefaultPluginManager#isDevelopment()} returns true - * than a {@link DevelopmentPluginClasspath} is returned - * else this method returns {@link DefaultPluginClasspath}. + * By default if {@link #isDevelopment()} returns {@code true} than a {@link DevelopmentPluginClasspath} + * is returned, else this method returns {@link DefaultPluginClasspath}. */ protected PluginClasspath createPluginClasspath() { return isDevelopment() ? new DevelopmentPluginClasspath() : new DefaultPluginClasspath(); |