public class PropertiesFileContentExtractor extends Object
| Constructor and Description |
|---|
PropertiesFileContentExtractor(FilePathFactory filePathFactory) |
| Modifier and Type | Method and Description |
|---|---|
String |
extractPropertiesFileContents(String propertiesFilePath,
hudson.model.AbstractProject job,
hudson.model.Node pollingNode,
org.jenkinsci.lib.xtrigger.XTriggerLog log,
Map<String,String> envVars)
Given a propertiesFilePath value, will split that value into multiple paths, read the content from the resolved file names
and return the content.
|
List<String> |
splitFilePaths(String propertiesFilePath)
Splits the value on semi-colon and trims each path.
|
public PropertiesFileContentExtractor(FilePathFactory filePathFactory)
public String extractPropertiesFileContents(String propertiesFilePath, hudson.model.AbstractProject job, hudson.model.Node pollingNode, org.jenkinsci.lib.xtrigger.XTriggerLog log, Map<String,String> envVars) throws org.jenkinsci.lib.xtrigger.XTriggerException
The content of the property files is assumed to be in properties file format. e.g.: prop1=1 prop2=2 prop3=3
As an example, if the propertiesFilePath is "a.properties;b.properties", that a.properties contains prop1=2 and that b.properties contains prop2=3, the method will return: prop1=2 prop2=3
propertiesFilePath - If this value is empty or null, the method will return an empty string.job - The job whose workspace is used to resolve the property files.pollingNode - Jenkins agent used to resolve the property files on. If not provided, Jenkins master is used.log - Used for logging.envVars - Environment variables used to resolve in the file paths.org.jenkinsci.lib.xtrigger.XTriggerException - On error.public List<String> splitFilePaths(String propertiesFilePath)
Right now, the separator is a hard coded value. It could probably be refactored to use a configurable value.
propertiesFilePath - The semi-colon separated value to split.Copyright © 2016–2019. All rights reserved.