|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecter.extensions.foundation.ERXRuntimeUtilities
public class ERXRuntimeUtilities
Collection of utilities dealing with threads and processes.
Nested Class Summary | |
---|---|
static class |
ERXRuntimeUtilities.Result
|
static class |
ERXRuntimeUtilities.StreamReader
|
static class |
ERXRuntimeUtilities.TimeoutException
|
static class |
ERXRuntimeUtilities.TimeoutTimerTask
|
Field Summary | |
---|---|
static org.apache.log4j.Logger |
log
logging support |
Constructor Summary | |
---|---|
ERXRuntimeUtilities()
|
Method Summary | |
---|---|
static void |
addThreadInterrupt(java.lang.Thread thread,
java.lang.String message)
Call this to get the thread in question interrupted on the next call to checkThreadInterrupt(). |
static void |
checkThreadInterrupt()
When you have an inner loop and you want to be able to bail out on a stop request, call this method and you will get interrupted when another thread wants you to. |
static java.lang.String |
clearThreadInterrupt(java.lang.Thread thread)
Clear the interrupt flag for the thread. |
static com.webobjects.foundation.NSBundle |
createBundleIfNeeded(java.lang.String name)
Hack to create a bundle after the app is loaded. |
static ERXRuntimeUtilities.Result |
execute(java.lang.String[] command,
java.lang.String[] envp,
java.io.File dir,
long timeout)
Excecutes the specified command line commands. |
static ERXRuntimeUtilities.Result[] |
executeCommandLineCommandsWithEnvVarsInWorkingDir(java.lang.String[][] commands,
java.lang.String[] envp,
java.io.File dir)
Excecutes the specified command line commands. |
static ERXRuntimeUtilities.Result |
executeCommandLineCommandWithArgumentsWithEnvVarsInWorkingDir(java.lang.String[] command,
java.lang.String[] envp,
java.io.File dir)
Excecutes the specified command line commands. |
static void |
freeProcessResources(java.lang.Process p)
Frees all of a resources associated with a given process and then destroys it. |
static com.webobjects.foundation.NSMutableDictionary<java.lang.String,java.lang.Object> |
informationForBundles()
|
static com.webobjects.foundation.NSMutableDictionary<java.lang.String,java.lang.Object> |
informationForContext(com.webobjects.appserver.WOContext context)
|
static com.webobjects.foundation.NSMutableDictionary<java.lang.String,java.lang.Object> |
informationForException(java.lang.Exception e)
Returns a dictionary with useful stuff. |
static com.webobjects.foundation.NSBundle |
loadBundleIfNeeded(java.io.File bundleFile)
Load an application, framework or jar bundle if not already loaded. |
static java.lang.Throwable |
originalThrowable(java.lang.Throwable t)
Retrieves the actual cause of an error by unwrapping them as far as possible, i.e. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.log4j.Logger log
Constructor Detail |
---|
public ERXRuntimeUtilities()
Method Detail |
---|
public static com.webobjects.foundation.NSBundle createBundleIfNeeded(java.lang.String name)
name
-
public static com.webobjects.foundation.NSBundle loadBundleIfNeeded(java.io.File bundleFile)
bundleFile
- - the directory or archive (e.g., jar, war) of the bundle to load
com.webobjects.foundation.NSForwardException
- if bundle loading failspublic static com.webobjects.foundation.NSMutableDictionary<java.lang.String,java.lang.Object> informationForException(java.lang.Exception e)
e
- public static com.webobjects.foundation.NSMutableDictionary<java.lang.String,java.lang.Object> informationForBundles()
public static com.webobjects.foundation.NSMutableDictionary<java.lang.String,java.lang.Object> informationForContext(com.webobjects.appserver.WOContext context)
public static java.lang.Throwable originalThrowable(java.lang.Throwable t)
public static final ERXRuntimeUtilities.Result executeCommandLineCommandWithArgumentsWithEnvVarsInWorkingDir(java.lang.String[] command, java.lang.String[] envp, java.io.File dir) throws java.io.IOException
command
- the commands to execute like "ls -la" or "cp /tmp/file1
/tmp/file2" or "open /Applications/*.app" new String[]{"ls",
"-la"} new String[]{"cp", "/tmp/file1", "/tmp/file2"} new
String[]{"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 nulldir
- a File
object representing the working
directory, can be null
java.io.IOException
- if something went wrongpublic static final ERXRuntimeUtilities.Result[] executeCommandLineCommandsWithEnvVarsInWorkingDir(java.lang.String[][] commands, java.lang.String[] envp, java.io.File dir) throws java.io.IOException
commands
- the commands to execute, this is an String array with two
dimensions the following commands new String[] { new String[] { "ls", "-la" }, new String[] { "cp", "/tmp/file1", "/tmp/file2" }, new String[] { "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 nulldir
- a File
object representing the working
directory, can be null
java.io.IOException
- if something went wrongpublic static final ERXRuntimeUtilities.Result execute(java.lang.String[] command, java.lang.String[] envp, java.io.File dir, long timeout) throws java.io.IOException, ERXRuntimeUtilities.TimeoutException
Process.waitFor()
should be observed and stopped if a
certain amount of time is over.
command
- the commands to execute, this is an String array with two
dimensions the following commands new String[] { new String[] { "ls", "-la" }, new String[] { "cp", "/tmp/file1", "/tmp/file2" }, new String[] { "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 nulldir
- a File
object representing the working
directory, can be nulltimeout
- a long
which can be either 0
indicating this method call waits until the process exits or
any long
number larger than 0
which means if the process does not exit after
timeout
milliseconds then this method throws an
ERXTimeoutException
java.io.IOException
- if something went wrong
ERXRuntimeUtilities.TimeoutException
public static void freeProcessResources(java.lang.Process p)
p
- process to destroypublic static void checkThreadInterrupt()
public static void addThreadInterrupt(java.lang.Thread thread, java.lang.String message)
thread
- message
- public static java.lang.String clearThreadInterrupt(java.lang.Thread thread)
thread
-
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |