use of org.walkmod.conf.ConfigurationManager in project walkmod-core by walkmod.
the class WalkModFacade method setWriter.
/**
* Sets an specific writer for an specific chain.
*
* @param chain
* Chain to apply the writer
* @param type
* Writer type to set
* @param path
* Writer path to set
* @param recursive
* If to set the writer to all the submodules.
* @param params
* Writer parameters
* @throws Exception
* if the walkmod configuration file can't be read.
*/
public void setWriter(String chain, String type, String path, boolean recursive, Map<String, String> params) throws Exception {
long startTime = System.currentTimeMillis();
Exception exception = null;
if ((type != null && !"".equals(type.trim())) || (path != null && !"".equals(path.trim()))) {
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.setWriter(chain, type, path, recursive, params);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
}
}
use of org.walkmod.conf.ConfigurationManager in project walkmod-core by walkmod.
the class WalkModFacade method readConfig.
private Configuration readConfig(ConfigurationProvider... cp) throws InvalidConfigurationException {
Configuration config = null;
try {
ConfigurationManager cfgManager = new ConfigurationManager(cfg, cp);
config = cfgManager.getConfiguration();
config.setParameters(options.getMutableCopyOfDynamicArgs());
} catch (Exception e) {
printConfigError(e);
}
return config;
}
use of org.walkmod.conf.ConfigurationManager in project walkmod-core by walkmod.
the class WalkModFacade method removeChains.
/**
* Removes the chains from the Walkmod config file.
*
* @param chains
* Chain names to remove
* @param recursive
* If it necessary to remove the chains from all the submodules.
* @throws Exception
* If the walkmod configuration file can't be read.
*/
public void removeChains(List<String> chains, boolean recursive) throws Exception {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (cfg.exists()) {
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
manager.getProjectConfigurationProvider().removeChains(chains, recursive);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
}
}
use of org.walkmod.conf.ConfigurationManager in project walkmod-core by walkmod.
the class WalkModFacade method removePluginConfig.
/**
* Removes a plugin from the configuration file.
*
* @param pluginConfig
* Plugin configuration to remove.
* @param recursive
* If it necessary to remove the plugin from all the submodules.
* @throws Exception
* if the walkmod configuration file can't be read.
*/
public void removePluginConfig(PluginConfig pluginConfig, boolean recursive) throws Exception {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.removePluginConfig(pluginConfig, recursive);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
}
use of org.walkmod.conf.ConfigurationManager in project walkmod-core by walkmod.
the class WalkModFacade method addExcludesToChain.
/**
* Adds a list of excludes rules into a chain
*
* @param chain
* Chain to apply the excludes list
* @param excludes
* List of excludes
* @param recursive
* If it necessary to set the parameter to all the submodules.
* @param setToReader
* If it is added into the reader includes list
* @param setToWriter
* If it is added into the writer includes list
*/
public void addExcludesToChain(String chain, List<String> excludes, boolean recursive, boolean setToReader, boolean setToWriter) {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (cfg.exists()) {
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
manager.getProjectConfigurationProvider().addExcludesToChain(chain, excludes, recursive, setToReader, setToWriter);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
}
}
Aggregations