    001package org.apache.turbine.modules;
    002
    003
    004/*
    005 * Licensed to the Apache Software Foundation (ASF) under one
    006 * or more contributor license agreements.  See the NOTICE file
    007 * distributed with this work for additional information
    008 * regarding copyright ownership.  The ASF licenses this file
    009 * to you under the Apache License, Version 2.0 (the
    010 * "License"); you may not use this file except in compliance
    011 * with the License.  You may obtain a copy of the License at
    012 *
    013 *   http://www.apache.org/licenses/LICENSE-2.0
    014 *
    015 * Unless required by applicable law or agreed to in writing,
    016 * software distributed under the License is distributed on an
    017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    018 * KIND, either express or implied.  See the License for the
    019 * specific language governing permissions and limitations
    020 * under the License.
    021 */
    022
    023
    024// Turbine Scheduler Classes
    025
    026import org.apache.turbine.services.schedule.JobEntry;
    027
    028/**
    029 * All Scheduled jobs should extend this.  The class that extends
    030 * ScheduledJobs should contain the code that you actually want to
    031 * execute at a specific time.  The name of this class is what you
    032 * register in the JobEntry.
    033 *
    034 * @author <a href="mailto:mbryson@mindspring.com">Dave Bryson</a>
    035 * @version $Id: ScheduledJob.java 1706239 2015-10-01 13:18:35Z tv $
    036 */
    037public abstract class ScheduledJob extends Assembler
    038{
    039    /** Prefix for scheduler job related classes */
    040    public static final String PREFIX = "scheduledjobs";
    041
    042    /** The key for the scheduler job cache size if module caching is on. */
    043    public static final String CACHE_SIZE_KEY = "scheduledjob.cache.size";
    044
    045    /** The default size of the scheduler job cache if module caching is on. */
    046    public static final int CACHE_SIZE_DEFAULT = 10;
    047
    048    /** Represents Scheduled Job Objects */
    049    public static final String NAME = "scheduledjob";
    050
    051    /**
    052     * @see org.apache.turbine.modules.Assembler#getPrefix()
    053     */
    054    @Override
    055    public String getPrefix()
    056    {
    057        return PREFIX;
    058    }
    059
    060    /**
    061     * Run the Jobentry from the scheduler queue.
    062     *
    063     * @param job The job to run.
    064     * @throws Exception if something goes wrong
    065     */
    066    public abstract void run(JobEntry job)
    067            throws Exception;
    068}