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.services.daemonfactory;
1819import org.apache.jetspeed.daemon.Daemon;
20import org.apache.jetspeed.daemon.DaemonEntry;
21import org.apache.jetspeed.daemon.DaemonContext;
22import org.apache.jetspeed.daemon.DaemonException;
23import org.apache.jetspeed.daemon.DaemonNotFoundException;
24import org.apache.turbine.services.Service;
2526/***27@author <a href="mailto:burton@apache.org">Kevin A. Burton</a>28@version $Id: DaemonFactoryService.java,v 1.4 2004/02/23 03:29:24 jford Exp $29*/30publicinterfaceDaemonFactoryServiceextends Service {
3132public String SERVICE_NAME = "DaemonFactory";
3334/***35 <p>36 Starts any daemons that need processing.37 </p>3839 <p>40 This should be called right after init() so that any daemons that need to be 41 started will be. If you need to do any per-daemon initialization then do so 42 before calling start()43 </p>44 */45publicvoid start();
4647/***48 Allows a Daemon to define its Thread priority through a factory. The Thread49 that this object should return should be an implementation of itself.50 */51publicDaemon getDaemon( DaemonEntry entry ) throws DaemonException;
5253/***54 Get a daemon with the given classname.5556 @see #getDaemon( DaemonEntry entry )57 */58publicDaemon getDaemon( String classname ) throws DaemonException;
5960/***61 */62publicDaemonContext getDaemonContext();
6364/***65 Kicks of processing of a Daemon. Does the same thing as getDaemon() but66 also creates a thread and runs the daemon.67 */68publicvoid process( DaemonEntry entry ) throws DaemonException;
6970/***71 */72publicint getStatus(DaemonEntry entry);
7374/***75 Get the last known result of the given DaemonEntry's processing76 */77publicint getResult(DaemonEntry entry);
7879/***80 Get the last known message of the given DaemonEntry's processing81 */82public String getMessage( DaemonEntry entry );
8384/***85 Get the current known DaemonEntries within the DaemonFactory86 */87publicDaemonEntry[] getDaemonEntries();
8889/***90 Given the name of a DaemonEntry... get it from the DaemonFactory 91 */92publicDaemonEntry getDaemonEntry(String name)
93 throws DaemonNotFoundException;
9495 }