org.apache.velocity.runtime.resource.loader
Class JarResourceLoader
java.lang.Object
|
+--org.apache.velocity.runtime.resource.loader.ResourceLoader
|
+--org.apache.velocity.runtime.resource.loader.JarResourceLoader
- public class JarResourceLoader
- extends ResourceLoader
ResourceLoader to load templates from multiple Jar files.
- Version:
- $Id: JarResourceLoader.java,v 1.7 2001/03/20 00:55:04 jon Exp $
- Author:
- Dave Bryson
Field Summary |
private java.util.Hashtable |
entryDirectory
Maps entries to the parent JAR File
Key = the entry *excluding* plain directories
Value = the JAR URL |
private java.util.Hashtable |
jarfiles
Maps JAR URLs to the actual JAR
Key = the JAR URL
Value = the JAR |
Method Summary |
private void |
addEntries(java.util.Hashtable entries)
Copy all the entries into the entryDirectory
It will overwrite any duplicate keys. |
private void |
closeJar(java.lang.String path)
Closes a Jar file and set its URLConnection
to null. |
long |
getLastModified(Resource resource)
Get the last modified time of the InputStream source
that was used to create the template. |
java.io.InputStream |
getResourceStream(java.lang.String source)
Get an InputStream so that the Runtime can build a
template with it. |
void |
init(Configuration configuration)
Called by Velocity to initialize the loader |
boolean |
isSourceModified(Resource resource)
Given a template, check to see if the source of InputStream
has been modified. |
private void |
loadJar(java.lang.String path)
|
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
entryDirectory
private java.util.Hashtable entryDirectory
- Maps entries to the parent JAR File
Key = the entry *excluding* plain directories
Value = the JAR URL
jarfiles
private java.util.Hashtable jarfiles
- Maps JAR URLs to the actual JAR
Key = the JAR URL
Value = the JAR
JarResourceLoader
public JarResourceLoader()
init
public void init(Configuration configuration)
- Called by Velocity to initialize the loader
- Overrides:
init
in class ResourceLoader
loadJar
private void loadJar(java.lang.String path)
closeJar
private void closeJar(java.lang.String path)
- Closes a Jar file and set its URLConnection
to null.
addEntries
private void addEntries(java.util.Hashtable entries)
- Copy all the entries into the entryDirectory
It will overwrite any duplicate keys.
getResourceStream
public java.io.InputStream getResourceStream(java.lang.String source)
throws ResourceNotFoundException
- Get an InputStream so that the Runtime can build a
template with it.
- Overrides:
getResourceStream
in class ResourceLoader
- Parameters:
name
- name of template to get- Returns:
- InputStream containing the template
- Throws:
ResourceNotFoundException
- if template not found
in the file template path.
isSourceModified
public boolean isSourceModified(Resource resource)
- Description copied from class:
ResourceLoader
- Given a template, check to see if the source of InputStream
has been modified.
- Overrides:
isSourceModified
in class ResourceLoader
getLastModified
public long getLastModified(Resource resource)
- Description copied from class:
ResourceLoader
- Get the last modified time of the InputStream source
that was used to create the template. We need the template
here because we have to extract the name of the template
in order to locate the InputStream source.
- Overrides:
getLastModified
in class ResourceLoader
Copyright © 2001 Apache Software Foundation. All Rights Reserved.