com.tivoli.twg.libs
Class TWGEnvironment

java.lang.Object
  extended bycom.tivoli.twg.libs.TWGEnvironment

public class TWGEnvironment
extends java.lang.Object

This class provides various methods for accessing values and performing simple utility functions which differ depending on the operating system platform. Components should add static methods to this class for platform-specific values and utility functions that are needed, thus keeping platform differences explict and isolated. Each accessor method may have its own way of determining the value to return (such as using system properties) or may require domain-specific input provided by the caller (e.g. database product name) to map to a value returned.


Field Summary
static int OS_TYPE_AIX
           
static int OS_TYPE_DYNIX
           
static int OS_TYPE_HPUX
           
static int OS_TYPE_LINUX
           
static int OS_TYPE_NT
           
static int OS_TYPE_OS400
           
static int OS_TYPE_OTHER
           
static int OS_TYPE_SOLARIS
           
static int OS_TYPE_UNIXWARE
           
static int OS_TYPE_WIN9X
           
static java.lang.String PROP_DIR_BIN
           
static java.lang.String PROP_DIR_CLASSES
           
static java.lang.String PROP_DIR_DATA
           
static java.lang.String PROP_DIR_DATABASE
           
static java.lang.String PROP_DIR_EXTENSIONS
           
static java.lang.String PROP_DIR_JRE
           
static java.lang.String PROP_DIR_LIB
           
static java.lang.String PROP_DIR_LOG
           
static java.lang.String PROP_DIR_PRODDATA
           
static java.lang.String PROP_DIR_PRODINFO
           
static java.lang.String PROP_DIR_ROOT
           
static java.lang.String PROP_DIR_SECMODS
           
static java.lang.String PROP_DIR_SUPPORT
           
static java.lang.String PROP_DIR_TEMPDATA
           
static java.lang.String PROP_ERROR_HANDLER
           
static java.lang.String[] tme_interp_type
           
 
Constructor Summary
TWGEnvironment()
           
 
Method Summary
static java.util.Properties ConfigProperties()
          Get environment-specific default server properties used for TWGConfigProperties
static java.lang.String EvalKeyFileName()
           
static java.lang.String getBinDirectory()
          Get directory containing native executables and libraries
static java.lang.String getClassesDirectory()
          Get directory containing java classes
static java.lang.String getDatabaseDirectory()
          Get database directory (content is preserved on upgrades)
static java.lang.String getDataDirectory()
          Get data directory (content is preserved on upgrades)
static java.lang.String getDbProviderClassName()
           
static java.lang.String getDefaultEncoding()
           
static java.lang.String getErrorHandlerClassName()
           
static java.lang.String getExtensionsDirectory()
          Get extensions directory
static java.lang.String getExternalEventWaiterClassName()
           
static java.lang.String getInterpType()
          Get Operating System INTERP type of the active environment
static java.lang.String getJreDirectory()
          Get directory containing java runtime environment
static java.lang.String getLibDirectory()
          Get directory containing third-party java libraries
static java.lang.String getLogDirectory()
          Get directory containing debug/trace logs/dumps
static java.lang.String getNativeUNCFileProviderClassName()
           
static java.lang.String getNativeUserProviderClassName()
           
static int getOSType()
          Get Operating System type of the active environment
static java.lang.String getProcessDataGathererClassName()
           
static java.lang.String getProdDataDirectory()
          Get product data directory (read-only type data installed with product)
static java.lang.String getProdInfoDirectory()
          Get product info directory
static java.lang.String getRasConfigPropClassName()
           
static java.lang.String getRemoteLogFactoryClassName()
           
static java.io.InputStream getResourceAsStream(java.lang.String name)
          Get an InputStream on a given resource.
static java.lang.String getRootDirectory()
          Get product root directory
static java.lang.String getRuntimeContextClassName()
           
static java.lang.String getSecmodsDirectory()
          Get directory containing transport security modules (secmods)
static java.lang.String getServerEnvironmentClassName()
           
static java.lang.String getStartConsoleCommand()
           
static java.lang.String getSupportDirectory()
          Get support directory
static java.lang.String getTempDataDirectory()
          Get temporary data directory
static java.lang.String getUserContextClassName()
           
static boolean hasGarbageCollectDaemon()
           
static boolean hasLogEngine()
          Returns whether platform has a log engine
static boolean hasNativeAgent()
          Returns whether platform has native agent
static boolean isAgentIPCExternalVMAccessible()
           
static boolean isAix()
          Test to see if AIX-type OS platform
static boolean isLinux()
          Test to see if Linux-type OS platform
static boolean isOS400()
          Test to see if OS/400 platform
static boolean isPCHardware()
          Test to see if PC-architecture platform (i.e.
static boolean isRMIDisabled()
          Deprecated.  
static boolean isSharedVM()
          Deprecated.  
static boolean isTKSPresent()
          Deprecated.  
static boolean isUNIX()
          Test to see if UNIX-type OS platform
static boolean isWindows()
          Test to see if Windows OS (Windows 2000)
static boolean loadLibrary(java.lang.String library)
          Load the specified native library if the platform requires it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_DIR_ROOT

public static final java.lang.String PROP_DIR_ROOT
See Also:
Constant Field Values

PROP_DIR_BIN

public static final java.lang.String PROP_DIR_BIN
See Also:
Constant Field Values

PROP_DIR_CLASSES

public static final java.lang.String PROP_DIR_CLASSES
See Also:
Constant Field Values

PROP_DIR_DATA

public static final java.lang.String PROP_DIR_DATA
See Also:
Constant Field Values

PROP_DIR_DATABASE

public static final java.lang.String PROP_DIR_DATABASE
See Also:
Constant Field Values

PROP_DIR_EXTENSIONS

public static final java.lang.String PROP_DIR_EXTENSIONS
See Also:
Constant Field Values

PROP_DIR_JRE

public static final java.lang.String PROP_DIR_JRE
See Also:
Constant Field Values

PROP_DIR_LIB

public static final java.lang.String PROP_DIR_LIB
See Also:
Constant Field Values

PROP_DIR_LOG

public static final java.lang.String PROP_DIR_LOG
See Also:
Constant Field Values

PROP_DIR_PRODDATA

public static final java.lang.String PROP_DIR_PRODDATA
See Also:
Constant Field Values

PROP_DIR_PRODINFO

public static final java.lang.String PROP_DIR_PRODINFO
See Also:
Constant Field Values

PROP_DIR_SECMODS

public static final java.lang.String PROP_DIR_SECMODS
See Also:
Constant Field Values

PROP_DIR_SUPPORT

public static final java.lang.String PROP_DIR_SUPPORT
See Also:
Constant Field Values

PROP_DIR_TEMPDATA

public static final java.lang.String PROP_DIR_TEMPDATA
See Also:
Constant Field Values

PROP_ERROR_HANDLER

public static final java.lang.String PROP_ERROR_HANDLER
See Also:
Constant Field Values

OS_TYPE_OTHER

public static final int OS_TYPE_OTHER
See Also:
Constant Field Values

OS_TYPE_NT

public static final int OS_TYPE_NT
See Also:
Constant Field Values

OS_TYPE_OS400

public static final int OS_TYPE_OS400
See Also:
Constant Field Values

OS_TYPE_AIX

public static final int OS_TYPE_AIX
See Also:
Constant Field Values

OS_TYPE_HPUX

public static final int OS_TYPE_HPUX
See Also:
Constant Field Values

OS_TYPE_UNIXWARE

public static final int OS_TYPE_UNIXWARE
See Also:
Constant Field Values

OS_TYPE_LINUX

public static final int OS_TYPE_LINUX
See Also:
Constant Field Values

OS_TYPE_SOLARIS

public static final int OS_TYPE_SOLARIS
See Also:
Constant Field Values

OS_TYPE_WIN9X

public static final int OS_TYPE_WIN9X
See Also:
Constant Field Values

OS_TYPE_DYNIX

public static final int OS_TYPE_DYNIX
See Also:
Constant Field Values

tme_interp_type

public static final java.lang.String[] tme_interp_type
Constructor Detail

TWGEnvironment

public TWGEnvironment()
Method Detail

getOSType

public static int getOSType()
Get Operating System type of the active environment

Returns:
one of the defined enum values: OS_TYPE_OTHER, OS_TYPE_NT, OS_TYPE_OS400, OS_TYPE_AIX, OS_TYPE_HPUX, OS_TYPE_UNIXWARE, OS_TYPE_LINUX, OS_TYPE_SOLARIS, OS_TYPE_WIN9X

getInterpType

public static java.lang.String getInterpType()
Get Operating System INTERP type of the active environment

Returns:
TME INTERP string or "other" if there is no mapping available

isPCHardware

public static boolean isPCHardware()
Test to see if PC-architecture platform (i.e. PC hardware)

Returns:
true if PC, false if not

isUNIX

public static boolean isUNIX()
Test to see if UNIX-type OS platform

Returns:
true if UNIX-type OS, false if not

isAix

public static boolean isAix()
Test to see if AIX-type OS platform

Returns:
true if AIX-type OS, false if not

isLinux

public static boolean isLinux()
Test to see if Linux-type OS platform

Returns:
true if Linux-type OS, false if not

isOS400

public static boolean isOS400()
Test to see if OS/400 platform

Returns:
true if OS/400, false if not

isWindows

public static boolean isWindows()
Test to see if Windows OS (Windows 2000)

Returns:
true if Windows OS, false if not

isSharedVM

public static boolean isSharedVM()
Deprecated.  

Test to see if the virtual machine is shared with other application(s)

Returns:
true if VM is shared, false if dedicated (OK to use System.exit, etc.)

isRMIDisabled

public static boolean isRMIDisabled()
Deprecated.  

Test to see if RMI is disabled in the environment

Returns:
true if RMI is disabled, false if RMI use is allowed

isTKSPresent

public static boolean isTKSPresent()
Deprecated.  


loadLibrary

public static boolean loadLibrary(java.lang.String library)
                           throws java.lang.SecurityException,
                                  java.lang.UnsatisfiedLinkError
Load the specified native library if the platform requires it

Returns:
boolean true if native library is in use
Throws:
SecurityError
java.lang.UnsatisfiedLinkError
java.lang.SecurityException

ConfigProperties

public static java.util.Properties ConfigProperties()
Get environment-specific default server properties used for TWGConfigProperties

Returns:
Properties object containing environment-specific Director server properties (or null if none)

getErrorHandlerClassName

public static java.lang.String getErrorHandlerClassName()
Returns:
class name of TWGErrorHandler class for this environment (or null for default error handling)

getExternalEventWaiterClassName

public static java.lang.String getExternalEventWaiterClassName()
                                                        throws BadExternalEventWaiterImplException
Returns:
class name of external event waiter for this environment
Throws:
BadExternalEventWaiterImplException - if class not defined for environment

getRasConfigPropClassName

public static java.lang.String getRasConfigPropClassName()
Returns:
class name of TWGRasConfigProperties subclass for this environment or null if not defined

getDefaultEncoding

public static java.lang.String getDefaultEncoding()
Returns:
default encoding for input stream of process returned from Runtime.exec()

isAgentIPCExternalVMAccessible

public static boolean isAgentIPCExternalVMAccessible()
Returns:
whether agent (without server) IPC is accessible from another VM

hasGarbageCollectDaemon

public static boolean hasGarbageCollectDaemon()
Returns:
true if garbage collection daemon is helpful in this environment

getRemoteLogFactoryClassName

public static java.lang.String getRemoteLogFactoryClassName()
Returns:
class name of TWGRemoteLog implementation for this environment or null if not defined

getServerEnvironmentClassName

public static java.lang.String getServerEnvironmentClassName()
Returns:
class name of TWGServerEnvironmentImpl implementation class for this environment or null if not defined

getNativeUserProviderClassName

public static java.lang.String getNativeUserProviderClassName()
Returns:
class name of the class implementing the interface or null if not defined

getRuntimeContextClassName

public static java.lang.String getRuntimeContextClassName()
Returns:
class name of the class implementing the interface for changing the runtime context

getUserContextClassName

public static java.lang.String getUserContextClassName()
Returns:
class name of the class implementing the interface for changing the user context

getProcessDataGathererClassName

public static java.lang.String getProcessDataGathererClassName()
Returns:
String class name of the class implementing the interface for gathering process data

getNativeUNCFileProviderClassName

public static java.lang.String getNativeUNCFileProviderClassName()
Returns:
class name of the class implementing the interface or null if not defined

getDbProviderClassName

public static java.lang.String getDbProviderClassName()
Returns:
class name of the class implementing the interface

getStartConsoleCommand

public static java.lang.String getStartConsoleCommand()
Returns:
command to start new console process (jvm)

hasLogEngine

public static boolean hasLogEngine()
Returns whether platform has a log engine

Returns:
whether platform supports log engine

hasNativeAgent

public static boolean hasNativeAgent()
Returns whether platform has native agent

Returns:
whether platform has native agent

EvalKeyFileName

public static java.lang.String EvalKeyFileName()

getResourceAsStream

public static java.io.InputStream getResourceAsStream(java.lang.String name)
Get an InputStream on a given resource. Will use the class loader that was used to load this class, otherwise, if none is set, will load using the system classpath.


getRootDirectory

public static java.lang.String getRootDirectory()
Get product root directory

Returns:
product root directory (e.g., /opt/IBM/director )

getBinDirectory

public static java.lang.String getBinDirectory()
Get directory containing native executables and libraries

Returns:
bin directory (i.e., /opt/IBM/director/bin)

getClassesDirectory

public static java.lang.String getClassesDirectory()
Get directory containing java classes

Returns:
classes directory (i.e., /opt/IBM/director/classes)

getDataDirectory

public static java.lang.String getDataDirectory()
Get data directory (content is preserved on upgrades)

Returns:
data directory (e.g., /opt/IBM/director/data)

getDatabaseDirectory

public static java.lang.String getDatabaseDirectory()
Get database directory (content is preserved on upgrades)

Returns:
data directory (e.g., /opt/IBM/director/database)

getExtensionsDirectory

public static java.lang.String getExtensionsDirectory()
Get extensions directory

Returns:
extensions directory ( i.e., /opt/IBM/director/classes/extensions )

getLibDirectory

public static java.lang.String getLibDirectory()
Get directory containing third-party java libraries

Returns:
lib directory (e.g., /opt/IBM/director/lib)

getJreDirectory

public static java.lang.String getJreDirectory()
Get directory containing java runtime environment

Returns:
jre directory (e.g., /opt/IBM/director/jre)

getLogDirectory

public static java.lang.String getLogDirectory()
Get directory containing debug/trace logs/dumps

Returns:
log directory (e.g., /opt/IBM/director/log)

getProdDataDirectory

public static java.lang.String getProdDataDirectory()
Get product data directory (read-only type data installed with product)

Returns:
product data directory (e.g., /opt/IBM/director/proddata)

getProdInfoDirectory

public static java.lang.String getProdInfoDirectory()
Get product info directory

Returns:
product info directory (e.g., /opt/IBM/director/classes/prodinfo)

getSecmodsDirectory

public static java.lang.String getSecmodsDirectory()
Get directory containing transport security modules (secmods)

Returns:
secmods directory (e.g., /opt/IBM/director/classes/secmods)

getSupportDirectory

public static java.lang.String getSupportDirectory()
Get support directory

Returns:
support directory (e.g., /opt/IBM/director/support)

getTempDataDirectory

public static java.lang.String getTempDataDirectory()
Get temporary data directory

Returns:
temporary data directory (e.g., /opt/IBM/director/tempdata)