com.bowstreet
Class BSConfig

java.lang.Object
  extended by com.bowstreet.BSConfig
All Implemented Interfaces:
com.bowstreet.servlet.ObjectLifeCycleHandler.ShutdownAwareObject, java.util.Observer

public class BSConfig
extends java.lang.Object
implements java.util.Observer, com.bowstreet.servlet.ObjectLifeCycleHandler.ShutdownAwareObject

This class provides methods to obscure/unobscure system properties. To access system properties, use the webAppAccess.getSystemProperties() method to retrieve the com.bowstreet.util.SystemProperties singleton in your webapp, or use the getInstance() method on SystemProperties to get the singleton from custom builder code.

See Also:
WebAppAccess, SystemProperties

Nested Class Summary
static class BSConfig.ValueOverride
          Instances of this class can override property settings on a fine-grained basis.
 
Field Summary
static java.lang.String APACHE_CONTAINER_PROVIDER
           
static java.lang.String BOWSTREET_BASE_FILENAME
           
static java.lang.String CLUSTER_BASE_FILENAME
           
static java.lang.String DEFAULT_APPCONTEXT
           
static java.lang.String enableObserverThreadsProperty
          Property used to enable or disable the creation and startup of property observer threads.
static java.lang.String EXPORT_VALUE_PREFIX
           
static int EXPORT_VALUE_PREFIX_LEN
           
static java.lang.String IN_BOWSTREET_CONTAINER
           
static java.lang.String IN_THIRD_PARTY_CONTAINER
           
static java.lang.String LOGGING_BASE_FILENAME
           
static java.lang.String OBSCURED_VALUE_PREFIX
           
static int OBSCURED_VALUE_PREFIX_LEN
           
static java.lang.String OVERRIDE_BASE_FILENAME
           
static java.lang.String PORTAL_BASE_FILENAME
           
static java.lang.String RUNTIME_ADMINSERVLETPATH
           
static java.lang.String RUNTIME_APPCONTEXT
           
static java.lang.String RUNTIME_ROOT_DIRECTORY
           
static java.lang.String RUNTIME_RUNNINGONSERVER
           
static java.lang.String RUNTIME_SERVERINFO
           
static java.lang.String SERVER_BASE_FILENAME
           
static java.lang.String SUNONE_CONTAINER_IMPLEMENTATION
           
static java.lang.String SUNONE_CONTAINER_PROVIDER
           
static java.lang.String TOMCAT_CONTAINER_IMPLEMENTATION
           
static java.lang.String UNKNOWN_APPCONTEXT
           
static java.lang.String UNKNOWN_CONTAINER_IMPLEMENTATION
           
static java.lang.String UNKNOWN_CONTAINER_PROVIDER
           
static java.lang.String UNKNOWN_CONTAINER_VERSION
           
static java.lang.String WEBLOGIC_CONTAINER_IMPLEMENTATION
           
static java.lang.String WEBLOGIC_CONTAINER_PROVIDER
           
static java.lang.String WEBSPHERE_CONTAINER_IMPLEMENTATION
           
static java.lang.String WEBSPHERE_CONTAINER_PROVIDER
           
 
Constructor Summary
BSConfig()
           
 
Method Summary
static void completeReset()
          Similar to reset() above, but also clears the property cache and HTML root field.
static void createInstance()
          Mini factory to create an instance of this class the first time used.
static java.lang.String getConfigFilePath(java.lang.String baseFileName)
          A convenience method for getting a config file.
static java.lang.String getHomedir()
          Get a reference to our home directory file path.
static java.lang.String getHomedirCanonical()
          Get canonical form of home directory file path.
static java.lang.String getHtmlRootDir()
          Get the String value of the HTML Root directory file path.
static BSConfig getInstance()
          Get the singleton instance
static java.util.Map getPropertiesList(java.lang.String prefix)
          get a list of properties
static com.bowstreet.util.ObservableProperties getPropertiesObject(java.lang.String prop)
          Get a Bow Street configuration property observer.
static java.lang.String getProperty(java.lang.String key)
          Get a Bow Street configuration property from one of the properties files
static java.lang.String getProperty(java.lang.String key, java.lang.String defaultVal)
          Get a Bow Street configuration property and return the default if none are found.
static boolean getPropertyBoolean(java.lang.String key)
          Return the boolean value of a "true/false" property value.
static boolean getPropertyBoolean(java.lang.String key, boolean defaultValue)
          Return the boolean value of a "true/false" property value.
static java.lang.Integer getPropertyInt(java.lang.String key)
          Get a Bow Street configuration property as an Integer.
static int getPropertyInt(java.lang.String key, int defaultValue)
          Get a Bow Street configuration property as an int, returning the specified default if the config value can't be returned for some reason.
static long getPropertyLong(java.lang.String key, long defaultValue)
          Get a Bow Street configuration property as a long, returning the specified default if the config value can't be returned for some reason.
static java.lang.String getServerUpTime()
          This method calculates the time that a server has been up and returns the formatted result.
static long getStartTime()
           
static BSConfig.ValueOverride getValueOverride()
          Get the current value override object.
static java.lang.String getVersion()
          Get the engine version info.
static boolean isRunningOnServer()
          Get runtime parameter indicating whether we are running on a Factory server or not
static void reloadProperties()
          Reload all of the property files on demand.
static void reloadProperties(java.lang.String baseFileName)
          Reload the specified property file on demand.
static void reset()
          This method clear all the existing properties, and re-initialize them.
static void setValueOverride(BSConfig.ValueOverride overrider)
          Set a value override object.
 void shutdown()
          Shupdown all of the property observer threads maintained by BSConfig.
static java.lang.String testVersion(java.lang.String sReqVersion)
          testVersion Test that the version of the Bowserver that is running is at least that of the required version (passed in).
 void update(java.util.Observable obj, java.lang.Object arg)
          Update request from one of our observable property objects This doesn't happen often (only when a property is changed at runtime) so we're not picky about just clearing a single cache entry.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APACHE_CONTAINER_PROVIDER

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

BOWSTREET_BASE_FILENAME

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

CLUSTER_BASE_FILENAME

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

DEFAULT_APPCONTEXT

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

enableObserverThreadsProperty

public static final java.lang.String enableObserverThreadsProperty
Property used to enable or disable the creation and startup of property observer threads. Default behavior for 7.0.0 and later is to not start the threads.

See Also:
Constant Field Values

EXPORT_VALUE_PREFIX

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

EXPORT_VALUE_PREFIX_LEN

public static final int EXPORT_VALUE_PREFIX_LEN

IN_BOWSTREET_CONTAINER

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

IN_THIRD_PARTY_CONTAINER

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

LOGGING_BASE_FILENAME

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

OBSCURED_VALUE_PREFIX

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

OBSCURED_VALUE_PREFIX_LEN

public static final int OBSCURED_VALUE_PREFIX_LEN

OVERRIDE_BASE_FILENAME

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

PORTAL_BASE_FILENAME

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

RUNTIME_ADMINSERVLETPATH

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

RUNTIME_APPCONTEXT

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

RUNTIME_ROOT_DIRECTORY

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

RUNTIME_RUNNINGONSERVER

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

RUNTIME_SERVERINFO

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

SERVER_BASE_FILENAME

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

SUNONE_CONTAINER_IMPLEMENTATION

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

SUNONE_CONTAINER_PROVIDER

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

TOMCAT_CONTAINER_IMPLEMENTATION

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

UNKNOWN_APPCONTEXT

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

UNKNOWN_CONTAINER_IMPLEMENTATION

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

UNKNOWN_CONTAINER_PROVIDER

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

UNKNOWN_CONTAINER_VERSION

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

WEBLOGIC_CONTAINER_IMPLEMENTATION

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

WEBLOGIC_CONTAINER_PROVIDER

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

WEBSPHERE_CONTAINER_IMPLEMENTATION

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

WEBSPHERE_CONTAINER_PROVIDER

public static final java.lang.String WEBSPHERE_CONTAINER_PROVIDER
See Also:
Constant Field Values
Constructor Detail

BSConfig

public BSConfig()
Method Detail

completeReset

public static void completeReset()
Similar to reset() above, but also clears the property cache and HTML root field.

For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

createInstance

public static void createInstance()
Mini factory to create an instance of this class the first time used. This is synchronized to make sure no two threads try this at once.

For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getConfigFilePath

public static java.lang.String getConfigFilePath(java.lang.String baseFileName)
A convenience method for getting a config file. Given the base file name "foo.properties", this should return something like "..\config\foo.properties"

For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getHomedir

public static java.lang.String getHomedir()
Get a reference to our home directory file path.

Returns:
String value of the home directory file path.
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getHomedirCanonical

public static java.lang.String getHomedirCanonical()
Get canonical form of home directory file path.

Returns:
String - canonical form of server home directory file path.
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getHtmlRootDir

public static java.lang.String getHtmlRootDir()
Get the String value of the HTML Root directory file path.

Returns:
String value of the HTML Root Directory file path.
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getInstance

public static BSConfig getInstance()
Get the singleton instance

For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getPropertiesList

public static java.util.Map getPropertiesList(java.lang.String prefix)
get a list of properties

For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getPropertiesObject

public static com.bowstreet.util.ObservableProperties getPropertiesObject(java.lang.String prop)
Get a Bow Street configuration property observer.

For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getProperty

public static java.lang.String getProperty(java.lang.String key)
Get a Bow Street configuration property from one of the properties files

Parameters:
key - the property name (eg, "server.htmlRoot" )
Returns:
String property value
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getProperty

public static java.lang.String getProperty(java.lang.String key,
                                           java.lang.String defaultVal)
Get a Bow Street configuration property and return the default if none are found.

Parameters:
key - the property name (eg, "server.htmlRoot" ).
defaultVal - default value to return if property not found.
Returns:
String property value.
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getPropertyBoolean

public static boolean getPropertyBoolean(java.lang.String key)
Return the boolean value of a "true/false" property value. The default if not found is false.

Parameters:
key - the property name
Returns:
boolean property value - default is false if property not found.
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getPropertyBoolean

public static boolean getPropertyBoolean(java.lang.String key,
                                         boolean defaultValue)
Return the boolean value of a "true/false" property value. Use the specified default if the property is not found.

Parameters:
key - the property name
defaultValue - the default to use if the property is not set, or not set properly.
Returns:
boolean property value
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getPropertyInt

public static java.lang.Integer getPropertyInt(java.lang.String key)
Get a Bow Street configuration property as an Integer.

Parameters:
key - the property name
Returns:
Integer property value - default is null if property not found.
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getPropertyInt

public static int getPropertyInt(java.lang.String key,
                                 int defaultValue)
Get a Bow Street configuration property as an int, returning the specified default if the config value can't be returned for some reason.

Parameters:
key - the property name.
defaultValue - default value to return if property not found.
Returns:
int property value.
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getPropertyLong

public static long getPropertyLong(java.lang.String key,
                                   long defaultValue)
Get a Bow Street configuration property as a long, returning the specified default if the config value can't be returned for some reason.

Parameters:
key - the property name.
defaultValue - default value to return if property not found.
Returns:
long property value.
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getServerUpTime

public static java.lang.String getServerUpTime()
This method calculates the time that a server has been up and returns the formatted result.

For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getStartTime

public static long getStartTime()
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getValueOverride

public static BSConfig.ValueOverride getValueOverride()
Get the current value override object.

For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

getVersion

public static java.lang.String getVersion()
Get the engine version info.

Returns:
String version.
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

isRunningOnServer

public static boolean isRunningOnServer()
Get runtime parameter indicating whether we are running on a Factory server or not

For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

reloadProperties

public static void reloadProperties()
                             throws java.io.IOException
Reload all of the property files on demand.

Throws:
java.io.IOException
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

reloadProperties

public static void reloadProperties(java.lang.String baseFileName)
                             throws java.io.IOException
Reload the specified property file on demand. If the over-ride property file is to be reloaded, then the baseFileName parameter must be "override" rather than the actual name of the file used to provide the over-ride properties.

Throws:
java.io.IOException
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

reset

public static void reset()
This method clear all the existing properties, and re-initialize them. I have to do it because reloadProperties() has an assumption that the file always contains same set of properties while only value is changed, this is not true for installation. Because we moved properties around between factory versions, even the bowstreet.rootDirectory may be changed, so we need to clear the properties before we reload to get the correct set of keys. Currently this method is only used by installation. So we don't need to worry about efficiency. In the future if we have dynamic set of properties, we should modify ObservableProperties.runLoop() to clean the property before refresh from file.

For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.
--Bin Ji. 6/13/01 5/11/05: Added method in ObservableProperties (markForRemove) to make sure ObservableProperties threads do not stick around after new versions are created. This was a particular problem in the Designer, since each time a user switches projects, this method gets called.

setValueOverride

public static void setValueOverride(BSConfig.ValueOverride overrider)
Set a value override object.

For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

shutdown

public void shutdown()
Shupdown all of the property observer threads maintained by BSConfig.

Specified by:
shutdown in interface com.bowstreet.servlet.ObjectLifeCycleHandler.ShutdownAwareObject
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

testVersion

public static java.lang.String testVersion(java.lang.String sReqVersion)
testVersion Test that the version of the Bowserver that is running is at least that of the required version (passed in). Return an error string if there is any problem. return null if OK.

For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

update

public void update(java.util.Observable obj,
                   java.lang.Object arg)
Update request from one of our observable property objects This doesn't happen often (only when a property is changed at runtime) so we're not picky about just clearing a single cache entry. Such a change would entail changes to the ObserveableProperties implementation themselves to more granularly define what's changing

Specified by:
update in interface java.util.Observer
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.


Copyright © 2009 IBM. All Rights Reserved.