Interface IScheduleService
public interface IScheduleService
IScheduleService manages a collection of Schedules.
A Schedule is a recurring event. The recurring period can be specified as
an interval and offset.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
fireScheduledEvent
(IThingID schedule) Immidietly fires the event the ISchedule generates regardless of when the next scheduled time is.long
Get the current time from the DB server so we can perform schedule calcs independent of local node OS timeRetrieves the next scheduled ISchedule whose 'nextTime' attribute is less than the current system time of the calling machine.the instance of the sched pub servicegetSchedule
(IThingID id) Retrieves individual ISchedule specified by 'id'.Collection of all ISchedule Things in the system.Create a schedule.schedule
(IThingID ownerID, String interval, String time, String eventName, String callbackReference) Create a schedule.void
unschedule
(IThingID scheduleID) Destroys the given schedule.
-
Method Details
-
schedule
IThingID schedule(IThingID ownerID, String interval, String time, String eventName) throws MetaException Create a schedule. This will generate an event based on the interval and time specified. The format of interval and time follows ISO8601 time format.
The time should be smaller than the interval.
Format:
- Y=Year
- M=Month (1-12)
- W=Week of Month (1-5)
- w=Week of Year (1-52)
- D=Day of Year (1-366)
- d=Day of Month (1-31)
- F=Day of Week (1-7) (1=Sunday)
- HH:MM:SS - HH is in 24hour time. Seconds are optional. '*' means don't care.
interval="1M" time="15d" - every month on the 15th.
interval="1W" time="2F" - every week on Monday.
interval="1W" time="2FT7:30" - every week on Monday at 7:30am.
interval="1:00:00" time="*:30" - every hour at 30 minutes past the hour.
interval="0:01:00" time="0" - every minute on the minute
interval="1D" time="2:00:00" - every day at 2:00am (2 hours past midnight)
interval="1D" time="2:00:00" - every day at 2:00am (2 hours past midnight)
interval="1W" time="1FT2:00:00" - every week on Sunday at 2:00am
interval="1M" time="1FT2:00:00" - every month on Sunday at 2:00am- Parameters:
ownerID
- the Thing ID of the ownerinterval
- the time period that the schedule should repeat
examples: "1H" "1D" "4W" "04:00:00"time
- the time that the schedule should occur
examples: "4F" "4FT12:00" "04:00:00"eventName
- name of event that will be raised- Returns:
- the Thing ID of the schedule. This can be used to create a subscription.
- Throws:
MetaException
- See Also:
-
ISubscriptionService.subscribe
-
schedule
IThingID schedule(IThingID ownerID, String interval, String time, String eventName, String callbackReference) throws MetaException Create a schedule. This will generate an event based on the interval and time specified. The format of interval and time follows ISO8601 time format.
The time should be smaller than the interval.
Format:
- Y=Year
- M=Month (1-12)
- W=Week of Month (1-5)
- w=Week of Year (1-52)
- D=Day of Year (1-366)
- d=Day of Month (1-31)
- F=Day of Week (1-7) (1=Sunday)
- HH:MM:SS - HH is in 24hour time. Seconds are optional. '*' means don't care.
interval="1M" time="15d" - every month on the 15th.
interval="1W" time="2F" - every week on Monday.
interval="1W" time="2FT7:30" - every week on Monday at 7:30am.
interval="1:00:00" time="*:30" - every hour at 30 minutes past the hour.
interval="0:01:00" time="0" - every minute on the minute
interval="1D" time="2:00:00" - every day at 2:00am (2 hours past midnight)
interval="1D" time="2:00:00" - every day at 2:00am (2 hours past midnight)
interval="1W" time="1FT2:00:00" - every week on Sunday at 2:00am
interval="1M" time="1FT2:00:00" - every month on Sunday at 2:00am- Parameters:
ownerID
- the Thing ID of the ownerinterval
- the time period that the schedule should repeat
examples: "1H" "1D" "4W" "04:00:00"time
- the time that the schedule should occur
examples: "4F" "4FT12:00" "04:00:00"eventName
- name of event that will be raised- Returns:
- the Thing ID of the schedule. This can be used to create a subscription.
- Throws:
MetaException
- See Also:
-
ISubscriptionService.subscribe
-
getSchedules
IThingIDList getSchedules()Collection of all ISchedule Things in the system. -
getSchedule
Retrieves individual ISchedule specified by 'id'.- Parameters:
id
- Thing ID of ISchedule to retrieve- Returns:
- null if ISchedule does not exist
-
getNextID
Retrieves the next scheduled ISchedule whose 'nextTime' attribute is less than the current system time of the calling machine.- Throws:
MetaException
-
fireScheduledEvent
Immidietly fires the event the ISchedule generates regardless of when the next scheduled time is.- Throws:
MetaException
-
unschedule
Destroys the given schedule.- Parameters:
schedule
- to destroy- Throws:
MetaException
-
getSchedPubService
ISchedPubService getSchedPubService()the instance of the sched pub service- Returns:
-
getDbTimeMillis
long getDbTimeMillis()Get the current time from the DB server so we can perform schedule calcs independent of local node OS time
-