View Javadoc

1   /*
2    * $Id: PlugIn.java 421119 2006-07-12 04:49:11Z wsmoak $
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  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  }