Plugins must provide a property file with name <PluginName>.properties

This commit is contained in:
Luca Frosini 2021-06-09 10:47:29 +02:00
parent ab992e11a7
commit e98829d01b
2 changed files with 4 additions and 2 deletions

View File

@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [v3.0.0-SNAPSHOT]
- Switched smart-executor JSON management to gcube-jackson [#19647]
- Plugins must provide a property file with name <PluginName>.properties [#21596]
## [v2.0.0]

View File

@ -20,7 +20,7 @@ public abstract class Plugin implements PluginDefinition {
private static Logger logger = LoggerFactory.getLogger(Plugin.class);
public static final String PLUGIN_PROPERTIES_FILENAME = "plugin.properties";
public static final String PLUGIN_PROPERTIES_SUFFIX_FILENAME = ".properties";
public static final String GROUP_PROPERTY = "groupId";
public static final String NAME_PROPERTY = "artifactId";
@ -52,7 +52,8 @@ public abstract class Plugin implements PluginDefinition {
properties = new Properties();
try {
InputStream input = getClass().getClassLoader().getResourceAsStream("META-INF" + File.separator + PLUGIN_PROPERTIES_FILENAME);
String filename = this.getClass().getSimpleName() + PLUGIN_PROPERTIES_SUFFIX_FILENAME;
InputStream input = getClass().getClassLoader().getResourceAsStream("META-INF" + File.separator + filename);
properties.load(input);
} catch(IOException e) {
throw new RuntimeException(e);