org.norther.tammi.spray.engine.resource
Class FileResourceResolver

java.lang.Object
  extended by org.norther.tammi.spray.engine.resource.AbstractResourceResolver
      extended by org.norther.tammi.spray.engine.resource.FileResourceResolver
All Implemented Interfaces:
Serializable, ResourceResolver

public class FileResourceResolver
extends AbstractResourceResolver

A resource resolver for resources stored in the file system. It uses case sensitive file names.

Based on FileResourceLoader in the Apache Jakarta Velocity project.

Author:
Jason van Zyl, Ilkka Priha
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.norther.tammi.spray.engine.resource.AbstractResourceResolver
AbstractResourceResolver.AbstractResource
 
Constructor Summary
FileResourceResolver()
          Constructs a new resolver.
 
Method Summary
 long getLastModified(String name)
          Gets a timestamp of the last modification of the resource.
 Resource getResource(String name)
          Gets a named resource.
 InputStream getResourceAsStream(String name)
          Gets a named resource as a stream.
 boolean resourceExists(String name)
          Checks whether a resource exists.
 
Methods inherited from class org.norther.tammi.spray.engine.resource.AbstractResourceResolver
getFinderAlias, getFinderKey, getMBeanServer, getPathFinder, getPaths, getTemplateEngineMBean, resolveLocale, setFinderAlias, setFinderKey, setPaths, setTemplateEngineMBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileResourceResolver

public FileResourceResolver()
Constructs a new resolver.

Method Detail

getResource

public Resource getResource(String name)
Description copied from interface: ResourceResolver
Gets a named resource.

Specified by:
getResource in interface ResourceResolver
Specified by:
getResource in class AbstractResourceResolver
Parameters:
name - the name of the resource.
Returns:
the named resource or null if not found.

getResourceAsStream

public InputStream getResourceAsStream(String name)
                                throws IOException
Description copied from interface: ResourceResolver
Gets a named resource as a stream.

Specified by:
getResourceAsStream in interface ResourceResolver
Specified by:
getResourceAsStream in class AbstractResourceResolver
Parameters:
name - the name of the resource.
Returns:
the named resource as a stream or null if not found.
Throws:
IOException - on I/O errors.

getLastModified

public long getLastModified(String name)
Description copied from interface: ResourceResolver
Gets a timestamp of the last modification of the resource.

Specified by:
getLastModified in interface ResourceResolver
Specified by:
getLastModified in class AbstractResourceResolver
Parameters:
name - the name of the resource.
Returns:
the modification time stamp or 0 if not found.

resourceExists

public boolean resourceExists(String name)
Description copied from interface: ResourceResolver
Checks whether a resource exists.

Specified by:
resourceExists in interface ResourceResolver
Specified by:
resourceExists in class AbstractResourceResolver
Parameters:
name - the name of the resource.
Returns:
true if the resource exists, otherwise false.


Copyright © 2004 The Norther Organization. All rights reserved.