Tweek Java API
v1.0


org.vrjuggler.tweek.services
Class EnvironmentServiceProxy

java.lang.Object
  extended by org.vrjuggler.tweek.services.EnvironmentServiceProxy
All Implemented Interfaces:
EnvironmentService

public class EnvironmentServiceProxy
extends Object
implements EnvironmentService

A proxy to the built-in Tweek Environment Service. Instantiate this class to get access to the Environment Service.


Field Summary
 
Fields inherited from interface org.vrjuggler.tweek.services.EnvironmentService
MacOS, UNIX, Windows, WindowsCE
 
Constructor Summary
EnvironmentServiceProxy()
          Creates a new EnvironmentService proxy to the Tweek Environment Service.
 
Method Summary
 String expandEnvVars(String inputStr)
          Expands environment variables in the input string.
 String getAppDataDir()
          Returns the absolute path to the platfom-specific directory where preferences files and other application data should be stored.
 String[] getCommandLineArgs()
          Returns the array of command-line arguments.
 String getenv(String envVarName)
          Returns the value of the named environment variable or null if the variable is not set in the user's environment.
 String getenv(String envVarName, String defaultValue)
          Returns the value of the named environment variable or the given default value if the variable is not set in the user's environment.
 int getOS()
          Returns an identifier for the host operationg system.
 String getUserHome()
          Gets the user's HOME environment variable using the JVM instead of the environment variable.
 void setCommandLineArgs(String[] args)
          Stores the command-line arguments passed to the application when it was started.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvironmentServiceProxy

public EnvironmentServiceProxy()
                        throws RuntimeException
Creates a new EnvironmentService proxy to the Tweek Environment Service.

Throws:
RuntimeException - if the EnvironmentService Bean could not be found.
Method Detail

setCommandLineArgs

public void setCommandLineArgs(String[] args)
Stores the command-line arguments passed to the application when it was started.

Specified by:
setCommandLineArgs in interface EnvironmentService

getCommandLineArgs

public String[] getCommandLineArgs()
Returns the array of command-line arguments.

Specified by:
getCommandLineArgs in interface EnvironmentService

expandEnvVars

public String expandEnvVars(String inputStr)
Expands environment variables in the input string. Environment variables may be specified using either $(variable_name) or ${variable_name} everything between the parentheses or braces will be considered the name of the variables.

Specified by:
expandEnvVars in interface EnvironmentService
Parameters:
inputStr - the string in which to look for and expand environment variables.
Returns:
the input string with the variables replaced by their values.

getUserHome

public String getUserHome()
Gets the user's HOME environment variable using the JVM instead of the environment variable.

Specified by:
getUserHome in interface EnvironmentService
Returns:
the path to the user's home directory

getAppDataDir

public String getAppDataDir()
Returns the absolute path to the platfom-specific directory where preferences files and other application data should be stored.

Specified by:
getAppDataDir in interface EnvironmentService

getOS

public int getOS()
Returns an identifier for the host operationg system. The value will be one of EnvironmentService.UNIX, EnvironmentService.MacOS, or EnvironmentService.Windows.

Specified by:
getOS in interface EnvironmentService

getenv

public String getenv(String envVarName)
Returns the value of the named environment variable or null if the variable is not set in the user's environment.

Specified by:
getenv in interface EnvironmentService
Parameters:
envVarName - The name of the variable to look up in the user's environment.
Returns:
A String object containing the value of the named environment variable if the variable exists in the user's environment. If it does not exist, null is returned.

getenv

public String getenv(String envVarName,
                     String defaultValue)
Returns the value of the named environment variable or the given default value if the variable is not set in the user's environment.

Specified by:
getenv in interface EnvironmentService
Parameters:
envVarName - The name of the variable to look up in the user's environment.
defaultValue - The value to return if the named variable is not found in the user's environment.
Returns:
A String object containing the value of the named environment variable if the variable exists in the user's environment. If it does not exist, the given default value is returned.

Tweek Java API
v1.0


Copyright © 1998–2005 Iowa State University. All rights reserved.