org.apache.jackrabbit.core.persistence.mem
Class InMemBundlePersistenceManager.InMemBLOBStore

java.lang.Object
  extended by org.apache.jackrabbit.core.persistence.mem.InMemBundlePersistenceManager.InMemBLOBStore
All Implemented Interfaces:
InMemBundlePersistenceManager.CloseableBLOBStore, BLOBStore
Enclosing class:
InMemBundlePersistenceManager

protected class InMemBundlePersistenceManager.InMemBLOBStore
extends Object
implements InMemBundlePersistenceManager.CloseableBLOBStore

Trivial BLOBStore implementation that is backed by a HashMap.


Constructor Summary
InMemBundlePersistenceManager.InMemBLOBStore()
           
 
Method Summary
 void close()
          
 String createId(PropertyId id, int index)
          Creates a unique identifier for the BLOB data associated with the given property id and value subscript.
 InputStream get(String blobId)
          Retrieves the BLOB data with the specified id as a binary stream.
 void put(String blobId, InputStream in, long size)
          Stores the BLOB data and returns a unique identifier.
 boolean remove(String blobId)
          Removes the BLOB data with the specified id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemBundlePersistenceManager.InMemBLOBStore

public InMemBundlePersistenceManager.InMemBLOBStore()
Method Detail

createId

public String createId(PropertyId id,
                       int index)
Creates a unique identifier for the BLOB data associated with the given property id and value subscript.

Specified by:
createId in interface BLOBStore
Parameters:
id - id of the property associated with the BLOB data
index - subscript of the value holding the BLOB data
Returns:
a string identifying the BLOB data

put

public void put(String blobId,
                InputStream in,
                long size)
         throws Exception
Stores the BLOB data and returns a unique identifier.

Specified by:
put in interface BLOBStore
Parameters:
blobId - identifier of the BLOB data as returned by BLOBStore.createId(PropertyId, int)
in - stream containing the BLOB data
size - size of the BLOB data
Throws:
Exception - if an error occured

get

public InputStream get(String blobId)
                throws Exception
Retrieves the BLOB data with the specified id as a binary stream.

Specified by:
get in interface BLOBStore
Parameters:
blobId - identifier of the BLOB data as returned by BLOBStore.createId(PropertyId, int)
Returns:
an input stream that delivers the BLOB data
Throws:
Exception - if an error occured

remove

public boolean remove(String blobId)
               throws Exception
Removes the BLOB data with the specified id.

Specified by:
remove in interface BLOBStore
Parameters:
blobId - identifier of the BLOB data as returned by BLOBStore.createId(PropertyId, int)
Returns:
true if BLOB data with the given id exists and has been successfully removed, false if there's no BLOB data with the given id.
Throws:
Exception - if an error occured

close

public void close()

Specified by:
close in interface InMemBundlePersistenceManager.CloseableBLOBStore


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.