|
ModeShape Distribution 3.0.0.CR1 | |||||||||
| 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.FileSystemBinaryStore
@ThreadSafe public class FileSystemBinaryStore
A BinaryStore that stores files in a directory on the file system. The store does use file locks to prevent other
processes from concurrently writing the files, and it also uses an internal set of locks to prevent mulitple threads from
simultaneously writing to the persisted files.
| Field Summary | |
|---|---|
protected static String |
TRASH_DIRECTORY_NAME
|
| Fields inherited from class org.modeshape.jcr.value.binary.AbstractBinaryStore |
|---|
logger, MEDIUM_BUFFER_SIZE |
| Constructor Summary | |
|---|---|
protected |
FileSystemBinaryStore(File directory)
|
| Method Summary | |
|---|---|
static FileSystemBinaryStore |
create(File directory)
|
protected File |
findFile(File directory,
BinaryKey key,
boolean createParentDirsIfMissing)
|
Iterable<BinaryKey> |
getAllBinaryKeys()
Obtain an iterable implementation containing all of the store's binary keys. |
File |
getDirectory()
|
String |
getExtractedText(BinaryValue source)
Returns the extracted text of a binary value, or null if such text hasn't been stored previously (but the binary
value can be found in the store) |
InputStream |
getInputStream(BinaryKey key)
Get an InputStream to the binary content with the supplied key. |
protected String |
getStoredMimeType(BinaryValue binaryValue)
Returns the stored mime-type of a binary value. |
protected void |
initializeStorage(File directory)
|
protected void |
markAsUnused(BinaryKey key)
|
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. |
protected void |
moveFileExclusively(File original,
File destination)
|
protected void |
pruneEmptyDirectories(File directory,
File removeable)
Remove any empty directories above removeable but below directory |
void |
removeValuesUnusedLongerThan(long minimumAge,
TimeUnit unit)
Remove binary values that have been unused for at least the specified amount of time. |
void |
storeExtractedText(BinaryValue source,
String extractedText)
Stores the extracted text of a binary value into this store. |
protected void |
storeMimeType(BinaryValue binaryValue,
String mimeType)
Stores the given mime-type for a binary value. |
BinaryValue |
storeValue(InputStream stream)
Store the binary value and return the JCR representation. |
protected void |
touch(File file)
|
| Methods inherited from class org.modeshape.jcr.value.binary.AbstractBinaryStore |
|---|
bestBufferSize, detector, extractors, getMimeType, getMinimumBinarySizeInBytes, getText, setMimeTypeDetector, setMinimumBinarySizeInBytes, setTextExtractors, shutdown, start |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String TRASH_DIRECTORY_NAME
| Constructor Detail |
|---|
protected FileSystemBinaryStore(File directory)
| Method Detail |
|---|
public static FileSystemBinaryStore create(File directory)
public File getDirectory()
public BinaryValue storeValue(InputStream stream)
throws BinaryStoreException
BinaryStore
stream - the stream containing the binary content to be stored; may not be null
BinaryStoreException - if there any unexpected problem
protected final void moveFileExclusively(File original,
File destination)
throws BinaryStoreException
BinaryStoreException
protected final File findFile(File directory,
BinaryKey key,
boolean createParentDirsIfMissing)
throws BinaryStoreException
BinaryStoreException
public InputStream getInputStream(BinaryKey key)
throws BinaryStoreException
BinaryStoreInputStream to the binary content with the supplied key.
key - the key to the binary content; never null
never null
BinaryStoreException - if there is a problem reading the content from the store or if a valid, non-null
InputStream cannot be returned for the given key.
protected void initializeStorage(File directory)
throws BinaryStoreException
BinaryStoreException
public void markAsUnused(Iterable<BinaryKey> keys)
throws BinaryStoreException
BinaryStoreBinaryStore.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 unused
protected void markAsUnused(BinaryKey key)
throws BinaryStoreException
BinaryStoreException
protected void touch(File file)
throws BinaryStoreException
BinaryStoreException
protected void pruneEmptyDirectories(File directory,
File removeable)
removeable but below directory
directory - the top-level directory to keep; may not be null and must be an ancestor of removeableremoveable - the file or directory above which any empty directories can be removed; may not be null
public void removeValuesUnusedLongerThan(long minimumAge,
TimeUnit unit)
throws BinaryStoreException
BinaryStoreunused 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 values
public String getExtractedText(BinaryValue source)
throws BinaryStoreException
AbstractBinaryStorenull if such text hasn't been stored previously (but the binary
value can be found in the store)
getExtractedText in class AbstractBinaryStoresource - 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 binary value cannot be found in the store.
public void storeExtractedText(BinaryValue source,
String extractedText)
throws BinaryStoreException
AbstractBinaryStore
storeExtractedText in class AbstractBinaryStoresource - 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 or if the extracted text cannot be stored for the given binary value
(regardless of the reason)
protected String getStoredMimeType(BinaryValue binaryValue)
throws BinaryStoreException
AbstractBinaryStore
getStoredMimeType in class AbstractBinaryStorebinaryValue - 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 store or if the binary value cannot be found in the
store
protected void storeMimeType(BinaryValue binaryValue,
String mimeType)
throws BinaryStoreException
AbstractBinaryStore
storeMimeType in class AbstractBinaryStorebinaryValue - a non-null BinaryValuemimeType - a non-empty String
BinaryStoreException - if there's a problem accessing the binary storepublic Iterable<BinaryKey> getAllBinaryKeys()
BinaryStoreBinaryKeys only as the iterator is used.
|
ModeShape Distribution 3.0.0.CR1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||