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.services.daemonfactory; 18 19 import org.apache.jetspeed.daemon.Daemon; 20 import org.apache.jetspeed.daemon.DaemonEntry; 21 import org.apache.jetspeed.daemon.DaemonContext; 22 import org.apache.jetspeed.daemon.DaemonException; 23 import org.apache.jetspeed.daemon.DaemonNotFoundException; 24 import org.apache.turbine.services.Service; 25 26 /** 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 */ 30 public interface DaemonFactoryService extends Service { 31 32 public String SERVICE_NAME = "DaemonFactory"; 33 34 /** 35 <p> 36 Starts any daemons that need processing. 37 </p> 38 39 <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 */ 45 public void start(); 46 47 /** 48 Allows a Daemon to define its Thread priority through a factory. The Thread 49 that this object should return should be an implementation of itself. 50 */ 51 public Daemon getDaemon( DaemonEntry entry ) throws DaemonException; 52 53 /** 54 Get a daemon with the given classname. 55 56 @see #getDaemon( DaemonEntry entry ) 57 */ 58 public Daemon getDaemon( String classname ) throws DaemonException; 59 60 /** 61 */ 62 public DaemonContext getDaemonContext(); 63 64 /** 65 Kicks of processing of a Daemon. Does the same thing as getDaemon() but 66 also creates a thread and runs the daemon. 67 */ 68 public void process( DaemonEntry entry ) throws DaemonException; 69 70 /** 71 */ 72 public int getStatus(DaemonEntry entry); 73 74 /** 75 Get the last known result of the given DaemonEntry's processing 76 */ 77 public int getResult(DaemonEntry entry); 78 79 /** 80 Get the last known message of the given DaemonEntry's processing 81 */ 82 public String getMessage( DaemonEntry entry ); 83 84 /** 85 Get the current known DaemonEntries within the DaemonFactory 86 */ 87 public DaemonEntry[] getDaemonEntries(); 88 89 /** 90 Given the name of a DaemonEntry... get it from the DaemonFactory 91 */ 92 public DaemonEntry getDaemonEntry(String name) 93 throws DaemonNotFoundException; 94 95 } 96