org.outerj.daisy.blobstore.impl
Class FSBlobStore

java.lang.Object
  extended byorg.outerj.daisy.blobstore.impl.FSBlobStore
All Implemented Interfaces:
BlobStore, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable

public class FSBlobStore
extends java.lang.Object
implements BlobStore, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable

Implementation of BlobStore that stores blobs in a directory on the filesystem.

This class in an Avalon component, and hence its lifecycle interfaces should be respected before being used.


Constructor Summary
FSBlobStore()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 void delete(java.lang.String name)
           
 void initialize()
           
 java.io.InputStream retrieve(java.lang.String name)
          The caller is responsible himself that a file is not being read before it is completely written.
 java.lang.String store(byte[] data)
          Returns an auto-generated key by which the blob can later be retrieved.
 java.lang.String store(java.io.InputStream is)
          Returns an auto-generated key by which the blob can later be retrieved.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FSBlobStore

public FSBlobStore()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

initialize

public void initialize()
                throws java.lang.Exception
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
java.lang.Exception

delete

public void delete(java.lang.String name)
            throws NonExistingBlobException
Specified by:
delete in interface BlobStore
Throws:
NonExistingBlobException

store

public java.lang.String store(byte[] data)
                       throws BlobIOException
Description copied from interface: BlobStore
Returns an auto-generated key by which the blob can later be retrieved.

Specified by:
store in interface BlobStore
Throws:
BlobIOException

store

public java.lang.String store(java.io.InputStream is)
                       throws BlobIOException
Description copied from interface: BlobStore
Returns an auto-generated key by which the blob can later be retrieved. The InputStream will be closed for you.

Specified by:
store in interface BlobStore
Throws:
BlobIOException

retrieve

public java.io.InputStream retrieve(java.lang.String name)
                             throws BlobIOException,
                                    NonExistingBlobException
Description copied from interface: BlobStore
The caller is responsible himself that a file is not being read before it is completely written. The caller is also responsible for making sure the stream gets closed, otherwise resource might leak (thus: always in a try-catch block!).

Specified by:
retrieve in interface BlobStore
Throws:
BlobIOException
NonExistingBlobException


Copyright © -2005 . All Rights Reserved.