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 015 package org.apache.tapestry.resolver; 016 017 import org.apache.hivemind.ApplicationRuntimeException; 018 import org.apache.hivemind.Location; 019 import org.apache.tapestry.INamespace; 020 import org.apache.tapestry.IRequestCycle; 021 import org.apache.tapestry.spec.IComponentSpecification; 022 023 /** 024 * Service interface for locating component specifications. 025 * 026 * @author Howard Lewis Ship 027 * @since 4.0 028 */ 029 public interface ComponentSpecificationResolver 030 { 031 /** 032 * Passed the namespace of a container (to resolve the type in) and the type to resolve, 033 * performs the processing. A "bare type" (without a library prefix) may be in the 034 * containerNamespace, or the framework namespace (a search occurs in that order). 035 * 036 * @param cycle 037 * current request cycle 038 * @param containerNamespace 039 * namespace that may contain a library referenced in the type 040 * @param type 041 * the component specification to find, either a simple name, or prefixed with a 042 * library id (defined for the container namespace) 043 * @see #getNamespace() 044 * @see #getSpecification() 045 */ 046 void resolve(IRequestCycle cycle, INamespace containerNamespace, String type, 047 Location location); 048 049 /** 050 * Like 051 * {@link #resolve(org.apache.tapestry.IRequestCycle, org.apache.tapestry.INamespace, java.lang.String, Location)}, 052 * but used when the type has already been parsed into a library id and a simple type. 053 * 054 * @param cycle 055 * current request cycle 056 * @param containerNamespace 057 * namespace that may contain a library referenced in the type 058 * @param libraryId 059 * the library id within the container namespace, or null 060 * @param type 061 * the component specification to find as a simple name (without a library prefix) 062 * @param location 063 * of reference to be resolved 064 * @throws ApplicationRuntimeException 065 * if the type cannot be resolved 066 */ 067 void resolve(IRequestCycle cycle, INamespace containerNamespace, String libraryId, 068 String type, Location location); 069 070 /** 071 * The specification resolved by the resolve() method. 072 */ 073 IComponentSpecification getSpecification(); 074 075 /** 076 * The namespace containing the resolved component. 077 */ 078 INamespace getNamespace(); 079 080 /** 081 * Returns the unqualified type of the component (i.e., with any namespace prefix stripped off). 082 */ 083 String getType(); 084 }