Browse Source

#107

pull/108/head
Decebal Suiu 8 years ago
parent
commit
d6f9ccb119
  1. 6
      pf4j/src/main/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinder.java
  2. 6
      pf4j/src/main/java/ro/fortsoft/pf4j/PropertiesPluginDescriptorFinder.java

6
pf4j/src/main/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinder.java

@ -85,7 +85,7 @@ public class ManifestPluginDescriptorFinder implements PluginDescriptorFinder {
}
protected PluginDescriptor createPluginDescriptor(Manifest manifest) {
PluginDescriptor pluginDescriptor = new PluginDescriptor();
PluginDescriptor pluginDescriptor = createPluginDescriptorInstance();
// TODO validate !!!
Attributes attributes = manifest.getMainAttributes();
@ -120,6 +120,10 @@ public class ManifestPluginDescriptorFinder implements PluginDescriptorFinder {
return pluginDescriptor;
}
protected PluginDescriptor createPluginDescriptorInstance() {
return new PluginDescriptor();
}
protected void validatePluginDescriptor(PluginDescriptor pluginDescriptor) throws PluginException {
if (StringUtils.isEmpty(pluginDescriptor.getPluginId())) {
throw new PluginException("Plugin-Id cannot be empty");

6
pf4j/src/main/java/ro/fortsoft/pf4j/PropertiesPluginDescriptorFinder.java

@ -89,7 +89,7 @@ public class PropertiesPluginDescriptorFinder implements PluginDescriptorFinder
}
protected PluginDescriptor createPluginDescriptor(Properties properties) {
PluginDescriptor pluginDescriptor = new PluginDescriptor();
PluginDescriptor pluginDescriptor = createPluginDescriptorInstance();
// TODO validate !!!
String id = properties.getProperty("plugin.id");
@ -112,6 +112,10 @@ public class PropertiesPluginDescriptorFinder implements PluginDescriptorFinder
return pluginDescriptor;
}
protected PluginDescriptor createPluginDescriptorInstance() {
return new PluginDescriptor();
}
protected void validatePluginDescriptor(PluginDescriptor pluginDescriptor) throws PluginException {
if (StringUtils.isEmpty(pluginDescriptor.getPluginId())) {
throw new PluginException("plugin.id cannot be empty");

Loading…
Cancel
Save