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