001    package 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    
024    /**
025     * Tools that go into the Toolbox should implement this interface.
026     *
027     * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
028     * @version $Id: ApplicationTool.java 615328 2008-01-25 20:25:05Z tv $
029     */
030    public interface ApplicationTool
031    {
032        /**
033         * Initialize the application tool. The data parameter holds a different
034         * type depending on how the tool is being instantiated:
035         * <ul>
036         * <li>For global tools data will be null</li>
037         * <li>For request tools data will be of type RunData</li>
038         * <li>For session and authorized tools data will be of type User</li>
039         * </ul>
040         * <p>
041         * It is possible that session scope tools will be initialized with a null
042         * <code>User</code> object.  This happens when the first request on a
043         * session happens to the be login action.
044         * <p>
045         * If your session tool depends on having a <code>User</code> object, you
046         * should look at implementing the {@link RunDataApplicationTool} interface
047         * instead.
048         *
049         * @param data initialization data
050         */
051        void init(Object data);
052    
053        /**
054         * Refresh the application tool. This is
055         * necessary for development work where you
056         * probably want the tool to refresh itself
057         * if it is using configuration information
058         * that is typically cached after initialization
059         */
060        void refresh();
061    }