com.samskivert.servlet
Class SiteResourceLoader.SiteResourceBundle

java.lang.Object
  extended by com.samskivert.servlet.SiteResourceLoader.SiteResourceBundle
Enclosing class:
SiteResourceLoader

public static class SiteResourceLoader.SiteResourceBundle
extends Object

Encapsulates the information we need to load data from a site resource bundle as well as to determine whether the loaded bundle is up to date.


Field Summary
protected  long _lastModified
          The last modified time of the jar file at the time that we opened it for reading.
 File file
          A handle on the site-specific jar file.
 JarFile jarFile
          The object through which we load resources from the site-specific jar file.
 
Constructor Summary
SiteResourceLoader.SiteResourceBundle(File file)
          Constructs a new site resource bundle.
 
Method Summary
 long getLastModified()
          Returns the last modified time of the underlying jar file.
 InputStream getResourceAsStream(String path)
          Fetches the specified resource from our site-specific jar file.
protected  void refreshJarFile()
          Reopens our site-specific jar file if it has been modified since it was last opened.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jarFile

public JarFile jarFile
The object through which we load resources from the site-specific jar file.


file

public File file
A handle on the site-specific jar file.


_lastModified

protected long _lastModified
The last modified time of the jar file at the time that we opened it for reading.

Constructor Detail

SiteResourceLoader.SiteResourceBundle

public SiteResourceLoader.SiteResourceBundle(File file)
                                      throws IOException
Constructs a new site resource bundle. The associated jar file will be opened the first time a resource is read.

Throws:
IOException
Method Detail

getResourceAsStream

public InputStream getResourceAsStream(String path)
                                throws IOException
Fetches the specified resource from our site-specific jar file. The last modified time of the underlying jar file may be checked to determine whether or not it needs to be reloaded.

Returns:
an input stream via which the resource can be read or null if no resource exists with the specified path.
Throws:
IOException

getLastModified

public long getLastModified()
                     throws IOException
Returns the last modified time of the underlying jar file.

Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

refreshJarFile

protected void refreshJarFile()
                       throws IOException
Reopens our site-specific jar file if it has been modified since it was last opened.

Throws:
IOException


Copyright © 2000-2008 Michael Bayne. All Rights Reserved.