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  /**
    25   * Tools that go into the Toolbox should implement this interface.
    26   *
    27   * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
    28   * @version $Id: ApplicationTool.java 615328 2008-01-25 20:25:05Z tv $
    29   */
    30  public interface ApplicationTool
    31  {
    32      /**
    33       * Initialize the application tool. The data parameter holds a different
    34       * type depending on how the tool is being instantiated:
    35       * <ul>
    36       * <li>For global tools data will be null</li>
    37       * <li>For request tools data will be of type RunData</li>
    38       * <li>For session and authorized tools data will be of type User</li>
    39       * </ul>
    40       * <p>
    41       * It is possible that session scope tools will be initialized with a null
    42       * <code>User</code> object.  This happens when the first request on a
    43       * session happens to the be login action.
    44       * <p>
    45       * If your session tool depends on having a <code>User</code> object, you
    46       * should look at implementing the {@link RunDataApplicationTool} interface
    47       * instead.
    48       *
    49       * @param data initialization data
    50       */
    51      void init(Object data);
    52
    53      /**
    54       * Refresh the application tool. This is
    55       * necessary for development work where you
    56       * probably want the tool to refresh itself
    57       * if it is using configuration information
    58       * that is typically cached after initialization
    59       */
    60      void refresh();
    61  }