public abstract class Environment extends java.lang.Object implements Immutable
To access Environment, use the currentEnvironment() static method.
Like Thread.currentThread(), this will fetch the
appropriate one for your thread and runtime context.
It is possible that we may add "sandboxes" in the future, which have different Environments. For example, we may start the system from a web-launched app, then go into a more traditional file-based mode for another application. However, at present Environment is a de facto singleton.
Instances of Environment are immutable objects. Once created you cannot change them; feel free to pass around copies all you like. Environment is thread-safe.
Copyright 1997-2006 Partner Software, Inc.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
headless |
protected java.lang.String |
jreDescription |
protected boolean |
modular |
protected OS |
os |
protected java.lang.String |
osDescription |
protected java.lang.String |
partnerBuild |
protected java.lang.String |
partnerCopyright |
protected java.lang.String |
partnerRelease |
protected boolean |
readOnly |
protected Sandbox |
sandbox |
protected java.lang.String |
userName |
protected boolean |
webStarted |
protected java.lang.String |
webStartURL |
| Modifier | Constructor and Description |
|---|---|
protected |
Environment() |
| Modifier and Type | Method and Description |
|---|---|
static Environment |
currentEnvironment()
Returns the correct Environment for your thread and runtime context.
|
java.lang.String |
getJREDescription() |
OS |
getOS()
Returns the specific OS object for this environment.
|
java.lang.String |
getOSDescription() |
java.lang.String |
getPartnerBuild() |
java.lang.String |
getPartnerCopyright() |
java.lang.String |
getPartnerRelease() |
Sandbox |
getSandbox() |
java.lang.String |
getUserName() |
java.lang.String |
getWebStartURL() |
boolean |
isHeadless()
Returns true if the app is running in headless (daemon) mode.
|
boolean |
isLinux()
Convenience method to test for Linuxness.
|
boolean |
isMac()
Convenience method to test for Macness.
|
boolean |
isModular()
Returns true if system is running in a modular context (with a modular class loader).
|
boolean |
isReadOnly() |
boolean |
isUnix()
Convenience method to test for Unicity.
|
boolean |
isWebStarted()
Returns true if the app is running via Java WebStart.
|
boolean |
isWindows()
Convenience method to test for Windosity.
|
static void |
setDefaultEnvironment(Environment newDefault)
Sets the default Environment.
|
protected OS os
protected java.lang.String osDescription
protected java.lang.String jreDescription
protected java.lang.String userName
protected boolean headless
protected boolean readOnly
protected boolean webStarted
protected java.lang.String webStartURL
protected java.lang.String partnerRelease
protected java.lang.String partnerBuild
protected java.lang.String partnerCopyright
protected boolean modular
protected Sandbox sandbox
public static Environment currentEnvironment()
public static void setDefaultEnvironment(Environment newDefault)
newDefault - new default Environment implementationpublic boolean isLinux()
public boolean isMac()
public boolean isUnix()
public boolean isWindows()
public OS getOS()
OS the app is running on.public boolean isHeadless()
public boolean isWebStarted()
public java.lang.String getWebStartURL()
public java.lang.String getOSDescription()
public java.lang.String getJREDescription()
public boolean isReadOnly()
public java.lang.String getUserName()
public java.lang.String getPartnerRelease()
public java.lang.String getPartnerBuild()
public java.lang.String getPartnerCopyright()
public boolean isModular()
public Sandbox getSandbox()