KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > runtime > resource > ResourceManager


1 package org.apache.velocity.runtime.resource;
2
3 /*
4  * Copyright 2000-2001,2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 import org.apache.velocity.runtime.RuntimeServices;
20
21 import org.apache.velocity.exception.ResourceNotFoundException;
22 import org.apache.velocity.exception.ParseErrorException;
23
24 /**
25  * Class to manage the text resource for the Velocity
26  * Runtime.
27  *
28  * @author <a HREF="mailto:jvanzyl@apache.org">Jason van Zyl</a>
29  * @author <a HREF="mailto:paulo.gaspar@krankikom.de">Paulo Gaspar</a>
30  * @author <a HREF="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
31  * @version $Id: ResourceManager.java,v 1.34.4.1 2004/03/03 23:23:01 geirm Exp $
32  */

33 public interface ResourceManager
34 {
35     /**
36      * A template resources.
37      */

38     public static final int RESOURCE_TEMPLATE = 1;
39     
40     /**
41      * A static content resource.
42      */

43     public static final int RESOURCE_CONTENT = 2;
44
45     /**
46      * Initialize the ResourceManager.
47      */

48     public void initialize( RuntimeServices rs ) throws Exception JavaDoc;
49
50     /**
51      * Gets the named resource. Returned class type corresponds to specified type
52      * (i.e. <code>Template</code> to <code>RESOURCE_TEMPLATE</code>).
53      *
54      * @param resourceName The name of the resource to retrieve.
55      * @param resourceType The type of resource (<code>RESOURCE_TEMPLATE</code>,
56      * <code>RESOURCE_CONTENT</code>, etc.).
57      * @param encoding The character encoding to use.
58      * @return Resource with the template parsed and ready.
59      * @throws ResourceNotFoundException if template not found
60      * from any available source.
61      * @throws ParseErrorException if template cannot be parsed due
62      * to syntax (or other) error.
63      * @throws Exception if a problem in parse
64      */

65     public Resource getResource(String JavaDoc resourceName, int resourceType, String JavaDoc encoding )
66         throws ResourceNotFoundException, ParseErrorException, Exception JavaDoc;
67
68     /**
69      * Determines is a template exists, and returns name of the loader that
70      * provides it. This is a slightly less hokey way to support
71      * the Velocity.templateExists() utility method, which was broken
72      * when per-template encoding was introduced. We can revisit this.
73      *
74      * @param resourceName Name of template or content resource
75      * @return class name of loader than can provide it
76      */

77     public String JavaDoc getLoaderNameForResource(String JavaDoc resourceName );
78      
79 }
80
81
82
Popular Tags