View Javadoc

    1   package org.apache.turbine.modules;
    2
    3
    4   /*
    5    * Licensed to the Apache Software Foundation (ASF) under one
    6    * or more contributor license agreements.  See the NOTICE file
    7    * distributed with this work for additional information
    8    * regarding copyright ownership.  The ASF licenses this file
    9    * to you under the Apache License, Version 2.0 (the
    10   * "License"); you may not use this file except in compliance
    11   * with the License.  You may obtain a copy of the License at
    12   *
    13   *   http://www.apache.org/licenses/LICENSE-2.0
    14   *
    15   * Unless required by applicable law or agreed to in writing,
    16   * software distributed under the License is distributed on an
    17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    18   * KIND, either express or implied.  See the License for the
    19   * specific language governing permissions and limitations
    20   * under the License.
    21   */
    22
    23
    24  // Turbine Scheduler Classes
    25
    26  import org.apache.turbine.services.schedule.JobEntry;
    27
    28  /**
    29   * All Scheduled jobs should extend this.  The class that extends
    30   * ScheduledJobs should contain the code that you actually want to
    31   * execute at a specific time.  The name of this class is what you
    32   * register in the JobEntry.
    33   *
    34   * @author <a href="mailto:mbryson@mindspring.com">Dave Bryson</a>
    35   * @version $Id: ScheduledJob.java 1706239 2015-10-01 13:18:35Z tv $
    36   */
    37  public abstract class ScheduledJob extends Assembler
    38  {
    39      /** Prefix for scheduler job related classes */
    40      public static final String PREFIX = "scheduledjobs";
    41
    42      /** The key for the scheduler job cache size if module caching is on. */
    43      public static final String CACHE_SIZE_KEY = "scheduledjob.cache.size";
    44
    45      /** The default size of the scheduler job cache if module caching is on. */
    46      public static final int CACHE_SIZE_DEFAULT = 10;
    47
    48      /** Represents Scheduled Job Objects */
    49      public static final String NAME = "scheduledjob";
    50
    51      /**
    52       * @see org.apache.turbine.modules.Assembler#getPrefix()
    53       */
    54      @Override
    55      public String getPrefix()
    56      {
    57          return PREFIX;
    58      }
    59
    60      /**
    61       * Run the Jobentry from the scheduler queue.
    62       *
    63       * @param job The job to run.
    64       * @throws Exception if something goes wrong
    65       */
    66      public abstract void run(JobEntry job)
    67              throws Exception;
    68  }