public class TimerSchedulerServiceImpl extends BaseOpenmrsService implements SchedulerService
Constructor and Description |
---|
TimerSchedulerServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
deleteTask(java.lang.Integer id)
Delete the task with the given identifier.
|
java.util.Collection<TaskDefinition> |
getRegisteredTasks()
Get all registered tasks.
|
java.util.Collection<TaskDefinition> |
getScheduledTasks()
Get all scheduled tasks.
|
SchedulerDAO |
getSchedulerDAO()
Gets the scheduler data access object.
|
java.lang.String |
getStatus(java.lang.Integer id)
Checks the status of a scheduled task.
|
java.util.SortedMap<java.lang.String,java.lang.String> |
getSystemVariables()
Get system variables.
|
TaskDefinition |
getTask(java.lang.Integer id)
Get the task with the given identifier.
|
TaskDefinition |
getTaskByName(java.lang.String name)
Get the task with the given name.
|
void |
onShutdown()
Shutdown hook for the scheduler and all of its scheduled tasks.
|
void |
onStartup()
Start up hook for the scheduler and all of its scheduled tasks.
|
void |
registerTask(TaskDefinition definition)
Register a new task by adding it to our task map with an empty schedule map.
|
void |
rescheduleAllTasks()
Loop over all currently started tasks and cycle them.
|
Task |
rescheduleTask(TaskDefinition taskDefinition)
Stop and start a scheduled task.
|
void |
restoreFromMemento(OpenmrsMemento memento)
Restore the scheduler service to state defined by Memento
|
void |
saveTask(TaskDefinition task)
Deprecated.
use saveTaskDefinition which follows correct naming standard
|
void |
saveTaskDefinition(TaskDefinition task)
Save a task in the database.
|
OpenmrsMemento |
saveToMemento()
Saves and stops all active tasks
|
Task |
scheduleTask(TaskDefinition taskDefinition)
Schedule the given task according to the given schedule.
|
void |
setSchedulerDAO(SchedulerDAO dao)
Sets the scheduler data access object.
|
void |
shutdownAllTasks()
Shutdown all running tasks.
|
void |
shutdownTask(TaskDefinition taskDefinition)
Stops a running task.
|
public SchedulerDAO getSchedulerDAO()
public void setSchedulerDAO(SchedulerDAO dao)
public void onStartup()
onStartup
in interface OpenmrsService
onStartup
in interface SchedulerService
onStartup
in class BaseOpenmrsService
OpenmrsService.onStartup()
public void onShutdown()
onShutdown
in interface OpenmrsService
onShutdown
in interface SchedulerService
onShutdown
in class BaseOpenmrsService
OpenmrsService.onShutdown()
public void shutdownAllTasks()
public Task scheduleTask(TaskDefinition taskDefinition) throws SchedulerException
scheduleTask
in interface SchedulerService
taskDefinition
- the task to be scheduledTask
, or null if there was a problem instantiating or
scheduling the taskSchedulerException
public void shutdownTask(TaskDefinition taskDefinition) throws SchedulerException
shutdownTask
in interface SchedulerService
taskDefinition
- the task to be stoppedSchedulerException
SchedulerService.shutdownTask(TaskDefinition)
public void rescheduleAllTasks() throws SchedulerException
rescheduleAllTasks
in interface SchedulerService
SchedulerException
public Task rescheduleTask(TaskDefinition taskDefinition) throws SchedulerException
SchedulerService
rescheduleTask
in interface SchedulerService
taskDefinition
- the TaskDefinition
to rescheduleSchedulerException
SchedulerService.rescheduleTask(org.openmrs.scheduler.TaskDefinition)
public void registerTask(TaskDefinition definition)
definition
- task to registerpublic java.util.Collection<TaskDefinition> getScheduledTasks()
getScheduledTasks
in interface SchedulerService
public java.util.Collection<TaskDefinition> getRegisteredTasks()
getRegisteredTasks
in interface SchedulerService
public TaskDefinition getTask(java.lang.Integer id)
getTask
in interface SchedulerService
id
- the identifier of the taskpublic TaskDefinition getTaskByName(java.lang.String name)
getTaskByName
in interface SchedulerService
name
- name of the taskpublic void saveTask(TaskDefinition task)
saveTask
in interface SchedulerService
task
- the TaskDefinition
to savepublic void saveTaskDefinition(TaskDefinition task)
saveTaskDefinition
in interface SchedulerService
task
- the TaskDefinition
to savepublic void deleteTask(java.lang.Integer id)
deleteTask
in interface SchedulerService
id
- the identifier of the taskpublic java.util.SortedMap<java.lang.String,java.lang.String> getSystemVariables()
getSystemVariables
in interface SchedulerService
public OpenmrsMemento saveToMemento()
saveToMemento
in interface SchedulerService
public void restoreFromMemento(OpenmrsMemento memento)
SchedulerService
restoreFromMemento
in interface SchedulerService
public java.lang.String getStatus(java.lang.Integer id)
SchedulerService
getStatus
in interface SchedulerService
String
status of the task with the given identifierTODO
internationalization of string status messages
Copyright © 2018 OpenMRS Inc.. All Rights Reserved.