@Override public PluginDescriptor find(Path pluginPath) throws PluginException { Properties properties = readProperties(pluginPath); return createPluginDescriptor(properties); }
protected Properties readProperties(Path pluginPath) throws PluginException { Path propertiesPath = getPropertiesPath(pluginPath, propertiesFileName); if (propertiesPath == null) { throw new PluginException("Cannot find the properties path"); } log.debug("Lookup plugin descriptor in '{}'", propertiesPath); if (Files.notExists(propertiesPath)) { throw new PluginException("Cannot find '{}' path", propertiesPath); } Properties properties = new Properties(); try (InputStream input = Files.newInputStream(propertiesPath)) { properties.load(input); } catch (IOException e) { throw new PluginException(e); } return properties; }
@Override protected PluginDescriptorFinder createPluginDescriptorFinder() { return new CompoundPluginDescriptorFinder() .add(new PropertiesPluginDescriptorFinder()) .add(new ManifestPluginDescriptorFinder()); }
protected PluginDescriptor createPluginDescriptor(Properties properties) { DefaultPluginDescriptor pluginDescriptor = createPluginDescriptorInstance(); // TODO validate !!! String id = properties.getProperty("plugin.id"); pluginDescriptor.setPluginId(id); String description = properties.getProperty("plugin.description"); if (StringUtils.isNullOrEmpty(description)) { pluginDescriptor.setPluginDescription(""); } else { pluginDescriptor.setPluginDescription(description); } String clazz = properties.getProperty("plugin.class"); if (StringUtils.isNotNullOrEmpty(clazz)) { pluginDescriptor.setPluginClass(clazz); } String version = properties.getProperty("plugin.version"); if (StringUtils.isNotNullOrEmpty(version)) { pluginDescriptor.setPluginVersion(version); } String provider = properties.getProperty("plugin.provider"); pluginDescriptor.setProvider(provider); String dependencies = properties.getProperty("plugin.dependencies"); pluginDescriptor.setDependencies(dependencies); String requires = properties.getProperty("plugin.requires"); if (StringUtils.isNotNullOrEmpty(requires)) { pluginDescriptor.setRequires(requires); } pluginDescriptor.setLicense(properties.getProperty("plugin.license")); return pluginDescriptor; }
@Override protected PluginDescriptorFinder createPluginDescriptorFinder() { return new CompoundPluginDescriptorFinder() .add(new PropertiesPluginDescriptorFinder()) .add(new ManifestPluginDescriptorFinder()); }
protected PluginDescriptor createPluginDescriptor(Properties properties) { DefaultPluginDescriptor pluginDescriptor = createPluginDescriptorInstance(); // TODO validate !!! String id = properties.getProperty("plugin.id"); pluginDescriptor.setPluginId(id); String description = properties.getProperty("plugin.description"); if (StringUtils.isNullOrEmpty(description)) { pluginDescriptor.setPluginDescription(""); } else { pluginDescriptor.setPluginDescription(description); } String clazz = properties.getProperty("plugin.class"); if (StringUtils.isNotNullOrEmpty(clazz)) { pluginDescriptor.setPluginClass(clazz); } String version = properties.getProperty("plugin.version"); if (StringUtils.isNotNullOrEmpty(version)) { pluginDescriptor.setPluginVersion(version); } String provider = properties.getProperty("plugin.provider"); pluginDescriptor.setProvider(provider); String dependencies = properties.getProperty("plugin.dependencies"); pluginDescriptor.setDependencies(dependencies); String requires = properties.getProperty("plugin.requires"); if (StringUtils.isNotNullOrEmpty(requires)) { pluginDescriptor.setRequires(requires); } pluginDescriptor.setLicense(properties.getProperty("plugin.license")); return pluginDescriptor; }
@Override public PluginDescriptor find(Path pluginPath) throws PluginException { Properties properties = readProperties(pluginPath); return createPluginDescriptor(properties); }
protected Properties readProperties(Path pluginPath) throws PluginException { Path propertiesPath = getPropertiesPath(pluginPath, propertiesFileName); if (propertiesPath == null) { throw new PluginException("Cannot find the properties path"); } log.debug("Lookup plugin descriptor in '{}'", propertiesPath); if (Files.notExists(propertiesPath)) { throw new PluginException("Cannot find '{}' path", propertiesPath); } Properties properties = new Properties(); try (InputStream input = Files.newInputStream(propertiesPath)) { properties.load(input); } catch (IOException e) { throw new PluginException(e); } return properties; }