|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.xtvdclient.xtvd.parser.AbstractParser
public abstract class AbstractParser
An abstract base class
for all XTVD parsers
.
All parsers
are implemented using a factory
design pattern
and are based upon Streaming API for XML
(StAX)
.
ParserFactory
Field Summary | |
---|---|
protected java.io.Writer |
log
A Writer that is used to write log messages to. |
protected javax.xml.stream.XMLStreamReader |
reader
An instance of the XML reader used to pull-parse the
XTVD XML data. |
protected java.text.SimpleDateFormat |
sdf
The formatter used to format time stamps that are used to log the parsing process. |
Fields inherited from interface net.sf.xtvdclient.xtvd.parser.Parser |
---|
END_OF_LINE |
Constructor Summary | |
---|---|
protected |
AbstractParser()
Default constructor. |
protected |
AbstractParser(java.io.Reader reader)
Create a new instance of the parser that reads the data from the specified InputStream . |
Method Summary | |
---|---|
protected Crew |
getCrew()
Parse the crew record in the XML data stream and
create a new net.sf.xtvdclient.xtvd.Crew object with the values. |
protected Crew |
getCrew(Crew crew)
Parse the crew record in the XML data stream and
populate the values of the instance variables of the specified
Crew object. |
protected Genre |
getGenre()
Parse the genre record from the XML stream and create
a new net.sf.xtvdclient.xtvd.Genre object with that data. |
protected Genre |
getGenre(Genre genre)
Parse the genre record from the XML stream and
populate the Genre object fields with that data. |
protected Lineup |
getLineup()
Parse the lineup record in the XML data stream and
create a new net.sf.xtvdclient.xtvd.Lineup object with the parsed values from the
XML stream. |
protected Lineup |
getLineup(Lineup lineup)
Parse the lineup record in the XML data stream and
populate the values of the instance variables of the specified
Lineup object. |
java.io.Writer |
getLog()
Returns log . |
protected Map |
getMap()
Parse the map record from the XML stream and create
a new net.sf.xtvdclient.xtvd.Map object with that data. |
protected Map |
getMap(Map map)
Parse the map record from the XML stream and populate
the instance variables of the specified Map object with
the parsed data. |
protected CrewMember |
getMember()
Parse the member record from the XML stream and create
a new CrewMember object with that data. |
protected CrewMember |
getMember(CrewMember member)
Parse the member record from the XML stream and
populate the CrewMember
object with that data. |
protected java.util.Collection |
getMessages()
Skip all the SOAP envelopes, and move the the messages
element in the XML stream. |
protected Part |
getPart()
Parse the part record from the XML stream and create
a new net.sf.xtvdclient.xtvd.Part object with that data. |
protected Part |
getPart(Part part)
Parse the part record from the XML stream and
populate the Part object fields with that data. |
protected Program |
getProgram()
Parse the program record in the XML data stream and
create a Program object with the data. |
protected Program |
getProgram(Program program)
Parse the program record in the XML data stream and
populate the values of the instance variables of the specified
Program object. |
protected ProgramGenre |
getProgramGenre()
Parse the programGenre record in the XML data stream
and create a new instance of ProgramGenre with the values. |
protected ProgramGenre |
getProgramGenre(ProgramGenre programGenre)
Parse the programGenre record in the XML data stream
and populate the values of the instance variables of the specified
ProgramGenre object. |
protected Schedule |
getSchedule()
Parse the schedule record in the XML data stream and
create a new Schedule object with the parsed values from
the XML stream. |
protected Schedule |
getSchedule(Schedule schedule)
Parse the schedule record in the XML data stream and
populate the values of the instance variables of the specified
Schedule object. |
protected Station |
getStation()
Parse the station record in the XML data stream and
return a new instance of Station with the values. |
protected Station |
getStation(Station station)
Parse the station record in the XML data stream and
populate the values of the instance variables of the specified
Station object. |
abstract void |
parseXTVD()
Parse the XTVD document and extract the information
from the top-level elements. |
void |
setLog(java.io.Writer log)
Set log . |
void |
toStartTag()
Advance the reader to the next starting XML element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected javax.xml.stream.XMLStreamReader reader
pull-parse
the
XTVD XML data.
protected java.io.Writer log
Writer
that is used to write log messages to.
By default this is set to System.err
. Please use
setLog(Writer)
if you wish to specify another log
stream.
protected java.text.SimpleDateFormat sdf
Constructor Detail |
---|
protected AbstractParser()
protected AbstractParser(java.io.Reader reader) throws DataDirectException
InputStream
.
Reader
- reader - The Reader from which the XML data
is to be parsed.
net.sf.xtvdclient.gui.DataDirectException
- - If errors are encountered while
initialising the parser or reading the data.
DataDirectException
Method Detail |
---|
public abstract void parseXTVD() throws DataDirectException
XTVD document
and extract the information
from the top-level
elements. Concrete implementations
of this class must be properly initialised with the appropriate
means for saving the data extracted by this method.
parseXTVD
in interface Parser
DataDirectException
- - If errors are encountered while
parsing the XML data stream or while saving the parsed contents.getStation(Station)
,
#getLineup(net.sf.xtvdclient.xtvd.Lineup)
,
getSchedule(Schedule)
,
getProgram(Program)
,
#getCrew(net.sf.xtvdclient.xtvd.Crew)
,
#getGenre(net.sf.xtvdclient.xtvd.Genre)
protected java.util.Collection getMessages() throws DataDirectException
messages
element in the XML stream. Extract any message
elements in the response, and create a collection with the
messages.
DataDirectException
- - If errors are encountered while
parsing the XML stream.protected Station getStation() throws DataDirectException
station
record in the XML data stream and
return a new instance of Station
with the values. Creates
a new instance of Station
, and then invokes getStation(Station)
.
Station
.
DataDirectException
- - If errors are encountered while
parsing the XML stream.protected Station getStation(Station station) throws DataDirectException
station
record in the XML data stream and
populate the values of the instance variables of the specified
Station
object.
Station
- station - The instance of Station
whose
fields are populated with the parsed data from the XML stream.
Station
.
DataDirectException
- - If errors are encountered while
parsing the XML stream.protected Lineup getLineup() throws DataDirectException
lineup
record in the XML data stream and
create a new net.sf.xtvdclient.xtvd.Lineup
object with the parsed values from the
XML stream. Also extract the map
child elements of
the record, and create appropriate net.sf.xtvdclient.xtvd.Map
instances.
net.sf.xtvdclient.xtvd.Lineup
.
DataDirectException
- - If errors are encountered while
parsing the XML stream.#getLineup(net.sf.xtvdclient.xtvd.Lineup)
protected Lineup getLineup(Lineup lineup) throws DataDirectException
lineup
record in the XML data stream and
populate the values of the instance variables of the specified
Lineup
object. Also extract the map
child elements of the record, and create appropriate net.sf.xtvdclient.xtvd.Map
instances.
Lineup
- station - The instance of Lineup
whose
fields are populated with the parsed data from the XML stream.
Lineup
.
DataDirectException
- - If errors are encountered while
parsing the XML stream.getMap()
protected Map getMap()
map
record from the XML stream and create
a new net.sf.xtvdclient.xtvd.Map
object with that data.
net.sf.xtvdclient.xtvd.Map
object that was created with the
parsed data.protected Map getMap(Map map)
map
record from the XML stream and populate
the instance variables of the specified Map
object with
the parsed data.
Map
object that was modified with the
parsed data.protected Schedule getSchedule() throws DataDirectException
schedule
record in the XML data stream and
create a new Schedule
object with the parsed values from
the XML stream. Also extract the part
child element
of the record, and create appropriate net.sf.xtvdclient.xtvd.Part
instances.
Schedule
.
DataDirectException
- - If errors are encountered while
parsing the XML stream.getSchedule(Schedule)
protected Schedule getSchedule(Schedule schedule) throws DataDirectException
schedule
record in the XML data stream and
populate the values of the instance variables of the specified
Schedule
object. Also extract the part
child element of the record, and create the appropriate net.sf.xtvdclient.xtvd.Part
instance.
Schedule
- schedule - The instance of Schedule
whose
fields are populated with the parsed data from the XML stream.
Schedule
.
DataDirectException
- - If errors are encountered while
parsing the XML stream.getPart()
protected Part getPart()
part
record from the XML stream and create
a new net.sf.xtvdclient.xtvd.Part
object with that data.
net.sf.xtvdclient.xtvd.Part
object that was created with the
parsed data.#getPart(net.sf.xtvdclient.xtvd.Part)
protected Part getPart(Part part)
part
record from the XML stream and
populate the Part
object fields with that data.
Part
- part - The Part
object whose instance variables
are to be set with the parsed data.
Part
object.
parsed data.protected Program getProgram() throws DataDirectException
program
record in the XML data stream and
create a Program
object with the data.
Program
that was
created.
DataDirectException
- - If errors are encountered while
parsing the XML stream.getProgram(Program)
protected Program getProgram(Program program) throws DataDirectException
program
record in the XML data stream and
populate the values of the instance variables of the specified
Program
object.
Program
- program - The instance of Program
whose
fields are populated with the parsed data from the XML stream.
Program
.
DataDirectException
- - If errors are encountered while
parsing the XML stream.protected Crew getCrew() throws DataDirectException
crew
record in the XML data stream and
create a new net.sf.xtvdclient.xtvd.Crew
object with the values.
net.sf.xtvdclient.xtvd.Crew
.
DataDirectException
- - If errors are encountered while
parsing the XML stream.#getCrew(net.sf.xtvdclient.xtvd.Crew)
protected Crew getCrew(Crew crew) throws DataDirectException
crew
record in the XML data stream and
populate the values of the instance variables of the specified
Crew
object.
Crew
- crew - The instance of Crew
whose
fields are populated with the parsed data from the XML stream.
Crew
.
DataDirectException
- - If errors are encountered while
parsing the XML stream.protected CrewMember getMember() throws DataDirectException
member
record from the XML stream and create
a new CrewMember
object with that data.
CrewMember
object that was created with the parsed data.
DataDirectException
- - If errors are encountered while
parsing the stream.protected CrewMember getMember(CrewMember member) throws DataDirectException
member
record from the XML stream and
populate the CrewMember
object with that data.
CrewMember
- member - The CrewMember
object whose fields are to be populated with the parsed data.
CrewMember
object.
DataDirectException
- - If errors are encountered while
parsing the stream.protected ProgramGenre getProgramGenre() throws DataDirectException
programGenre
record in the XML data stream
and create a new instance of ProgramGenre
with the values.
ProgramGenre
.
net.sf.xtvdclient.gui.DataDirectException
- - If errors are encountered while
parsing the XML stream.
DataDirectException
getProgramGenre(ProgramGenre)
protected ProgramGenre getProgramGenre(ProgramGenre programGenre) throws DataDirectException
programGenre
record in the XML data stream
and populate the values of the instance variables of the specified
ProgramGenre
object.
ProgramGenre
- programGenre - The instance of ProgramGenre
whose fields are populated with the parsed data
from the XML stream.
ProgramGenre
.
DataDirectException
- - If errors are encountered while
parsing the XML stream.getGenre()
protected Genre getGenre() throws DataDirectException
genre
record from the XML stream and create
a new net.sf.xtvdclient.xtvd.Genre
object with that data.
net.sf.xtvdclient.xtvd.Genre
object that was created with
the parsed data.
DataDirectException
- - If errors are encountered while
parsing the stream.protected Genre getGenre(Genre genre) throws DataDirectException
genre
record from the XML stream and
populate the Genre
object fields with that data.
Genre
- genre - The Genre
object whose fields are
to be set with the parsed data.
Genre
object.
DataDirectException
- - If errors are encountered while
parsing the stream.public void toStartTag() throws DataDirectException
reader
to the next starting XML element.
DataDirectException
- - If errors are encountered while
parsing the stream.public final java.io.Writer getLog()
log
.
getLog
in interface Parser
public final void setLog(java.io.Writer log)
log
.
setLog
in interface Parser
Writer
- log - The value to set.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |