示例#1
0
 /**
  * Overrides the Java execution for settings the arguments correctly.
  *
  * @param device the current device
  * @param variables the variables for the current device
  */
 public void execute(Device device, Map variables) {
   if (this.message != null) {
     String msg = PropertyUtil.writeProperties(this.message, variables);
     System.out.println(msg);
   }
   // remove all arguments:
   super.clearArgs();
   Argument[] arguments =
       (Argument[]) this.argumentsList.toArray(new Argument[this.argumentsList.size()]);
   for (int i = 0; i < arguments.length; i++) {
     Argument argument = arguments[i];
     String[] parts = argument.getParts();
     StringBuffer buffer = new StringBuffer();
     for (int j = 0; j < parts.length; j++) {
       String part = parts[j];
       /* does not work anyhow
       if (part.indexOf(' ') != -1) {
       	part = '"' + part + '"';
       }
       */
       buffer.append(part);
       if (j != parts.length - 1) {
         buffer.append(" ");
       }
     }
     String line = PropertyUtil.writeProperties(buffer.toString(), variables);
     Argument newArgument = super.createArg();
     newArgument.setLine(line);
   }
   execute();
 }