Google

NetCommand (Apache Ant API)

org.apache.tools.ant.taskdefs.optional.dotnet
Class NetCommand


java.lang.Object

  |

  +--org.apache.tools.ant.taskdefs.optional.dotnet.NetCommand


public class NetCommand
extends java.lang.Object

This is a helper class to spawn net commands out. In its initial form it contains no .net specifics, just contains all the command line/exe construction stuff. However, it may be handy in future to have a means of setting the path to point to the dotnet bin directory; in which case the shared code should go in here.

Version:
0.5
Author:
Steve Loughran steve_l@iseran.com

Field Summary
protected  Commandline commandLine
          what is the command line
protected  Execute executable
          executabe
protected  boolean failOnError
          flag to control action on execution trouble
protected  Task owner
          owner project
protected  java.lang.String program
          actual program to invoke
protected  java.lang.String title
          title of the command
protected  boolean traceCommandLine
          trace flag
 
Constructor Summary
NetCommand(Task owner, java.lang.String title, java.lang.String program)
          constructor
 
Method Summary
 void addArgument(java.lang.String argument)
          add an argument to a command line; do nothing if the arg is null or empty string
 void addArgument(java.lang.String argument1, java.lang.String argument2)
           
 boolean getFailFailOnError()
          query fail on error flag
protected  void logError(java.lang.String msg)
          error text log
protected  void logVerbose(java.lang.String msg)
          verbose text log
protected  void prepareExecutor()
          set up the command sequence..
 void runCommand()
          Run the command using the given Execute instance.
 void setFailOnError(boolean b)
          set fail on error flag
 void setTraceCommandLine(boolean b)
          turn tracing on or off
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner


protected Task owner
owner project


executable


protected Execute executable
executabe


commandLine


protected Commandline commandLine
what is the command line


title


protected java.lang.String title
title of the command


program


protected java.lang.String program
actual program to invoke


traceCommandLine


protected boolean traceCommandLine
trace flag


failOnError


protected boolean failOnError
flag to control action on execution trouble

Constructor Detail

NetCommand


public NetCommand(Task owner,
                  java.lang.String title,
                  java.lang.String program)
constructor

Parameters:
title - (for logging/errors)
owner - owner task
program - app we are to run
Method Detail

setTraceCommandLine


public void setTraceCommandLine(boolean b)
turn tracing on or off

Parameters:
b - trace flag

setFailOnError


public void setFailOnError(boolean b)
set fail on error flag

Parameters:
b - fail flag -set to true to cause an exception to be raised if the return value != 0

getFailFailOnError


public boolean getFailFailOnError()
query fail on error flag

Returns:
The failFailOnError value

logVerbose


protected void logVerbose(java.lang.String msg)
verbose text log

Parameters:
msg - string to add to log iff verbose is defined for the build

logError


protected void logError(java.lang.String msg)
error text log

Parameters:
msg - message to display as an error

addArgument


public void addArgument(java.lang.String argument)
add an argument to a command line; do nothing if the arg is null or empty string

Parameters:
argument - The feature to be added to the Argument attribute

addArgument


public void addArgument(java.lang.String argument1,
                        java.lang.String argument2)

prepareExecutor


protected void prepareExecutor()
set up the command sequence..


runCommand


public void runCommand()
                throws BuildException
Run the command using the given Execute instance.

Throws:
BuildException - iff something goes wrong and the failOnError flag is true


Copyright 2000-2002 Apache Software Foundation. All Rights Reserved.