|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.rhi.architecture.parc.adapter.AbstractInputAdapter
com.rhi.architecture.parc.adapter.file.AbstractFileInputAdapter
AbstractFileInputAdapter Should serve as a common base classes that all kinds of file input adapters can share. File input adapters can work with one fixed file or on a directory on polling basis or some other type. This base class should be flexible enough to cater for different file input adapters.
Constructor Summary | |
AbstractFileInputAdapter()
constructor |
Method Summary | |
static void |
closeReader(java.io.Reader reader)
Convenience method to avoid code duplication in sub-classes. |
protected int |
getBatchSize()
Returns batchSize configured through properties, if batch size needs to provided by other means, then this method should be overridden. |
protected java.lang.String |
getDelimiter()
Returns delimiter configured through properties, if delimiter needs to provided by other means, then this method should be overridden. |
protected abstract java.io.BufferedReader |
getFileReader()
Details of how to obtain a reader to read records are left to the concrete classes to provide flexibility. |
void |
init(java.util.Properties props)
Performs any resource initialization. |
protected java.util.Collection |
loadBatch()
Reads the file one record at a time using readRecordString(), parses each record into column values and passes this list of colums to the method readRow(). |
protected java.lang.String[] |
parseRecordString(java.lang.String record)
Hook provided for subclasses to control the way given string is parsed to extract columns. |
protected java.lang.String |
readRecordString()
Hook provided for subclasses to change the way a record is read from a file. |
protected abstract Record |
readRow(java.util.ArrayList al)
Extract the attributes from the ArrayList and return a Record object. |
Methods inherited from class com.rhi.architecture.parc.adapter.AbstractInputAdapter |
addToErrorChannel, cleanup, getAuditAgent, getErrors, push, setAuditAgent, setErrorChannel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractFileInputAdapter()
Method Detail |
public void init(java.util.Properties props) throws InitializationException
Performs any resource initialization.
Initilizes following things:
#delim
2) no. of records to be read from file in the one batch #batchSize
#m_BufferReader
, to read the file line
by line in different batches.
init
in interface Adapter
init
in class AbstractInputAdapter
props
- Properties Property object, to store the
initialization parameters.
InitializationException
- It throws the
initialization exception, if it occurs during any of the
above mentioned initialization.
InitializationException
protected java.util.Collection loadBatch() throws ProcessingException
loadBatch
in class AbstractInputAdapter
ProcessingException
- It throws the ProcessingException,
if there is a error during the reading of afile.
ProcessingException
readRecordString( String )
,
parseRecordString( String )
,
readRow( ArrayList )
protected java.lang.String readRecordString() throws java.io.IOException
java.io.IOException
protected java.lang.String[] parseRecordString(java.lang.String record)
record
-
protected int getBatchSize()
protected java.lang.String getDelimiter()
protected abstract java.io.BufferedReader getFileReader()
protected abstract Record readRow(java.util.ArrayList al) throws ProcessingException
SQLException
ProcessingException
public static void closeReader(java.io.Reader reader)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |