Class ScheduleManager


  • public class ScheduleManager
    extends Object
    Manager-class for starting, stopping and removing schedules jobs
    Author:
    XIMA MEDIA GmbH
    • Constructor Summary

      Constructors 
      Constructor Description
      ScheduleManager()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addJob​(IJobWrapper job, org.quartz.Trigger trigger)
      Method to add and start an job
      static void configureSchedulerName​(String schedulerName)  
      static Properties getDefaultProperties()
      Method to get the default Properties to start the scheduler with
      static org.quartz.JobDetail getJob​(org.quartz.JobKey key)
      Method to get an scheduled job by his key
      static Set<org.quartz.JobKey> getJobs​(NameMatcher<org.quartz.JobKey> nameMatcher)
      Finds all quartz jobs with a certain name.
      static Set<org.quartz.JobKey> getJobs​(org.quartz.impl.matchers.GroupMatcher<org.quartz.JobKey> groupMatcher)
      Finds all jobs that belong to the given groups.
      static Set<org.quartz.JobKey> getJobs​(org.quartz.impl.matchers.GroupMatcher<org.quartz.JobKey> groupMatcher, NameMatcher<org.quartz.JobKey> nameMatcher)
      Finds all jobs with a certain name in the given groups.
      static org.quartz.Scheduler getScheduler()  
      static org.quartz.Trigger getTrigger​(org.quartz.TriggerKey key)
      Method to get an trigger by his key
      static Set<org.quartz.TriggerKey> getTriggers​(NameMatcher<org.quartz.TriggerKey> nameMatcher)
      Finds all quartz triggers with a certain name.
      static Set<org.quartz.TriggerKey> getTriggers​(org.quartz.impl.matchers.GroupMatcher<org.quartz.TriggerKey> groupMatcher)
      Finds all triggers that belong to the given groups.
      static Set<org.quartz.TriggerKey> getTriggers​(org.quartz.impl.matchers.GroupMatcher<org.quartz.TriggerKey> groupMatcher, NameMatcher<org.quartz.TriggerKey> nameMatcher)
      Finds all triggers with a certain name in the given groups.
      static void initialize()
      Initializes the schedule manager.
      static void registerStartupListener​(IBaseNotificationListener listener)  
      static void removeJob​(org.quartz.JobKey key)
      Method to remove an job by his key
      static void removeJobs​(org.quartz.impl.matchers.GroupMatcher<org.quartz.JobKey> groupMatcher)
      Removes all job that match the given group.
      static void removeJobs​(org.quartz.impl.matchers.GroupMatcher<org.quartz.JobKey> groupMatcher, NameMatcher<org.quartz.JobKey> nameMatcher)
      Removes all job that match the given group and name.
      static void removeStartupListener​(IBaseNotificationListener listener)  
      static void rescheduleJob​(org.quartz.TriggerKey triggerKey, org.quartz.Trigger trigger)
      Reschedules the trigger with the given key.
      static void setCustomProperties​(Properties properties)
      Method to override the default properties
      static void shutdown()
      Method to shutdown the scheduler
    • Constructor Detail

      • ScheduleManager

        public ScheduleManager()
    • Method Detail

      • addJob

        public static void addJob​(IJobWrapper job,
                                  org.quartz.Trigger trigger)
        Method to add and start an job
        Parameters:
        job - IJobWrapper with data to start the job with
        trigger - Trigger to schedule the job
      • configureSchedulerName

        public static void configureSchedulerName​(String schedulerName)
        Parameters:
        schedulerName - String the name of the scheduler to use
      • getDefaultProperties

        public static Properties getDefaultProperties()
        Method to get the default Properties to start the scheduler with
        Returns:
        Properties to start the scheduler with
      • getJob

        public static org.quartz.JobDetail getJob​(org.quartz.JobKey key)
        Method to get an scheduled job by his key
        Parameters:
        key - JobKey to search the job with
        Returns:
        JobDetail the found job or null
      • getJobs

        public static Set<org.quartz.JobKey> getJobs​(org.quartz.impl.matchers.GroupMatcher<org.quartz.JobKey> groupMatcher)
        Finds all jobs that belong to the given groups.
        Parameters:
        groupMatcher - Details on the groups to match.
        Returns:
        All jobs that belong to a group matching the given matcher.
      • getJobs

        public static Set<org.quartz.JobKey> getJobs​(org.quartz.impl.matchers.GroupMatcher<org.quartz.JobKey> groupMatcher,
                                                     NameMatcher<org.quartz.JobKey> nameMatcher)
        Finds all jobs with a certain name in the given groups.
        Parameters:
        groupMatcher - Details on the group to match.
        nameMatcher - Details on the name to match.
        Returns:
        All jobs with a name that matches the given name matcher that also belongs to a group matching the given group matcher.
      • getJobs

        public static Set<org.quartz.JobKey> getJobs​(NameMatcher<org.quartz.JobKey> nameMatcher)
        Finds all quartz jobs with a certain name.
        Parameters:
        nameMatcher - Details on the name to match.
        Returns:
        All jobs with a name that match the given matcher.
      • getScheduler

        public static org.quartz.Scheduler getScheduler()
        Returns:
        The current quartz scheduler. When quartz is not active, this returns null.
      • getTrigger

        public static org.quartz.Trigger getTrigger​(org.quartz.TriggerKey key)
        Method to get an trigger by his key
        Parameters:
        key - TriggerKey to search the trigger for
        Returns:
        Trigger the found trigger or null
      • getTriggers

        public static Set<org.quartz.TriggerKey> getTriggers​(org.quartz.impl.matchers.GroupMatcher<org.quartz.TriggerKey> groupMatcher)
        Finds all triggers that belong to the given groups.
        Parameters:
        groupMatcher - Details on the groups to match.
        Returns:
        All triggers that belong to a group matching the given matcher.
      • getTriggers

        public static Set<org.quartz.TriggerKey> getTriggers​(org.quartz.impl.matchers.GroupMatcher<org.quartz.TriggerKey> groupMatcher,
                                                             NameMatcher<org.quartz.TriggerKey> nameMatcher)
        Finds all triggers with a certain name in the given groups.
        Parameters:
        groupMatcher - Details on the group to match.
        nameMatcher - Details on the name to match.
        Returns:
        All triggers with a name that matches the given name matcher that also belongs to a group matching the given group matcher.
      • getTriggers

        public static Set<org.quartz.TriggerKey> getTriggers​(NameMatcher<org.quartz.TriggerKey> nameMatcher)
        Finds all quartz triggers with a certain name.
        Parameters:
        nameMatcher - Details on the name to match.
        Returns:
        All triggers with a name that match the given matcher.
      • initialize

        public static void initialize()
        Initializes the schedule manager. Checks whether all preconditions are met (database running etc.)
      • registerStartupListener

        public static void registerStartupListener​(IBaseNotificationListener listener)
        Parameters:
        listener - Listener to invoke when the scheduler is started.
      • removeJob

        public static void removeJob​(org.quartz.JobKey key)
        Method to remove an job by his key
        Parameters:
        key - JobKey to find the job to remove
      • removeJobs

        public static void removeJobs​(org.quartz.impl.matchers.GroupMatcher<org.quartz.JobKey> groupMatcher)
        Removes all job that match the given group.
        Parameters:
        groupMatcher - Groups of jobs to remove.
      • removeJobs

        public static void removeJobs​(org.quartz.impl.matchers.GroupMatcher<org.quartz.JobKey> groupMatcher,
                                      NameMatcher<org.quartz.JobKey> nameMatcher)
        Removes all job that match the given group and name.
        Parameters:
        groupMatcher - Groups of jobs to remove.
        nameMatcher - Name of jobs to remove.
      • removeStartupListener

        public static void removeStartupListener​(IBaseNotificationListener listener)
        Parameters:
        listener - Listener not to invoke anymore when the scheduler is started.
      • rescheduleJob

        public static void rescheduleJob​(org.quartz.TriggerKey triggerKey,
                                         org.quartz.Trigger trigger)
        Reschedules the trigger with the given key.
        Parameters:
        triggerKey - Key of the trigger to reschedule.
        trigger - Trigger with the new schedule.
      • setCustomProperties

        public static void setCustomProperties​(Properties properties)
        Method to override the default properties
        Parameters:
        properties - Properties to start the scheduler with
      • shutdown

        public static void shutdown()
        Method to shutdown the scheduler