1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.struts.action;
19
20 import org.apache.struts.config.ModuleConfig;
21
22 import javax.servlet.ServletException;
23
24 /***
25 * <p>A <strong>PlugIn</strong> is a configuration wrapper for a
26 * module-specific resource or service that needs to be notified about
27 * application startup and application shutdown events (corresponding to when
28 * the container calls <code>init</code> and <code>destroy</code> on the
29 * corresponding {@link ActionServlet} instance). <code>PlugIn</code> objects
30 * can be configured in the <code>struts-config.xml</code> file, without the
31 * need to subclass {@link ActionServlet} simply to perform application
32 * lifecycle activities.</p>
33 *
34 * <p>Implementations of this interface must supply a zero-argument
35 * constructor for use by {@link ActionServlet}. Configuration can be
36 * accomplished by providing standard JavaBeans property setter methods, which
37 * will all have been called before the <code>init()</code> method is
38 * invoked.</p>
39 *
40 * <p>This interface can be applied to any class, including an Action
41 * subclass. </p>
42 *
43 * @version $Rev: 421119 $ $Date: 2005-05-14 01:09:32 -0400 (Sat, 14 May 2005)
44 * $
45 * @since Struts 1.1
46 */
47 public interface PlugIn {
48 /***
49 * <p>Receive notification that our owning module is being shut down.</p>
50 */
51 void destroy();
52
53 /***
54 * <p>Receive notification that the specified module is being started
55 * up.</p>
56 *
57 * @param servlet ActionServlet that is managing all the modules in this
58 * web application
59 * @param config ModuleConfig for the module with which this plug-in is
60 * associated
61 * @throws ServletException if this <code>PlugIn</code> cannot be
62 * successfully initialized
63 */
64 void init(ActionServlet servlet, ModuleConfig config)
65 throws ServletException;
66 }