|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.raritantechnologies.verity.collection.FlatFileGateway
Reads a flat file or files to create sets of records (IResultSet) for indexing.
Configuration file defines the columns in the flat file - or in other words how the columns in the flat file map to fields in the XML record.
XML Configuration Template:
<CollectionGateway name="FlatFiles"
class="com.raritantechnologies.verity.collection.FlatFileGateway"
rootPath="C:\some\path\to\the\files"
numRecordsPerSet="100"
keyFieldName="[ name of key field ]" >
<Files>
<File name="*.txt"
delimiter="[delimChar] or tab|cr|lf|crlf"
valueDelimiter=","
comment="#"
skipLines="1"
VdkVgwKey="[ field that has key ]" >
<!-- Filter that is applied to each line of the text file -->
<LineFilter class="[ class of com.raritantechnologies.utils.filter.IStringFilter" ]" >
</LineFilter>
<!-- Filter that is applied to each field value -->
<FieldFilter class="[ class of com.raritantechnologies.utils.filter.IStringFilter" ]" >
</FieldFilter>
<Columns>
<Column fieldID="firstFieldID" />
<Column fieldID="secondFieldID" />
<Column /> <!-- Ignore this one -->
<Column fieldID="thirdFieldID" />
</Columns>
</File>
<File name="DataFile*.csv" delimiter=":" comment="rem" skiplines="0" >
<Columns>
<Column ID|fieldID="secondFieldID" />
<Column ID|fieldID="thirdFieldID" />
<Column ID|fieldID="firstFieldID" />
</Columns>
</File>
<File name="DataFile*.csv" delimiter=":" comment="rem" skiplines="0" >
<Columns>
<Column>secondFieldID
<Column>thirdFieldID
<Column>firstFieldID
</Columns>
</File>
<!-- File definition that uses 1st line of file as column definition -->
<File name="*.txt"
delimiter="[delimChar] or tab|cr|lf|crlf"
valueDelimiter=","
comment="#"
skipLines="1"
firstLineDefinesColumns="true|false (default)"/>
</Files>
</CollectionGateway>
| Nested Class Summary | |
class |
FlatFileGateway.FileProcessor
|
| Constructor Summary | |
FlatFileGateway()
|
|
FlatFileGateway(java.lang.String rootPath,
boolean recurseSubdirectories)
|
|
| Method Summary | |
void |
addFileProcessor(java.lang.String name,
java.lang.String delimiter,
java.lang.String comment,
int skipLines,
java.lang.String[] columns)
|
java.lang.String |
getConfigurationXML()
|
protected FlatFileGateway.FileProcessor |
getFileProcessor(java.io.File file)
|
IGatewayListener |
getGatewayListener()
|
java.lang.String |
getKeyField()
|
int |
getNumRecordsPerSet()
|
boolean |
getRecurseSubdirectories()
|
java.lang.String |
getRootDirectory()
|
void |
initialize(org.w3c.dom.Element gatewayElem,
ISearchFieldMap sfMap)
Initialize the ICollectionGateway from a Configuration XML element. |
boolean |
isPaused()
|
void |
pause()
|
protected void |
processFile(java.io.File aFile)
|
void |
resume()
|
void |
run()
|
void |
run(ILoginInfo userInfo)
Need to have loginInfo for sources which require login/pw access. |
void |
setDataAvailable(IResultSet rs)
|
void |
setDataComplete()
|
void |
setGatewayListener(IGatewayListener listener)
Sets the IGatewayListener interface. |
void |
setInputParameters(OrderedMap inputParams)
set input parameters... |
void |
setKeyField(java.lang.String keyField)
|
void |
setNumRecordsPerSet(int numRecordsPerSet)
|
void |
setRecurseSubdirectories(boolean recurseSubdirectories)
|
void |
setRootDirectory(java.lang.String rootDirectory)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FlatFileGateway()
public FlatFileGateway(java.lang.String rootPath,
boolean recurseSubdirectories)
| Method Detail |
public void initialize(org.w3c.dom.Element gatewayElem,
ISearchFieldMap sfMap)
ICollectionGateway
initialize in interface ICollectionGatewaypublic void setInputParameters(OrderedMap inputParams)
ICollectionGateway
setInputParameters in interface ICollectionGatewaypublic void run()
run in interface ICollectionGatewayprotected void processFile(java.io.File aFile)
protected FlatFileGateway.FileProcessor getFileProcessor(java.io.File file)
public void run(ILoginInfo userInfo)
run in interface ICollectionGatewaypublic void setGatewayListener(IGatewayListener listener)
ICollectionGateway
setGatewayListener in interface ICollectionGatewaypublic void setDataAvailable(IResultSet rs)
public void setDataComplete()
public void pause()
pause in interface ICollectionGatewaypublic void resume()
resume in interface ICollectionGatewaypublic boolean isPaused()
isPaused in interface ICollectionGatewaypublic IGatewayListener getGatewayListener()
public void addFileProcessor(java.lang.String name,
java.lang.String delimiter,
java.lang.String comment,
int skipLines,
java.lang.String[] columns)
public void setRootDirectory(java.lang.String rootDirectory)
public java.lang.String getRootDirectory()
public void setRecurseSubdirectories(boolean recurseSubdirectories)
public boolean getRecurseSubdirectories()
public void setNumRecordsPerSet(int numRecordsPerSet)
public int getNumRecordsPerSet()
public void setKeyField(java.lang.String keyField)
public java.lang.String getKeyField()
public java.lang.String getConfigurationXML()
getConfigurationXML in interface ICollectionGateway
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||