com.jthomas.mailfaces
Class FaceOptions

java.lang.Object
  |
  +--com.jthomas.mailfaces.FaceOptions

public class FaceOptions
extends java.lang.Object

Class to handle the various options used by MailFaces.

This current version obtains the options by reading them from a a specified file. There is no dialog yet for modifying the options other than by editing the file with your favorite editor. However this is on the TO-DO list.

The OptionFile is either specified on the command line; obtained from the MailFaces Properties or obtained by prompting the user. The Options file is read and each line is parsed into a key and a value. The value is then stored in a Hashtable key and the String value. When a subsequent statement is found with the same key, then the String value in the Hashtable is replaced with a Vector that consists of previous and current values with that key. .

Author:
John Thomas
Method Summary
 java.lang.String get(java.lang.String option)
          Method to access the value of a named Option.
 java.lang.String get(java.lang.String option, java.lang.String dflt)
          Method to access the value of a named Option.
 boolean getBoolean(java.lang.String option, boolean dflt)
          Method to access the value of a named boolean Option.
 java.lang.String getFileName()
          Get the name of the Options file
 int getInt(java.lang.String option, int dflt)
          Method to access the integer value of a named Option.
 java.lang.String[] getList(java.lang.String option)
          Method to access the value of a named Option that is a List.
static FaceOptions getRef()
          Static Class Method to access the one and Only FaceOptions object.
 void parseOptions(java.lang.String filename)
          This method will read and parse the specified Options file.
 void put(java.lang.String option, java.lang.String value)
          Method to set the value of a named Option.
 boolean verifyOptions()
          Method to verify that all of the required Options are specified and warn users if their Option file is out of date or invalid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRef

public static FaceOptions getRef()
Static Class Method to access the one and Only FaceOptions object.


parseOptions

public void parseOptions(java.lang.String filename)
                  throws com.jthomas.mailfaces.FaceOptionsException
This method will read and parse the specified Options file. The values will be saved in a Hashtable. If the same option is found more than once, than the values will be saved in a vector and a reference to the vector will be saved in the Hashtable.

com.jthomas.mailfaces.FaceOptionsException

verifyOptions

public boolean verifyOptions()
Method to verify that all of the required Options are specified and warn users if their Option file is out of date or invalid.


get

public java.lang.String get(java.lang.String option)
Method to access the value of a named Option. It returns a string that is the value of the object or an empty string if the option is not found. If the Option is coded as "*PROMPT*" then the user is promptd for the value. It will return the value that the user enters.


get

public java.lang.String get(java.lang.String option,
                            java.lang.String dflt)
Method to access the value of a named Option. It returns a string that is the value of the object or the default if the option is not found. If the Option is coded as "*PROMPT*" then the user is prompted for the value. It will return the value that the user enters.


getBoolean

public boolean getBoolean(java.lang.String option,
                          boolean dflt)
Method to access the value of a named boolean Option. if the optin is found, it returns true if the value is "true" and false otherwise. If it is not found then it returns the default.


getInt

public int getInt(java.lang.String option,
                  int dflt)
Method to access the integer value of a named Option. It returns a integer value if found. Otherwise if it is not found or is invalid, it returns the default value


put

public void put(java.lang.String option,
                java.lang.String value)
Method to set the value of a named Option.


getList

public java.lang.String[] getList(java.lang.String option)
Method to access the value of a named Option that is a List. It returns an array of Strings. It returns an empty array if the option is not found.


getFileName

public java.lang.String getFileName()
Get the name of the Options file

Returns:
File name of the Options file.