Search in sources :

Example 1 with ProjectConfigurationProvider

use of org.walkmod.conf.ProjectConfigurationProvider 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);
        }
    }
}
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)

Example 2 with ProjectConfigurationProvider

use of org.walkmod.conf.ProjectConfigurationProvider 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);
    }
}
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)

Example 3 with ProjectConfigurationProvider

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

the class WalkModFacade method removeModules.

/**
 * Removes the module list from the configuration file
 *
 * @param modules
 *            Module names to remove
 * @throws Exception
 *             if the walkmod configuration file can't be read.
 */
public void removeModules(List<String> modules) 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.removeModules(modules);
    } 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)

Example 4 with ProjectConfigurationProvider

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

the class WalkModFacade method removeTransformations.

/**
 * Remove a list of transformations for an specific chain. If it is recursive, this removal
 * action is applied into all the submodules.
 *
 * @param chain
 *            To remove the transformations. By default, it is the "default" chain.
 * @param transformations
 *            List of transformation names (type ids) to be removed.
 * @param recursive
 *            If the action is applied to all the submodules.
 * @throws Exception
 *             if the walkmod configuration file can't be read.
 */
public void removeTransformations(String chain, List<String> transformations, boolean recursive) throws Exception {
    long startTime = System.currentTimeMillis();
    Exception exception = null;
    if (transformations != 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.removeTransformations(chain, transformations, 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)

Example 5 with ProjectConfigurationProvider

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

the class WalkModFacade method removeProviders.

/**
 * Removes the list of configuration providers from the config file.
 *
 * @param providers
 *            Name of the configuration providers 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 removeProviders(List<String> providers, 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.removeProviders(providers, 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