RSE
Release 3.2

org.eclipse.rse.services.clientserver.messages
Class SystemMessageFile

java.lang.Object
  extended by org.eclipse.rse.services.clientserver.messages.SystemMessageFile
All Implemented Interfaces:
ErrorHandler
Direct Known Subclasses:
SystemUIMessageFile

public class SystemMessageFile
extends Object
implements ErrorHandler

Use this class to open, and parse, a RSE-style message file.


Constructor Summary
SystemMessageFile(String messageFileName, InputStream messageFile, InputStream dtdStream)
          Constructor
SystemMessageFile(String messageFileName, URL msgFileURL, URL dtdURL)
          Constructor to use for lazy loading of a system message file.
 
Method Summary
 void error(SAXParseException ex)
          XML Parser-required method: XML-parser Error.
 void fatalError(SAXParseException ex)
          XML Parser-required method: XML-parser Fatal error.
protected  org.eclipse.rse.services.clientserver.messages.SystemMessageFile.MessageFileInfo getFromCache(String messageFileName)
          If the named message file has already been loaded return its MessageFileInfo
 SystemMessage getMessage(String msgId)
          Use this method to retrieve a message from the message file.
protected  SystemMessage loadSystemMessage(String componentAbbr, String subComponentAbbr, String msgNumber, char msgIndicator, String msgL1, String msgL2)
          Override this to provide different extended SystemMessage implementation
 boolean printHTML(String fullFileName)
          Use this method to generate html documentation for the messages in the message file.
 boolean scanForDuplicates()
          Use this method to scan message file for duplicate messages.
 void warning(SAXParseException ex)
          XML Parser-required method: XML-parser warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemMessageFile

public SystemMessageFile(String messageFileName,
                         URL msgFileURL,
                         URL dtdURL)
Constructor to use for lazy loading of a system message file. The difference between the SystemMessageFile(String,InputStream,InputStream) constructor and this one is that the former loads the message file synchronously while this one loads the message file in a thread. The message file and DTD URLs are passed in here so that the opening of their input streams can be deferred until the time when the worker thread is started and able to load the message file.

Parameters:
messageFileName - the name of the system message file
msgFileURL - the URL to the message file
dtdURL - the URL to the DTD for the message file
Since:
3.1

SystemMessageFile

public SystemMessageFile(String messageFileName,
                         InputStream messageFile,
                         InputStream dtdStream)
Constructor

Parameters:
messageFileName - - a key used to determine if a message file has already been loaded. Usually the name of the xml file containing the message file.
messageFile - the stream containing the message file.
dtdStream - the stream containing the dtd for this message file.
Method Detail

getFromCache

protected org.eclipse.rse.services.clientserver.messages.SystemMessageFile.MessageFileInfo getFromCache(String messageFileName)
If the named message file has already been loaded return its MessageFileInfo

Parameters:
messageFileName - name of the message file
Returns:
the MessageFileInfo for this message file

getMessage

public SystemMessage getMessage(String msgId)
Use this method to retrieve a message from the message file. If this SystemMessageFile loaded from a thread, then the method will wait until the loading is complete before returning the message.

Parameters:
msgId - - the ID of the message to retrieve. This is the concatenation of the message's component abbreviation, subcomponent abbreviation, and message ID as declared in the message XML file.
Returns:
SystemMessage the SysteMessage object that corresponds to the message ID

loadSystemMessage

protected SystemMessage loadSystemMessage(String componentAbbr,
                                          String subComponentAbbr,
                                          String msgNumber,
                                          char msgIndicator,
                                          String msgL1,
                                          String msgL2)
Override this to provide different extended SystemMessage implementation

Parameters:
componentAbbr - a three letter component name
subComponentAbbr - a one letter subcomponent name
msgNumber - a four digit message number
msgIndicator - a single character message type indicator
msgL1 - the first level text that describes the error
msgL2 - the second level text that provides details about the error and possible recovery
Returns:
the SystemMessage
See Also:
for message type indicator constants

scanForDuplicates

public boolean scanForDuplicates()
Use this method to scan message file for duplicate messages. You typically do this only during development!! If a duplicate is found, its message id is written to standard out, and to the systems.core log file.

Returns:
true if duplicates found.

printHTML

public boolean printHTML(String fullFileName)
Use this method to generate html documentation for the messages in the message file. This is useful for reference information, or to give to Level 2 for service support.

Parameters:
fullFileName - - the fully qualified name of the file to write to. Overwrites current contents.
Returns:
true if it went well, false if it failed for some reason, such as given a bad file name. Errors written to standard out.

warning

public void warning(SAXParseException ex)
XML Parser-required method: XML-parser warning.

Specified by:
warning in interface ErrorHandler

error

public void error(SAXParseException ex)
XML Parser-required method: XML-parser Error.

Specified by:
error in interface ErrorHandler

fatalError

public void fatalError(SAXParseException ex)
                throws SAXException
XML Parser-required method: XML-parser Fatal error.

Specified by:
fatalError in interface ErrorHandler
Throws:
SAXException

RSE
Release 3.2

Copyright (c) IBM Corporation and others 2000, 2010. All Rights Reserved.