org.orbeon.oxf.resources
Class FilesystemResourceManagerImpl

java.lang.Object
  extended by ResourceManagerBase
      extended by org.orbeon.oxf.resources.FilesystemResourceManagerImpl
Direct Known Subclasses:
FlatFileResourceManagerImpl

public class FilesystemResourceManagerImpl
extends ResourceManagerBase

The Filesystem resource manager is able to load resources from the filesystem with a direct mapping, or, if the property is specified, within a sandbox.


Field Summary
protected  File rootDirectory
           
 
Constructor Summary
FilesystemResourceManagerImpl(Map props)
           
 
Method Summary
 boolean canWrite(String key)
          Indicates if the resource manager implementation supports write operations
 Reader getContentAsReader(String key)
          Returns a character reader from the resource manager for the specified key.
 InputStream getContentAsStream(String key)
          Returns a binary input stream for the specified key.
protected  File getFile(String key)
           
 OutputStream getOutputStream(String key)
          Allows writing to the resource
 String getRealPath(String key)
           
 Writer getWriter(String key)
          Allow writing to the resource
protected  long lastModifiedImpl(String key, boolean doNotThrowResourceNotFound)
          Gets the last modified timestamp for the specified resource
 int length(String key)
          Returns the length of the file denoted by this abstract pathname.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootDirectory

protected File rootDirectory
Constructor Detail

FilesystemResourceManagerImpl

public FilesystemResourceManagerImpl(Map props)
                              throws OXFException
Throws:
OXFException
Method Detail

getContentAsStream

public InputStream getContentAsStream(String key)
Returns a binary input stream for the specified key. The key could point to any document type (text or binary).

Parameters:
key - A Resource Manager key
Returns:
a input stream

getContentAsReader

public Reader getContentAsReader(String key)
Returns a character reader from the resource manager for the specified key. The key could point to any text document.

Parameters:
key - A Resource Manager key
Returns:
a character reader

lastModifiedImpl

protected long lastModifiedImpl(String key,
                                boolean doNotThrowResourceNotFound)
Gets the last modified timestamp for the specified resource

Parameters:
key - A Resource Manager key
doNotThrowResourceNotFound -
Returns:
a timestamp

length

public int length(String key)
Returns the length of the file denoted by this abstract pathname.

Returns:
The length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist

canWrite

public boolean canWrite(String key)
Indicates if the resource manager implementation supports write operations

Returns:
true if write operations are allowed

getOutputStream

public OutputStream getOutputStream(String key)
Allows writing to the resource

Parameters:
key - A Resource Manager key
Returns:
an output stream

getWriter

public Writer getWriter(String key)
Allow writing to the resource

Parameters:
key - A Resource Manager key
Returns:
a writer

getFile

protected File getFile(String key)

getRealPath

public String getRealPath(String key)