logo

class

sys::Sys

sys::Obj
  sys::Sys
  1  //
  2  // Copyright (c) 2006, Brian Frank and Andy Frank
  3  // Licensed under the Academic Free License version 3.0
  4  //
  5  // History:
  6  //   9 Jan 06  Brian Frank  Creation
  7  //
  8  
  9  **
 10  ** Sys provides static access to the system's environment.
 11  **
 12  final class Sys
 13  {
 14  
 15  //////////////////////////////////////////////////////////////////////////
 16  // Constructor
 17  //////////////////////////////////////////////////////////////////////////
 18  
 19    **
 20    ** Private constructor.
 21    **
 22    private new make()
 23  
 24  //////////////////////////////////////////////////////////////////////////
 25  // Environment
 26  //////////////////////////////////////////////////////////////////////////
 27  
 28    **
 29    ** Get the resource which defines the root of the local virtual
 30    ** machine's Uri namespace.  This resource always has a uri of "/".
 31    **
 32    static Resource namespace()
 33  
 34    **
 35    ** Get the command line arguments used to run the fan process
 36    ** as a readonly List of strings.
 37    **
 38    static Str[] args()
 39  
 40    **
 41    ** Get the environment variables as a readonly map of Str name/value
 42    ** pairs.  The environment map is initialized from the following
 43    ** sources from lowest priority to highest priority:
 44    **   1. shell environment variables
 45    **   2. Java system properties (Java VM only obviously)
 46    **   3. {homeDir}/lib/sys.props
 47    **
 48    static Str:Str env()
 49  
 50    **
 51    ** Get the fan installation home directory.
 52    **
 53    static File homeDir()
 54  
 55    **
 56    ** Get the application home directory.  The appDir is
 57    ** automatically exposed into the namespace as part
 58    ** of the root Resource:
 59    **   - In 'fand' this is the app directory used to
 60    **     boot the namespace.
 61    **   - In 'fant' this is the test directory.
 62    **   - In other VMs it is the current working directory.
 63    **
 64    static File appDir()
 65  
 66    **
 67    ** Get the local host name of the machine running the
 68    ** virtual machine process.
 69    **
 70    static Str hostName()
 71  
 72    **
 73    ** Get the user name of the user account used to run the
 74    ** virtual machine process.
 75    **
 76    static Str userName()
 77  
 78    **
 79    ** Terminate the current virtual machine.
 80    **
 81    static Void exit(Int status := 0)
 82  
 83    **
 84    ** Standard output stream.
 85    **
 86    static InStream in()
 87  
 88    **
 89    ** Standard output stream.
 90    **
 91    static OutStream out()
 92  
 93    **
 94    ** Standard error output stream.
 95    **
 96    static OutStream err()
 97  
 98  }