1 // Copyright 2004, 2005 The Apache Software Foundation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package org.apache.tapestry.parse; 16 17 import org.apache.hivemind.Resource; 18 19 /** 20 * Service interface for the <code>tapestry.TemplateParser</code> service. 21 * Note that this requires a threaded service model. 22 * 23 * <p> 24 * Note: had to use the 'I' prefix, so that {@link org.apache.tapestry.parse.TemplateParser} 25 * could keep its name. Otherwise, it makes Spindle support really, really ugly. 26 * 27 * @author Howard Lewis Ship 28 * @since 4.0 29 */ 30 public interface ITemplateParser 31 { 32 /** 33 * Parses the template data into an array of {@link TemplateToken}s. 34 * 35 * <p>The parser is <i>decidedly</i> not threadsafe, so care should be taken 36 * that only a single thread accesses it. 37 * 38 * @param templateData the HTML template to parse. Some tokens will hold 39 * a reference to this array. 40 * @param delegate object that "knows" about defined components 41 * @param resourceLocation a description of where the template originated from, 42 * used with error messages. 43 * 44 **/ 45 public abstract TemplateToken[] parse( 46 char[] templateData, 47 ITemplateParserDelegate delegate, 48 Resource resourceLocation) 49 throws TemplateParseException; 50 }