com.continuent.tungsten.common.help
Class HelpManager

java.lang.Object
  extended by com.continuent.tungsten.common.help.HelpManager

public class HelpManager
extends java.lang.Object

This class fetches and presents online help text. Help is stored in text files that are located in a help directory. Help operates as a separate subsystem with a factory method to fetch manager instances. Help output defaults to System.out.


Method Summary
protected  boolean display(java.io.File helpFile)
          Displays the requested help file if it is found.
 boolean displayTopic(java.lang.String name)
          Display help for a topic.
 boolean displayTopicFromNames(java.lang.String[] names)
          Display help for a topic.
static HelpManager getInstance()
          Return a help manager instance.
static void initialize(java.io.File helpDir)
          Initialize help.
protected  void loadAndWrite(java.io.File file)
          Copy help file contents to the current output.
 void setWriter(java.io.Writer writer)
          Set the print output writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initialize

public static void initialize(java.io.File helpDir)
                       throws HelpException
Initialize help. This must be called before fetching a help manager.

Parameters:
helpDir - Location of help files.
Throws:
HelpException - Thrown if help directory is invalid

getInstance

public static HelpManager getInstance()
Return a help manager instance.


setWriter

public void setWriter(java.io.Writer writer)
Set the print output writer.


displayTopic

public boolean displayTopic(java.lang.String name)
Display help for a topic. The name will be lower-cased and extended with the help file suffix, then displayed.

Parameters:
name - Help topic name or null to get the default value
Returns:
True if help file was successfully displayed, otherwise false.

displayTopicFromNames

public boolean displayTopicFromNames(java.lang.String[] names)
Display help for a topic. The topic consists of one or more strings. To locate the corresponding file, we lower case the strings, connect them by "_" characters, and add the help file suffix.

Parameters:
names - An array of names used to construct the topic name
Returns:
True if help file was successfully displayed, otherwise false.

display

protected boolean display(java.io.File helpFile)
                   throws HelpException
Displays the requested help file if it is found. If not, we first try to display the default not found message. If that is not available, we display a default message.

Parameters:
helpFile - Requested help file.
Returns:
True if found and properly displayed
Throws:
HelpException

loadAndWrite

protected void loadAndWrite(java.io.File file)
                     throws HelpException
Copy help file contents to the current output.

Throws:
HelpException