View Javadoc
1   package org.apache.turbine.services.pull;
2   
3   
4   /*
5    * Licensed to the Apache Software Foundation (ASF) under one
6    * or more contributor license agreements.  See the NOTICE file
7    * distributed with this work for additional information
8    * regarding copyright ownership.  The ASF licenses this file
9    * to you under the Apache License, Version 2.0 (the
10   * "License"); you may not use this file except in compliance
11   * with the License.  You may obtain a copy of the License at
12   *
13   *   http://www.apache.org/licenses/LICENSE-2.0
14   *
15   * Unless required by applicable law or agreed to in writing,
16   * software distributed under the License is distributed on an
17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18   * KIND, either express or implied.  See the License for the
19   * specific language governing permissions and limitations
20   * under the License.
21   */
22  
23  
24  import org.apache.turbine.util.RunData;
25  
26  /**
27   * Tools in the Toolbox that need a Rundata Object on every refresh should
28   * implement this interface.
29   *
30   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
31   * @version $Id: RunDataApplicationTool.java 1854787 2019-03-04 18:30:25Z tv $
32   */
33  public interface RunDataApplicationTool
34  {
35      /**
36       * Initialize the application tool. The data parameter holds a different
37       * type depending on how the tool is being instantiated:
38       * <ul>
39       * <li>For global tools data will be null</li>
40       * <li>For request tools data will be of type RunData</li>
41       * <li>For session and authorized tools data will be of type User</li>
42       * </ul>
43       * <p>
44       * It is possible that session scope tools will be initialized with a null
45       * <code>User</code> object.  This happens when the first request on a
46       * session happens to the be login action.  The next request on the session
47       * will cause the session tool to be refreshed if
48       * <code>tools.per.request.refresh</code> is set to <code>true</code>
49       * in <code>TurbineResources.properties</code>.  You will then be able to
50       * get a <code>User</code> object from the instance of
51       * <code>RunData</code>.
52       *
53       * @param data initialization data
54       */
55      void init(Object data);
56  
57      /**
58       * Refresh the application tool. This is
59       * necessary for development work where you
60       * probably want the tool to refresh itself
61       * if it is using configuration information
62       * that is typically cached after initialization
63       *
64       * @param data The current RunData Object
65       */
66      void refresh(RunData data);
67  }