1 /* 2 * $Id: PlugIn.java 54929 2004-10-16 16:38:42Z germuska $ 3 * 4 * Copyright 2000-2004 The Apache Software Foundation. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 20 package org.apache.struts.action; 21 22 23 import javax.servlet.ServletException; 24 import org.apache.struts.config.ModuleConfig; 25 26 27 /** 28 * <p>A <strong>PlugIn</strong> is a configuration wrapper for a 29 * module-specific resource or service that needs to be notified about 30 * application startup and application shutdown events (corresponding to when 31 * the container calls <code>init</code> and <code>destroy</code> on the 32 * corresponding {@link ActionServlet} instance). <code>PlugIn</code> objects can be 33 * configured in the <code>struts-config.xml</code> file, without the need 34 * to subclass {@link ActionServlet} simply to perform application lifecycle 35 * activities.</p> 36 * 37 * <p>Implementations of this interface must supply a zero-argument constructor 38 * for use by {@link ActionServlet}. Configuration can be accomplished by 39 * providing standard JavaBeans property setter methods, which will all have 40 * been called before the <code>init()</code> method is invoked.</p> 41 * 42 * <p>This interface can be applied to any class, including an Action subclass</p> 43 * 44 * @version $Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $ 45 * @since Struts 1.1 46 */ 47 48 public interface PlugIn { 49 50 51 /** 52 * <p>Receive notification that our owning module is being 53 * shut down.</p> 54 */ 55 void destroy(); 56 57 58 /** 59 * <p>Receive notification that the specified module is being 60 * started up.</p> 61 * 62 * @param servlet ActionServlet that is managing all the 63 * modules in this web application 64 * @param config ModuleConfig for the module with which 65 * this plug-in is associated 66 * 67 * @exception ServletException if this <code>PlugIn</code> cannot 68 * be successfully initialized 69 */ 70 void init(ActionServlet servlet, ModuleConfig config) 71 throws ServletException; 72 73 74 } 75