|
|
@ -37,6 +37,15 @@ public class ManifestPluginDescriptorFinder implements PluginDescriptorFinder { |
|
|
|
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(ManifestPluginDescriptorFinder.class); |
|
|
|
private static final Logger log = LoggerFactory.getLogger(ManifestPluginDescriptorFinder.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final String PLUGIN_ID = "Plugin-Id"; |
|
|
|
|
|
|
|
public static final String PLUGIN_DESCRIPTION = "Plugin-Description"; |
|
|
|
|
|
|
|
public static final String PLUGIN_CLASS = "Plugin-Class"; |
|
|
|
|
|
|
|
public static final String PLUGIN_VERSION = "Plugin-Version"; |
|
|
|
|
|
|
|
public static final String PLUGIN_PROVIDER = "Plugin-Provider"; |
|
|
|
|
|
|
|
public static final String PLUGIN_DEPENDENCIES = "Plugin-Dependencies"; |
|
|
|
|
|
|
|
public static final String PLUGIN_REQUIRES = "Plugin-Requires"; |
|
|
|
|
|
|
|
public static final String PLUGIN_LICENSE = "Plugin-License"; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean isApplicable(Path pluginPath) { |
|
|
|
public boolean isApplicable(Path pluginPath) { |
|
|
|
return Files.exists(pluginPath) && (Files.isDirectory(pluginPath) || FileUtils.isJarFile(pluginPath)); |
|
|
|
return Files.exists(pluginPath) && (Files.isDirectory(pluginPath) || FileUtils.isJarFile(pluginPath)); |
|
|
@ -92,37 +101,37 @@ public class ManifestPluginDescriptorFinder implements PluginDescriptorFinder { |
|
|
|
|
|
|
|
|
|
|
|
// TODO validate !!!
|
|
|
|
// TODO validate !!!
|
|
|
|
Attributes attributes = manifest.getMainAttributes(); |
|
|
|
Attributes attributes = manifest.getMainAttributes(); |
|
|
|
String id = attributes.getValue("Plugin-Id"); |
|
|
|
String id = attributes.getValue(PLUGIN_ID); |
|
|
|
pluginDescriptor.setPluginId(id); |
|
|
|
pluginDescriptor.setPluginId(id); |
|
|
|
|
|
|
|
|
|
|
|
String description = attributes.getValue("Plugin-Description"); |
|
|
|
String description = attributes.getValue(PLUGIN_DESCRIPTION); |
|
|
|
if (StringUtils.isNullOrEmpty(description)) { |
|
|
|
if (StringUtils.isNullOrEmpty(description)) { |
|
|
|
pluginDescriptor.setPluginDescription(""); |
|
|
|
pluginDescriptor.setPluginDescription(""); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
pluginDescriptor.setPluginDescription(description); |
|
|
|
pluginDescriptor.setPluginDescription(description); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String clazz = attributes.getValue("Plugin-Class"); |
|
|
|
String clazz = attributes.getValue(PLUGIN_CLASS); |
|
|
|
if (StringUtils.isNotNullOrEmpty(clazz)) { |
|
|
|
if (StringUtils.isNotNullOrEmpty(clazz)) { |
|
|
|
pluginDescriptor.setPluginClass(clazz); |
|
|
|
pluginDescriptor.setPluginClass(clazz); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String version = attributes.getValue("Plugin-Version"); |
|
|
|
String version = attributes.getValue(PLUGIN_VERSION); |
|
|
|
if (StringUtils.isNotNullOrEmpty(version)) { |
|
|
|
if (StringUtils.isNotNullOrEmpty(version)) { |
|
|
|
pluginDescriptor.setPluginVersion(version); |
|
|
|
pluginDescriptor.setPluginVersion(version); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String provider = attributes.getValue("Plugin-Provider"); |
|
|
|
String provider = attributes.getValue(PLUGIN_PROVIDER); |
|
|
|
pluginDescriptor.setProvider(provider); |
|
|
|
pluginDescriptor.setProvider(provider); |
|
|
|
String dependencies = attributes.getValue("Plugin-Dependencies"); |
|
|
|
String dependencies = attributes.getValue(PLUGIN_DEPENDENCIES); |
|
|
|
pluginDescriptor.setDependencies(dependencies); |
|
|
|
pluginDescriptor.setDependencies(dependencies); |
|
|
|
|
|
|
|
|
|
|
|
String requires = attributes.getValue("Plugin-Requires"); |
|
|
|
String requires = attributes.getValue(PLUGIN_REQUIRES); |
|
|
|
if (StringUtils.isNotNullOrEmpty(requires)) { |
|
|
|
if (StringUtils.isNotNullOrEmpty(requires)) { |
|
|
|
pluginDescriptor.setRequires(requires); |
|
|
|
pluginDescriptor.setRequires(requires); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pluginDescriptor.setLicense(attributes.getValue("Plugin-License")); |
|
|
|
pluginDescriptor.setLicense(attributes.getValue(PLUGIN_LICENSE)); |
|
|
|
|
|
|
|
|
|
|
|
return pluginDescriptor; |
|
|
|
return pluginDescriptor; |
|
|
|
} |
|
|
|
} |
|
|
|