|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.xtvdclient.xtvd.parser.AbstractParser
net.sf.xtvdclient.xtvd.parser.RDBMSParser
public class RDBMSParser
A parser
implementation that is used to parse the
specified XML stream, and then write the data to a relational
database
.
Field Summary | |
---|---|
static java.lang.String |
CREW_STATEMENT
The parametrised statement that is to be executed for
inserting crew records to the crew table. |
static java.lang.String |
GENRE_STATEMENT
The parametrised statement that is to be executed for
inserting programGenre records to the
program_genre table. |
static java.lang.String |
LINEUP_STATEMENT
The parametrised statement that is to be executed for
inserting lineup records to the lineups
table. |
static java.lang.String |
MAP_STATEMENT
The parametrised statement that is to be executed for
inserting map records to the lineup_map
table. |
static java.lang.String |
PROGRAM_MOVIE_ADVISORY_STATEMENT
The parametrised statement that is to be executed for
inserting program advisories records to the
program_movie_advisories intersection table. |
static java.lang.String |
PROGRAM_STATEMENT
The parametrised statement that is to be executed for
inserting program records to the programs
table. |
static java.lang.String |
SCHEDULE_STATEMENT
The parametrised statement that is to be executed for
inserting schedule records to the schedules
table. |
static java.lang.String |
STATION_STATEMENT
The parametrised statement that is to be executed for
inserting station records to the stations
table. |
Fields inherited from class net.sf.xtvdclient.xtvd.parser.AbstractParser |
---|
log, reader, sdf |
Fields inherited from interface net.sf.xtvdclient.xtvd.parser.Parser |
---|
END_OF_LINE |
Constructor Summary | |
---|---|
protected |
RDBMSParser(java.io.Reader in,
java.sql.Connection connection)
Create a new instance of the parser that reads the data from the specified Reader and writes to the database using the
specified Connection . |
Method Summary | |
---|---|
protected void |
closeStatement(java.sql.Statement statement)
Close the specified statement and the batch of statements associated with it. |
protected void |
parseGenres()
Parse the genres top-level element from the
AbstractParser.reader , and populate the program_genres
table with the data. |
protected void |
parseLineups()
Parse the lineups top-level element from the
AbstractParser.reader , and write the parsed data to the lineups
and lineup_map tables. |
protected void |
parseProductionCrew()
Parse the productionCrew top-level element from the
AbstractParser.reader , and populate the crew table with
the data. |
protected void |
parsePrograms()
Parse the programs top-level element from the
AbstractParser.reader and write the parsed data to the
programs table. |
protected void |
parseSchedules()
Parse the schedules top-level element from the
AbstractParser.reader , and write the parsed data to the
schedules table. |
protected void |
parseStations()
Parse an individual station record from the
AbstractParser.reader , and write the parsed data to the stations
table . |
void |
parseXTVD()
Read the xml data from the AbstractParser.reader , parse the XTVD
document and populate the #xtvd class fields. |
Methods inherited from class net.sf.xtvdclient.xtvd.parser.AbstractParser |
---|
getCrew, getCrew, getGenre, getGenre, getLineup, getLineup, getLog, getMap, getMap, getMember, getMember, getMessages, getPart, getPart, getProgram, getProgram, getProgramGenre, getProgramGenre, getSchedule, getSchedule, getStation, getStation, setLog, toStartTag |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String STATION_STATEMENT
parametrised statement
that is to be executed for
inserting station
records to the stations
table.
"insert into stations columns( id, call_sign, name, affiliate, fcc_channel_number ) values( ?, ?, ?, ?, ? )"
public static final java.lang.String LINEUP_STATEMENT
parametrised statement
that is to be executed for
inserting lineup
records to the lineups
table.
"insert into lineups columns( id, name, location, type, device, postalCode ) values( ?, ?, ?, ?, ?, ? )"
public static final java.lang.String MAP_STATEMENT
parametrised statement
that is to be executed for
inserting map
records to the lineup_map
table.
"insert into lineup_map columns( lineup, station, channel, channel_minor, from, to ) values( ?, ?, ?, ?, ?, ? )"
public static final java.lang.String SCHEDULE_STATEMENT
parametrised statement
that is to be executed for
inserting schedule
records to the schedules
table.
"insert into schedules columns( program, station, time, duration, tv_rating, repeat, stereo, subtitled, hdtv, close_captioned, part_number, part_total ) values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )"
public static final java.lang.String PROGRAM_STATEMENT
parametrised statement
that is to be executed for
inserting program
records to the programs
table.
"insert into programs columns( id, series, title, subtitle, description, mpaa_rating, star_rating, runtime, year, show_type, color_code, syn_epi_num, original_air_date ) values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )"
public static final java.lang.String PROGRAM_MOVIE_ADVISORY_STATEMENT
parametrised statement
that is to be executed for
inserting program advisories
records to the
program_movie_advisories intersection
table.
"insert into program_movie_advisories columns( program, movie_advisory, ranking ) values( ?, ?, ? )"
public static final java.lang.String CREW_STATEMENT
parametrised statement
that is to be executed for
inserting crew
records to the crew
table.
"insert into crew columns( program, role, given_name, surname ) values( ?, ?, ?, ? )"
public static final java.lang.String GENRE_STATEMENT
parametrised statement
that is to be executed for
inserting programGenre
records to the
program_genre
table.
"insert into program_genre columns( program, genre, relevance ) values( ?, ?, ? )"
Constructor Detail |
---|
protected RDBMSParser(java.io.Reader in, java.sql.Connection connection) throws DataDirectException
Reader
and writes to the database using the
specified Connection
. Also set the
autoCommit
property for the connection
to
false
.
Note: The connection
reference set in the
constructor will not be closed
in this class. Calling
classes should take care of closing the Connection
.
Reader
- in - The Reader from which the XML data
is to be parsed. Make sure that the reader object has the
character encoding
properly set to
UTF-8
.Connection
- connection - The connection
to be used.
DataDirectException
- - If errors are encountered while
initialising the parser or reading the data.Method Detail |
---|
public void parseXTVD() throws DataDirectException
AbstractParser.reader
, parse the XTVD
document
and populate the #xtvd
class fields.
parseXTVD
in interface Parser
parseXTVD
in class AbstractParser
DataDirectException
- - If errors are encountered while
parsing the XML data stream.#parseRootElement()
,
parseStations()
,
#getLineup(net.sf.xtvdclient.xtvd.Lineup)
,
AbstractParser.getSchedule(net.sf.xtvdclient.xtvd.datatypes.Schedule)
,
AbstractParser.getProgram(Program)
,
#getCrew(net.sf.xtvdclient.xtvd.Crew)
,
AbstractParser.getProgramGenre(net.sf.xtvdclient.xtvd.datatypes.ProgramGenre)
protected void parseStations() throws DataDirectException
station
record from the
AbstractParser.reader
, and write the parsed data to the stations
table
. Adds each station record that is to be written
as a batch entry
to a PreparedStatement
.
The batch is executed
after all the station records
have been processed.
DataDirectException
- - If errors are encountered while
reading or writing the XML data.AbstractParser.getStation()
protected void parseLineups() throws DataDirectException
lineups
top-level element from the
AbstractParser.reader
, and write the parsed data to the lineups
and lineup_map
tables.
DataDirectException
- - If errors are encountered while
reading or writing the XML data.AbstractParser.getLineup()
protected void parseSchedules() throws DataDirectException
schedules
top-level element from the
AbstractParser.reader
, and write the parsed data to the
schedules
table.
Note: The part_number
and
part_total
columns will be populated with values of
0
if no data is available.
DataDirectException
- - If errors are encountered while
reading or writing the XML data.AbstractParser.getSchedule()
protected void parsePrograms() throws DataDirectException
programs
top-level element from the
AbstractParser.reader
and write the parsed data to the
programs
table.
DataDirectException
- - If errors are encountered while
reading or writing the XML data.AbstractParser.getProgram()
protected void parseProductionCrew() throws DataDirectException
productionCrew
top-level element from the
AbstractParser.reader
, and populate the crew
table with
the data.
DataDirectException
- - If errors are encountered while
reading or writing the XML data.AbstractParser.getCrew()
protected void parseGenres() throws DataDirectException
genres
top-level element from the
AbstractParser.reader
, and populate the program_genres
table with the data.
DataDirectException
- - If errors are encountered while
reading or writing the XML data.AbstractParser.getProgramGenre()
protected void closeStatement(java.sql.Statement statement)
AbstractParser.log
.
Statement
- statement - The Statement
that is
to be closed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |