    001package org.apache.turbine.services.pull;
    002
    003
    004/*
    005 * Licensed to the Apache Software Foundation (ASF) under one
    006 * or more contributor license agreements.  See the NOTICE file
    007 * distributed with this work for additional information
    008 * regarding copyright ownership.  The ASF licenses this file
    009 * to you under the Apache License, Version 2.0 (the
    010 * "License"); you may not use this file except in compliance
    011 * with the License.  You may obtain a copy of the License at
    012 *
    013 *   http://www.apache.org/licenses/LICENSE-2.0
    014 *
    015 * Unless required by applicable law or agreed to in writing,
    016 * software distributed under the License is distributed on an
    017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    018 * KIND, either express or implied.  See the License for the
    019 * specific language governing permissions and limitations
    020 * under the License.
    021 */
    022
    023
    024import org.apache.turbine.util.RunData;
    025
    026/**
    027 * Tools in the Toolbox that need a Rundata Object on every refresh should
    028 * implement this interface.
    029 *
    030 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
    031 * @version $Id: RunDataApplicationTool.java 1773378 2016-12-09 13:19:59Z tv $
    032 */
    033public interface RunDataApplicationTool
    034{
    035    /**
    036     * Initialize the application tool. The data parameter holds a different
    037     * type depending on how the tool is being instantiated:
    038     * <ul>
    039     * <li>For global tools data will be null</li>
    040     * <li>For request tools data will be of type RunData</li>
    041     * <li>For session and authorized tools data will be of type User</li>
    042     * </ul>
    043     * <p>
    044     * It is possible that session scope tools will be initialized with a null
    045     * <code>User</code> object.  This happens when the first request on a
    046     * session happens to the be login action.  The next request on the session
    047     * will cause the session tool to be refreshed if
    048     * <code>tools.per.request.refresh</code> is set to <code>true</code>
    049     * in <code>TurbineResources.properties</code>.  You will then be able to
    050     * get a <code>User</code> object from the instance of
    051     * <code>RunData</code>.
    052     *
    053     * @param data initialization data
    054     */
    055    public void init(Object data);
    056
    057    /**
    058     * Refresh the application tool. This is
    059     * necessary for development work where you
    060     * probably want the tool to refresh itself
    061     * if it is using configuration information
    062     * that is typically cached after initialization
    063     *
    064     * @param data The current RunData Object
    065     */
    066    public void refresh(RunData data);
    067
    068}