View Javadoc

1   package org.apache.turbine.services.pull;
2   
3   /*
4    * Copyright 2001-2005 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  import org.apache.turbine.util.RunData;
20  
21  /***
22   * Tools in the Toolbox that need a Rundata Object on every refresh should
23   * implement this interface.
24   *
25   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
26   * @version $Id: RunDataApplicationTool.java 264152 2005-08-29 14:50:22Z henning $
27   */
28  public interface RunDataApplicationTool
29  {
30      /***
31       * Initialize the application tool. The data parameter holds a different
32       * type depending on how the tool is being instantiated:
33       * <ul>
34       * <li>For global tools data will be null</li>
35       * <li>For request tools data will be of type RunData</li>
36       * <li>For session and authorized tools data will be of type User</li>
37       * </ul>
38       * <p>
39       * It is possible that session scope tools will be initialized with a null
40       * <code>User</code> object.  This happens when the first request on a
41       * session happens to the be login action.  The next request on the session
42       * will cause the session tool to be refreshed if
43       * <code>tools.per.request.refresh</code> is set to <code>true</code>
44       * in <code>TurbineResources.properties</code>.  You will then be able to
45       * get a <code>User</code> object from the instance of
46       * <code>RunData</object>.
47       *
48       * @param data initialization data
49       */
50      void init(Object data);
51  
52      /***
53       * Refresh the application tool. This is
54       * necessary for development work where you
55       * probably want the tool to refresh itself
56       * if it is using configuration information
57       * that is typically cached after initialization
58       *
59       * @param data The current RunData Object
60       */
61      void refresh(RunData data);
62  }