public class Scheduler extends AbstractRestObject<Scheduler,SchedulerResponse> implements ICachedObject
moduleName| Constructor and Description |
|---|
Scheduler(String moduleName,
String cacheFilePath)
Constructor that initializes the timer and task registry.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListeners()
Adds event listeners.
|
String |
addTask(ChangeSchedulerRequest addRequest)
Adds a new task to the scheduler.
|
String |
deleteAllTasks()
Deletes all tasks.
|
String |
deleteTask(ChangeSchedulerRequest deleteRequest)
This method deletes a single crontab.
|
SchedulerResponse |
getAsJson(javax.ws.rs.core.MultivaluedMap<String,String> query)
Returns a JSON representation of this object.
|
Date |
getNextHarvestDate()
Returns the date of the earliest scheduled harvest.
|
protected String |
getPrettyPlainText()
Returns a pretty print representation of this object.
|
void |
loadFromDisk()
Attempts to load a schedule from disk.
|
protected void |
onContextDestroyed(ContextDestroyedEvent event)
Removes event listeners, cancels the timer and removes
all registered tasks.
|
void |
removeEventListeners()
Removes all event listeners of this class.
|
void |
saveToDisk()
Saves all cron tabs to disk as a JSON array.
|
int |
size()
Returns the number of registered cron tabs.
|
getAsPlainTextpublic void addEventListeners()
IEventListeneraddEventListeners in interface IEventListeneraddEventListeners in class AbstractRestObject<Scheduler,SchedulerResponse>public void removeEventListeners()
IEventListenerremoveEventListeners in interface IEventListenerremoveEventListeners in class AbstractRestObject<Scheduler,SchedulerResponse>public void saveToDisk()
saveToDisk in interface ICachedObjectpublic void loadFromDisk()
loadFromDisk in interface ICachedObjectpublic int size()
public Date getNextHarvestDate()
protected void onContextDestroyed(ContextDestroyedEvent event)
onContextDestroyed in class AbstractRestObject<Scheduler,SchedulerResponse>event - the event that triggered the callback functionprotected String getPrettyPlainText()
AbstractRestObjectgetPrettyPlainText in class AbstractRestObject<Scheduler,SchedulerResponse>public SchedulerResponse getAsJson(javax.ws.rs.core.MultivaluedMap<String,String> query)
AbstractRestObjectgetAsJson in class AbstractRestObject<Scheduler,SchedulerResponse>query - optional query parameters from the HTTP requestpublic String addTask(ChangeSchedulerRequest addRequest)
addRequest - the request that is to add a new taskpublic String deleteTask(ChangeSchedulerRequest deleteRequest) throws IllegalArgumentException
deleteRequest - a JSON object that transports the cron tab to be deletedIllegalArgumentException - thrown if the cron tab is not registeredpublic String deleteAllTasks()
Copyright © 2017–2019. All rights reserved.