org.orbeon.oxf.resources
Class DBResourceManagerImpl

java.lang.Object
  extended byorg.orbeon.oxf.resources.ResourceManagerBase
      extended byorg.orbeon.oxf.resources.DBResourceManagerImpl
All Implemented Interfaces:
ResourceManager
Direct Known Subclasses:
DataSourceResourceManagerImpl

public class DBResourceManagerImpl
extends org.orbeon.oxf.resources.ResourceManagerBase

The database resource manager is able to load resource from a relational database. It can be initialized frm either a JDBC URL or from a datasource.

See Also:
DataSourceResourceManagerImpl

Nested Class Summary
 
Nested classes inherited from class org.orbeon.oxf.resources.ResourceManagerBase
org.orbeon.oxf.resources.ResourceManagerBase.ResourceManagerXMLReader
 
Constructor Summary
DBResourceManagerImpl(Map props, Connection connection)
           
 
Method Summary
 boolean canWrite(String key)
          Indicates if the resource manager implementation suports write operations
protected  void closeConnection(Connection connection)
           
protected  Connection getConnection()
           
 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.
 OutputStream getOutputStream(String key)
          Allows writing to the resource
 String getRealPath(String key)
          Returns the path to the given resource on the file system.
 Writer getWriter(String key)
          Allow writing to the resource
 long lastModifiedImpl(String key)
          Gets the last modified timestamp for the specofoed resource
 int length(String key)
          Returns the length of the file denoted by this abstract pathname.
protected  void setConnection(Connection connection)
           
 
Methods inherited from class org.orbeon.oxf.resources.ResourceManagerBase
getContentAsDOM, getContentAsDOM4J, getContentAsSAX, getContentAsSAX, getWriteContentHandler, getXMLReader, getXMLReader, invalidateLastModifiedCache, lastModified, writeDOM, writeDOM4J
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBResourceManagerImpl

public DBResourceManagerImpl(Map props,
                             Connection connection)
Method Detail

getConnection

protected Connection getConnection()
                            throws SQLException
Throws:
SQLException

setConnection

protected void setConnection(Connection connection)

closeConnection

protected void closeConnection(Connection connection)
                        throws SQLException
Throws:
SQLException

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

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

lastModifiedImpl

public long lastModifiedImpl(String key)
Gets the last modified timestamp for the specofoed resource

Parameters:
key - A Resource Manager key
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 suports write operations

Parameters:
key - A Resource Manager key
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

getRealPath

public String getRealPath(String key)
Description copied from interface: ResourceManager
Returns the path to the given resource on the file system. If a path on the local file system cannot be provided by the resource manager, null is returned.