aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demo/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java4
-rw-r--r--demo/plugins/plugin2/src/main/java/org/pf4j/demo/hello/HelloPlugin.java2
-rw-r--r--demo_gradle/app/src/main/java/org/pf4j/demo/Boot.java18
-rw-r--r--demo_gradle/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java5
-rw-r--r--demo_gradle/plugins/plugin2/src/main/java/org/pf4j/demo/hello/HelloPlugin.java2
-rw-r--r--pf4j/src/main/java/org/pf4j/DefaultExtensionFinder.java2
-rw-r--r--pf4j/src/main/java/org/pf4j/DefaultPluginManager.java6
-rw-r--r--pf4j/src/main/java/org/pf4j/DependencyResolver.java16
-rw-r--r--pf4j/src/main/java/org/pf4j/Extension.java2
-rw-r--r--pf4j/src/main/java/org/pf4j/LegacyExtensionFinder.java6
-rw-r--r--pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java4
-rw-r--r--pf4j/src/main/java/org/pf4j/PluginClassLoader.java28
-rw-r--r--pf4j/src/main/java/org/pf4j/PluginDescriptorFinder.java2
-rw-r--r--pf4j/src/main/java/org/pf4j/PluginManager.java22
-rw-r--r--pf4j/src/main/java/org/pf4j/PluginState.java18
-rw-r--r--pf4j/src/main/java/org/pf4j/PluginWrapper.java136
-rw-r--r--pf4j/src/main/java/org/pf4j/PropertiesPluginDescriptorFinder.java24
-rw-r--r--pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java28
-rw-r--r--pf4j/src/main/java/org/pf4j/util/DirectedGraph.java26
-rw-r--r--pf4j/src/main/java/org/pf4j/util/DirectoryFileFilter.java2
-rw-r--r--pf4j/src/main/java/org/pf4j/util/FileUtils.java48
-rw-r--r--pf4j/src/main/java/org/pf4j/util/HiddenFilter.java8
-rw-r--r--pf4j/src/main/java/org/pf4j/util/StringUtils.java6
-rw-r--r--pf4j/src/main/java/org/pf4j/util/Unzip.java4
24 files changed, 210 insertions, 209 deletions
diff --git a/demo/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java b/demo/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java
index 1106048..8dce434 100644
--- a/demo/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java
+++ b/demo/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java
@@ -37,7 +37,7 @@ public class WelcomePlugin extends Plugin {
System.out.println("WelcomePlugin.start()");
// for testing the development mode
if (RuntimeMode.DEVELOPMENT.equals(wrapper.getRuntimeMode())) {
- System.out.println(StringUtils.upperCase("WelcomePlugin"));
+ System.out.println(StringUtils.upperCase("WelcomePlugin"));
}
}
@@ -49,7 +49,7 @@ public class WelcomePlugin extends Plugin {
@Extension
public static class WelcomeGreeting implements Greeting {
- @Override
+ @Override
public String getGreeting() {
return "Welcome";
}
diff --git a/demo/plugins/plugin2/src/main/java/org/pf4j/demo/hello/HelloPlugin.java b/demo/plugins/plugin2/src/main/java/org/pf4j/demo/hello/HelloPlugin.java
index d801177..0f02a08 100644
--- a/demo/plugins/plugin2/src/main/java/org/pf4j/demo/hello/HelloPlugin.java
+++ b/demo/plugins/plugin2/src/main/java/org/pf4j/demo/hello/HelloPlugin.java
@@ -44,7 +44,7 @@ public class HelloPlugin extends Plugin {
@Extension(ordinal=1)
public static class HelloGreeting implements Greeting {
- @Override
+ @Override
public String getGreeting() {
return "Hello";
}
diff --git a/demo_gradle/app/src/main/java/org/pf4j/demo/Boot.java b/demo_gradle/app/src/main/java/org/pf4j/demo/Boot.java
index cbf6007..ebc5c31 100644
--- a/demo_gradle/app/src/main/java/org/pf4j/demo/Boot.java
+++ b/demo_gradle/app/src/main/java/org/pf4j/demo/Boot.java
@@ -94,19 +94,19 @@ public class Boot {
/*
Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- pluginManager.stopPlugins();
- }
+ @Override
+ public void run() {
+ pluginManager.stopPlugins();
+ }
});
*/
}
- private static void printLogo() {
- logger.info(StringUtils.repeat("#", 40));
- logger.info(StringUtils.center("PF4J-DEMO", 40));
- logger.info(StringUtils.repeat("#", 40));
- }
+ private static void printLogo() {
+ logger.info(StringUtils.repeat("#", 40));
+ logger.info(StringUtils.center("PF4J-DEMO", 40));
+ logger.info(StringUtils.repeat("#", 40));
+ }
}
diff --git a/demo_gradle/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java b/demo_gradle/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java
index 65f4d28..aaf1804 100644
--- a/demo_gradle/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java
+++ b/demo_gradle/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java
@@ -28,6 +28,7 @@ import org.pf4j.demo.api.Greeting;
* @author Decebal Suiu
*/
public class WelcomePlugin extends Plugin {
+
private static final Logger logger = LoggerFactory.getLogger(WelcomePlugin.class);
public WelcomePlugin(PluginWrapper wrapper) {
@@ -37,7 +38,7 @@ public class WelcomePlugin extends Plugin {
@Override
public void start() {
logger.info("WelcomePlugin.start()");
- logger.info(StringUtils.upperCase("WelcomePlugin"));
+ logger.info(StringUtils.upperCase("WelcomePlugin"));
}
@Override
@@ -48,7 +49,7 @@ public class WelcomePlugin extends Plugin {
@Extension
public static class WelcomeGreeting implements Greeting {
- @Override
+ @Override
public String getGreeting() {
return "Welcome";
}
diff --git a/demo_gradle/plugins/plugin2/src/main/java/org/pf4j/demo/hello/HelloPlugin.java b/demo_gradle/plugins/plugin2/src/main/java/org/pf4j/demo/hello/HelloPlugin.java
index d3af229..f9c7797 100644
--- a/demo_gradle/plugins/plugin2/src/main/java/org/pf4j/demo/hello/HelloPlugin.java
+++ b/demo_gradle/plugins/plugin2/src/main/java/org/pf4j/demo/hello/HelloPlugin.java
@@ -47,7 +47,7 @@ public class HelloPlugin extends Plugin {
@Extension(ordinal=1)
public static class HelloGreeting implements Greeting {
- @Override
+ @Override
public String getGreeting() {
return "Hello";
}
diff --git a/pf4j/src/main/java/org/pf4j/DefaultExtensionFinder.java b/pf4j/src/main/java/org/pf4j/DefaultExtensionFinder.java
index 217bd59..183b757 100644
--- a/pf4j/src/main/java/org/pf4j/DefaultExtensionFinder.java
+++ b/pf4j/src/main/java/org/pf4j/DefaultExtensionFinder.java
@@ -31,7 +31,7 @@ public class DefaultExtensionFinder implements ExtensionFinder, PluginStateListe
protected PluginManager pluginManager;
protected List<ExtensionFinder> finders = new ArrayList<>();
- public DefaultExtensionFinder(PluginManager pluginManager) {
+ public DefaultExtensionFinder(PluginManager pluginManager) {
this.pluginManager = pluginManager;
add(new LegacyExtensionFinder(pluginManager));
diff --git a/pf4j/src/main/java/org/pf4j/DefaultPluginManager.java b/pf4j/src/main/java/org/pf4j/DefaultPluginManager.java
index 2cc89b3..01f0f28 100644
--- a/pf4j/src/main/java/org/pf4j/DefaultPluginManager.java
+++ b/pf4j/src/main/java/org/pf4j/DefaultPluginManager.java
@@ -29,7 +29,7 @@ import java.nio.file.Path;
*/
public class DefaultPluginManager extends AbstractPluginManager {
- private static final Logger log = LoggerFactory.getLogger(DefaultPluginManager.class);
+ private static final Logger log = LoggerFactory.getLogger(DefaultPluginManager.class);
protected PluginClasspath pluginClasspath;
@@ -60,7 +60,7 @@ public class DefaultPluginManager extends AbstractPluginManager {
@Override
protected ExtensionFinder createExtensionFinder() {
- DefaultExtensionFinder extensionFinder = new DefaultExtensionFinder(this);
+ DefaultExtensionFinder extensionFinder = new DefaultExtensionFinder(this);
addPluginStateListener(extensionFinder);
return extensionFinder;
@@ -120,7 +120,7 @@ public class DefaultPluginManager extends AbstractPluginManager {
}
log.info("PF4J version {} in '{}' mode", getVersion(), getRuntimeMode());
- }
+ }
/**
* Load a plugin from disk. If the path is a zip file, first unpack
diff --git a/pf4j/src/main/java/org/pf4j/DependencyResolver.java b/pf4j/src/main/java/org/pf4j/DependencyResolver.java
index 7f36728..26999bd 100644
--- a/pf4j/src/main/java/org/pf4j/DependencyResolver.java
+++ b/pf4j/src/main/java/org/pf4j/DependencyResolver.java
@@ -39,9 +39,9 @@ import java.util.Map;
*/
public class DependencyResolver {
- private static final Logger log = LoggerFactory.getLogger(DependencyResolver.class);
+ private static final Logger log = LoggerFactory.getLogger(DependencyResolver.class);
- private VersionManager versionManager;
+ private VersionManager versionManager;
private DirectedGraph<String> dependenciesGraph; // the value is 'pluginId'
private DirectedGraph<String> dependentsGraph; // the value is 'pluginId'
@@ -168,10 +168,10 @@ public class DependencyResolver {
"' for plugin '" + dependent.getPluginId() + "'");
}
- public static class Result {
+ public static class Result {
- private boolean cyclicDependency;
- private List<String> notFoundDependencies; // value is "pluginId"
+ private boolean cyclicDependency;
+ private List<String> notFoundDependencies; // value is "pluginId"
private List<String> sortedPlugins; // value is "pluginId"
private List<WrongDependencyVersion> wrongVersionDependencies;
@@ -194,9 +194,9 @@ public class DependencyResolver {
return cyclicDependency;
}
- /**
- * Returns a list with dependencies required that were not found.
- */
+ /**
+ * Returns a list with dependencies required that were not found.
+ */
public List<String> getNotFoundDependencies() {
return notFoundDependencies;
}
diff --git a/pf4j/src/main/java/org/pf4j/Extension.java b/pf4j/src/main/java/org/pf4j/Extension.java
index 87639a6..dceecbd 100644
--- a/pf4j/src/main/java/org/pf4j/Extension.java
+++ b/pf4j/src/main/java/org/pf4j/Extension.java
@@ -32,6 +32,6 @@ import java.lang.annotation.Target;
@Documented
public @interface Extension {
- int ordinal() default 0;
+ int ordinal() default 0;
}
diff --git a/pf4j/src/main/java/org/pf4j/LegacyExtensionFinder.java b/pf4j/src/main/java/org/pf4j/LegacyExtensionFinder.java
index 55b824f..5c7c9b2 100644
--- a/pf4j/src/main/java/org/pf4j/LegacyExtensionFinder.java
+++ b/pf4j/src/main/java/org/pf4j/LegacyExtensionFinder.java
@@ -39,11 +39,11 @@ import java.util.Set;
*/
public class LegacyExtensionFinder extends AbstractExtensionFinder {
- private static final Logger log = LoggerFactory.getLogger(LegacyExtensionFinder.class);
+ private static final Logger log = LoggerFactory.getLogger(LegacyExtensionFinder.class);
- public LegacyExtensionFinder(PluginManager pluginManager) {
+ public LegacyExtensionFinder(PluginManager pluginManager) {
super(pluginManager);
- }
+ }
@Override
public Map<String, Set<String>> readClasspathStorages() {
diff --git a/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java b/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java
index 951e246..74cd0f3 100644
--- a/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java
+++ b/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java
@@ -43,11 +43,11 @@ public class ManifestPluginDescriptorFinder implements PluginDescriptorFinder {
}
@Override
- public PluginDescriptor find(Path pluginPath) throws PluginException {
+ public PluginDescriptor find(Path pluginPath) throws PluginException {
Manifest manifest = readManifest(pluginPath);
return createPluginDescriptor(manifest);
- }
+ }
protected Manifest readManifest(Path pluginPath) throws PluginException {
if (FileUtils.isJarFile(pluginPath)) {
diff --git a/pf4j/src/main/java/org/pf4j/PluginClassLoader.java b/pf4j/src/main/java/org/pf4j/PluginClassLoader.java
index 644d676..2043929 100644
--- a/pf4j/src/main/java/org/pf4j/PluginClassLoader.java
+++ b/pf4j/src/main/java/org/pf4j/PluginClassLoader.java
@@ -37,11 +37,11 @@ public class PluginClassLoader extends URLClassLoader {
private static final Logger log = LoggerFactory.getLogger(PluginClassLoader.class);
private static final String JAVA_PACKAGE_PREFIX = "java.";
- private static final String PLUGIN_PACKAGE_PREFIX = "org.pf4j.";
+ private static final String PLUGIN_PACKAGE_PREFIX = "org.pf4j.";
- private PluginManager pluginManager;
- private PluginDescriptor pluginDescriptor;
- private boolean parentFirst;
+ private PluginManager pluginManager;
+ private PluginDescriptor pluginDescriptor;
+ private boolean parentFirst;
public PluginClassLoader(PluginManager pluginManager, PluginDescriptor pluginDescriptor, ClassLoader parent) {
this(pluginManager, pluginDescriptor, parent, false);
@@ -52,20 +52,20 @@ public class PluginClassLoader extends URLClassLoader {
* before trying to load the a class through this loader.
*/
public PluginClassLoader(PluginManager pluginManager, PluginDescriptor pluginDescriptor, ClassLoader parent, boolean parentFirst) {
- super(new URL[0], parent);
+ super(new URL[0], parent);
- this.pluginManager = pluginManager;
- this.pluginDescriptor = pluginDescriptor;
- this.parentFirst = parentFirst;
- }
+ this.pluginManager = pluginManager;
+ this.pluginDescriptor = pluginDescriptor;
+ this.parentFirst = parentFirst;
+ }
@Override
- public void addURL(URL url) {
+ public void addURL(URL url) {
log.debug("Add '{}'", url);
- super.addURL(url);
- }
+ super.addURL(url);
+ }
- public void addFile(File file) {
+ public void addFile(File file) {
try {
addURL(file.getCanonicalFile().toURI().toURL());
} catch (IOException e) {
@@ -80,7 +80,7 @@ public class PluginClassLoader extends URLClassLoader {
* via the standard {@link ClassLoader#loadClass(String)} mechanism.
* Use {@link #parentFirst} to change the loading strategy.
*/
- @Override
+ @Override
public Class<?> loadClass(String className) throws ClassNotFoundException {
synchronized (getClassLoadingLock(className)) {
// first check whether it's a system class, delegate to the system loader
diff --git a/pf4j/src/main/java/org/pf4j/PluginDescriptorFinder.java b/pf4j/src/main/java/org/pf4j/PluginDescriptorFinder.java
index 8d40813..3b9f600 100644
--- a/pf4j/src/main/java/org/pf4j/PluginDescriptorFinder.java
+++ b/pf4j/src/main/java/org/pf4j/PluginDescriptorFinder.java
@@ -35,6 +35,6 @@ public interface PluginDescriptorFinder {
*/
boolean isApplicable(Path pluginPath);
- PluginDescriptor find(Path pluginPath) throws PluginException;
+ PluginDescriptor find(Path pluginPath) throws PluginException;
}
diff --git a/pf4j/src/main/java/org/pf4j/PluginManager.java b/pf4j/src/main/java/org/pf4j/PluginManager.java
index 52285d7..eaa605f 100644
--- a/pf4j/src/main/java/org/pf4j/PluginManager.java
+++ b/pf4j/src/main/java/org/pf4j/PluginManager.java
@@ -40,12 +40,12 @@ public interface PluginManager {
/**
* Retrieves all resolved plugins (with resolved dependency).
*/
- List<PluginWrapper> getResolvedPlugins();
+ List<PluginWrapper> getResolvedPlugins();
- /**
- * Retrieves all unresolved plugins (with unresolved dependency).
- */
- List<PluginWrapper> getUnresolvedPlugins();
+ /**
+ * Retrieves all unresolved plugins (with unresolved dependency).
+ */
+ List<PluginWrapper> getUnresolvedPlugins();
/**
* Retrieves all started plugins.
@@ -71,7 +71,7 @@ public interface PluginManager {
* @param pluginPath
* @return the pluginId of the installed plugin or null
*/
- String loadPlugin(Path pluginPath);
+ String loadPlugin(Path pluginPath);
/**
* Start all active plugins.
@@ -129,13 +129,13 @@ public interface PluginManager {
*/
boolean deletePlugin(String pluginId);
- ClassLoader getPluginClassLoader(String pluginId);
+ ClassLoader getPluginClassLoader(String pluginId);
<T> List<Class<T>> getExtensionClasses(Class<T> type);
<T> List<Class<T>> getExtensionClasses(Class<T> type, String pluginId);
- <T> List<T> getExtensions(Class<T> type);
+ <T> List<T> getExtensions(Class<T> type);
<T> List<T> getExtensions(Class<T> type, String pluginId);
@@ -146,9 +146,9 @@ public interface PluginManager {
ExtensionFactory getExtensionFactory();
/**
- * The runtime mode. Must currently be either DEVELOPMENT or DEPLOYMENT.
- */
- RuntimeMode getRuntimeMode();
+ * The runtime mode. Must currently be either DEVELOPMENT or DEPLOYMENT.
+ */
+ RuntimeMode getRuntimeMode();
/**
* Retrieves the {@link PluginWrapper} that loaded the given class 'clazz'.
diff --git a/pf4j/src/main/java/org/pf4j/PluginState.java b/pf4j/src/main/java/org/pf4j/PluginState.java
index 195e121..51c3f48 100644
--- a/pf4j/src/main/java/org/pf4j/PluginState.java
+++ b/pf4j/src/main/java/org/pf4j/PluginState.java
@@ -23,7 +23,7 @@ public class PluginState {
/**
* The runtime knows the plugin is there. It knows about the plugin path, the plugin descriptor.
*/
- public static final PluginState CREATED = new PluginState("CREATED");
+ public static final PluginState CREATED = new PluginState("CREATED");
/**
* The plugin cannot be used.
@@ -39,18 +39,18 @@ public class PluginState {
/**
* The {@link Plugin#start()} has executed. A started plugin may contribute extensions.
*/
- public static final PluginState STARTED = new PluginState("STARTED");
+ public static final PluginState STARTED = new PluginState("STARTED");
/**
* The {@link Plugin#stop()} has executed.
*/
public static final PluginState STOPPED = new PluginState("STOPPED");
- private String status;
+ private String status;
- private PluginState(String status) {
- this.status = status;
- }
+ private PluginState(String status) {
+ this.status = status;
+ }
@Override
public boolean equals(Object o) {
@@ -68,8 +68,8 @@ public class PluginState {
}
@Override
- public String toString() {
- return status;
- }
+ public String toString() {
+ return status;
+ }
}
diff --git a/pf4j/src/main/java/org/pf4j/PluginWrapper.java b/pf4j/src/main/java/org/pf4j/PluginWrapper.java
index c5d3383..c7d93ca 100644
--- a/pf4j/src/main/java/org/pf4j/PluginWrapper.java
+++ b/pf4j/src/main/java/org/pf4j/PluginWrapper.java
@@ -25,23 +25,23 @@ import java.nio.file.Path;
public class PluginWrapper {
private PluginManager pluginManager;
- private PluginDescriptor descriptor;
- private Path pluginPath;
- private ClassLoader pluginClassLoader;
- private PluginFactory pluginFactory;
- private PluginState pluginState;
- private RuntimeMode runtimeMode;
+ private PluginDescriptor descriptor;
+ private Path pluginPath;
+ private ClassLoader pluginClassLoader;
+ private PluginFactory pluginFactory;
+ private PluginState pluginState;
+ private RuntimeMode runtimeMode;
Plugin plugin; // cache
- public PluginWrapper(PluginManager pluginManager, PluginDescriptor descriptor, Path pluginPath, ClassLoader pluginClassLoader) {
+ public PluginWrapper(PluginManager pluginManager, PluginDescriptor descriptor, Path pluginPath, ClassLoader pluginClassLoader) {
this.pluginManager = pluginManager;
- this.descriptor = descriptor;
- this.pluginPath = pluginPath;
- this.pluginClassLoader = pluginClassLoader;
+ this.descriptor = descriptor;
+ this.pluginPath = pluginPath;
+ this.pluginClassLoader = pluginClassLoader;
- pluginState = PluginState.CREATED;
- }
+ pluginState = PluginState.CREATED;
+ }
/**
* Returns the plugin manager.
@@ -54,23 +54,23 @@ public class PluginWrapper {
* Returns the plugin descriptor.
*/
public PluginDescriptor getDescriptor() {
- return descriptor;
+ return descriptor;
}
/**
* Returns the path of this plugin.
*/
public Path getPluginPath() {
- return pluginPath;
+ return pluginPath;
}
/**
* Returns the plugin class loader used to load classes and resources
- * for this plug-in. The class loader can be used to directly access
- * plug-in resources and classes.
- */
+ * for this plug-in. The class loader can be used to directly access
+ * plug-in resources and classes.
+ */
public ClassLoader getPluginClassLoader() {
- return pluginClassLoader;
+ return pluginClassLoader;
}
public Plugin getPlugin() {
@@ -79,15 +79,15 @@ public class PluginWrapper {
}
return plugin;
- }
+ }
- public PluginState getPluginState() {
- return pluginState;
- }
+ public PluginState getPluginState() {
+ return pluginState;
+ }
- public RuntimeMode getRuntimeMode() {
- return runtimeMode;
- }
+ public RuntimeMode getRuntimeMode() {
+ return runtimeMode;
+ }
/**
* Shortcut
@@ -96,49 +96,49 @@ public class PluginWrapper {
return getDescriptor().getPluginId();
}
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + descriptor.getPluginId().hashCode();
-
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null) {
- return false;
- }
-
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- PluginWrapper other = (PluginWrapper) obj;
- if (!descriptor.getPluginId().equals(other.descriptor.getPluginId())) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public String toString() {
- return "PluginWrapper [descriptor=" + descriptor + ", pluginPath=" + pluginPath + "]";
- }
-
- void setPluginState(PluginState pluginState) {
- this.pluginState = pluginState;
- }
-
- void setRuntimeMode(RuntimeMode runtimeMode) {
- this.runtimeMode = runtimeMode;
- }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + descriptor.getPluginId().hashCode();
+
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null) {
+ return false;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ PluginWrapper other = (PluginWrapper) obj;
+ if (!descriptor.getPluginId().equals(other.descriptor.getPluginId())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "PluginWrapper [descriptor=" + descriptor + ", pluginPath=" + pluginPath + "]";
+ }
+
+ void setPluginState(PluginState pluginState) {
+ this.pluginState = pluginState;
+ }
+
+ void setRuntimeMode(RuntimeMode runtimeMode) {
+ this.runtimeMode = runtimeMode;
+ }
void setPluginFactory(PluginFactory pluginFactory) {
this.pluginFactory = pluginFactory;
diff --git a/pf4j/src/main/java/org/pf4j/PropertiesPluginDescriptorFinder.java b/pf4j/src/main/java/org/pf4j/PropertiesPluginDescriptorFinder.java
index 462f998..3e9e1c1 100644
--- a/pf4j/src/main/java/org/pf4j/PropertiesPluginDescriptorFinder.java
+++ b/pf4j/src/main/java/org/pf4j/PropertiesPluginDescriptorFinder.java
@@ -34,19 +34,19 @@ import java.util.Properties;
*/
public class PropertiesPluginDescriptorFinder implements PluginDescriptorFinder {
- private static final Logger log = LoggerFactory.getLogger(PropertiesPluginDescriptorFinder.class);
+ private static final Logger log = LoggerFactory.getLogger(PropertiesPluginDescriptorFinder.class);
- private static final String DEFAULT_PROPERTIES_FILE_NAME = "plugin.properties";
+ private static final String DEFAULT_PROPERTIES_FILE_NAME = "plugin.properties";
- protected String propertiesFileName;
+ protected String propertiesFileName;
- public PropertiesPluginDescriptorFinder() {
- this(DEFAULT_PROPERTIES_FILE_NAME);
- }
+ public PropertiesPluginDescriptorFinder() {
+ this(DEFAULT_PROPERTIES_FILE_NAME);
+ }
- public PropertiesPluginDescriptorFinder(String propertiesFileName) {
+ public PropertiesPluginDescriptorFinder(String propertiesFileName) {
this.propertiesFileName = propertiesFileName;
- }
+ }
@Override
public boolean isApplicable(Path pluginPath) {
@@ -54,11 +54,11 @@ public class PropertiesPluginDescriptorFinder implements PluginDescriptorFinder
}
@Override
- public PluginDescriptor find(Path pluginPath) throws PluginException {
+ public PluginDescriptor find(Path pluginPath) throws PluginException {
Properties properties = readProperties(pluginPath);
return createPluginDescriptor(properties);
- }
+ }
protected Properties readProperties(Path pluginPath) throws PluginException {
Path propertiesPath = getPropertiesPath(pluginPath, propertiesFileName);
@@ -82,10 +82,10 @@ public class PropertiesPluginDescriptorFinder implements PluginDescriptorFinder
}
protected Path getPropertiesPath(Path pluginPath, String propertiesFileName) throws PluginException {
- if (Files.isDirectory(pluginPath)) {
+ if (Files.isDirectory(pluginPath)) {
return pluginPath.resolve(Paths.get(propertiesFileName));
} else {
- // it's a jar file
+ // it's a jar file
try {
return FileUtils.getPath(pluginPath, propertiesFileName);
} catch (IOException e) {
diff --git a/pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java b/pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java
index 5e69090..2e89df3 100644
--- a/pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java
+++ b/pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java
@@ -58,17 +58,17 @@ public class ExtensionAnnotationProcessor extends AbstractProcessor {
}
@Override
- public SourceVersion getSupportedSourceVersion() {
- return SourceVersion.latest();
- }
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latest();
+ }
- @Override
- public Set<String> getSupportedAnnotationTypes() {
- Set<String> annotationTypes = new HashSet<>();
+ @Override
+ public Set<String> getSupportedAnnotationTypes() {
+ Set<String> annotationTypes = new HashSet<>();
annotationTypes.add(Extension.class.getName());
return annotationTypes;
- }
+ }
@Override
public Set<String> getSupportedOptions() {
@@ -79,17 +79,17 @@ public class ExtensionAnnotationProcessor extends AbstractProcessor {
}
@Override
- public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
- if (roundEnv.processingOver()) {
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ if (roundEnv.processingOver()) {
return false;
}
info("Processing @%s", Extension.class);
- for (Element element : roundEnv.getElementsAnnotatedWith(Extension.class)) {
+ for (Element element : roundEnv.getElementsAnnotatedWith(Extension.class)) {
// check if @Extension is put on class and not on method or constructor
if (!(element instanceof TypeElement)) {
- continue;
- }
+ continue;
+ }
// check if class extends/implements an extension point
if (!isExtension(element.asType())) {
@@ -130,8 +130,8 @@ public class ExtensionAnnotationProcessor extends AbstractProcessor {
// write extensions
storage.write(extensions);
- return false;
- }
+ return false;
+ }
public ProcessingEnvironment getProcessingEnvironment() {
return processingEnv;
diff --git a/pf4j/src/main/java/org/pf4j/util/DirectedGraph.java b/pf4j/src/main/java/org/pf4j/util/DirectedGraph.java
index 619043f..076d67c 100644
--- a/pf4j/src/main/java/org/pf4j/util/DirectedGraph.java
+++ b/pf4j/src/main/java/org/pf4j/util/DirectedGraph.java
@@ -41,7 +41,7 @@ public class DirectedGraph<V> {
*/
public void addVertex(V vertex) {
if (containsVertex(vertex)) {
- return;
+ return;
}
neighbors.put(vertex, new ArrayList<V>());
@@ -94,7 +94,7 @@ public class DirectedGraph<V> {
public Map<V, Integer> outDegree() {
Map<V, Integer> result = new HashMap<>();
for (V vertex : neighbors.keySet()) {
- result.put(vertex, neighbors.get(vertex).size());
+ result.put(vertex, neighbors.get(vertex).size());
}
return result;
@@ -106,7 +106,7 @@ public class DirectedGraph<V> {
public Map<V, Integer> inDegree() {
Map<V, Integer> result = new HashMap<>();
for (V vertex : neighbors.keySet()) {
- result.put(vertex, 0); // all in-degrees are 0
+ result.put(vertex, 0); // all in-degrees are 0
}
for (V from : neighbors.keySet()) {
for (V to : neighbors.get(from)) {
@@ -128,7 +128,7 @@ public class DirectedGraph<V> {
Stack<V> zeroVertices = new Stack<>(); // stack as good as any here
for (V v : degree.keySet()) {
if (degree.get(v) == 0) {
- zeroVertices.push(v);
+ zeroVertices.push(v);
}
}
@@ -142,14 +142,14 @@ public class DirectedGraph<V> {
degree.put(neighbor, degree.get(neighbor) - 1);
// remember any vertices that now have zero in-degree
if (degree.get(neighbor) == 0) {
- zeroVertices.push(neighbor);
+ zeroVertices.push(neighbor);
}
}
}
// check that we have used the entire graph (if not, there was a cycle)
if (result.size() != neighbors.size()) {
- return null;
+ return null;
}
return result;
@@ -159,14 +159,14 @@ public class DirectedGraph<V> {
* Report (as a List) the reverse topological sort of the vertices; null for no such sort.
*/
public List<V> reverseTopologicalSort() {
- List<V> list = topologicalSort();
- if (list == null) {
- return null;
- }
+ List<V> list = topologicalSort();
+ if (list == null) {
+ return null;
+ }
- Collections.reverse(list);
+ Collections.reverse(list);
- return list;
+ return list;
}
/**
@@ -183,7 +183,7 @@ public class DirectedGraph<V> {
public String toString() {
StringBuffer sb = new StringBuffer();
for (V vertex : neighbors.keySet()) {
- sb.append("\n " + vertex + " -> " + neighbors.get(vertex));
+ sb.append("\n " + vertex + " -> " + neighbors.get(vertex));
}
return sb.toString();
diff --git a/pf4j/src/main/java/org/pf4j/util/DirectoryFileFilter.java b/pf4j/src/main/java/org/pf4j/util/DirectoryFileFilter.java
index d86dad4..db6f4cc 100644
--- a/pf4j/src/main/java/org/pf4j/util/DirectoryFileFilter.java
+++ b/pf4j/src/main/java/org/pf4j/util/DirectoryFileFilter.java
@@ -25,7 +25,7 @@ import java.io.FileFilter;
*/
public class DirectoryFileFilter implements FileFilter {
- @Override
+ @Override
public boolean accept(File file) {
return file.isDirectory();
}
diff --git a/pf4j/src/main/java/org/pf4j/util/FileUtils.java b/pf4j/src/main/java/org/pf4j/util/FileUtils.java
index fa2eb4d..38fd309 100644
--- a/pf4j/src/main/java/org/pf4j/util/FileUtils.java
+++ b/pf4j/src/main/java/org/pf4j/util/FileUtils.java
@@ -47,34 +47,34 @@ public class FileUtils {
public static List<String> readLines(Path path, boolean ignoreComments) throws IOException {
File file = path.toFile();
- if (!file.exists() || !file.isFile()) {
- return new ArrayList<>();
- }
+ if (!file.exists() || !file.isFile()) {
+ return new ArrayList<>();
+ }
- List<String> lines = new ArrayList<>();
+ List<String> lines = new ArrayList<>();
- try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
- String line;
- while ((line = reader.readLine()) != null) {
- if (ignoreComments && !line.startsWith("#") && !lines.contains(line)) {
- lines.add(line);
- }
- }
- }
+ try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ if (ignoreComments && !line.startsWith("#") && !lines.contains(line)) {
+ lines.add(line);
+ }
+ }
+ }
- return lines;
- }
+ return lines;
+ }
public static void writeLines(Collection<String> lines, File file) throws IOException {
Files.write(file.toPath(), lines, StandardCharsets.UTF_8);
}
/**
- * Delete a file or recursively delete a folder, do not follow symlinks.
- *
- * @param path the file or folder to delete
- * @throws IOException if something goes wrong
- */
+ * Delete a file or recursively delete a folder, do not follow symlinks.
+ *
+ * @param path the file or folder to delete
+ * @throws IOException if something goes wrong
+ */
public static void delete(Path path) throws IOException {
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
@@ -95,13 +95,13 @@ public class FileUtils {
}
});
- }
+ }
- public static List<File> getJars(Path folder) {
- List<File> bucket = new ArrayList<>();
- getJars(bucket, folder);
+ public static List<File> getJars(Path folder) {
+ List<File> bucket = new ArrayList<>();
+ getJars(bucket, folder);
- return bucket;
+ return bucket;
}
private static void getJars(final List<File> bucket, Path folder) {
diff --git a/pf4j/src/main/java/org/pf4j/util/HiddenFilter.java b/pf4j/src/main/java/org/pf4j/util/HiddenFilter.java
index ef9a56e..8adfbc0 100644
--- a/pf4j/src/main/java/org/pf4j/util/HiddenFilter.java
+++ b/pf4j/src/main/java/org/pf4j/util/HiddenFilter.java
@@ -25,9 +25,9 @@ import java.io.FileFilter;
*/
public class HiddenFilter implements FileFilter {
- @Override
- public boolean accept(File file) {
- return file.isHidden();
- }
+ @Override
+ public boolean accept(File file) {
+ return file.isHidden();
+ }
}
diff --git a/pf4j/src/main/java/org/pf4j/util/StringUtils.java b/pf4j/src/main/java/org/pf4j/util/StringUtils.java
index 6d03d53..72087ca 100644
--- a/pf4j/src/main/java/org/pf4j/util/StringUtils.java
+++ b/pf4j/src/main/java/org/pf4j/util/StringUtils.java
@@ -20,9 +20,9 @@ package org.pf4j.util;
*/
public class StringUtils {
- public static boolean isNullOrEmpty(String str) {
- return (str == null) || str.isEmpty();
- }
+ public static boolean isNullOrEmpty(String str) {
+ return (str == null) || str.isEmpty();
+ }
public static boolean isNotNullOrEmpty(String str) {
return !isNullOrEmpty(str);
diff --git a/pf4j/src/main/java/org/pf4j/util/Unzip.java b/pf4j/src/main/java/org/pf4j/util/Unzip.java
index 1572187..7762e47 100644
--- a/pf4j/src/main/java/org/pf4j/util/Unzip.java
+++ b/pf4j/src/main/java/org/pf4j/util/Unzip.java
@@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
*/
public class Unzip {
- private static final Logger log = LoggerFactory.getLogger(Unzip.class);
+ private static final Logger log = LoggerFactory.getLogger(Unzip.class);
/**
* Holds the destination directory.
@@ -71,7 +71,7 @@ public class Unzip {
FileUtils.delete(destination.toPath());
}
- try (ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(source))) {
+ try (ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(source))) {
ZipEntry zipEntry;
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
try {