*
Metamerge logo
Search

Advanced Search
*
*
*
* HOME DOCUMENTS & RESOURCES DOWNLOADS EARLY TECH ACCESS SUPPORT FAQ KNOWN ISSUES OLD VERSIONS
*

com.architech.parser
Class rspParser

java.lang.Object
  |
  +--com.architech.parser.rspParser
All Implemented Interfaces:
com.architech.parser.rspParserInterface

public abstract class rspParser
extends java.lang.Object
implements com.architech.parser.rspParserInterface

The rspParser class provides the base class for parser implementations. This class provides common methods and properties that apply to all parsers.


Constructor Summary
rspParser()
           
 
Method Summary
 void closeParser()
          Close parser and deallocate resources.
 void debug(java.lang.String msg)
          Writes a message to the log if debug mode is set.
 boolean debugMode()
          Returns current status of the debugMode flag.
static java.lang.Object getClassInstance(java.lang.String className)
          Create a parser instance.
 java.lang.Object getContext()
          Return the context in which this parser is running (e.g. assemblyline object).
 java.io.InputStream getInputStream()
          Return current input-stream object.
 java.io.OutputStream getOutputStream()
          Return current output-stream object.
 java.lang.String getParam(java.lang.String param)
          Return configuration value.
 com.architech.parser.rspParserInterface getParser()
          Return the chained parser (future implementation).
 java.io.BufferedReader getReader()
          Return current reader object.
 java.io.BufferedWriter getWriter()
          Return current writer object.
 void initParser()
          Perform initialization of parser.
 void logmsg(java.lang.String msg)
          Writes a message to the log.
 void registerScriptBeans(com.architech.script.scriptEngine se)
          Register objects in the script engine.
 void setConfiguration(com.architech.config.rsConfiguration config)
          Set the parser configuration.
 void setContext(java.lang.Object context)
          Set the context in which the parser runs.
 void setInputStream(java.io.InputStream is)
          Set the parser input stream.
 void setInputStream(java.io.Reader is)
          Use Reader object for input.
 void setInputStream(java.lang.String is)
          Use a string as input.
 void setOutputStream(java.io.OutputStream os)
          Set the parser output stream.
 void setOutputStream(java.io.Writer os)
          Use Writer object for output.
 void setParam(java.lang.String param, java.lang.String value)
          Set parser configuration value.
 void setParser(com.architech.parser.rspParserInterface parser)
          Set the chained parser (future implementation).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.architech.parser.rspParserInterface
readEntry, writeEntry
 

Constructor Detail

rspParser

public rspParser()
Method Detail

getContext

public java.lang.Object getContext()
Return the context in which this parser is running (e.g. assemblyline object). The context is called upon when the parser needs to access resources outside it's scope. The logmsg method is one such builtin method but sub-classes may use the context object to communicate with the "housing" object. This object is typically a connector or an event handler. If the object using this class is not setting the context then the return value is null.
Specified by:
getContext in interface com.architech.parser.rspParserInterface
Returns:
The object housing this parser

setContext

public void setContext(java.lang.Object context)
Set the context in which the parser runs. This method is optionally called by any object that wants to make itself visible to the parser.
Specified by:
setContext in interface com.architech.parser.rspParserInterface
Parameters:
context - The context object

setParser

public void setParser(com.architech.parser.rspParserInterface parser)
Set the chained parser (future implementation).
Specified by:
setParser in interface com.architech.parser.rspParserInterface
Parameters:
parser - The chained parser

getParser

public com.architech.parser.rspParserInterface getParser()
Return the chained parser (future implementation).
Specified by:
getParser in interface com.architech.parser.rspParserInterface
Returns:
The chained parser

setParam

public void setParam(java.lang.String param,
                     java.lang.String value)
Set parser configuration value.
Specified by:
setParam in interface com.architech.parser.rspParserInterface
Parameters:
param - The parameter name
value - The parameter value

getParam

public java.lang.String getParam(java.lang.String param)
Return configuration value.
Specified by:
getParam in interface com.architech.parser.rspParserInterface
Parameters:
param - The name of the parameter to return
Returns:
The value associated with the parameter or null.

setConfiguration

public void setConfiguration(com.architech.config.rsConfiguration config)
Set the parser configuration. This method is called by instantiating classes to provide the parser with a configuration object.
Specified by:
setConfiguration in interface com.architech.parser.rspParserInterface
Parameters:
config - The configuration object

setInputStream

public void setInputStream(java.io.InputStream is)
Set the parser input stream. This method sets the input stream object from which the parser will read it's data. If the configuration has an encryptionKey parameter set, then this method will make an instance of the rssEncryptedReader to decrypt the underlying input stream. If no encryptionKey is specified then an instance of java.io.BufferedReader is used to provide buffered access to the input stream. Also, if the characterSet configuration parameter is set the input stream is read/decoded according the character set specified by that parameter.
Specified by:
setInputStream in interface com.architech.parser.rspParserInterface
Parameters:
is - The InputStream object (e.g. FileInputStream, SocketInputStream etc. ..)

setOutputStream

public void setOutputStream(java.io.OutputStream os)
Set the parser output stream. This method sets the output stream object to which the parser will write it's data. If the configuration has an encryptionKey parameter set, then this method will make an instance of the rssEncryptedWriter to encrypt data to the underlying output stream. If no encryptionKey is specified then an instance of java.io.BufferedWriter is used to provide buffered access to the output stream. Also, if the characterSet configuration parameter is set the output stream is written according the character set specified by that parameter.
Specified by:
setOutputStream in interface com.architech.parser.rspParserInterface
Parameters:
os - The OutputStream object (e.g. FileOutputStream, SocketOutputStream etc. ..)

setInputStream

public void setInputStream(java.lang.String is)
Use a string as input. This method creates an instance of the StringReader class to read data from a String rather than an input stream.
Specified by:
setInputStream in interface com.architech.parser.rspParserInterface
Parameters:
is - String to read data from

setInputStream

public void setInputStream(java.io.Reader is)
Use Reader object for input. This method creates an instance of the BufferedReader class providing the is reader object as input. Use this method to pass an already created instance of any Reader class (e.g. FileReader, StringReader ...). If the encryptionKey parameter is set an instance of the rssEncryptedReader is used on top of the provided Reader to decrypt the input stream.
Specified by:
setInputStream in interface com.architech.parser.rspParserInterface
Parameters:
is - Reader object

setOutputStream

public void setOutputStream(java.io.Writer os)
Use Writer object for output. This method creates an instance of the BufferedWriter class providing the os writer object as input. Use this method to pass an already created instance of any Writer class (e.g. FileReader, StringReader ...). If the encryptionKey parameter is set an instance of the rssEncryptedWriter is used on top of the provided Writer to encrypt the output stream.
Specified by:
setOutputStream in interface com.architech.parser.rspParserInterface
Parameters:
os - Writer object

getReader

public java.io.BufferedReader getReader()
Return current reader object.
Specified by:
getReader in interface com.architech.parser.rspParserInterface
Returns:
The reader object being used for input

getWriter

public java.io.BufferedWriter getWriter()
Return current writer object.
Specified by:
getWriter in interface com.architech.parser.rspParserInterface
Returns:
The writer object being used for output

getInputStream

public java.io.InputStream getInputStream()
Return current input-stream object. This may be null if the parser was initialied with a Reader object.
Returns:
The inputstream object being used for input

getOutputStream

public java.io.OutputStream getOutputStream()
Return current output-stream object. This may be null if the parser was initialied with a Writer object.
Returns:
The outputstream object being used for output

initParser

public void initParser()
                throws java.lang.Exception
Perform initialization of parser.
Specified by:
initParser in interface com.architech.parser.rspParserInterface
Throws:
java.lang.Exception -  

closeParser

public void closeParser()
Close parser and deallocate resources. This method closes the input and output streams.
Specified by:
closeParser in interface com.architech.parser.rspParserInterface

getClassInstance

public static java.lang.Object getClassInstance(java.lang.String className)
                                         throws java.lang.Exception
Create a parser instance. This method dynamically creates a new instance of a parser class based on the class name provided.
Parameters:
className - The complete Java class name
Returns:
The parser class instance

logmsg

public void logmsg(java.lang.String msg)
Writes a message to the log. If the parser has a context then the context is examined for a known class (like connector, switchboard) and then calls the context's logmsg method. If no context exists or the context object type is unknown nothing is done.
Parameters:
msg - The log message

debug

public void debug(java.lang.String msg)
Writes a message to the log if debug mode is set.
Parameters:
msg - The log message

debugMode

public boolean debugMode()
Returns current status of the debugMode flag.
Returns:
True if debug mode is enabled, false otherwise.

registerScriptBeans

public void registerScriptBeans(com.architech.script.scriptEngine se)
                         throws java.lang.Exception
Register objects in the script engine. This method may be called by a hosting object to let the parser register objects in the script engine. This allows the user to access parser specific objects using predefined names in the scripting environment. The default implementation is to declare parser as a reference to the parser class instance.
Specified by:
registerScriptBeans in interface com.architech.parser.rspParserInterface
Parameters:
se - The script engine


*
  Metamerge Integrator version 4.5 ©Copyright Metamerge AS 2000-2002 Last edited 2002-04-30 contact us