public class TemplateConfigurationHelper extends Object
| Constructor and Description |
|---|
TemplateConfigurationHelper(String[] includes,
String[] excludes,
ConfigurationManager cfm)
Creates instance of template configuration helper with given lists of filtering
patterns.
|
| Modifier and Type | Method and Description |
|---|---|
InputStream |
fillTemplate(InputStream inputStream,
Map<String,String> parameters)
Reads configuration file from a stream and replaces all the occurrences of template-variables
(like : "${parameter.name}") with values provided in the map.
|
InputStream |
fillTemplate(String filename,
Map<String,String> parameters)
Reads configuration file from a stream and replaces all the occurrences of template-variables
(like : "${parameter.name}") with values provided in the map.
|
static InputStream |
getInputStream(ConfigurationManager cfm,
String filename)
Tries first to get the file content using the configuration manager, if it cannot
be found it will then try to get it from the context class loader of the current thread,
if it cannot be found it will try to get it from the class loader of the current class and
finally it still cannot be found it will try to use the file name as a file path.
|
protected Map<String,String> |
prepareParameters(Map<String,String> parameters)
Filters the map of parameters, leaving only those than matches filtering regular expressions.
|
public TemplateConfigurationHelper(String[] includes, String[] excludes, ConfigurationManager cfm)
includes - Array with string representation of include reg-exp patternsexcludes - Array with string representation of exclude reg-exp patternscfm - instance for looking up resourcespublic InputStream fillTemplate(InputStream inputStream, Map<String,String> parameters) throws IOException
inputStream - parameters - IOExceptionpublic InputStream fillTemplate(String filename, Map<String,String> parameters) throws IOException
filename - parameters - IOExceptionpublic static InputStream getInputStream(ConfigurationManager cfm, String filename)
cfm - the configuration manager from which we want to try to find the file contentfilename - the name of the file to foundInputStream corresponding to the file content if it can be found
null otherwiseprotected Map<String,String> prepareParameters(Map<String,String> parameters)
parameters - Copyright © 2019 eXo Platform SAS. All Rights Reserved.