Commits

Sebastian Sdorra committed da84edc

some javadoc for Schedulers

  • Participants
  • Parent commits 487fe46

Comments (0)

Files changed (1)

src/main/java/sonia/scm/scheduler/api/Schedulers.java

  */
 
 
+
 package sonia.scm.scheduler.api;
 
 //~--- non-JDK imports --------------------------------------------------------
 import sonia.scm.web.security.PrivilegedAction;
 
 /**
+ * Util class for SCM-Manager quartz schedulers.
+ * <p>&nbsp;</p>
+ * <b>Execute an Scheduler on startup of SCM-Manager:</b>
+ * <pre><code>
+ * @Extension
+ * public class ReportContextListener implements ServletContextListener {
+ *
+ *   private final AdministrationContext adminContext;
+ *   private final SchedulerFactory schedulerFactory;
+ *
+ *   @Inject
+ *   public ReportContextListener(AdministrationContext adminContext,
+ *     SchedulerFactory schedulerFactory){
+ *     this.adminContext = adminContext;
+ *     this.schedulerFactory = schedulerFactory;
+ *   }
+ *
+ *   @Override
+ *   public void contextDestroyed(ServletContextEvent sce) {}
+ *
+ *   @Override
+ *   public void contextInitialized(ServletContextEvent sce){
+ *     Schedulers.schedule(adminContext, schedulerFactory,
+ *       SimpleScheduleBuilder.repeatMinutelyForever(), ReportJob.class);
+ *   }
+ * }
+ * </code></pre>
  *
  * @author Sebastian Sdorra
  */
   //~--- methods --------------------------------------------------------------
 
   /**
-   * Method description
+   * Schedules the job class with the given cron expression.
+   * The job class will be executed in an administrative context.
    *
    *
-   * @param adminContext
-   * @param factory
-   * @param cronExpression
-   * @param jobClass
+   * @param adminContext administrative context
+   * @param factory quartz scheduler factory
+   * @param cronExpression cron expression
+   * @param jobClass job class to execute
    */
   public static void schedule(AdministrationContext adminContext,
     final SchedulerFactory factory, final String cronExpression,
   }
 
   /**
-   * Method description
+   * Schedules the job class with the given {@link ScheduleBuilder}.
+   * The job class will be executed in an administrative context.
    *
-   *
-   * @param adminContext
-   * @param factory
-   * @param builder
-   * @param jobClass
+   * @param adminContext administrative context
+   * @param factory quartz scheduler factory
+   * @param builder quartz schedule builder
+   * @param jobClass job class to execute
    */
   public static void schedule(AdministrationContext adminContext,
     final SchedulerFactory factory, final ScheduleBuilder<?> builder,
   }
 
   /**
-   * Method description
+   * Schedules the job class with the given cron expression.
+   * <b>Note:</b> This method need administrative privileges.
    *
    *
-   * @param factory
-   * @param cronExpression
-   * @param jobClass
+   * @param factory quartz scheduler factory
+   * @param cronExpression cron expression
+   * @param jobClass job class to execute
    *
    * @throws SchedulerException
    */
   }
 
   /**
-   * Method description
+   * Schedules the job class with the given {@link ScheduleBuilder}.
+   * <b>Note:</b> This method need administrative privileges.
    *
    *
-   * @param factory
-   * @param builder
-   * @param jobClass
+   * @param factory quartz scheduler factory
+   * @param builder quartz schedule builder
+   * @param jobClass job class to execute
    *
    * @throws SchedulerException
    */