ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able
Class AblePreferences

java.lang.Object
  |
  +--com.ibm.able.AblePreferences

public class AblePreferences
extends java.lang.Object

The AblePreferences class contains preferences for the base Able classes, including:

The actual preferences file that is read and written is located in the directory specified by the "able.prefdir" system property when the Able class is loaded.

An example preferences file is located at in the ABL product directory.


Constructor Summary
AblePreferences()
          Instantiate all preferences from a Properties file read from disk.
 
Method Summary
 java.lang.String getCommPort()
          Returns the comm port used by ABLE platform code.
 long getMessageLogConsoleSeverity()
          Returns the preference for the severity of the message logger's console handler.
 boolean getMessageLogDailyFile()
          Indicates a preference for daily message log files.
 java.lang.String getMessageLogFileName()
          Returns the path and name for the message log file handler.
 long getMessageLogFileSeverity()
          Returns the preference for the severity of the message logger's file handler.
 boolean getSecurity()
          Indicates if the ABLE platform should use special secure methods or run completely open.
 java.lang.String getSocketFactoryClass()
          Returns the fully qualified class name of the socket factory used by ABLE platform code; for example "com.ibm.able.AbleSocketFactory".
 long getTraceLogConsoleLevel()
          Returns the preference for the level of the trace logger's console handler.
 boolean getTraceLogDailyFile()
          Indicates a preference for daily trace log files.
 long getTraceLogFileLevel()
          Returns the preference for the level of the trace logger's file handler.
 java.lang.String getTraceLogFileName()
          Returns the path and name for the trace log file handler.
 java.lang.String getWorkingDirectory()
          Returns the current working directory.
 boolean isSecure()
          Indicates if the ABLE platform should use special secure methods or run completely open.
 void readPropertiesFile()
          Load up the current set of working preferences from a physical properties file.
 void setCommPort(java.lang.String theValue)
          Sets the comm port used by ABLE platform code.
 void setMessageLogConsoleSeverity(long theValue)
          Sets the preference for the severity of the message logger's console handler.
 void setMessageLogDailyFile(boolean theValue)
          Sets the preference for daily message log files.
 void setMessageLogFileName(java.lang.String fileName)
          Sets the path and name for the message log file handler.
 void setMessageLogFileSeverity(long theValue)
          Sets the preference for the severity of the message logger's file handler.
 void setSocketFactoryClass(java.lang.String theValue)
          Sets the fully qualified class name of the socket factory used by ABLE platform code; for example "com.ibm.able.AbleSocketFactory".
 void setTraceLogConsoleLevel(long theValue)
          Sets the preference for the level of the trace logger's console handler.
 void setTraceLogDailyFile(boolean theValue)
          Sets the preference for daily trace log files.
 void setTraceLogFileLevel(long theValue)
          Sets the preference for the level of the trace logger's file handler.
 void setTraceLogFileName(java.lang.String fileName)
          Sets the path and name for the trace log file handler.
 void setWorkingDirectory(java.lang.String theValue)
          Sets the current working directory.
 void updatePreferenceVariablesAndWritePropertiesFile(AblePreferences theNewPreferences)
          Change all current working preferences, except Security (which shall not be set programmtically), to the values contained in the specified preferences object.
 void writePropertiesFile()
          Save the current set of working preferences to a physical properties file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AblePreferences

public AblePreferences()
Instantiate all preferences from a Properties file read from disk.

We look for this package's properties file first in the directory as specified by the system property contained in the variable Able.PropertiesFileDirectoryProperty and if the named property isn't set, then in the user's home directory. If there is no properties file in either location, a default properties file is created.

Method Detail

getWorkingDirectory

public final java.lang.String getWorkingDirectory()
Returns the current working directory.
Returns:
The current working directory which defaults to the system property user.home.

setWorkingDirectory

public final void setWorkingDirectory(java.lang.String theValue)
Sets the current working directory.
Parameters:
theValue - The current working directory.

getTraceLogConsoleLevel

public final long getTraceLogConsoleLevel()
Returns the preference for the level of the trace logger's console handler.
Returns:
The current level of the console handler from the AbleTraceLogger.TraceLogLevelValuesVector list.

setTraceLogConsoleLevel

public final void setTraceLogConsoleLevel(long theValue)
Sets the preference for the level of the trace logger's console handler.
Parameters:
The - current level of the console handler, a value from the AbleTraceLogger.TraceLogLevelValuesVector list.

getTraceLogFileLevel

public final long getTraceLogFileLevel()
Returns the preference for the level of the trace logger's file handler.
Returns:
The current level of the file handler from the AbleTraceLogger.TraceLogLevelValuesVector list.

setTraceLogFileLevel

public final void setTraceLogFileLevel(long theValue)
Sets the preference for the level of the trace logger's file handler.
Parameters:
theValue - The current level of the file handler, a value from the AbleTraceLogger.TraceLogLevelValuesVector list.

getTraceLogDailyFile

public boolean getTraceLogDailyFile()
Indicates a preference for daily trace log files. When true a datestamp precedes the extension in the filename, and a new file is created for each day.
Returns:
true if a datestamp is to precede the extension in the filename, and a new file is to be created for each day.

setTraceLogDailyFile

public void setTraceLogDailyFile(boolean theValue)
Sets the preference for daily trace log files.
Parameters:
theValue - true if a datestamp is to precede the extension in the filename, and a new file is to be created for each day.

getTraceLogFileName

public final java.lang.String getTraceLogFileName()
Returns the path and name for the trace log file handler. The default is AbleTrc.log in the user.home directory. If getTraceLogDailyFile() is true, a datestamp will precede the extension.
Returns:
The path and name for the trace log file.

setTraceLogFileName

public final void setTraceLogFileName(java.lang.String fileName)
Sets the path and name for the trace log file handler. If getTraceLogDailyFile() is true, a datestamp will precede the extension.
Parameters:
fileName - The path and name for the trace log file.

getMessageLogConsoleSeverity

public final long getMessageLogConsoleSeverity()
Returns the preference for the severity of the message logger's console handler.
Returns:
The current level of the console handler from the AbleTraceLogger.MessageLogSeverityValuesVector list.

setMessageLogConsoleSeverity

public final void setMessageLogConsoleSeverity(long theValue)
Sets the preference for the severity of the message logger's console handler.
Parameters:
theValue - The current severity of the console handler, a value from the AbleTraceLogger.MessageLogSeverityValuesVector list.

getMessageLogFileSeverity

public final long getMessageLogFileSeverity()
Returns the preference for the severity of the message logger's file handler.
Returns:
The current severity of the file handler from the AbleTraceLogger.MessageLogSeverityValuesVector list.

setMessageLogFileSeverity

public final void setMessageLogFileSeverity(long theValue)
Sets the preference for the severity of the message logger's file handler.
Parameters:
theValue - The current severity of the file handler, a value from the AbleTraceLogger.MessageLogSeverityValuesVector list.

getMessageLogFileName

public final java.lang.String getMessageLogFileName()
Returns the path and name for the message log file handler. The default is AbleMsg.log in the user.home directory. If getMessageLogDailyFile() is true, a datestamp will precede the extension.
Returns:
The path and name for the message log file.

setMessageLogFileName

public final void setMessageLogFileName(java.lang.String fileName)
Sets the path and name for the message log file handler. If getMessageLogDailyFile() is true, a datestamp will precede the extension.
Parameters:
fileName - The path and name for the trace log file.

getMessageLogDailyFile

public boolean getMessageLogDailyFile()
Indicates a preference for daily message log files. When true a datestamp precedes the extension in the filename, and a new file is created for each day.
Returns:
true if a datestamp is to precede the extension in the filename, and a new file is to be created for each day.

setMessageLogDailyFile

public void setMessageLogDailyFile(boolean theValue)
Sets the preference for daily message log files.
Parameters:
theValue - true if a datestamp is to precede the extension in the filename, and a new file is to be created for each day.

getCommPort

public final java.lang.String getCommPort()
Returns the comm port used by ABLE platform code. If not the empty string, the colon is mandatory!

Default value: an empty string.


setCommPort

public final void setCommPort(java.lang.String theValue)
Sets the comm port used by ABLE platform code. If not the empty string, the colon is mandatory!

Default value: an empty string.

Parameters:
theValue - The comm port; ; for example ":1234".

getSocketFactoryClass

public final java.lang.String getSocketFactoryClass()
Returns the fully qualified class name of the socket factory used by ABLE platform code; for example "com.ibm.able.AbleSocketFactory". May be the empty string, in which case the default RMI socket factory is used.

Default value: an empty string.


setSocketFactoryClass

public final void setSocketFactoryClass(java.lang.String theValue)
Sets the fully qualified class name of the socket factory used by ABLE platform code; for example "com.ibm.able.AbleSocketFactory". May be the empty string, in which case the default RMI socket factory is used.

Default value: an empty string.

Parameters:
theValue - The class name of the socket factory.

getSecurity

public final boolean getSecurity()
Indicates if the ABLE platform should use special secure methods or run completely open. The default is to run open.

Default value: off. Can be set only by manually editing the able.preferences file before startup.

Returns:
The security setting, where true indicates security is on, and false indicates security is off.

isSecure

public final boolean isSecure()
Indicates if the ABLE platform should use special secure methods or run completely open. The default is to run open.

Default value: off. Can be set only by manually editing the able.preferences file before startup.

Returns:
The security setting, where true indicates security is on, and false indicates security is off.

readPropertiesFile

public void readPropertiesFile()
Load up the current set of working preferences from a physical properties file.
See Also:
writePropertiesFile()

writePropertiesFile

public void writePropertiesFile()
Save the current set of working preferences to a physical properties file.
See Also:
readPropertiesFile()

updatePreferenceVariablesAndWritePropertiesFile

public void updatePreferenceVariablesAndWritePropertiesFile(AblePreferences theNewPreferences)
Change all current working preferences, except Security (which shall not be set programmtically), to the values contained in the specified preferences object. Note that a side-effect is that the new preference values are written to disk!
Parameters:
theNewPreferences - A preferences object containing replacement values for the current set of working preferences.


ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003