public abstract class AbstractBinaryManager extends Object implements BinaryManager
| Modifier and Type | Field and Description |
|---|---|
protected String |
blobProviderId |
static int |
DEFAULT_DEPTH |
static String |
DEFAULT_DIGEST |
protected BinaryManagerRootDescriptor |
descriptor |
static HashMap<Integer,String> |
DIGESTS_BY_LENGTH |
protected BinaryGarbageCollector |
garbageCollector |
static int |
MAX_BUF_SIZE |
static String |
MD5_DIGEST |
static int |
MD5_DIGEST_LENGTH |
static int |
MIN_BUF_SIZE |
static String |
SHA1_DIGEST |
static int |
SHA1_DIGEST_LENGTH |
static String |
SHA256_DIGEST |
static int |
SHA256_DIGEST_LENGTH |
PROP_KEY, PROP_PATH| Constructor and Description |
|---|
AbstractBinaryManager() |
| Modifier and Type | Method and Description |
|---|---|
Binary |
getBinary(Blob blob)
Saves the given blob into a
Binary. |
protected abstract Binary |
getBinary(InputStream in)
Creates a binary value from the given input stream.
|
abstract Binary |
getBinary(String digest)
Returns a
Binary corresponding to the given digest. |
protected String |
getDefaultDigestAlgorithm()
Gets the default message digest to use to hash binaries.
|
protected BinaryManagerRootDescriptor |
getDescriptor(File configFile)
Gets existing descriptor or creates a default one.
|
String |
getDigestAlgorithm()
Returns the digest algorithm used to store and digest binaries.
|
BinaryGarbageCollector |
getGarbageCollector()
Returns the Binary Garbage Collector that can be used for this binary manager.
|
void |
initialize(String blobProviderId,
Map<String,String> properties)
Initializes the binary manager.
|
void |
removeBinaries(Collection<String> digests)
Remove definitively a set of binaries
|
protected String |
storeAndDigest(InputStream in,
OutputStream out) |
static String |
toHexString(byte[] data) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclosepublic static final String MD5_DIGEST
public static final String SHA1_DIGEST
public static final String SHA256_DIGEST
public static final int MD5_DIGEST_LENGTH
public static final int SHA1_DIGEST_LENGTH
public static final int SHA256_DIGEST_LENGTH
public static final HashMap<Integer,String> DIGESTS_BY_LENGTH
public static final String DEFAULT_DIGEST
public static final int DEFAULT_DEPTH
protected String blobProviderId
protected BinaryManagerRootDescriptor descriptor
protected BinaryGarbageCollector garbageCollector
public static final int MIN_BUF_SIZE
public static final int MAX_BUF_SIZE
public AbstractBinaryManager()
public void initialize(String blobProviderId, Map<String,String> properties) throws IOException
BinaryManagerinitialize in interface BinaryManagerblobProviderId - the blob provider id for this binary managerproperties - initialization propertiesIOExceptionprotected abstract Binary getBinary(InputStream in) throws IOException
IOExceptionpublic Binary getBinary(Blob blob) throws IOException
BinaryManagerBinary.
Returns a Binary representing the stream. The Binary includes 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.
getBinary in interface BinaryManagerblob - the blobIOExceptionpublic abstract Binary getBinary(String digest)
BinaryManagerBinary corresponding to the given digest.
A null is returned if the digest could not be found.
getBinary in interface BinaryManagerdigest - the digest, or nullpublic void removeBinaries(Collection<String> digests)
BinaryManagerremoveBinaries in interface BinaryManagerdigests - a set of digests, must not be null.protected BinaryManagerRootDescriptor getDescriptor(File configFile) throws IOException
IOExceptionprotected String storeAndDigest(InputStream in, OutputStream out) throws IOException
IOExceptionpublic static String toHexString(byte[] data)
public BinaryGarbageCollector getGarbageCollector()
BinaryManager
Several calls to this method will return the same GC, so that its status can be monitored using
BinaryGarbageCollector.isInProgress().
getGarbageCollector in interface BinaryManagerpublic String getDigestAlgorithm()
BinaryManagergetDigestAlgorithm in interface BinaryManagerprotected String getDefaultDigestAlgorithm()
Copyright © 2019 Nuxeo. All rights reserved.