edu.sdsc.inca.depot.persistent
Class Schedule

java.lang.Object
  extended by edu.sdsc.inca.depot.persistent.PersistentObject
      extended by edu.sdsc.inca.depot.persistent.Schedule

public class Schedule
extends PersistentObject

Schedule holds the information for a cron-like schedule that we use. In the future there will be other schedule types as well.

Author:
cmills

Field Summary
 
Fields inherited from class edu.sdsc.inca.depot.persistent.PersistentObject
DB_EMPTY_STRING, logger, MAX_DB_LONG_STRING_LENGTH, MAX_DB_STRING_LENGTH
 
Constructor Summary
Schedule()
          Default constructor.
Schedule(java.lang.String min, java.lang.String hour, java.lang.String mday, java.lang.String month, java.lang.String wday, java.lang.String type, java.lang.Integer numOccurs)
          Full constructor.
 
Method Summary
 boolean equals(java.lang.Object o)
          Override of the default equals method.
 Schedule fromBean(edu.sdsc.inca.dataModel.util.Schedule s)
          Copies information from an Inca schema XmlBean Schedule object so that this object contains equivalent information.
 PersistentObject fromBean(org.apache.xmlbeans.XmlObject o)
          Copies information from an Inca schema XmlBean Schedule object so that this object contains equivalent information.
 java.lang.String getHour()
          Return the hour portion of the cron schedule.
 java.lang.String getMday()
          Return the mday portion of the cron schedule.
 java.lang.String getMinute()
          Return the minute portion of the cron schedule.
 java.lang.String getMonth()
          Return the month portion of the cron schedule.
 java.lang.Integer getNumOccurs()
          Null implies unlimited.
 boolean getSuspended()
          Returns whether or not further execution has been suspended pending a user request to resume.
 java.lang.String getType()
          Returns the type of schedule.
 java.lang.String getWday()
          Return the wday portion of the cron schedule.
 java.util.Date nextEvent(java.util.Date d)
          Returns the first date/time after a specified date/time that this schedule will cause an event.
 void setHour(java.lang.String hour)
          Set the hour portion of the cron schedule.
 void setMday(java.lang.String mday)
          Set the month day portion of the schedule.
 void setMinute(java.lang.String minute)
          Set the minute portion of the cron schedule.
 void setMonth(java.lang.String month)
          Set the month portion of the cron schedule.
 void setNumOccurs(java.lang.Integer numOccurs)
          Set the number of times the schedule should be run before being discarded.
 void setSuspended(boolean suspended)
          Indicates whether or not further execution should be suspended pending a user request to resume.
 void setType(java.lang.String type)
          Set the type of schedule.
 void setWday(java.lang.String wday)
          Set the week day portion of the schedule.
 org.apache.xmlbeans.XmlObject toBean()
          Returns a Inca schema XmlBean Schedule object that contains information equivalent to this object.
 java.lang.String toString()
           
 
Methods inherited from class edu.sdsc.inca.depot.persistent.PersistentObject
toXml, truncate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Schedule

public Schedule()
Default constructor.


Schedule

public Schedule(java.lang.String min,
                java.lang.String hour,
                java.lang.String mday,
                java.lang.String month,
                java.lang.String wday,
                java.lang.String type,
                java.lang.Integer numOccurs)
Full constructor.

Parameters:
min -
hour -
mday -
month -
wday -
type -
numOccurs -
Method Detail

fromBean

public PersistentObject fromBean(org.apache.xmlbeans.XmlObject o)
Copies information from an Inca schema XmlBean Schedule object so that this object contains equivalent information.

Specified by:
fromBean in class PersistentObject
Parameters:
o - the XmlBean Schedule object to copy
Returns:
this, for convenience

fromBean

public Schedule fromBean(edu.sdsc.inca.dataModel.util.Schedule s)
Copies information from an Inca schema XmlBean Schedule object so that this object contains equivalent information.

Parameters:
s - the XmlBean Schedule object to copy
Returns:
this, for convenience

getMinute

public java.lang.String getMinute()
Return the minute portion of the cron schedule.

Returns:
the minute cron field

nextEvent

public java.util.Date nextEvent(java.util.Date d)
Returns the first date/time after a specified date/time that this schedule will cause an event. Returns null if no later event will ever occur.

Parameters:
d - a date/time preceding the returned value
Returns:
the next date/time an event will occur

setMinute

public void setMinute(java.lang.String minute)
Set the minute portion of the cron schedule.

Parameters:
minute - this minute portion of the schedule

getHour

public java.lang.String getHour()
Return the hour portion of the cron schedule.

Returns:
the hour cron field

setHour

public void setHour(java.lang.String hour)
Set the hour portion of the cron schedule.

Parameters:
hour - this hour portion of the schedule

getMonth

public java.lang.String getMonth()
Return the month portion of the cron schedule.

Returns:
the month cron field

setMonth

public void setMonth(java.lang.String month)
Set the month portion of the cron schedule.

Parameters:
month - the month portion of the schedule

getMday

public java.lang.String getMday()
Return the mday portion of the cron schedule.

Returns:
the month day cron field

setMday

public void setMday(java.lang.String mday)
Set the month day portion of the schedule.

Parameters:
mday - the month day portion of the schedule

getWday

public java.lang.String getWday()
Return the wday portion of the cron schedule.

Returns:
the week day cron field.

setWday

public void setWday(java.lang.String wday)
Set the week day portion of the schedule.

Parameters:
wday - the week day portion of the schedule

getType

public java.lang.String getType()
Returns the type of schedule.

Returns:
the type of schedule

setType

public void setType(java.lang.String type)
Set the type of schedule. Current recognized values are "cron" and "immediate".

Parameters:
type -

getNumOccurs

public java.lang.Integer getNumOccurs()
Null implies unlimited.

Returns:
the number of times the schedule will be executed.

setNumOccurs

public void setNumOccurs(java.lang.Integer numOccurs)
Set the number of times the schedule should be run before being discarded. Null indicates unlimited.

Parameters:
numOccurs -

getSuspended

public boolean getSuspended()
Returns whether or not further execution has been suspended pending a user request to resume.

Returns:
the suspension status

setSuspended

public void setSuspended(boolean suspended)
Indicates whether or not further execution should be suspended pending a user request to resume.

Parameters:
suspended - the suspension status

toBean

public org.apache.xmlbeans.XmlObject toBean()
Returns a Inca schema XmlBean Schedule object that contains information equivalent to this object.

Specified by:
toBean in class PersistentObject
Returns:
an XmlBean Schedule object that contains equivalent information

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Override of the default equals method.

Overrides:
equals in class java.lang.Object