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