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); 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"); String clazz = attrs.getValue("Plugin-Class");
if (StringUtils.isEmpty(clazz)) { if (StringUtils.isEmpty(clazz)) {
throw new PluginException("Plugin-Class cannot be empty"); 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 { public class PluginDescriptor {
private String pluginId; private String pluginId;
private String pluginDescription;
private String pluginClass; private String pluginClass;
private PluginVersion version; private PluginVersion version;
private String provider; private String provider;
@ -41,6 +42,13 @@ public class PluginDescriptor {
return pluginId; return pluginId;
} }
/**
* Returns the description of this plugin.
*/
public String getPluginDescription() {
return pluginDescription;
}
/** /**
* Returns the name of the class that implements Plugin interface. * Returns the name of the class that implements Plugin interface.
*/ */
@ -82,6 +90,10 @@ public class PluginDescriptor {
this.pluginId = pluginId; this.pluginId = pluginId;
} }
void setPluginDescription(String pluginDescription) {
this.pluginDescription = pluginDescription;
}
void setPluginClass(String pluginClassName) { void setPluginClass(String pluginClassName) {
this.pluginClass = pluginClassName; this.pluginClass = pluginClassName;
} }

Loading…
Cancel
Save