aboutsummaryrefslogtreecommitdiffstats
path: root/pf4j
diff options
context:
space:
mode:
authordecebals <decebal.suiu@gmail.com>2019-05-02 21:51:05 +0300
committerdecebals <decebal.suiu@gmail.com>2019-05-02 21:51:05 +0300
commitfde642e63a6a0165d0e60b80f6fc559368f712e7 (patch)
tree60aec3c31799f9ef6192bab66ee005284da61750 /pf4j
parent73ac9c0d2bef43362719c3857648831d59f3480f (diff)
downloadpf4j-fde642e63a6a0165d0e60b80f6fc559368f712e7.tar.gz
pf4j-fde642e63a6a0165d0e60b80f6fc559368f712e7.zip
Extract constants for some strings
Diffstat (limited to 'pf4j')
-rw-r--r--pf4j/src/main/java/org/pf4j/AbstractPluginManager.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
index a940610..9e86909 100644
--- a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
+++ b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
@@ -45,6 +45,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";
+ public static final String DEFAULT_PLUGINS_DIR = "plugins";
+ public static final String DEVELOPMENT_PLUGINS_DIR = "../plugins";
private Path pluginsRoot;
@@ -685,19 +687,15 @@ public abstract class AbstractPluginManager implements PluginManager {
/**
* Add the possibility to override the plugins 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}.
+ * If {@link #getRuntimeMode()} returns {@link RuntimeMode#DEVELOPMENT} than {@link #DEVELOPMENT_PLUGINS_DIR}
+ * is returned else this method returns {@link #DEFAULT_PLUGINS_DIR}.
*
* @return the plugins root
*/
protected Path createPluginsRoot() {
String pluginsDir = System.getProperty(PLUGINS_DIR_PROPERTY_NAME);
if (pluginsDir == null) {
- if (isDevelopment()) {
- pluginsDir = "../plugins";
- } else {
- pluginsDir = "plugins";
- }
+ pluginsDir = isDevelopment() ? DEVELOPMENT_PLUGINS_DIR : DEFAULT_PLUGINS_DIR;
}
return Paths.get(pluginsDir);