aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2018-03-19 20:21:35 +0200
committerDecebal Suiu <decebal.suiu@gmail.com>2018-03-19 20:21:35 +0200
commit9b6d4a3efb31351cb45d1187edba796e03bcec16 (patch)
treef66a9e117eac8b78c772329cce2309e82d3df4d1
parent183914623870371001ac75b9274389a89091d5e2 (diff)
downloadpf4j-9b6d4a3efb31351cb45d1187edba796e03bcec16.tar.gz
pf4j-9b6d4a3efb31351cb45d1187edba796e03bcec16.zip
Resolve #199
-rw-r--r--pf4j/src/main/java/org/pf4j/AbstractPluginManager.java4
-rw-r--r--pf4j/src/main/java/org/pf4j/DefaultPluginDescriptor.java11
-rw-r--r--pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java4
-rw-r--r--pf4j/src/main/java/org/pf4j/Plugin.java2
-rw-r--r--pf4j/src/main/java/org/pf4j/PropertiesPluginDescriptorFinder.java4
5 files changed, 8 insertions, 17 deletions
diff --git a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
index 99aff8c..57f1c86 100644
--- a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
+++ b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
@@ -887,10 +887,6 @@ public abstract class AbstractPluginManager implements PluginManager {
throw new PluginException("Field 'id' cannot be empty");
}
- if (StringUtils.isNullOrEmpty(descriptor.getPluginClass())) {
- throw new PluginException("Field 'class' cannot be empty");
- }
-
if (descriptor.getVersion() == null) {
throw new PluginException("Field 'version' cannot be empty");
}
diff --git a/pf4j/src/main/java/org/pf4j/DefaultPluginDescriptor.java b/pf4j/src/main/java/org/pf4j/DefaultPluginDescriptor.java
index 61a7d2a..4d81a8d 100644
--- a/pf4j/src/main/java/org/pf4j/DefaultPluginDescriptor.java
+++ b/pf4j/src/main/java/org/pf4j/DefaultPluginDescriptor.java
@@ -26,7 +26,7 @@ public class DefaultPluginDescriptor implements PluginDescriptor {
private String pluginId;
private String pluginDescription;
- private String pluginClass;
+ private String pluginClass = Plugin.class.getName();
private String version;
private String requires = "*"; // SemVer format
private String provider;
@@ -37,15 +37,6 @@ public class DefaultPluginDescriptor implements PluginDescriptor {
dependencies = new ArrayList<>();
}
- /**
- * @param pluginId
- * @param pluginDescription
- * @param pluginClass
- * @param version
- * @param requires
- * @param provider
- * @param license
- */
public DefaultPluginDescriptor(String pluginId, String pluginDescription, String pluginClass, String version, String requires, String provider, String license) {
this();
this.pluginId = pluginId;
diff --git a/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java b/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java
index e2f26c9..d6ef17f 100644
--- a/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java
+++ b/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java
@@ -103,7 +103,9 @@ public class ManifestPluginDescriptorFinder implements PluginDescriptorFinder {
}
String clazz = attributes.getValue("Plugin-Class");
- pluginDescriptor.setPluginClass(clazz);
+ if (StringUtils.isNotNullOrEmpty(clazz)) {
+ pluginDescriptor.setPluginClass(clazz);
+ }
String version = attributes.getValue("Plugin-Version");
if (StringUtils.isNotNullOrEmpty(version)) {
diff --git a/pf4j/src/main/java/org/pf4j/Plugin.java b/pf4j/src/main/java/org/pf4j/Plugin.java
index 1972664..cfaa343 100644
--- a/pf4j/src/main/java/org/pf4j/Plugin.java
+++ b/pf4j/src/main/java/org/pf4j/Plugin.java
@@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
*
* @author Decebal Suiu
*/
-public abstract class Plugin {
+public class Plugin {
/**
* Makes logging service available for descending classes.
diff --git a/pf4j/src/main/java/org/pf4j/PropertiesPluginDescriptorFinder.java b/pf4j/src/main/java/org/pf4j/PropertiesPluginDescriptorFinder.java
index 80026b9..cedb4aa 100644
--- a/pf4j/src/main/java/org/pf4j/PropertiesPluginDescriptorFinder.java
+++ b/pf4j/src/main/java/org/pf4j/PropertiesPluginDescriptorFinder.java
@@ -109,7 +109,9 @@ public class PropertiesPluginDescriptorFinder implements PluginDescriptorFinder
}
String clazz = properties.getProperty("plugin.class");
- pluginDescriptor.setPluginClass(clazz);
+ if (StringUtils.isNotNullOrEmpty(clazz)) {
+ pluginDescriptor.setPluginClass(clazz);
+ }
String version = properties.getProperty("plugin.version");
if (StringUtils.isNotNullOrEmpty(version)) {