org.alfresco.repo.action.scheduled
Class ScheduledPersistedActionServiceImpl

java.lang.Object
  extended by 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

Nested Class Summary
static class ScheduledPersistedActionServiceImpl.ScheduledJobWrapper
          The thing that Quartz runs when the schedule fires.
static class ScheduledPersistedActionServiceImpl.ScheduledPersistedActionServiceBootstrap
          This is used to trigger the loading of previously persisted schedules on an application startup.
 
Field Summary
protected static java.util.Set ACTION_TYPES
           
protected static java.lang.String JOB_ACTION_NODEREF
           
protected static java.lang.String JOB_SCHEDULE_NODEREF
           
protected static org.alfresco.service.cmr.repository.NodeRef SCHEDULED_ACTION_ROOT_NODE_REF
           
protected static java.lang.String SCHEDULER_GROUP
           
 
Constructor Summary
ScheduledPersistedActionServiceImpl()
           
 
Method Summary
protected  void addToScheduler(ScheduledPersistedActionImpl schedule)
          Builds up the Quartz details, and adds it to the Quartz scheduler when the transaction completes.
protected  org.quartz.JobDetail buildJobDetail(ScheduledPersistedActionImpl schedule)
           
 ScheduledPersistedAction createSchedule(Action persistedAction)
          Creates a new schedule, for the specified Action.
 void deleteSchedule(ScheduledPersistedAction schedule)
          Removes the schedule for the action, and cancels future executions of it.
 ScheduledPersistedAction getSchedule(Action persistedAction)
          Returns the schedule for the specified action, or null if it isn't currently scheduled.
 java.util.List listSchedules()
          Returns all currently scheduled actions.
protected  ScheduledPersistedActionImpl loadPersistentSchedule(org.alfresco.service.cmr.repository.NodeRef schedule)
           
protected  void locatePersistanceFolder()
           
protected  void removeFromScheduler(ScheduledPersistedActionImpl schedule)
          Takes an entry out of the scheduler, if it's currently there.
 void saveSchedule(ScheduledPersistedAction schedule)
          Saves the changes to the schedule to the repository, and updates the Scheduler with any changed details.
 void schedulePreviouslyPersisted()
          Find all our previously persisted scheduled actions, and tell the scheduler to start handling them.
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
           
 void setRepositoryHelper(Repository repositoryHelper)
           
 void setRuntimeActionService(RuntimeActionService runtimeActionService)
           
 void setScheduler(org.quartz.Scheduler scheduler)
           
 void setStartupNodeService(org.alfresco.service.cmr.repository.NodeService startupNodeService)
          Sets the node service to use during startup, which won't do permissions check etc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 static org.alfresco.service.cmr.repository.NodeRef SCHEDULED_ACTION_ROOT_NODE_REF

ACTION_TYPES

protected static final java.util.Set ACTION_TYPES

SCHEDULER_GROUP

protected static final java.lang.String SCHEDULER_GROUP
See Also:
Constant Field Values
Constructor Detail

ScheduledPersistedActionServiceImpl

public ScheduledPersistedActionServiceImpl()
Method Detail

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:
createSchedule in interface ScheduledPersistedActionService

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:
saveSchedule in interface ScheduledPersistedActionService

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:
deleteSchedule in interface ScheduledPersistedActionService

getSchedule

public ScheduledPersistedAction getSchedule(Action persistedAction)
Returns the schedule for the specified action, or null if it isn't currently scheduled.

Specified by:
getSchedule in interface ScheduledPersistedActionService

listSchedules

public java.util.List listSchedules()
Returns all currently scheduled actions.

Specified by:
listSchedules in interface ScheduledPersistedActionService

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)


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.