1/*2 * Copyright 2000-2001,2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.daemon;
181920/***21A simple interface to create Daemons within Jetspeed. These are basically 22threads that get work done to facilitate content serving.2324@author <a href="mailto:burton@apache.org">Kevin A. Burton</a>25@version $Id: Daemon.java,v 1.9 2004/02/23 02:48:57 jford Exp $26*/27publicinterfaceDaemonextends Runnable {
2829publicfinalstaticint STATUS_UNKNOWN = 0;
30publicfinalstaticint STATUS_NOT_PROCESSED = 1;
31publicfinalstaticint STATUS_PROCESSED = 2;
32publicfinalstaticint STATUS_PROCESSING = 3;
33publicfinalstaticint STATUS_NOT_STARTED = 4;
34publicfinalstaticint STATUS_STARTED = 5;
3536/***37 The result for this daemon is not yet known.38 */39publicfinalstaticint RESULT_UNKNOWN = 0;
4041/***42 A daemon has processed and it was successful43 */44publicfinalstaticint RESULT_SUCCESS = 1;
4546/***47 A daemon has processed but it has failed48 */49publicfinalstaticint RESULT_FAILED = 2;
5051/***52 A daemon is processing so its result is not yet known53 */54publicfinalstaticint RESULT_PROCESSING = 3;
5556/***57 Initialize this daemon providing configuration data.58 */59publicvoid init(DaemonConfig config, DaemonEntry entry);
6061/***62 Require that Daemons have a getter for the DaemonConfig63 */64publicDaemonConfig getDaemonConfig();
6566/***67 Report on the status of this daemon. Should be of STATUS_NOT_PROCESSED, 68 STATUS_PROCESSED, or STATUS_PROCESSING 69 */70publicint getStatus();
7172/***73 Force the status on this Daemon74 */75publicvoid setStatus(int status);
7677/***78 Get the entry for this daemon.79 */80publicDaemonEntry getDaemonEntry();
8182/***83 <p>84 Get the result of this daemons processing. All Daemon implementations 85 are responsible for defining this.86 </p>8788 <p>89 The default for this should be RESULT_UNKNOWN. This usually means that90 this daemon has never been called for processing. 91 </p>92 */93publicint getResult();
9495/***96 Force the result of this Daemon97 */98publicvoid setResult( int result );
99100/***101 Provided so that a Daemon can provide a message to users. Null if it has102 nothing to give to the user.103 */104public String getMessage();
105 }
106