KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > daemon > Daemon


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 at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * 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 and
14  * limitations under the License.
15  */

16
17 package org.apache.jetspeed.daemon;
18
19
20 /**
21 A simple interface to create Daemons within Jetspeed. These are basically
22 threads that get work done to facilitate content serving.
23
24 @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 */

27 public interface Daemon extends Runnable JavaDoc {
28
29     public final static int STATUS_UNKNOWN = 0;
30     public final static int STATUS_NOT_PROCESSED = 1;
31     public final static int STATUS_PROCESSED = 2;
32     public final static int STATUS_PROCESSING = 3;
33     public final static int STATUS_NOT_STARTED = 4;
34     public final static int STATUS_STARTED = 5;
35
36     /**
37     The result for this daemon is not yet known.
38     */

39     public final static int RESULT_UNKNOWN = 0;
40
41     /**
42     A daemon has processed and it was successful
43     */

44     public final static int RESULT_SUCCESS = 1;
45
46     /**
47     A daemon has processed but it has failed
48     */

49     public final static int RESULT_FAILED = 2;
50
51     /**
52     A daemon is processing so its result is not yet known
53     */

54     public final static int RESULT_PROCESSING = 3;
55     
56     /**
57     Initialize this daemon providing configuration data.
58     */

59     public void init(DaemonConfig config, DaemonEntry entry);
60
61     /**
62     Require that Daemons have a getter for the DaemonConfig
63     */

64     public DaemonConfig getDaemonConfig();
65
66     /**
67     Report on the status of this daemon. Should be of STATUS_NOT_PROCESSED,
68     STATUS_PROCESSED, or STATUS_PROCESSING
69     */

70     public int getStatus();
71
72     /**
73     Force the status on this Daemon
74     */

75     public void setStatus(int status);
76     
77     /**
78     Get the entry for this daemon.
79     */

80     public DaemonEntry getDaemonEntry();
81
82     /**
83     <p>
84     Get the result of this daemons processing. All Daemon implementations
85     are responsible for defining this.
86     </p>
87     
88     <p>
89     The default for this should be RESULT_UNKNOWN. This usually means that
90     this daemon has never been called for processing.
91     </p>
92     */

93     public int getResult();
94
95     /**
96     Force the result of this Daemon
97     */

98     public void setResult( int result );
99
100     /**
101     Provided so that a Daemon can provide a message to users. Null if it has
102     nothing to give to the user.
103     */

104     public String JavaDoc getMessage();
105 }
106
107
Popular Tags