Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.storage.sql
Class DefaultBinaryManager

java.lang.Object
  extended by org.nuxeo.ecm.core.storage.sql.DefaultBinaryManager
All Implemented Interfaces:
BinaryManager
Direct Known Subclasses:
XORBinaryManager

public class DefaultBinaryManager
extends java.lang.Object
implements BinaryManager

A simple filesystem-based binary manager. It stores the binaries according to their digest (hash), which means that no transactional behavior needs to be implemented.

A garbage collection is needed to purge unused binaries.

The format of the binaries directory is:

Author:
Florent Guillaume

Nested Class Summary
static class DefaultBinaryManager.NullBinaryScrambler
          A BinaryScrambler that does nothing.
static class DefaultBinaryManager.ScrambledBinary
          A Binary that is unscrambled on read using a BinaryScrambler.
static class DefaultBinaryManager.ScrambledFileInputStream
          A FileInputStream that is unscrambled on read using a BinaryScrambler.
static class DefaultBinaryManager.ScrambledStreamSource
          A FileSource that is unscrambled on read using a BinaryScrambler.
 
Field Summary
static java.lang.String CONFIG_FILE
           
static java.lang.String DATA
           
static int DEFAULT_DEPTH
           
static java.lang.String DEFAULT_DIGEST
           
static java.lang.String DEFAULT_PATH
           
static int MAX_BUF_SIZE
           
static int MIN_BUF_SIZE
           
static java.lang.String TMP
           
 
Constructor Summary
DefaultBinaryManager()
           
 
Method Summary
 Binary getBinary(java.io.InputStream in)
          Saves the given input stream into a Binary.
 Binary getBinary(java.lang.String digest)
          Returns a Binary corresponding to the given digest.
 java.io.File getFileForDigest(java.lang.String digest, boolean createDir)
          Gets a file representing the storage for a given digest.
 java.io.File getStorageDir()
           
 void initialize(RepositoryDescriptor repositoryDescriptor)
          Initializer.
static java.lang.String toHexString(byte[] data)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DIGEST

public static final java.lang.String DEFAULT_DIGEST
See Also:
Constant Field Values

DEFAULT_DEPTH

public static final int DEFAULT_DEPTH
See Also:
Constant Field Values

DEFAULT_PATH

public static final java.lang.String DEFAULT_PATH
See Also:
Constant Field Values

DATA

public static final java.lang.String DATA
See Also:
Constant Field Values

TMP

public static final java.lang.String TMP
See Also:
Constant Field Values

CONFIG_FILE

public static final java.lang.String CONFIG_FILE
See Also:
Constant Field Values

MIN_BUF_SIZE

public static final int MIN_BUF_SIZE
See Also:
Constant Field Values

MAX_BUF_SIZE

public static final int MAX_BUF_SIZE
See Also:
Constant Field Values
Constructor Detail

DefaultBinaryManager

public DefaultBinaryManager()
Method Detail

initialize

public void initialize(RepositoryDescriptor repositoryDescriptor)
                throws java.io.IOException
Description copied from interface: BinaryManager
Initializer.

Specified by:
initialize in interface BinaryManager
Throws:
java.io.IOException

getStorageDir

public java.io.File getStorageDir()

getBinary

public Binary getBinary(java.io.InputStream in)
                 throws java.io.IOException
Description copied from interface: BinaryManager
Saves the given input stream into a Binary.

Returns a Binary representing the stream. The Binary includes a digest that is a sufficient representation to persist it.

Specified by:
getBinary in interface BinaryManager
Parameters:
in - the input stream
Returns:
the corresponding binary
Throws:
java.io.IOException

getBinary

public Binary getBinary(java.lang.String digest)
Description copied from interface: BinaryManager
Returns a Binary corresponding to the given digest.

A null is returned if the digest could not be found.

Specified by:
getBinary in interface BinaryManager
Parameters:
digest - the digest, or null
Returns:
the corresponding binary

getFileForDigest

public java.io.File getFileForDigest(java.lang.String digest,
                                     boolean createDir)
Gets a file representing the storage for a given digest.

Parameters:
digest - the digest
createDir - true if the directory containing the file itself must be created
Returns:
the file for this digest

toHexString

public static java.lang.String toHexString(byte[] data)

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.