|
ModeShape Distribution 3.0.0.Beta3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.modeshape.jcr.value.binary.AbstractBinaryStore
@ThreadSafe public abstract class AbstractBinaryStore
An abstract class for a BinaryStore, with common functionality needed by implementation classes.
| Field Summary | |
|---|---|
protected Logger |
logger
|
protected static int |
MEDIUM_BUFFER_SIZE
|
| Fields inherited from interface org.modeshape.jcr.value.binary.BinaryStore |
|---|
DEFAULT_MINIMUM_BINARY_SIZE_IN_BYTES |
| Constructor Summary | |
|---|---|
AbstractBinaryStore()
|
|
| Method Summary | |
|---|---|
static int |
bestBufferSize(long fileSize)
|
protected MimeTypeDetector |
detector()
Get the MIME type detector that can be used to find the MIME type for binary content |
protected TextExtractors |
extractors()
Get the text extractor that can be used to extract text by this store. |
String |
getMimeType(BinaryValue binary,
String name)
Get the MIME type for this binary value or null if the mime-type cannot be determined. |
long |
getMinimumBinarySizeInBytes()
Get the minimum number of bytes that a binary value must contain before it can be stored in the binary store. |
protected String |
getStoredMimeType(BinaryValue binaryValue)
Returns the stored mime-type of a binary value. |
String |
getText(BinaryValue binary)
Get the text that can be extracted from this binary content. |
void |
setMimeTypeDetector(MimeTypeDetector mimeTypeDetector)
Set the MIME type detector that can be used for determining the MIME type for binary content. |
void |
setMinimumBinarySizeInBytes(long minSizeInBytes)
Set the minimum number of bytes that a binary value must contain before it can be stored in the binary store. |
void |
setTextExtractors(TextExtractors textExtractors)
Set the text extractor that can be used for extracting text from binary content. |
void |
shutdown()
|
void |
start()
Initialize the store and get ready for use. |
protected void |
storeMimeType(BinaryValue binaryValue,
String mimeType)
Stores the given mime-type for a binary value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.modeshape.jcr.value.binary.BinaryStore |
|---|
getAllBinaryKeys, getExtractedText, getInputStream, markAsUnused, removeValuesUnusedLongerThan, storeExtractedText, storeValue |
| Field Detail |
|---|
protected static final int MEDIUM_BUFFER_SIZE
protected Logger logger
| Constructor Detail |
|---|
public AbstractBinaryStore()
| Method Detail |
|---|
public static int bestBufferSize(long fileSize)
public long getMinimumBinarySizeInBytes()
BinaryStore
getMinimumBinarySizeInBytes in interface BinaryStorepublic void setMinimumBinarySizeInBytes(long minSizeInBytes)
BinaryStore
setMinimumBinarySizeInBytes in interface BinaryStoreminSizeInBytes - the minimum number of bytes for a stored binary value; may not be negativepublic void setTextExtractors(TextExtractors textExtractors)
BinaryStore
setTextExtractors in interface BinaryStoretextExtractors - a non-null TextExtractors instancepublic void setMimeTypeDetector(MimeTypeDetector mimeTypeDetector)
BinaryStore
setMimeTypeDetector in interface BinaryStoremimeTypeDetector - the detector
public final String getText(BinaryValue binary)
throws BinaryStoreException
BinaryStorenull
If extraction is enabled, this method may block until a text extractor has finished extracting the text.
If there are any problems either with the binary value or during the extraction process, the exception will be logged and
null is returned
AbstractBinaryStore should be enough and any custom BinaryStore
implementations aren't expected to implement this.
getText in interface BinaryStorebinary - the binary content; may not be null
BinaryStoreException - if the binary content could not be accessed
public String getMimeType(BinaryValue binary,
String name)
throws IOException,
RepositoryException
BinaryStorenull if the mime-type cannot be determined.
getMimeType in interface BinaryStorebinary - the binary content; may not be nullname - the name of the content, useful for determining the MIME type; may be null if not known
IOException - if there is a problem reading the binary content
RepositoryException - if any other error occurs.
protected String getStoredMimeType(BinaryValue binaryValue)
throws BinaryStoreException
binaryValue - 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
protected void storeMimeType(BinaryValue binaryValue,
String mimeType)
throws BinaryStoreException
binaryValue - a non-null BinaryValuemimeType - a non-empty String
BinaryStoreException - if there's a problem accessing the binary storeprotected final TextExtractors extractors()
protected final MimeTypeDetector detector()
public void start()
public void shutdown()
|
ModeShape Distribution 3.0.0.Beta3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||