|
|
@ -19,6 +19,9 @@ import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.util.Properties; |
|
|
|
import java.util.Properties; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
|
|
|
import ro.fortsoft.pf4j.util.StringUtils; |
|
|
|
import ro.fortsoft.pf4j.util.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -28,10 +31,14 @@ import ro.fortsoft.pf4j.util.StringUtils; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class PropertiesPluginDescriptorFinder implements PluginDescriptorFinder { |
|
|
|
public class PropertiesPluginDescriptorFinder implements PluginDescriptorFinder { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(PropertiesPluginDescriptorFinder.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String DEFAULT_PROPERTIES_FILE_NAME = "plugin.properties"; |
|
|
|
|
|
|
|
|
|
|
|
private String propertiesFileName; |
|
|
|
private String propertiesFileName; |
|
|
|
|
|
|
|
|
|
|
|
public PropertiesPluginDescriptorFinder() { |
|
|
|
public PropertiesPluginDescriptorFinder() { |
|
|
|
this("plugin.properties"); |
|
|
|
this(DEFAULT_PROPERTIES_FILE_NAME); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PropertiesPluginDescriptorFinder(String propertiesFileName) { |
|
|
|
public PropertiesPluginDescriptorFinder(String propertiesFileName) { |
|
|
@ -41,6 +48,7 @@ public class PropertiesPluginDescriptorFinder implements PluginDescriptorFinder |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public PluginDescriptor find(File pluginRepository) throws PluginException { |
|
|
|
public PluginDescriptor find(File pluginRepository) throws PluginException { |
|
|
|
File propertiesFile = new File(pluginRepository, propertiesFileName); |
|
|
|
File propertiesFile = new File(pluginRepository, propertiesFileName); |
|
|
|
|
|
|
|
log.debug("Lookup plugin descriptor in '{}'", propertiesFile); |
|
|
|
if (!propertiesFile.exists()) { |
|
|
|
if (!propertiesFile.exists()) { |
|
|
|
throw new PluginException("Cannot find '" + propertiesFile + "' file"); |
|
|
|
throw new PluginException("Cannot find '" + propertiesFile + "' file"); |
|
|
|
} |
|
|
|
} |
|
|
|