Java Doc for Execute.java in  » Build » ANT » org » apache » tools » ant » taskdefs » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Build » ANT » org.apache.tools.ant.taskdefs 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.tools.ant.taskdefs.Execute

Execute
public class Execute (Code)
Runs an external program.
since:
   Ant 1.2


Field Summary
final public static  intINVALID
     Invalid exit code.

Constructor Summary
public  Execute()
     Creates a new execute object using PumpStreamHandler for stream handling.
public  Execute(ExecuteStreamHandler streamHandler)
     Creates a new execute object.
public  Execute(ExecuteStreamHandler streamHandler, ExecuteWatchdog watchdog)
     Creates a new execute object.

Method Summary
public static  voidcloseStreams(Process process)
     Close the streams belonging to the given Process.
public  intexecute()
     Runs a process defined by the command line and returns its exit status.
public  String[]getCommandline()
     Returns the commandline used to create a subprocess.
public  String[]getEnvironment()
     Returns the environment used to create a subprocess.
public  intgetExitValue()
     Query the exit value of the process.
public static synchronized  VectorgetProcEnvironment()
     Find the list of environment variables for this process.
public  FilegetWorkingDirectory()
     Return the working directory.
public static  booleanisFailure(int exitValue)
     Checks whether exitValue signals a failure on the current system (OS specific).

Note that this method relies on the conventions of the OS, it will return false results if the application you are running doesn't follow these conventions.

public  booleanisFailure()
     Did this execute return in a failure.
public  booleankilledProcess()
     Test for an untimely death of the process.
public static  Processlaunch(Project project, String[] command, String[] env, File dir, boolean useVM)
     Creates a process that runs a command.
Parameters:
  project - the Project, only used for logging purposes, may be null.
Parameters:
  command - the command to run.
Parameters:
  env - the environment for the command.
Parameters:
  dir - the working directory for the command.
Parameters:
  useVM - use the built-in exec command for JDK 1.3 if available.
public static  voidrunCommand(Task task, String[] cmdline)
     A utility method that runs an external command.
public  voidsetAntRun(Project project)
     Set the name of the antRun script using the project's value.
public  voidsetCommandline(String[] commandline)
     Sets the commandline of the subprocess to launch.
public  voidsetEnvironment(String[] env)
     Sets the environment variables for the subprocess to launch.
protected  voidsetExitValue(int value)
     Set the exit value.
public  voidsetNewenvironment(boolean newenv)
     Set whether to propagate the default environment or not.
public  voidsetSpawn(boolean spawn)
     Set whether or not you want the process to be spawned.
public  voidsetStreamHandler(ExecuteStreamHandler streamHandler)
     Set the stream handler to use.
public  voidsetVMLauncher(boolean useVMLauncher)
     Launch this execution through the VM, where possible, rather than through the OS's shell.
public  voidsetWorkingDirectory(File wd)
     Sets the working directory of the process to execute.
public  voidspawn()
     Starts a process defined by the command line.
public static  StringtoString(ByteArrayOutputStream bos)
     ByteArrayOutputStream#toString doesn't seem to work reliably on OS/390, at least not the way we use it in the execution context.
Parameters:
  bos - the output stream that one wants to read.
protected  voidwaitFor(Process process)
     Wait for a given process.

Field Detail
INVALID
final public static int INVALID(Code)
Invalid exit code. set to Integer.MAX_VALUE




Constructor Detail
Execute
public Execute()(Code)
Creates a new execute object using PumpStreamHandler for stream handling.



Execute
public Execute(ExecuteStreamHandler streamHandler)(Code)
Creates a new execute object.
Parameters:
  streamHandler - the stream handler used to handle the input andoutput streams of the subprocess.



Execute
public Execute(ExecuteStreamHandler streamHandler, ExecuteWatchdog watchdog)(Code)
Creates a new execute object.
Parameters:
  streamHandler - the stream handler used to handle the input andoutput streams of the subprocess.
Parameters:
  watchdog - a watchdog for the subprocess or null toto disable a timeout for the subprocess.




Method Detail
closeStreams
public static void closeStreams(Process process)(Code)
Close the streams belonging to the given Process.
Parameters:
  process - the Process.



execute
public int execute() throws IOException(Code)
Runs a process defined by the command line and returns its exit status. the exit status of the subprocess or INVALID.
exception:
  java.io.IOException - The exception is thrown, if launchingof the subprocess failed.



getCommandline
public String[] getCommandline()(Code)
Returns the commandline used to create a subprocess. the commandline used to create a subprocess.



getEnvironment
public String[] getEnvironment()(Code)
Returns the environment used to create a subprocess. the environment used to create a subprocess.



getExitValue
public int getExitValue()(Code)
Query the exit value of the process. the exit value or Execute.INVALID if no exit value hasbeen received.



getProcEnvironment
public static synchronized Vector getProcEnvironment()(Code)
Find the list of environment variables for this process. a vector containing the environment variables.The vector elements are strings formatted like variable = value.



getWorkingDirectory
public File getWorkingDirectory()(Code)
Return the working directory. the directory as a File.
since:
   Ant 1.7



isFailure
public static boolean isFailure(int exitValue)(Code)
Checks whether exitValue signals a failure on the current system (OS specific).

Note that this method relies on the conventions of the OS, it will return false results if the application you are running doesn't follow these conventions. One notable exception is the Java VM provided by HP for OpenVMS - it will return 0 if successful (like on any other platform), but this signals a failure on OpenVMS. So if you execute a new Java VM on OpenVMS, you cannot trust this method.


Parameters:
  exitValue - the exit value (return code) to be checked. true if exitValue signals a failure.



isFailure
public boolean isFailure()(Code)
Did this execute return in a failure.
See Also:   Execute.isFailure(int) true if and only if the exit code is interpreted as a failure
since:
   Ant1.7



killedProcess
public boolean killedProcess()(Code)
Test for an untimely death of the process. true if a watchdog had to kill the process.
since:
   Ant 1.5



launch
public static Process launch(Project project, String[] command, String[] env, File dir, boolean useVM) throws IOException(Code)
Creates a process that runs a command.
Parameters:
  project - the Project, only used for logging purposes, may be null.
Parameters:
  command - the command to run.
Parameters:
  env - the environment for the command.
Parameters:
  dir - the working directory for the command.
Parameters:
  useVM - use the built-in exec command for JDK 1.3 if available. the process started.
throws:
  IOException - forwarded from the particular launcher used.
since:
   Ant 1.5



runCommand
public static void runCommand(Task task, String[] cmdline) throws BuildException(Code)
A utility method that runs an external command. Writes the output and error streams of the command to the project log.
Parameters:
  task - The task that the command is part of. Used for logging
Parameters:
  cmdline - The command to execute.
throws:
  BuildException - if the command does not exit successfully.



setAntRun
public void setAntRun(Project project) throws BuildException(Code)
Set the name of the antRun script using the project's value.
Parameters:
  project - the current project.
throws:
  BuildException - not clear when it is going to throw an exception, butit is the method's signature.



setCommandline
public void setCommandline(String[] commandline)(Code)
Sets the commandline of the subprocess to launch.
Parameters:
  commandline - the commandline of the subprocess to launch.



setEnvironment
public void setEnvironment(String[] env)(Code)
Sets the environment variables for the subprocess to launch.
Parameters:
  env - array of Strings, each element of which hasan environment variable settings in format key=value.



setExitValue
protected void setExitValue(int value)(Code)
Set the exit value.
Parameters:
  value - exit value of the process.



setNewenvironment
public void setNewenvironment(boolean newenv)(Code)
Set whether to propagate the default environment or not.
Parameters:
  newenv - whether to propagate the process environment.



setSpawn
public void setSpawn(boolean spawn)(Code)
Set whether or not you want the process to be spawned. Default is not spawned.
Parameters:
  spawn - if true you do not want Antto wait for the end of the process.
since:
   Ant 1.6



setStreamHandler
public void setStreamHandler(ExecuteStreamHandler streamHandler)(Code)
Set the stream handler to use.
Parameters:
  streamHandler - ExecuteStreamHandler.
since:
   Ant 1.6



setVMLauncher
public void setVMLauncher(boolean useVMLauncher)(Code)
Launch this execution through the VM, where possible, rather than through the OS's shell. In some cases and operating systems using the shell will allow the shell to perform additional processing such as associating an executable with a script, etc.
Parameters:
  useVMLauncher - true if exec should launch through the VM,false if the shell should be used to launch thecommand.



setWorkingDirectory
public void setWorkingDirectory(File wd)(Code)
Sets the working directory of the process to execute.

This is emulated using the antRun scripts unless the OS is Windows NT in which case a cmd.exe is spawned, or MRJ and setting user.dir works, or JDK 1.3 and there is official support in java.lang.Runtime.
Parameters:
  wd - the working directory of the process.




spawn
public void spawn() throws IOException(Code)
Starts a process defined by the command line. Ant will not wait for this process, nor log its output.
throws:
  java.io.IOException - The exception is thrown, if launchingof the subprocess failed.
since:
   Ant 1.6



toString
public static String toString(ByteArrayOutputStream bos)(Code)
ByteArrayOutputStream#toString doesn't seem to work reliably on OS/390, at least not the way we use it in the execution context.
Parameters:
  bos - the output stream that one wants to read. the output stream as a string, read withspecial encodings in the case of z/os and os/400.
since:
   Ant 1.5



waitFor
protected void waitFor(Process process)(Code)
Wait for a given process.
Parameters:
  process - the process one wants to wait for.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.