|
ModeShape Distribution 3.0.0.Beta2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.jcr.value.binary.AbstractBinaryStore
org.modeshape.jcr.value.binary.DatabaseBinaryStore
@ThreadSafe public class DatabaseBinaryStore
A BinaryStore
implementation that uses a database for persisting binary values.
Field Summary |
---|
Fields inherited from class org.modeshape.jcr.value.binary.AbstractBinaryStore |
---|
logger, MEDIUM_BUFFER_SIZE |
Fields inherited from interface org.modeshape.jcr.value.binary.BinaryStore |
---|
DEFAULT_MINIMUM_BINARY_SIZE_IN_BYTES |
Constructor Summary | |
---|---|
DatabaseBinaryStore(String datasourceJNDILocation)
Create new store that uses the JDBC DataSource in the given JNDI location. |
|
DatabaseBinaryStore(String driverClass,
String connectionURL,
String username,
String password)
Create new store. |
Method Summary | |
---|---|
protected Database |
doCreateDatabase(Connection connection)
|
String |
getExtractedText(BinaryValue source)
Retrieves the extracted text of a binary value, which may or may not have been stored previously. |
InputStream |
getInputStream(BinaryKey key)
Get an InputStream to the binary content with the supplied key. |
protected String |
getStoredMimeType(BinaryValue source)
Returns the stored mime-type of a binary value. |
void |
markAsUnused(Iterable<BinaryKey> keys)
Mark the supplied binary keys as unused, but key them in quarantine until needed again (at which point they're removed from quarantine) or until BinaryStore.removeValuesUnusedLongerThan(long, TimeUnit) is called. |
void |
removeValuesUnusedLongerThan(long minimumAge,
TimeUnit unit)
Remove binary values that have been unused for at least the specified amount of time. |
void |
shutdown()
|
void |
start()
Initialize the store and get ready for use. |
void |
storeExtractedText(BinaryValue source,
String extractedText)
Stores the extracted text of a binary value into this store. |
protected void |
storeMimeType(BinaryValue source,
String mimeType)
Stores the given mime-type for a binary value. |
BinaryValue |
storeValue(InputStream stream)
Store the binary value and return the JCR representation. |
Methods inherited from class org.modeshape.jcr.value.binary.AbstractBinaryStore |
---|
bestBufferSize, detector, extractors, getMimeType, getMinimumBinarySizeInBytes, getText, setMimeTypeDetector, setMinimumBinarySizeInBytes, setTextExtractors |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DatabaseBinaryStore(String driverClass, String connectionURL, String username, String password)
driverClass
- JDBC driver class nameconnectionURL
- database locationusername
- database user namepassword
- database passwordpublic DatabaseBinaryStore(String datasourceJNDILocation)
datasourceJNDILocation
- the JNDI name of the JDBC Data Source that should be used, or nullMethod Detail |
---|
public BinaryValue storeValue(InputStream stream) throws BinaryStoreException
BinaryStore
stream
- the stream containing the binary content to be stored; may not be null
BinaryStoreException
public InputStream getInputStream(BinaryKey key) throws BinaryStoreException
BinaryStore
InputStream
to the binary content with the supplied key.
key
- the key to the binary content; never null
BinaryStoreException
- if there is a problem reading the content from the storepublic void markAsUnused(Iterable<BinaryKey> keys) throws BinaryStoreException
BinaryStore
BinaryStore.removeValuesUnusedLongerThan(long, TimeUnit)
is called. This method ignores any keys for
values not stored within this store.
keys
- the keys for the binary values that are no longer needed
BinaryStoreException
- if there is a problem marking any of the supplied binary values as unusedpublic void removeValuesUnusedLongerThan(long minimumAge, TimeUnit unit) throws BinaryStoreException
BinaryStore
unused
for at least the specified amount of time.
minimumAge
- the minimum time that a binary value has been unused
before it can be
removed; must be non-negativeunit
- the time unit for the minimum age; may not be null
BinaryStoreException
- if there is a problem removing the unused valuesprotected String getStoredMimeType(BinaryValue source) throws BinaryStoreException
AbstractBinaryStore
getStoredMimeType
in class AbstractBinaryStore
source
- a non-null
BinaryValue
String
if a stored mimetype exists, or null
if such a value doesn't exist yet.
BinaryStoreException
- if there's a problem accessing the binary storeprotected void storeMimeType(BinaryValue source, String mimeType) throws BinaryStoreException
AbstractBinaryStore
storeMimeType
in class AbstractBinaryStore
source
- a non-null
BinaryValue
mimeType
- a non-empty String
BinaryStoreException
- if there's a problem accessing the binary storepublic String getExtractedText(BinaryValue source) throws BinaryStoreException
BinaryStore
source
- a non-null
BinaryValue
instance from which the text was extracted
String
representing the extracted text, or null
if such text hasn't been stored in this
store previously.
BinaryStoreException
- if the operation failspublic void storeExtractedText(BinaryValue source, String extractedText) throws BinaryStoreException
BinaryStore
source
- a non-null
BinaryValue
instance from which the text was extractedextractedText
- a non-null
and non-blank
string representing the extracted text
BinaryStoreException
- if the operation fails for whatever reasonpublic void start()
AbstractBinaryStore
start
in class AbstractBinaryStore
protected Database doCreateDatabase(Connection connection)
public void shutdown()
shutdown
in class AbstractBinaryStore
|
ModeShape Distribution 3.0.0.Beta2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |