com.caucho.server.util
Class CauchoSystem

java.lang.Object
  extended by com.caucho.server.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 CpuUsage getCpuUsage()
           
static char getFileSeparatorChar()
           
static double getLoadAvg()
           
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.String getServerId()
           
static java.lang.String getUserDir()
           
static java.lang.String getUserName()
           
static long getVersionId()
          public static Path getRootDirectory() { if (_rootDirectory != null) return _rootDirectory; String path = System.getProperty("server.root"); if (path != null) { _rootDirectory = Vfs.lookupNative(path); return _rootDirectory; } path = System.getProperty("resin.home"); if (path != null) { _rootDirectory = Vfs.lookupNative(path); return _rootDirectory; } _rootDirectory = getResinHome(); return _rootDirectory; }
static Path getWorkPath()
          Returns a path to the work directory.
static boolean isCaseInsensitive()
           
static boolean isDetailedStatistics()
          Detailed statistics cause various parts of Resin to keep more detailed statistics at the possible expense of some performance.
static boolean isJdk15()
           
static boolean isTest()
           
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)
          Loads a class from the context class loader.
static java.lang.Class loadClass(java.lang.String name, boolean init, java.lang.ClassLoader loader)
          Loads a class from a classloader.
static void setDetailedStatistics(boolean isVerboseStatistics)
          Set true to cause the tracking of detailed statistcs, default false.
static void setIsTesting(boolean testing)
           
static void setResinHome(Path path)
          Sets the Path to be used as ResinHome.
static int 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 isWindows)
           
 
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 long getVersionId()
public static Path getRootDirectory() { if (_rootDirectory != null) return _rootDirectory; String path = System.getProperty("server.root"); if (path != null) { _rootDirectory = Vfs.lookupNative(path); return _rootDirectory; } path = System.getProperty("resin.home"); if (path != null) { _rootDirectory = Vfs.lookupNative(path); return _rootDirectory; } _rootDirectory = getResinHome(); return _rootDirectory; }


getResinConfig

public static java.lang.String getResinConfig()

getWorkPath

public static Path getWorkPath()
Returns a path to the work directory. The work directory is specified in the resin.conf by /caucho.com/java/work-path. If unspecified, it defaults to /tmp/caucho.

Returns:
directory path to work in.

getServerId

public static java.lang.String getServerId()

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()

isTest

public static boolean isTest()

isCaseInsensitive

public static boolean isCaseInsensitive()

isUnix

public static boolean isUnix()

setWindowsTest

public static void setWindowsTest(boolean isWindows)

getLocalHost

public static java.lang.String getLocalHost()

isJdk15

public static boolean isJdk15()

getUserName

public static java.lang.String getUserName()

setDetailedStatistics

public static void setDetailedStatistics(boolean isVerboseStatistics)
Set true to cause the tracking of detailed statistcs, default false. Detailed statistics cause various parts of Resin to keep more detailed statistics at the possible expense of performance.


isDetailedStatistics

public static boolean isDetailedStatistics()
Detailed statistics cause various parts of Resin to keep more detailed statistics at the possible expense of some performance.


getCpuUsage

public static CpuUsage getCpuUsage()

loadClass

public static java.lang.Class loadClass(java.lang.String name)
                                 throws java.lang.ClassNotFoundException
Loads a class from the context class loader.

Parameters:
name - the classname, separated by '.'
Returns:
the loaded class.
Throws:
java.lang.ClassNotFoundException

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.
Throws:
java.lang.ClassNotFoundException

getClassPath

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


getLoadAvg

public static double getLoadAvg()

setUser

public static int 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.

Throws:
java.lang.Exception