001// Copyright 2004, 2005 The Apache Software Foundation 002// 003// Licensed under the Apache License, Version 2.0 (the "License"); 004// you may not use this file except in compliance with the License. 005// You may obtain a copy of the License at 006// 007// http://www.apache.org/licenses/LICENSE-2.0 008// 009// Unless required by applicable law or agreed to in writing, software 010// distributed under the License is distributed on an "AS IS" BASIS, 011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012// See the License for the specific language governing permissions and 013// limitations under the License. 014 015package org.apache.tapestry.spec; 016 017import java.util.Map; 018 019import org.apache.hivemind.LocationHolder; 020import org.apache.tapestry.util.IPropertyHolder; 021 022/** 023 * Defines an "extension", which is much like a helper bean, but is part of a library or application 024 * specification (and has the same lifecycle as the application). 025 * 026 * @author glongman@intelligentworks.com 027 */ 028public interface IExtensionSpecification extends IPropertyHolder, LocationHolder 029{ 030 public abstract String getClassName(); 031 032 public abstract void setClassName(String className); 033 034 public abstract void addConfiguration(String propertyName, String value); 035 036 /** 037 * Returns an immutable Map of the configuration; keyed on property name, with values as 038 * properties to assign. 039 */ 040 public abstract Map getConfiguration(); 041 042 /** 043 * Invoked to instantiate an instance of the extension and return it. It also configures 044 * properties of the extension. 045 */ 046 public abstract Object instantiateExtension(); 047 048 /** 049 * Returns true if the extensions should be instantiated immediately after the containing 050 * {@link org.apache.tapestry.spec.LibrarySpecification}if parsed. Non-immediate extensions are 051 * instantiated only as needed. 052 */ 053 public abstract boolean isImmediate(); 054 055 public abstract void setImmediate(boolean immediate); 056}