Search in sources :

Example 11 with ProjectConfigurationProvider

use of org.walkmod.conf.ProjectConfigurationProvider in project walkmod-core by walkmod.

the class WalkModFacade method addProviderConfig.

/**
 * Adds a new provider configuration into the configuration file
 *
 * @param providerCfg
 *            provider configuration to add.
 * @param recursive
 *            if the provider config is added recursively to all the submodules.
 * @throws Exception
 *             in case that the walkmod configuration file can't be read.
 */
public void addProviderConfig(ProviderConfig providerCfg, 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.addProviderConfig(providerCfg, recursive);
    } catch (Exception e) {
        exception = e;
    } finally {
        System.setProperty("user.dir", userDir);
        updateMsg(startTime, exception);
    }
}
Also used : ProjectConfigurationProvider(org.walkmod.conf.ProjectConfigurationProvider) File(java.io.File) ConfigurationManager(org.walkmod.conf.ConfigurationManager) WalkModException(org.walkmod.exceptions.WalkModException) IOException(java.io.IOException) InvalidConfigurationException(org.walkmod.exceptions.InvalidConfigurationException)

Aggregations

File (java.io.File)11 IOException (java.io.IOException)11 ConfigurationManager (org.walkmod.conf.ConfigurationManager)11 ProjectConfigurationProvider (org.walkmod.conf.ProjectConfigurationProvider)11 InvalidConfigurationException (org.walkmod.exceptions.InvalidConfigurationException)11 WalkModException (org.walkmod.exceptions.WalkModException)11