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