Class SchedulerService

java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.scheduler.service.SchedulerService
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

public class SchedulerService extends ServiceConfig
Author:
pgarcia
  • Constructor Details

    • SchedulerService

      public SchedulerService(TaskDAO taskDAO, SchedulerDAO schedulerDAO, CalendarDAO calendarDAO, boolean isRemoteEnabled, boolean isSchedulerInstance)
      Constructor
  • Method Details

    • startOnInit

      public ServiceData startOnInit() throws AWException
      Start the scheduler service Requires QUARTZ
      Throws:
      AWException - Error starting scheduler
    • start

      public ServiceData start() throws AWException
      Start the scheduler service Requires QUARTZ
      Throws:
      AWException - Error starting scheduler
    • startNoQuartz

      public ServiceData startNoQuartz() throws AWException
      Start the scheduler service Requires QUARTZ
      Throws:
      AWException - Error starting scheduler
    • stop

      public ServiceData stop() throws AWException
      Stop the scheduler service Requires QUARTZ
      Throws:
      AWException - Error stopping scheduler
    • restart

      public ServiceData restart() throws AWException
      Scheduler's emergency reboot method Requires QUARTZ
      Throws:
      AWException - Error restarting scheduler
    • clearAndStop

      public ServiceData clearAndStop() throws AWException
      Clear all scheduled tasks and stop the scheduler. Requires QUARTZ
      Returns:
      Service data
      Throws:
      AWException
    • currentlyExecutingJobs

      public ServiceData currentlyExecutingJobs() throws AWException
      Get currently executing jobs from the scheduler instance Requires QUARTZ
      Returns:
      Service data
      Throws:
      AWException - Error retrieving currently executing jobs
    • getConfiguredJobs

      public ServiceData getConfiguredJobs() throws AWException
      Get configured Requires QUARTZ
      Returns:
      Configured jobs
      Throws:
      AWException - Error retrieving configured jobs
    • getSchedulerMetadata

      public ServiceData getSchedulerMetadata() throws AWException
      Returns information about the configured scheduler Requires QUARTZ
      Returns:
      Scheduler metadata
      Throws:
      AWException - Error retrieving scheduler metadata
    • getTaskList

      public ServiceData getTaskList() throws AWException
      Retrieve the task list Requires QUARTZ
      Returns:
      ServiceData
      Throws:
      AWException - Error retrieving task list
    • getTaskExecutionList

      public ServiceData getTaskExecutionList(Integer taskId) throws AWException
      Retrieve the task progress status Requires LOG FILES
      Returns:
      ServiceData
      Throws:
      AWException - Error retrieving task execution list
    • getExecutionsToPurge

      public ServiceData getExecutionsToPurge(Integer taskId, Integer executions) throws AWException
      Retrieve the executions to purge
      Returns:
      ServiceData
      Throws:
      AWException - Error retrieving executions to purge
    • executeTaskNow

      public ServiceData executeTaskNow(Integer taskId, String user) throws AWException
      Execute the selected task now Requires QUARTZ
      Parameters:
      taskId - Task identifier
      Returns:
      ServiceData
      Throws:
      AWException - Error executing task
    • pauseTask

      public ServiceData pauseTask(Integer taskId) throws AWException
      Pause the selected task Requires QUARTZ
      Parameters:
      taskId - Task identifier
      Returns:
      ServiceData
      Throws:
      AWException - Error pausing task
    • resumeTask

      public ServiceData resumeTask(Integer taskId) throws AWException
      Resume the selected task Requires QUARTZ
      Parameters:
      taskId - Task identifier
      Returns:
      ServiceData
      Throws:
      AWException - Error resuming task
    • insertSchedulerTask

      public ServiceData insertSchedulerTask(Integer taskId) throws AWException
      Insert and schedule a new task Requires QUARTZ
      Parameters:
      taskId - Task identifier
      Returns:
      ServiceData
      Throws:
      AWException - Error inserting task
    • updateSchedulerTask

      public ServiceData updateSchedulerTask(Integer taskId) throws AWException
      Update and reschedule a task Requires QUARTZ
      Parameters:
      taskId - Task identifier list
      Returns:
      ServiceData
      Throws:
      AWException - Error updating task
    • deleteSchedulerTask

      public ServiceData deleteSchedulerTask(List<Integer> ideTsk) throws AWException
      Delete a task from scheduler Requires QUARTZ
      Parameters:
      ideTsk - Task identifier list
      Returns:
      ServiceData
      Throws:
      AWException - Error deleting task
    • deleteSchedulerTask

      public ServiceData deleteSchedulerTask(Integer ideTsk) throws AWException
      Delete a single task from scheduler Requires QUARTZ
      Parameters:
      ideTsk - Task identifier list
      Returns:
      ServiceData
      Throws:
      AWException - Error deleting task
    • updateExecutionTime

      public ServiceData updateExecutionTime(Integer taskId, Integer taskExecution) throws AWException
      Update execution time
      Parameters:
      taskId - Task identifier list
      Returns:
      ServiceData
      Throws:
      AWException - Error updating execution time
    • loadMaintainVariables

      public ServiceData loadMaintainVariables(String maintainStr) throws AWException
      Load needed variables from the selected maintain
      Parameters:
      maintainStr - Maintain identifier
      Returns:
      ServiceData
      Throws:
      AWException - Error loading maintain variables
    • loadExecutionScreen

      public ServiceData loadExecutionScreen(String path, com.fasterxml.jackson.databind.JsonNode address) throws AWException
      Load execution screen
      Parameters:
      path - Execution path
      address - Execution address
      Returns:
      Service data
      Throws:
      AWException - Error loading execution screen
    • reloadExecutionScreen

      public ServiceData reloadExecutionScreen(Integer taskId, Integer executionId) throws AWException
      Reload execution screen
      Parameters:
      taskId - Task identifier
      executionId - Execution identifier
      Returns:
      Service data
      Throws:
      AWException - Error reloading execution screen
    • purgeExecutionLogs

      public ServiceData purgeExecutionLogs(Integer taskId, Integer executions) throws AWException
      Purge execution logs Requires LOG FILES
      Parameters:
      taskId - Task identifier
      executions - Number of executions to purge
      Returns:
      Service data
      Throws:
      AWException - Error purging execution logs
    • purgeExecutionsAtStart

      public ServiceData purgeExecutionsAtStart() throws AWException
      Purge execution logs on application start Requires LOG FILES
      Returns:
      Service data
      Throws:
      AWException - Error purging executions
    • deactivateCalendar

      public ServiceData deactivateCalendar(List<Integer> calendarIdList) throws AWException
      Pause the selected calendar Requires QUARTZ
      Parameters:
      calendarIdList - Calendar identifier list
      Returns:
      ServiceData
      Throws:
      AWException - Error deactivating calendars
    • activateCalendar

      public ServiceData activateCalendar(List<Integer> calendarIdList) throws AWException
      Resume the selected calendar Requires QUARTZ
      Parameters:
      calendarIdList - Calendar identifier list
      Returns:
      ServiceData
      Throws:
      AWException - Error activating calendars
    • checkCalendarExist

      public ServiceData checkCalendarExist(List<Integer> calendarIdList) throws AWException
      Check if the scheduler contains the selected calendar Requires QUARTZ
      Parameters:
      calendarIdList - Calendar identifier list
      Returns:
      ServiceData
      Throws:
      AWException - Error checking calendars existence
    • insertSchedulerCalendar

      public ServiceData insertSchedulerCalendar(Integer calendarIde) throws AWException
      Insert and schedule a new calendar Requires QUARTZ
      Parameters:
      calendarIde - Calendar identifier
      Returns:
      ServiceData
      Throws:
      AWException - Error inserting scheduler calendar
    • insertSchedulerCalendar

      public ServiceData insertSchedulerCalendar(Integer calendarId, boolean replace, boolean updateTriggers) throws AWException
      Insert and schedule a new calendar Requires QUARTZ
      Parameters:
      calendarId - Calendar identifier
      replace - Replace calendar
      updateTriggers - Update task triggers
      Returns:
      ServiceData
      Throws:
      AWException - Error inserting scheduler calendar
    • insertSchedulerCalendar

      public ServiceData insertSchedulerCalendar(String alias, Integer calendarId, boolean replace, boolean updateTriggers) throws AWException
      Insert and schedule a new calendar Requires QUARTZ
      Parameters:
      calendarId - Calendar identifier
      replace - Replace calendar
      updateTriggers - Update task triggers
      alias - Calendar alias
      Returns:
      ServiceData
      Throws:
      AWException - Error inserting scheduler calendar
    • updateSchedulerCalendar

      public ServiceData updateSchedulerCalendar(Integer calendarId) throws AWException
      Update and schedule a new calendar Requires QUARTZ
      Parameters:
      calendarId - Calendar identifier
      Returns:
      ServiceData
      Throws:
      AWException - Error updating scheduler calendar
    • deleteSchedulerCalendar

      public ServiceData deleteSchedulerCalendar(List<Integer> calendarIdList) throws AWException
      Delete selected calendars Requires QUARTZ
      Parameters:
      calendarIdList - Calendar identifier list
      Returns:
      ServiceData
      Throws:
      AWException - Error deleting scheduler calendars
    • deleteSchedulerCalendar

      public ServiceData deleteSchedulerCalendar(Integer calendarId) throws AWException
      Delete a calendar from scheduler Requires QUARTZ
      Parameters:
      calendarId - Calendar identifier
      Returns:
      ServiceData
      Throws:
      AWException - Error deleting scheduler calendar
    • yearSelectService

      public ServiceData yearSelectService()
      Retrieves next 100 years
      Returns:
      ServiceData
    • computeNextFireTimes

      public ServiceData computeNextFireTimes(Integer times, Schedule schedule) throws AWException
      Compute next fire times Requires QUARTZ
      Parameters:
      times - # of fire times to compute
      schedule - Schedule
      Returns:
      Service data
      Throws:
      AWException - Error computing next fire times