@DeclareRoles(value="org.imixs.ACCESSLEVEL.MANAGERACCESS")
@RunAs(value="org.imixs.ACCESSLEVEL.MANAGERACCESS")
public class SchedulerService
extends java.lang.Object
A scheduler definition is stored in a document with the type "scheduler". The document can provide concrete information to process the timer event.
The TimerService can be started using the method start(). The Methods findTimerDescription and findAllTimerDescriptions are used to lookup enabled and running service instances.
Each Method expects or generates a TimerDescription Object. This object is an instance of a ItemCollection. To create a new timer the ItemCollection should contain the following attributes:
the following additional attributes are generated by the finder methods and can be used by an application to verfiy the status of a running instance:
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DOCUMENT_TYPE |
Constructor and Description |
---|
SchedulerService() |
Modifier and Type | Method and Description |
---|---|
protected jakarta.ejb.Timer |
createTimerOnCalendar(ItemCollection configItemCollection)
Create a calendar-based timer based on a input schedule expression.
|
protected Scheduler |
findSchedulerByName(java.lang.String schedulerClassName)
This method returns a n injected JobHandler by name or null if no JobHandler
with the requested class name is injected.
|
jakarta.ejb.Timer |
findTimer(java.lang.String id)
This method returns a timer for a corresponding id if such a timer object
exists.
|
ItemCollection |
loadConfiguration(java.lang.String name)
Loads the scheduler configuration entity by name.
|
void |
logMessage(java.lang.String message,
ItemCollection configuration,
ItemCollection workitem)
Creates a new log entry stored in the item _scheduler_log.
|
void |
logWarning(java.lang.String message,
ItemCollection configuration,
ItemCollection workitem)
Creates a new log entry stored in the item _scheduler_log.
|
protected void |
onTimeout(jakarta.ejb.Timer timer)
This is the method which processes the timeout event depending on the running
timer settings.
|
ItemCollection |
saveConfiguration(ItemCollection configItemCollection)
This method saves the scheduler configuration.
|
ItemCollection |
start(ItemCollection configuration)
Starts a new Timer for the scheduler defined by the Configuration.
|
void |
startAllSchedulers()
This method will start all schedulers which are not yet started.
|
ItemCollection |
stop(ItemCollection configuration)
Cancels a running timer instance.
|
ItemCollection |
stop(ItemCollection configuration,
jakarta.ejb.Timer timer) |
void |
updateTimerDetails(ItemCollection configuration)
Updates the timer details of a running timer service.
|
public static final java.lang.String DOCUMENT_TYPE
public ItemCollection loadConfiguration(java.lang.String name)
public ItemCollection saveConfiguration(ItemCollection configItemCollection)
AccessDeniedException
public ItemCollection start(ItemCollection configuration) throws AccessDeniedException, java.text.ParseException
The Timer can be started based on a Calendar setting stored in the property _scheduler_definition.
The $UniqueID of the configuration entity is the id of the timer to be controlled.
The method throws an exception if the configuration entity contains invalid attributes or values.
After the timer was started the configuration is updated with the latest statusmessage. The item _schedueler_enabled will be set to 'true'.
The method returns the updated configuration. The configuration will not be saved!
configuration
- - scheduler configurationAccessDeniedException
java.text.ParseException
public ItemCollection stop(ItemCollection configuration)
The method returns the current configuration. The configuration will not be saved!
public ItemCollection stop(ItemCollection configuration, jakarta.ejb.Timer timer)
public void startAllSchedulers()
public jakarta.ejb.Timer findTimer(java.lang.String id)
id
- java.lang.Exception
public void updateTimerDetails(ItemCollection configuration)
configuration
- - the current scheduler configuration to be updated.public void logMessage(java.lang.String message, ItemCollection configuration, ItemCollection workitem)
message
- configuration
- public void logWarning(java.lang.String message, ItemCollection configuration, ItemCollection workitem)
message
- configuration
- protected Scheduler findSchedulerByName(java.lang.String schedulerClassName)
jobHandlerClassName
- protected void onTimeout(jakarta.ejb.Timer timer)
timer
- java.lang.Exception
QueryException
protected jakarta.ejb.Timer createTimerOnCalendar(ItemCollection configItemCollection) throws java.text.ParseException
second=0
minute=0
hour=*
dayOfWeek=
dayOfMonth=
month=
year=*
sConfiguation
- java.text.ParseException
Copyright © 2006–2022 Imixs Software Solutions GmbH. All rights reserved.