@@ -2,26 +2,54 @@ package co.statu.parsek
22
33import org.pf4j.ManifestPluginDescriptorFinder
44import org.pf4j.PluginDescriptor
5- import org.pf4j.util.StringUtils
65import java.util.jar.Manifest
76
87class ParsekManifestPluginDescriptorFinder : ManifestPluginDescriptorFinder () {
98 companion object {
10- private const val PLUGIN_SOURCE_URL : String = " Plugin-Source-Url"
9+ private const val PLUGIN_ID : String = " id"
10+ private const val PLUGIN_NAME : String = " name"
11+ private const val PLUGIN_DESCRIPTION : String = " description"
12+ private const val PLUGIN_PARSEK_VERSION : String = " parsek-version"
13+ private const val PLUGIN_CLASS : String = " main-class"
14+ private const val PLUGIN_VERSION : String = " version"
15+ private const val PLUGIN_DEVELOPER : String = " developer"
16+ private const val PLUGIN_LICENSE : String = " license"
17+ private const val PLUGIN_SOURCE_URL : String = " source-url"
18+ private const val PLUGIN_DEPENDENCIES : String = " dependencies"
19+ private const val PLUGIN_REQUIRES : String = " requires"
1120 }
1221
1322 override fun createPluginDescriptorInstance (): ParsekPluginDescriptor {
1423 return ParsekPluginDescriptor ()
1524 }
1625
1726 override fun createPluginDescriptor (manifest : Manifest ): PluginDescriptor {
18- val pluginDescriptor = super .createPluginDescriptor(manifest) as ParsekPluginDescriptor
27+ val pluginDescriptor = createPluginDescriptorInstance()
1928
2029 val attributes = manifest.mainAttributes
30+ val id = attributes.getValue(PLUGIN_ID )
31+ val name = attributes.getValue(PLUGIN_NAME )
32+ val description = attributes.getValue(PLUGIN_DESCRIPTION )
33+ val parsekVersion = attributes.getValue(PLUGIN_PARSEK_VERSION )
34+ val clazz = attributes.getValue(PLUGIN_CLASS )
35+ val version = attributes.getValue(PLUGIN_VERSION )
36+ val developer = attributes.getValue(PLUGIN_DEVELOPER )
37+ val license = attributes.getValue(PLUGIN_LICENSE )
2138 val sourceUrl = attributes.getValue(PLUGIN_SOURCE_URL )
22- if (StringUtils .isNotNullOrEmpty(sourceUrl)) {
23- pluginDescriptor.sourceUrl = sourceUrl
24- }
39+ val dependencies = attributes.getValue(PLUGIN_DEPENDENCIES )
40+ val requires = attributes.getValue(PLUGIN_REQUIRES )
41+
42+ pluginDescriptor.pluginId = id
43+ pluginDescriptor.name = name ? : id
44+ pluginDescriptor.description = description
45+ pluginDescriptor.parsekVersion = parsekVersion
46+ pluginDescriptor.setPluginClass(clazz)
47+ pluginDescriptor.setPluginVersion(version)
48+ pluginDescriptor.developer = developer
49+ pluginDescriptor.license = license
50+ pluginDescriptor.sourceUrl = sourceUrl
51+ pluginDescriptor.setDependencies(dependencies ? : " " )
52+ pluginDescriptor.setRequires(requires ? : " " )
2553
2654 return pluginDescriptor
2755 }
0 commit comments