bboss.org.apache.velocity.runtime.resource.ResourceManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bboss-velocity Show documentation
Show all versions of bboss-velocity Show documentation
bboss is a j2ee framework include aop/ioc,mvc,persistent,taglib,rpc,event ,bean-xml serializable and so on.http://www.bbossgroups.com
package bboss.org.apache.velocity.runtime.resource;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import bboss.org.apache.velocity.runtime.RuntimeServices;
import bboss.org.apache.velocity.exception.ResourceNotFoundException;
import bboss.org.apache.velocity.exception.ParseErrorException;
/**
* Class to manage the text resource for the Velocity
* Runtime.
*
* @author Jason van Zyl
* @author Paulo Gaspar
* @author Geir Magnusson Jr.
* @version $Id: ResourceManager.java 898050 2010-01-11 20:15:31Z nbubna $
*/
public interface ResourceManager
{
/**
* A template resources.
*/
public static final int RESOURCE_TEMPLATE = 1;
/**
* A static content resource.
*/
public static final int RESOURCE_CONTENT = 2;
public static final int RESOURCE_SQL = 3;
public static final int RESOURCE_ES = 4;
/**
* Initialize the ResourceManager.
* @param rs
*/
public void initialize( RuntimeServices rs );
/**
* Gets the named resource. Returned class type corresponds to specified type
* (i.e. Template
to RESOURCE_TEMPLATE
).
*
* @param resourceName The name of the resource to retrieve.
* @param resourceType The type of resource (RESOURCE_TEMPLATE
,
* RESOURCE_CONTENT
, etc.).
* @param encoding The character encoding to use.
* @return Resource with the template parsed and ready.
* @throws ResourceNotFoundException if template not found
* from any available source.
* @throws ParseErrorException if template cannot be parsed due
* to syntax (or other) error.
*/
public Resource getResource(String resourceName, int resourceType, String encoding )
throws ResourceNotFoundException, ParseErrorException;
public void initTemplate(Resource template, String encoding);
/**
* Determines is a template exists, and returns name of the loader that
* provides it. This is a slightly less hokey way to support
* the Velocity.templateExists() utility method, which was broken
* when per-template encoding was introduced. We can revisit this.
*
* @param resourceName Name of template or content resource
* @return class name of loader than can provide it
*/
public String getLoaderNameForResource(String resourceName );
}