|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectspeedscheduler.io.XmlScheduleIO
public class XmlScheduleIO
An implementation of ScheduleIO that persists Schedules to and loads Schedules from an XML file.
| Nested Class Summary | |
|---|---|
private class |
XmlScheduleIO.ScheduleHandler
|
| Field Summary | |
|---|---|
private int |
defaultMaxDownloadRate
|
private int |
defaultMaxUploadRate
|
private static java.lang.String |
INDENT
|
private static java.lang.String[] |
SAX_PARSER_CLASSES
|
private java.util.Vector |
schedules
|
protected boolean |
schedulesLoaded
|
| Constructor Summary | |
|---|---|
XmlScheduleIO()
|
|
| Method Summary | |
|---|---|
int |
getDefaultMaxDownloadSpeed()
|
int |
getDefaultMaxUploadSpeed()
|
private java.lang.String |
getSaveFileName()
Helper function that tells us where to save the Schedules. |
private org.xml.sax.XMLReader |
getSaxParser()
Finds an appropriate SAX driver class name |
java.util.Vector |
getSchedules()
|
private boolean |
isValidSaxDriver(java.lang.String parserClassName)
Checks a class name. |
void |
loadSchedules()
|
static void |
main(java.lang.String[] args)
For unit testing only. |
void |
saveDefaultSpeeds(int defaultMaxUploadSpeed,
int defaultMaxDownloadSpeed)
|
void |
saveSchedules(java.util.Vector schedulesToSave,
int defaultMaxUploadRate,
int defaultMaxDownloadRate)
|
java.lang.String |
scheduleToXml(Schedule schedule)
Converts a schedul to an XML representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean schedulesLoaded
private static final java.lang.String[] SAX_PARSER_CLASSES
private static final java.lang.String INDENT
private int defaultMaxUploadRate
private int defaultMaxDownloadRate
private java.util.Vector schedules
| Constructor Detail |
|---|
public XmlScheduleIO()
| Method Detail |
|---|
public void saveSchedules(java.util.Vector schedulesToSave,
int defaultMaxUploadRate,
int defaultMaxDownloadRate)
throws java.io.IOException
saveSchedules in interface ScheduleIOjava.io.IOExceptionScheduleIO.saveSchedules(java.util.Vector, int, int)
public void saveDefaultSpeeds(int defaultMaxUploadSpeed,
int defaultMaxDownloadSpeed)
throws java.io.IOException
saveDefaultSpeeds in interface ScheduleIOjava.io.IOExceptionScheduleIO.saveDefaultSpeeds(int, int)public java.lang.String scheduleToXml(Schedule schedule)
schedule - The Schedule to convert to XML.
public static void main(java.lang.String[] args)
public void loadSchedules()
throws java.io.IOException
loadSchedules in interface ScheduleIOjava.io.IOExceptionScheduleIO.loadSchedules()
private org.xml.sax.XMLReader getSaxParser()
throws org.xml.sax.SAXException
org.xml.sax.SAXExceptionprivate boolean isValidSaxDriver(java.lang.String parserClassName)
parserClassName -
public java.util.Vector getSchedules()
getSchedules in interface ScheduleIOScheduleIO.getSchedules()public int getDefaultMaxUploadSpeed()
getDefaultMaxUploadSpeed in interface ScheduleIOspeedscheduler.ScheduleIO#getDefaultMaxUploadSpeed()public int getDefaultMaxDownloadSpeed()
getDefaultMaxDownloadSpeed in interface ScheduleIOspeedscheduler.ScheduleIO#getDefaultMaxDownloadSpeed()private java.lang.String getSaveFileName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||