Package com.alphacsp.cit

Examples of com.alphacsp.cit.VariableValue


        return "executes the '" + getVariableName() + "' environment variable";
    }

    public void execute(ExecutionContext executionContext) {
        Assert.notNull(variableName);
        VariableValue editor = executionContext.getEnvironment().getVar(getVariableName());
        List<String> parameters = executionContext.getParameters();
        List<String> commands = new ArrayList<String>();
        commands.add(editor.getAsText());
        commands.addAll(parameters);
        DefaultProcessLauncher processLauncher = new DefaultProcessLauncher();
        Environment environment = executionContext.getEnvironment();
        processLauncher.setWorkingDir(environment.pwd().getAsFile());
        processLauncher.addCommands(commands);
View Full Code Here


    public void setVendor(String vendor) {
        this.vendor = vendor;
    }

    public void validate(EnvironmentVariableContext environmentVariableContext) throws ValidationException {
        VariableValue varValue = environmentVariableContext.getVariableValue();
        String varName = environmentVariableContext.getVariableName();

        String output;
        ProcessLauncher processLauncher = new JavaLauncher(varValue.getAsFile());
        Map<String, String> environmentVariables = environmentVariableContext.getEnvironment().getVars(RenderHint.native_os);
        processLauncher.addEnvironmentVariables(environmentVariables);
        processLauncher.addCommand("-version");
        Process process = processLauncher.exec();
        output = ProcessUtils.readOutput(process);
View Full Code Here

import java.io.File;
import java.text.MessageFormat;

public class AutoCreateDirectoryValidator implements VariableValidator {
    public void validate(EnvironmentVariableContext environmentVariableContext) throws ValidationException {
        VariableValue value = environmentVariableContext.getVariableValue();
        String name = environmentVariableContext.getVariableName();
        File dir = value.getAsFile();
        if (!dir.exists()) {
            if (!dir.mkdirs()) {
                throw new ValidationException(
                        MessageFormat.format("The value of the variable {0} ({1}) is not an existing directory and cannot be created as well!", name, value));
            }
        } else if (!value.getAsFile().isDirectory()) {
            throw new ValidationException(
                    MessageFormat.format("The value of the variable {0} ({1}) is not an existing directory!", name, value));
        }
    }
View Full Code Here

* @author Yoav Hakman
*/
public class DirectoryValidator implements VariableValidator {

    public void validate(EnvironmentVariableContext environmentVariableContext) throws ValidationException {
        VariableValue value = environmentVariableContext.getVariableValue();
        String name = environmentVariableContext.getVariableName();
        if (! value.getAsFile().isDirectory()) {
            throw new ValidationException("The value of the variable " + name + " (" + value + ") is not an existing directory!");
        }
    }
View Full Code Here

* @author Yoav Hakman
*/
public class FileValidator implements VariableValidator {

    public void validate(EnvironmentVariableContext environmentVariableContext) throws ValidationException {
        VariableValue value = environmentVariableContext.getVariableValue();
        String name = environmentVariableContext.getVariableName();

        File file = value.getAsFile();
        if (! file.exists()) {
            throw new ValidationException("The value of the variable " + name + " (" + value + ") does not exist!");
        }

        if (file.isDirectory()) {
View Full Code Here

TOP

Related Classes of com.alphacsp.cit.VariableValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.