|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.melati.poem.csv.CSVFilesProcessor
public class CSVFilesProcessor
A class to define a sequence of CSVTable
s and process them by
parsing the files and writing the data to the database.
Field Summary | |
---|---|
protected Vector |
tables
|
Constructor Summary | |
---|---|
CSVFilesProcessor(Database db)
Constructor. |
Method Summary | |
---|---|
CSVTable |
addTable(String tablename,
File file)
Convenience method. |
CSVTable |
addTable(Table tab,
File file)
Add a table to this processor. |
void |
process(boolean writeOnFly,
boolean emptyTables,
boolean recordDetails,
boolean fieldDetails,
Writer output)
Load all the data from the files, empty the tables if necessary and then write the new data into the tables. |
void |
process(boolean emptyTables,
boolean recordDetails,
boolean fieldDetails,
Writer output)
With write on the fly false. |
protected void |
writeData(Writer o)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Vector tables
Constructor Detail |
---|
public CSVFilesProcessor(Database db)
db
- the target databaseMethod Detail |
---|
public CSVTable addTable(String tablename, File file)
tablename
- the name of a POEM tablefile
- a CSV file, with first line containing field names
public CSVTable addTable(Table tab, File file)
tab
- a POEM tablefile
- a CSV file, with first line containing field names
public void process(boolean writeOnFly, boolean emptyTables, boolean recordDetails, boolean fieldDetails, Writer output) throws IOException, CSVParseException, NoPrimaryKeyInCSVTableException, CSVWriteDownException
Write a report of the progress to the Writer.
writeOnFly
- flag whether to write down to db when all files read in
if set then it is the programmers responsibility to ensure that
there are no references to yet to be created fieldsemptyTables
- flag whether to remove remains from last runrecordDetails
- flag passed in to table.reportfieldDetails
- flag passed in to table.reportoutput
- to write report to
IOException
- if file stuff goes wrong
CSVParseException
- if csv file has an error
NoPrimaryKeyInCSVTableException
- not thrown
CSVWriteDownException
- thrown when a persistent cannot be createdpublic void process(boolean emptyTables, boolean recordDetails, boolean fieldDetails, Writer output) throws IOException, CSVParseException, NoPrimaryKeyInCSVTableException, CSVWriteDownException
Load all the data from the files, empty the tables if necessary and then write the new data into the tables.
Write a report of the progress to the Writer.
emptyTables
- flag whether to remove remains from last runrecordDetails
- flag passed in to table.reportfieldDetails
- flag passed in to table.reportoutput
- to write report to
IOException
- if file stuff goes wrong
CSVParseException
- if csv file has an error
NoPrimaryKeyInCSVTableException
- not thrown
CSVWriteDownException
- thrown when a persistent cannot be createdprotected void writeData(Writer o) throws NoPrimaryKeyInCSVTableException, CSVWriteDownException
o
- output log to write to
NoPrimaryKeyInCSVTableException
CSVWriteDownException
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |