Project Wonder 2.0

er.extensions
Class ERXRuntimeUtilities

java.lang.Object
  extended byer.extensions.ERXRuntimeUtilities

public class ERXRuntimeUtilities
extends Object


Nested Class Summary
static class ERXRuntimeUtilities.Result
           
 
Field Summary
static ERXLogger log
          logging support
 
Constructor Summary
ERXRuntimeUtilities()
           
 
Method Summary
static String escapePath(String path)
           
static ERXRuntimeUtilities.Result[] executeCommandLineCommandsWithEnvVarsInWorkingDir(String[] commands, String[] envp, File dir)
          Excecutes the specified command line commands.
static ERXRuntimeUtilities.Result executeCommandLineCommandWithArgumentsWithEnvVarsInWorkingDir(String[] command, String[] envp, File dir)
          Excecutes the specified command line commands.
static ERXRuntimeUtilities.Result executeCommandLineCommandWithEnvVarsInWorkingDir(String command, String[] envp, File dir)
          Excecutes the specified command line command.
static void freeProcessResources(Process p)
          Frees all of a resources associated with a given process and then destroys it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static ERXLogger log
logging support

Constructor Detail

ERXRuntimeUtilities

public ERXRuntimeUtilities()
Method Detail

executeCommandLineCommandsWithEnvVarsInWorkingDir

public static final ERXRuntimeUtilities.Result[] executeCommandLineCommandsWithEnvVarsInWorkingDir(String[] commands,
                                                                                                   String[] envp,
                                                                                                   File dir)
                                                                                            throws IOException
Excecutes the specified command line commands. If envp is not null the environment variables are set before executing the command.

Parameters:
commands - the commands to execute like "ls -la" or "cp /tmp/file1 /tmp/file2" or "open /Applications/*.app"
envp - a String array which represents the environment variables like String[] envp = new String[]{"PATH=/usr/bin:/bin", "CVS_RSH=ssh"}, can be null
dir - a File object representing the working directory, can be null
Returns:
the results from the processes that were executed
Throws:
IOException - if something went wrong

executeCommandLineCommandWithArgumentsWithEnvVarsInWorkingDir

public static final ERXRuntimeUtilities.Result executeCommandLineCommandWithArgumentsWithEnvVarsInWorkingDir(String[] command,
                                                                                                             String[] envp,
                                                                                                             File dir)
                                                                                                      throws IOException
Excecutes the specified command line commands. If envp is not null the environment variables are set before executing the command.

Parameters:
envp - a String array which represents the environment variables like String[] envp = new String[]{"PATH=/usr/bin:/bin", "CVS_RSH=ssh"}, can be null
dir - a File object representing the working directory, can be null
Returns:
the results from the processes that were executed
Throws:
IOException - if something went wrong

executeCommandLineCommandWithEnvVarsInWorkingDir

public static final ERXRuntimeUtilities.Result executeCommandLineCommandWithEnvVarsInWorkingDir(String command,
                                                                                                String[] envp,
                                                                                                File dir)
                                                                                         throws IOException
Excecutes the specified command line command. If envp is not null the environment variables are set before executing the command.

Parameters:
command - the command to execute like "ls -la" or "cp /tmp/file1 /tmp/file2" or "open /Applications/*.app"
envp - a String array which represents the environment variables like String[] envp = new String[]{"PATH=/usr/bin:/bin", "CVS_RSH=ssh"}, can be null
dir - a File object representing the working directory, can be null
Returns:
the result from the process that was executed
Throws:
IOException - if something went wrong

freeProcessResources

public static void freeProcessResources(Process p)
Frees all of a resources associated with a given process and then destroys it.

Parameters:
p - process to destroy

escapePath

public static String escapePath(String path)

Last updated: Do, Dez 9, 2004 • 12:46 PM CET

Copyright © 2002 – 2004 Project Wonder.