Browse Source

Add an optional description to the manifest

pull/13/head
James Moger 11 years ago
parent
commit
2bc87639f9
  1. 7
      pf4j/src/main/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinder.java
  2. 12
      pf4j/src/main/java/ro/fortsoft/pf4j/PluginDescriptor.java

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

@ -79,6 +79,13 @@ public class ManifestPluginDescriptorFinder implements PluginDescriptorFinder {
}
pluginDescriptor.setPluginId(id);
String description = attrs.getValue("Plugin-Description");
if (StringUtils.isEmpty(description)) {
pluginDescriptor.setPluginDescription("");
} else {
pluginDescriptor.setPluginDescription(description);
}
String clazz = attrs.getValue("Plugin-Class");
if (StringUtils.isEmpty(clazz)) {
throw new PluginException("Plugin-Class cannot be empty");

12
pf4j/src/main/java/ro/fortsoft/pf4j/PluginDescriptor.java

@ -25,6 +25,7 @@ import java.util.List;
public class PluginDescriptor {
private String pluginId;
private String pluginDescription;
private String pluginClass;
private PluginVersion version;
private String provider;
@ -41,6 +42,13 @@ public class PluginDescriptor {
return pluginId;
}
/**
* Returns the description of this plugin.
*/
public String getPluginDescription() {
return pluginDescription;
}
/**
* Returns the name of the class that implements Plugin interface.
*/
@ -82,6 +90,10 @@ public class PluginDescriptor {
this.pluginId = pluginId;
}
void setPluginDescription(String pluginDescription) {
this.pluginDescription = pluginDescription;
}
void setPluginClass(String pluginClassName) {
this.pluginClass = pluginClassName;
}

Loading…
Cancel
Save