speedscheduler
Class SchedulePersistencyManager

java.lang.Object
  extended by speedscheduler.SchedulePersistencyManager

public class SchedulePersistencyManager
extends java.lang.Object

Responsible for loading/saving schedules to/from disk. Listeners can register with this class to be notified when the user changes the saved schedules.


Field Summary
private static SchedulePersistencyManager instance
          Make it easy for people to get an instance of me.
private  java.util.Vector scheduleChangeListeners
          Maintains a list of the registered listeners.
private  ScheduleIO scheduleIO
          Where to save the schedules (TODO: hard-coded for now, find plugin dir and save there)
private  ScheduleIO scheduleIO2
           
 
Constructor Summary
private SchedulePersistencyManager()
          Create a new SchedulePersistencyManager.
 
Method Summary
 void addScheduleChangeListener(ScheduleChangeListener listener)
          If you want to know when the Schedules have changed, register here.
 int getDefaultMaxDownloadSpeed()
          Gets the persisted default max download rate (used when no schedules apply).
 int getDefaultMaxUploadSpeed()
          Gets the persisted default max upload rate (used when no schedules apply).
static SchedulePersistencyManager getInstance()
          Gets the singleton instance of this class.
 java.util.Vector getSchedules()
          Gest the currently persisted Schedules.
 void loadSchedules()
           
 void saveDefaultSpeeds(int defaultMaxUploadSpeed, int defaultMaxDownloadSpeed)
           
 void saveSchedules(java.util.Vector schedulesToSave, int defaultMaxUploadSpeed, int defaultMaxDownloadSpeed)
          Save these Schedules and default up/down rates to the persistent file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scheduleChangeListeners

private java.util.Vector scheduleChangeListeners
Maintains a list of the registered listeners.


instance

private static SchedulePersistencyManager instance
Make it easy for people to get an instance of me.


scheduleIO

private ScheduleIO scheduleIO
Where to save the schedules (TODO: hard-coded for now, find plugin dir and save there)


scheduleIO2

private ScheduleIO scheduleIO2
Constructor Detail

SchedulePersistencyManager

private SchedulePersistencyManager()
Create a new SchedulePersistencyManager.

Method Detail

getDefaultMaxUploadSpeed

public int getDefaultMaxUploadSpeed()
Gets the persisted default max upload rate (used when no schedules apply).

Returns:

getDefaultMaxDownloadSpeed

public int getDefaultMaxDownloadSpeed()
Gets the persisted default max download rate (used when no schedules apply).

Returns:

getInstance

public static SchedulePersistencyManager getInstance()
Gets the singleton instance of this class. We need a PluginInterface in case we have to re-intantiate ourselves.

Parameters:
pluginInterface -
Returns:

addScheduleChangeListener

public void addScheduleChangeListener(ScheduleChangeListener listener)
If you want to know when the Schedules have changed, register here. Don't call us, we'll call you.

Parameters:
listener - The ScheduleChangeListener you want to be notified when the user changes a Schedule.

getSchedules

public java.util.Vector getSchedules()
Gest the currently persisted Schedules.

Returns:

saveSchedules

public void saveSchedules(java.util.Vector schedulesToSave,
                          int defaultMaxUploadSpeed,
                          int defaultMaxDownloadSpeed)
                   throws java.io.IOException
Save these Schedules and default up/down rates to the persistent file.

Parameters:
schedulesToSave -
defaultMaxUploadSpeed -
defaultMaxDownloadSpeed -
Throws:
java.io.IOException

saveDefaultSpeeds

public void saveDefaultSpeeds(int defaultMaxUploadSpeed,
                              int defaultMaxDownloadSpeed)
                       throws java.io.IOException
Throws:
java.io.IOException

loadSchedules

public void loadSchedules()
                   throws java.io.IOException
Throws:
java.io.IOException