amber.type.server
Class ScheduledObject

java.lang.Object
  |
  +--amber.type.server.ScheduledObject
All Implemented Interfaces:
TimerInterface

public class ScheduledObject
extends java.lang.Object
implements TimerInterface

This object contains information on the objects which the server is currently scheduling. It contains the reference to the class which is being run along with the timer thread which is invoking it.

Version:
1.0.0
Author:
Dr. David J. Knowles
See Also:
amber.server.manager.extension.SchedulerModule

Field Summary
protected  boolean active
          Is the object currently active.
protected  amber.type.server.ScheduleInterface client
          This is the client class which is being scheduled.
protected  long duration
          The number of milliseconds this client should run.
protected  amber.type.server.SchedulerModule parent
          The parent controller for this object.
protected  long quanta
          The repeat interval.
protected  long repeatNumber
          The number of times the client should be run in total.
protected  boolean runFlag
          Has the object ever run.
protected  java.util.Date startDate
          This is the date/time at which point the scheduled object will start.timer thread which is running the client object.
protected  long startTime
          The time the object was created.
protected  Timer timer
          This is the timer thread which is running the client object.
 
Constructor Summary
ScheduledObject()
          Default Constructor.
ScheduledObject(amber.type.server.SchedulerModule parent, amber.type.server.ScheduleInterface client, java.util.Date startDate, long quanta, long duration, long repeatNumber)
          Initialising Constructor.
 
Method Summary
 amber.type.server.ScheduleInterface getClient()
          Gets the data in the following variable: This is the client class which is being scheduled.
 long getDuration()
          Gets the data in the following variable: The number of milliseconds this client should run.
 amber.type.server.SchedulerModule getParent()
          Gets the data in the following variable: SchedulerModule which handles this object.
 long getQuanta()
          Gets the data in the following variable: The number of milliseconds before the timer operation should be repeated.
 long getRepeatNumber()
          Gets the data in the following variable: The number of times the client should be run in total.
 java.util.Date getStartDate()
          Gets the data in the following variable: This is the date/time at which point the scheduled object will start.timer thread which is running the client object.
 java.util.Date getTimeObjectStarted()
          Gets the data in the following variable: This is the date/time when the scheduled object was formally started.
 Timer getTimer()
          Gets the data in the following variable: This is the timer thread which is running the client object.
 boolean hasRun()
          Gets the data in the following variable: Whether this object has ever run.
protected  void initialiseTimer()
           
 boolean isActive()
          Gets the data in the following variable: Whether this object is currently running.
 void setActive(boolean data)
          Sets the data in the following variable: Whether this object is currently running.
 void setClient(amber.type.server.ScheduleInterface data)
          Sets the data in the following variable: This is the client class which is being scheduled.
 void setDuration(long data)
          Sets the data in the following variable: The number of milliseconds this client should run.
 void setParent(amber.type.server.SchedulerModule data)
          Sets the data in the following variable: SchedulerModule which handles this object.
 void setQuanta(long data)
          Sets the data in the following variable: The number of milliseconds before the timer operation should be repeated.
 void setRepeatNumber(long data)
          Sets the data in the following variable: The number of times the client should be run in total.
 void setStartDate(java.util.Date data)
          Sets the data in the following variable: This is the date/time at which point the scheduled object will start.timer thread which is running the client object.
 void setTimer(Timer data)
          Sets the data in the following variable: This is the timer thread which is running the client object.
 void start()
          This function starts the scheduled object internal timer.
 void timeEventOccurred()
          This is called by the master timer.
 java.lang.String toString()
          This function returns the String form of the data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

client

protected amber.type.server.ScheduleInterface client
This is the client class which is being scheduled.

timer

protected Timer timer
This is the timer thread which is running the client object.

quanta

protected long quanta
The repeat interval.

duration

protected long duration
The number of milliseconds this client should run.

repeatNumber

protected long repeatNumber
The number of times the client should be run in total.

startTime

protected long startTime
The time the object was created.

parent

protected amber.type.server.SchedulerModule parent
The parent controller for this object.

active

protected boolean active
Is the object currently active.

runFlag

protected boolean runFlag
Has the object ever run.

startDate

protected java.util.Date startDate
This is the date/time at which point the scheduled object will start.timer thread which is running the client object.
Constructor Detail

ScheduledObject

public ScheduledObject()
Default Constructor.

ScheduledObject

public ScheduledObject(amber.type.server.SchedulerModule parent,
                       amber.type.server.ScheduleInterface client,
                       java.util.Date startDate,
                       long quanta,
                       long duration,
                       long repeatNumber)
Initialising Constructor.
Parameters:
parent - SchedulerModule which handles this object.
client - This is the client class which is being scheduled.
startDate - This is the date/time when the object is to be started.
quanta - long time duration to wait before calling the client.
duration - The number of milliseconds this client should run.
repeatNumber - The number of times the client should be run in total.
Method Detail

start

public void start()
This function starts the scheduled object internal timer.

initialiseTimer

protected void initialiseTimer()

getParent

public amber.type.server.SchedulerModule getParent()
Gets the data in the following variable: SchedulerModule which handles this object.
Returns:
SchedulerModule containing the required information.

getClient

public amber.type.server.ScheduleInterface getClient()
Gets the data in the following variable: This is the client class which is being scheduled.
Returns:
ScheduleInterface containing the required information.

getTimer

public Timer getTimer()
Gets the data in the following variable: This is the timer thread which is running the client object.
Returns:
amber.utility.Timer containing the required information.

getQuanta

public long getQuanta()
Gets the data in the following variable: The number of milliseconds before the timer operation should be repeated. This is the repeat interval.
Returns:
long containing the required information.

getDuration

public long getDuration()
Gets the data in the following variable: The number of milliseconds this client should run.
Returns:
long containing the required information.

getRepeatNumber

public long getRepeatNumber()
Gets the data in the following variable: The number of times the client should be run in total.
Returns:
long containing the required information.

hasRun

public boolean hasRun()
Gets the data in the following variable: Whether this object has ever run.
Returns:
boolean containing the required information.

isActive

public boolean isActive()
Gets the data in the following variable: Whether this object is currently running.
Returns:
boolean containing the required information.

getStartDate

public java.util.Date getStartDate()
Gets the data in the following variable: This is the date/time at which point the scheduled object will start.timer thread which is running the client object.
Returns:
Date containing the required information.

getTimeObjectStarted

public java.util.Date getTimeObjectStarted()
Gets the data in the following variable: This is the date/time when the scheduled object was formally started.
Returns:
Date containing the required information.

setParent

public void setParent(amber.type.server.SchedulerModule data)
Sets the data in the following variable: SchedulerModule which handles this object.
Parameters:
data - SchedulerModule containing the data to set the variable to.

setClient

public void setClient(amber.type.server.ScheduleInterface data)
Sets the data in the following variable: This is the client class which is being scheduled.
Parameters:
data - ScheduleInterface containing the data to set the variable to.

setTimer

public void setTimer(Timer data)
Sets the data in the following variable: This is the timer thread which is running the client object.
Parameters:
data - amber.utility.Timer containing the data to set the variable to.

setQuanta

public void setQuanta(long data)
Sets the data in the following variable: The number of milliseconds before the timer operation should be repeated. This is the repeat interval.
Parameters:
data - long containing the data to set the variable to.

setDuration

public void setDuration(long data)
Sets the data in the following variable: The number of milliseconds this client should run.
Parameters:
data - long containing the data to set the variable to.

setRepeatNumber

public void setRepeatNumber(long data)
Sets the data in the following variable: The number of times the client should be run in total.
Parameters:
data - long containing the data to set the variable to.

setActive

public void setActive(boolean data)
Sets the data in the following variable: Whether this object is currently running.
Parameters:
data - boolean containing the data to set the variable to.

setStartDate

public void setStartDate(java.util.Date data)
Sets the data in the following variable: This is the date/time at which point the scheduled object will start.timer thread which is running the client object.
Parameters:
data - Date containing the data to set the variable to.

toString

public java.lang.String toString()
This function returns the String form of the data.
Overrides:
toString in class java.lang.Object
Returns:
String containing the string version of this class.

timeEventOccurred

public void timeEventOccurred()
This is called by the master timer. It performs some internal computations and then calls the client module.
Specified by:
timeEventOccurred in interface TimerInterface


Copyright © 2002 Clearfield Research Ltd. All Rights Reserved.