com.caucho.util
Class CauchoSystem

java.lang.Object
  |
  +--com.caucho.util.CauchoSystem

public class CauchoSystem
extends java.lang.Object

A wrapper for Caucho system variables, allowing tests to override the default variables.


Method Summary
static java.lang.String getClassPath()
          Returns the system classpath, including the bootpath
static java.lang.ClassLoader getContextClassLoader()
          Gets the per-thread class loader, the context class loader.
static CpuUsage getCpuUsage()
           
static char getFileSeparatorChar()
           
static java.lang.String getLocalHost()
           
static java.lang.String getNewlineString()
           
static char getPathSeparatorChar()
           
static java.lang.String getResinConfig()
           
static Path getResinHome()
          Gets the Path used as ResinHome.
static java.lang.ClassLoader getStaticClassLoader()
          Returns the top-level class loader.
static java.lang.String getUserDir()
           
static java.lang.String getUserName()
           
static int getVersionId()
           
static Path getWorkPath()
           
static boolean isJdk12()
           
static boolean isTesting()
          Returns true if we're currently running a test.
static boolean isUnix()
           
static boolean isWindows()
           
static java.lang.Class loadClass(java.lang.String name, boolean init, java.lang.ClassLoader loader)
          Loads a class from a classloader.
static void setContextClassLoader(java.lang.ClassLoader loader)
          Sets the per-thread class loader, the context class loader.
static void setIsTesting(boolean testing)
           
static void setResinHome(Path path)
          Sets the Path to be used as ResinHome.
static void setStaticClassLoader(java.lang.ClassLoader loader)
          Sets the top-level class loader.
static boolean setUser()
           
static boolean setUser(java.lang.String user, java.lang.String group)
          Sets the runtime user so we don't need to run as root.
static void setWindowsTest(boolean windows)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isTesting

public static boolean isTesting()
Returns true if we're currently running a test.

setIsTesting

public static void setIsTesting(boolean testing)

setResinHome

public static void setResinHome(Path path)
Sets the Path to be used as ResinHome.

getResinHome

public static Path getResinHome()
Gets the Path used as ResinHome.

getVersionId

public static int getVersionId()

getResinConfig

public static java.lang.String getResinConfig()

getWorkPath

public static Path getWorkPath()

getUserDir

public static java.lang.String getUserDir()

getFileSeparatorChar

public static char getFileSeparatorChar()

getPathSeparatorChar

public static char getPathSeparatorChar()

getNewlineString

public static java.lang.String getNewlineString()

isWindows

public static boolean isWindows()

isUnix

public static boolean isUnix()

setWindowsTest

public static void setWindowsTest(boolean windows)

getLocalHost

public static java.lang.String getLocalHost()

getUserName

public static java.lang.String getUserName()

getCpuUsage

public static CpuUsage getCpuUsage()

isJdk12

public static boolean isJdk12()

loadClass

public static java.lang.Class loadClass(java.lang.String name,
                                        boolean init,
                                        java.lang.ClassLoader loader)
                                 throws java.lang.ClassNotFoundException
Loads a class from a classloader. If the loader is null, uses the context class loader.
Parameters:
name - the classname, separated by '.'
init - if true, resolves the class instances
loader - the class loader
Returns:
the loaded class.

getContextClassLoader

public static java.lang.ClassLoader getContextClassLoader()
Gets the per-thread class loader, the context class loader.
Returns:
loader the class loader for this thread.

setContextClassLoader

public static void setContextClassLoader(java.lang.ClassLoader loader)
Sets the per-thread class loader, the context class loader.
Parameters:
loader - the class loader for this thread.

setStaticClassLoader

public static void setStaticClassLoader(java.lang.ClassLoader loader)
Sets the top-level class loader.

getStaticClassLoader

public static java.lang.ClassLoader getStaticClassLoader()
Returns the top-level class loader.

getClassPath

public static java.lang.String getClassPath()
Returns the system classpath, including the bootpath

setUser

public static boolean setUser(java.lang.String user,
                              java.lang.String group)
                       throws java.lang.Exception
Sets the runtime user so we don't need to run as root.

setUser

public static boolean setUser()
                       throws java.lang.Exception