Examples of VariableValue


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

Examples of com.alphacsp.cit.VariableValue

    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

Examples of com.alphacsp.cit.VariableValue

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

Examples of com.alphacsp.cit.VariableValue

* @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

Examples of com.alphacsp.cit.VariableValue

* @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

Examples of com.google.clearsilver.jsilver.values.VariableValue

   * @return Name (as string)
   */
  public Value execute(Value... args) {
    Value value = args[0];
    if (value instanceof VariableValue) {
      VariableValue variableValue = (VariableValue) value;
      Data variable = variableValue.getReference();
      if (variable != null) {
        return literalValue(variable.getSymlink().getName(), variableValue.getEscapeMode(),
            variableValue.isPartiallyEscaped());
      }
    }
    return literalConstant("", value);
  }
View Full Code Here

Examples of com.google.clearsilver.jsilver.values.VariableValue

  /**
   * @param args A local variable.
   * @return Boolean value.
   */
  public Value execute(Value... args) {
    VariableValue arg = (VariableValue) args[0];
    if (arg.getReference() == null) {
      return literalConstant(false, arg);
    }

    Data thisNode = arg.getReference().getSymlink();
    return literalConstant(thisNode.isFirstSibling(), arg);
  }
View Full Code Here

Examples of com.google.clearsilver.jsilver.values.VariableValue

  public void caseAEachCommand(AEachCommand node) {
    setLastPosition(node.getPosition());
    Value expression = expressionEvaluator.evaluate(node.getExpression());

    if (expression instanceof VariableValue) {
      VariableValue variableValue = (VariableValue) expression;
      Data parent = variableValue.getReference();
      if (parent != null) {
        each(node.getVariable(), variableValue.getName(), parent, node.getCommand());
      }
    }
  }
View Full Code Here

Examples of com.google.clearsilver.jsilver.values.VariableValue

  /**
   * @param args A variable value referring to an HDF node
   * @return Number of children
   */
  public Value execute(Value... args) {
    VariableValue arg = (VariableValue) args[0];
    if (arg.getReference() == null) {
      return literalConstant(0, arg);
    }

    Data thisNode = arg.getReference().getSymlink();
    return literalConstant(thisNode.getChildCount(), arg);
  }
View Full Code Here

Examples of com.google.clearsilver.jsilver.values.VariableValue

  /**
   * @param args A local variable.
   * @return Boolean value.
   */
  public Value execute(Value... args) {
    VariableValue arg = (VariableValue) args[0];
    if (arg.getReference() == null) {
      return literalConstant(false, arg);
    }

    Data thisNode = arg.getReference().getSymlink();
    return literalConstant(thisNode.isLastSibling(), arg);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.