org.eclipse.jgit.util
Class SystemReader

java.lang.Object
  extended by org.eclipse.jgit.util.SystemReader

public abstract class SystemReader
extends java.lang.Object

Interface to read values from the system.

When writing unit tests, extending this interface with a custom class permits to simulate an access to a system variable or property and permits to control the user's global configuration.


Constructor Summary
SystemReader()
           
 
Method Summary
abstract  long getCurrentTime()
           
abstract  java.lang.String getenv(java.lang.String variable)
           
abstract  java.lang.String getHostname()
          Gets the hostname of the local host.
static SystemReader getInstance()
           
abstract  java.lang.String getProperty(java.lang.String key)
           
abstract  int getTimezone(long when)
           
abstract  FileBasedConfig openUserConfig()
           
static void setInstance(SystemReader newReader)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemReader

public SystemReader()
Method Detail

getInstance

public static SystemReader getInstance()
Returns:
the live instance to read system properties.

setInstance

public static void setInstance(SystemReader newReader)
Parameters:
newReader - the new instance to use when accessing properties.

getHostname

public abstract java.lang.String getHostname()
Gets the hostname of the local host. If no hostname can be found, the hostname is set to the default value "localhost".

Returns:
the canonical hostname

getenv

public abstract java.lang.String getenv(java.lang.String variable)
Parameters:
variable - system variable to read
Returns:
value of the system variable

getProperty

public abstract java.lang.String getProperty(java.lang.String key)
Parameters:
key - of the system property to read
Returns:
value of the system property

openUserConfig

public abstract FileBasedConfig openUserConfig()
Returns:
the git configuration found in the user home

getCurrentTime

public abstract long getCurrentTime()
Returns:
the current system time

getTimezone

public abstract int getTimezone(long when)
Parameters:
when - TODO
Returns:
the local time zone