Package org.nuxeo.ecm.core.blob.binary
Class AbstractBinaryManager
- java.lang.Object
- 
- org.nuxeo.ecm.core.blob.binary.AbstractBinaryManager
 
- 
- All Implemented Interfaces:
- BinaryManager
 - Direct Known Subclasses:
- CachingBinaryManager,- GridFSBinaryManager,- LocalBinaryManager
 
 public abstract class AbstractBinaryManager extends Object implements BinaryManager Abstract BinaryManager implementation that provides a few utilities- Author:
- Florent Guillaume
 
- 
- 
Field SummaryFields Modifier and Type Field Description StringblobProviderIdstatic intDEFAULT_DEPTHstatic StringDEFAULT_DIGESTprotected BinaryManagerRootDescriptordescriptorprotected PatterndigestPatternstatic Map<Integer,String>DIGESTS_BY_LENGTHprotected BinaryGarbageCollectorgarbageCollectorstatic intMAX_BUF_SIZEstatic StringMD5_DIGESTstatic intMD5_DIGEST_LENGTHDeprecated.since 11.1, unusedstatic intMIN_BUF_SIZEprotected Map<String,String>propertiesstatic StringSHA1_DIGESTDeprecated.since 11.1, unusedstatic intSHA1_DIGEST_LENGTHDeprecated.since 11.1, unusedstatic StringSHA256_DIGESTDeprecated.since 11.1, unusedstatic intSHA256_DIGEST_LENGTHDeprecated.since 11.1, unused- 
Fields inherited from interface org.nuxeo.ecm.core.blob.binary.BinaryManagerPROP_KEY, PROP_PATH
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractBinaryManager()
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidcomputeDigestPattern()protected abstract BinarygetBinary(InputStream in)Creates a binary value from the given input stream.abstract BinarygetBinary(String digest)Returns aBinarycorresponding to the given digest.BinarygetBinary(Blob blob)Saves the given blob into aBinary.protected StringgetDefaultDigestAlgorithm()Gets the default message digest to use to hash binaries.protected BinaryManagerRootDescriptorgetDescriptor(File configFile)Gets existing descriptor or creates a default one.StringgetDigestAlgorithm()Returns the digest algorithm used to store and digest binaries.BinaryGarbageCollectorgetGarbageCollector()Returns the Binary Garbage Collector that can be used for this binary manager.voidinitialize(String blobProviderId, Map<String,String> properties)Initializes the binary manager.booleanisValidDigest(String digest)voidremoveBinaries(Collection<String> digests)Remove definitively a set of binariesprotected voidsetDescriptor(BinaryManagerRootDescriptor descriptor)protected StringstoreAndDigest(InputStream in, OutputStream out)static StringtoHexString(byte[] data)Deprecated.since 11.1, useHex.encodeHexString(byte[])directly- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.nuxeo.ecm.core.blob.binary.BinaryManagerclose
 
- 
 
- 
- 
- 
Field Detail- 
MD5_DIGESTpublic static final String MD5_DIGEST - See Also:
- Constant Field Values
 
 - 
SHA1_DIGEST@Deprecated public static final String SHA1_DIGEST Deprecated.since 11.1, unused- See Also:
- Constant Field Values
 
 - 
SHA256_DIGEST@Deprecated public static final String SHA256_DIGEST Deprecated.since 11.1, unused- See Also:
- Constant Field Values
 
 - 
MD5_DIGEST_LENGTH@Deprecated public static final int MD5_DIGEST_LENGTH Deprecated.since 11.1, unused- See Also:
- Constant Field Values
 
 - 
SHA1_DIGEST_LENGTH@Deprecated public static final int SHA1_DIGEST_LENGTH Deprecated.since 11.1, unused- See Also:
- Constant Field Values
 
 - 
SHA256_DIGEST_LENGTH@Deprecated public static final int SHA256_DIGEST_LENGTH Deprecated.since 11.1, unused- See Also:
- Constant Field Values
 
 - 
DIGESTS_BY_LENGTHpublic static final Map<Integer,String> DIGESTS_BY_LENGTH - Since:
- 7.4
 
 - 
DEFAULT_DIGESTpublic static final String DEFAULT_DIGEST - See Also:
- Constant Field Values
 
 - 
DEFAULT_DEPTHpublic static final int DEFAULT_DEPTH - See Also:
- Constant Field Values
 
 - 
blobProviderIdpublic String blobProviderId 
 - 
propertiesprotected Map<String,String> properties 
 - 
descriptorprotected BinaryManagerRootDescriptor descriptor 
 - 
garbageCollectorprotected BinaryGarbageCollector garbageCollector 
 - 
digestPatternprotected Pattern digestPattern 
 - 
MIN_BUF_SIZEpublic static final int MIN_BUF_SIZE - See Also:
- Constant Field Values
 
 - 
MAX_BUF_SIZEpublic static final int MAX_BUF_SIZE - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
AbstractBinaryManagerpublic AbstractBinaryManager() 
 
- 
 - 
Method Detail- 
initializepublic void initialize(String blobProviderId, Map<String,String> properties) throws IOException Description copied from interface:BinaryManagerInitializes the binary manager.- Specified by:
- initializein interface- BinaryManager
- Parameters:
- blobProviderId- the blob provider id for this binary manager
- properties- initialization properties
- Throws:
- IOException
 
 - 
setDescriptorprotected void setDescriptor(BinaryManagerRootDescriptor descriptor) 
 - 
getBinaryprotected abstract Binary getBinary(InputStream in) throws IOException Creates a binary value from the given input stream.- Throws:
- IOException
 
 - 
getBinarypublic Binary getBinary(Blob blob) throws IOException Description copied from interface:BinaryManagerSaves the given blob into aBinary.Returns a Binaryrepresenting the stream. TheBinaryincludes a digest that is a sufficient representation to persist it.If the blob is a temporary FileBlob, then the temporary file may be reused as the final storage location after being moved.- Specified by:
- getBinaryin interface- BinaryManager
- Parameters:
- blob- the blob
- Returns:
- the corresponding binary
- Throws:
- IOException
 
 - 
getBinarypublic abstract Binary getBinary(String digest) Description copied from interface:BinaryManagerReturns aBinarycorresponding to the given digest.A nullis returned if the digest could not be found.- Specified by:
- getBinaryin interface- BinaryManager
- Parameters:
- digest- the digest, or- null
- Returns:
- the corresponding binary
 
 - 
removeBinariespublic void removeBinaries(Collection<String> digests) Description copied from interface:BinaryManagerRemove definitively a set of binaries- Specified by:
- removeBinariesin interface- BinaryManager
- Parameters:
- digests- a set of digests, must not be- null.
 
 - 
getDescriptorprotected BinaryManagerRootDescriptor getDescriptor(File configFile) throws IOException Gets existing descriptor or creates a default one.- Throws:
- IOException
 
 - 
storeAndDigestprotected String storeAndDigest(InputStream in, OutputStream out) throws IOException - Throws:
- IOException
 
 - 
toHexString@Deprecated public static String toHexString(byte[] data) Deprecated.since 11.1, useHex.encodeHexString(byte[])directly
 - 
computeDigestPatternprotected void computeDigestPattern() 
 - 
isValidDigestpublic boolean isValidDigest(String digest) 
 - 
getGarbageCollectorpublic BinaryGarbageCollector getGarbageCollector() Description copied from interface:BinaryManagerReturns the Binary Garbage Collector that can be used for this binary manager.Several calls to this method will return the same GC, so that its status can be monitored using BinaryGarbageCollector.isInProgress().- Specified by:
- getGarbageCollectorin interface- BinaryManager
- Returns:
- the binary GC
 
 - 
getDigestAlgorithmpublic String getDigestAlgorithm() Description copied from interface:BinaryManagerReturns the digest algorithm used to store and digest binaries.- Specified by:
- getDigestAlgorithmin interface- BinaryManager
 
 - 
getDefaultDigestAlgorithmprotected String getDefaultDigestAlgorithm() Gets the default message digest to use to hash binaries.- Since:
- 6.0
 
 
- 
 
-