net.shibboleth.utilities.java.support.resource
Class FilesystemResource

java.lang.Object
  extended by net.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent
      extended by net.shibboleth.utilities.java.support.resource.AbstractResource
          extended by net.shibboleth.utilities.java.support.resource.FilesystemResource
All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, ValidatableComponent, Resource

public class FilesystemResource
extends AbstractResource

An Resource that reads data from a fileystem file.


Field Summary
private  File resourceFile
          Filesytem file read by this resource.
 
Constructor Summary
FilesystemResource(String resourcePath)
          Constructor.
 
Method Summary
protected  boolean doExists()
          Checks whether the resource exists.
protected  InputStream doGetInputStream()
          Gets the input stream to the resource's data.
protected  long doGetLastModifiedTime()
          Gets the time, in milliseconds since the epoch, when the resource was last modified.
 
Methods inherited from class net.shibboleth.utilities.java.support.resource.AbstractResource
doValidate, equals, exists, getInputStream, getLastModifiedTime, getLocation, hashCode, setLocation, toString, validate
 
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent
destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.shibboleth.utilities.java.support.component.DestructableComponent
destroy, isDestroyed
 
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
 

Field Detail

resourceFile

private final File resourceFile
Filesytem file read by this resource.

Constructor Detail

FilesystemResource

public FilesystemResource(String resourcePath)
Constructor. The file character set is set to the system default character set.

Parameters:
resourcePath - file read by this resource, never null or empty
Method Detail

doExists

protected boolean doExists()
                    throws ResourceException
Checks whether the resource exists.

Specified by:
doExists in class AbstractResource
Returns:
true if the resource exists, false if not
Throws:
ResourceException - thrown if there is a problem determining if the resource exists

doGetInputStream

protected InputStream doGetInputStream()
                                throws ResourceException
Gets the input stream to the resource's data.

Specified by:
doGetInputStream in class AbstractResource
Returns:
input stream to the resource's data
Throws:
ResourceException - thrown if an input stream can not be created for the resource

doGetLastModifiedTime

protected long doGetLastModifiedTime()
                              throws ResourceException
Gets the time, in milliseconds since the epoch, when the resource was last modified.

Specified by:
doGetLastModifiedTime in class AbstractResource
Returns:
time, in milliseconds since the epoch, when the resource was last modified
Throws:
ResourceException - thrown if the last modified time can not be determined


Copyright © 1999-2012. All Rights Reserved.