Class ScheduledPersistedActionServiceImpl
- java.lang.Object
-
- org.alfresco.repo.action.scheduled.ScheduledPersistedActionServiceImpl
-
- All Implemented Interfaces:
ScheduledPersistedActionService
public class ScheduledPersistedActionServiceImpl extends java.lang.Object implements ScheduledPersistedActionService
A service which handles the scheduling of the execution of persisted actions. It handles registering them with the Quartz scheduler on repository start, and handles the edit, creation and deletion of them.- Since:
- 3.4
- Author:
- Nick Burch
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classScheduledPersistedActionServiceImpl.ScheduledJobWrapperThe thing that Quartz runs when the schedule fires.static classScheduledPersistedActionServiceImpl.ScheduledPersistedActionServiceBootstrapThis is used to trigger the loading of previously persisted schedules on an application startup.
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.Set<org.alfresco.service.namespace.QName>ACTION_TYPESprotected static java.lang.StringJOB_ACTION_NODEREFprotected static java.lang.StringJOB_SCHEDULE_NODEREFprotected org.alfresco.service.cmr.repository.NodeRefSCHEDULED_ACTION_ROOT_NODE_REFprotected static java.lang.StringSCHEDULER_GROUP
-
Constructor Summary
Constructors Constructor Description ScheduledPersistedActionServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddToScheduler(ScheduledPersistedActionImpl schedule)Builds up the Quartz details, and adds it to the Quartz scheduler when the transaction completes.protected org.quartz.JobDetailbuildJobDetail(ScheduledPersistedActionImpl schedule)ScheduledPersistedActioncreateSchedule(Action persistedAction)Creates a new schedule, for the specified Action.voiddeleteSchedule(ScheduledPersistedAction schedule)Removes the schedule for the action, and cancels future executions of it.ScheduledPersistedActiongetSchedule(Action persistedAction)Returns the schedule for the specified action, or null if it isn't currently scheduled.ScheduledPersistedActiongetSchedule(org.alfresco.service.cmr.repository.NodeRef persistedActionNodeRef)Returns the schedule for the specified action nodeRef, or null if it isn't currently scheduled.java.util.List<ScheduledPersistedAction>listSchedules()Returns all currently scheduled actions.protected ScheduledPersistedActionImplloadPersistentSchedule(org.alfresco.service.cmr.repository.NodeRef schedule)protected voidlocatePersistanceFolder()protected voidremoveFromScheduler(ScheduledPersistedActionImpl schedule)Takes an entry out of the scheduler, if it's currently there.voidsaveSchedule(ScheduledPersistedAction schedule)Saves the changes to the schedule to the repository, and updates the Scheduler with any changed details.voidschedulePreviouslyPersisted()Find all our previously persisted scheduled actions, and tell the scheduler to start handling them.voidsetBehaviourFilter(BehaviourFilter behaviourFilter)voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)voidsetRepositoryHelper(Repository repositoryHelper)voidsetRuntimeActionService(RuntimeActionService runtimeActionService)voidsetScheduler(org.quartz.Scheduler scheduler)voidsetStartupNodeService(org.alfresco.service.cmr.repository.NodeService startupNodeService)Sets the node service to use during startup, which won't do permissions check etc
-
-
-
Field Detail
-
JOB_SCHEDULE_NODEREF
protected static final java.lang.String JOB_SCHEDULE_NODEREF
- See Also:
- Constant Field Values
-
JOB_ACTION_NODEREF
protected static final java.lang.String JOB_ACTION_NODEREF
- See Also:
- Constant Field Values
-
SCHEDULED_ACTION_ROOT_NODE_REF
protected org.alfresco.service.cmr.repository.NodeRef SCHEDULED_ACTION_ROOT_NODE_REF
-
ACTION_TYPES
protected static final java.util.Set<org.alfresco.service.namespace.QName> ACTION_TYPES
-
SCHEDULER_GROUP
protected static final java.lang.String SCHEDULER_GROUP
- See Also:
- Constant Field Values
-
-
Method Detail
-
setBehaviourFilter
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
-
setScheduler
public void setScheduler(org.quartz.Scheduler scheduler)
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
-
setStartupNodeService
public void setStartupNodeService(org.alfresco.service.cmr.repository.NodeService startupNodeService)
Sets the node service to use during startup, which won't do permissions check etc
-
setRepositoryHelper
public void setRepositoryHelper(Repository repositoryHelper)
-
setRuntimeActionService
public void setRuntimeActionService(RuntimeActionService runtimeActionService)
-
locatePersistanceFolder
protected void locatePersistanceFolder()
-
schedulePreviouslyPersisted
public void schedulePreviouslyPersisted()
Find all our previously persisted scheduled actions, and tell the scheduler to start handling them. Called by spring when startup is complete.
-
createSchedule
public ScheduledPersistedAction createSchedule(Action persistedAction)
Creates a new schedule, for the specified Action.- Specified by:
createSchedulein interfaceScheduledPersistedActionService
-
saveSchedule
public void saveSchedule(ScheduledPersistedAction schedule)
Saves the changes to the schedule to the repository, and updates the Scheduler with any changed details.- Specified by:
saveSchedulein interfaceScheduledPersistedActionService
-
deleteSchedule
public void deleteSchedule(ScheduledPersistedAction schedule)
Removes the schedule for the action, and cancels future executions of it. The persisted action is unchanged.- Specified by:
deleteSchedulein interfaceScheduledPersistedActionService
-
getSchedule
public ScheduledPersistedAction getSchedule(Action persistedAction)
Description copied from interface:ScheduledPersistedActionServiceReturns the schedule for the specified action, or null if it isn't currently scheduled.- Specified by:
getSchedulein interfaceScheduledPersistedActionService
-
getSchedule
public ScheduledPersistedAction getSchedule(org.alfresco.service.cmr.repository.NodeRef persistedActionNodeRef)
Description copied from interface:ScheduledPersistedActionServiceReturns the schedule for the specified action nodeRef, or null if it isn't currently scheduled.- Specified by:
getSchedulein interfaceScheduledPersistedActionService
-
listSchedules
public java.util.List<ScheduledPersistedAction> listSchedules()
Returns all currently scheduled actions.- Specified by:
listSchedulesin interfaceScheduledPersistedActionService
-
loadPersistentSchedule
protected ScheduledPersistedActionImpl loadPersistentSchedule(org.alfresco.service.cmr.repository.NodeRef schedule)
-
removeFromScheduler
protected void removeFromScheduler(ScheduledPersistedActionImpl schedule)
Takes an entry out of the scheduler, if it's currently there.
-
addToScheduler
protected void addToScheduler(ScheduledPersistedActionImpl schedule)
Builds up the Quartz details, and adds it to the Quartz scheduler when the transaction completes. We have to wait for the transaction to finish, otherwise Quartz may end up trying and failing to load the details of a job that hasn't been committed to the repo yet!
-
buildJobDetail
protected org.quartz.JobDetail buildJobDetail(ScheduledPersistedActionImpl schedule)
-
-