public class SQLBinaryManager extends CachingBinaryManager
The BLOBs are cached locally on first access for efficiency.
Because the BLOB length can be accessed independently of the binary stream, it is also cached in a simple text file if accessed before the stream.
Modifier and Type | Class and Description |
---|---|
static class |
SQLBinaryManager.SQLBinaryGarbageCollector |
class |
SQLBinaryManager.SQLFileStorage |
Modifier and Type | Field and Description |
---|---|
static String |
CACHE_SIZE_PREFIX |
static String |
CACHE_SIZE_PROP |
protected String |
checkSql |
static String |
COL_BIN |
static String |
COL_ID |
static String |
COL_MARK |
protected String |
dataSourceName |
static String |
DEFAULT_CACHE_SIZE |
protected static boolean |
disableCheckExisting |
static String |
DS_PREFIX |
static String |
DS_PROP |
protected String |
gcMarkSql |
protected String |
gcStartSql |
protected String |
gcStatsSql |
protected String |
gcSweepSql |
protected String |
getLengthSql |
protected String |
getSql |
protected String |
putSql |
protected static boolean |
resetCache |
static String |
TABLE_PREFIX |
static String |
TABLE_PROP |
cachedir, fileCache, fileStorage, LEN_DIGEST_SUFFIX
blobProviderId, DEFAULT_DEPTH, DEFAULT_DIGEST, descriptor, DIGESTS_BY_LENGTH, garbageCollector, MAX_BUF_SIZE, MD5_DIGEST, MD5_DIGEST_LENGTH, MIN_BUF_SIZE, SHA1_DIGEST, SHA1_DIGEST_LENGTH, SHA256_DIGEST, SHA256_DIGEST_LENGTH
PROP_KEY, PROP_PATH
Constructor and Description |
---|
SQLBinaryManager() |
Modifier and Type | Method and Description |
---|---|
protected void |
createGarbageCollector() |
protected void |
createSql(String tableName) |
Binary |
getBinary(InputStream in)
Creates a binary value from the given input stream.
|
Binary |
getBinary(String digest)
Returns a
Binary corresponding to the given digest. |
protected Connection |
getConnection() |
protected Dialect |
getDialect() |
void |
initialize(String blobProviderId,
Map<String,String> properties)
Initializes the binary manager.
|
protected static boolean |
isDuplicateKeyException(SQLException e) |
protected static String |
loggedValue(Serializable value) |
protected static void |
logSQL(String sql,
Serializable... values) |
close, getFile, getLength, getLengthFromCache, initializeCache, initializeCache, putLengthInCache
getBinary, getDefaultDigestAlgorithm, getDescriptor, getDigestAlgorithm, getGarbageCollector, removeBinaries, storeAndDigest, toHexString
public static final String DS_PROP
public static final String DS_PREFIX
public static final String TABLE_PROP
public static final String TABLE_PREFIX
public static final String CACHE_SIZE_PROP
public static final String CACHE_SIZE_PREFIX
public static final String DEFAULT_CACHE_SIZE
public static final String COL_ID
public static final String COL_BIN
public static final String COL_MARK
protected String dataSourceName
protected String getLengthSql
protected String gcStartSql
protected String gcStatsSql
protected String gcSweepSql
protected static boolean disableCheckExisting
protected static boolean resetCache
public SQLBinaryManager()
public void initialize(String blobProviderId, Map<String,String> properties) throws IOException
BinaryManager
initialize
in interface BinaryManager
initialize
in class CachingBinaryManager
blobProviderId
- the blob provider id for this binary managerproperties
- initialization propertiesIOException
protected void createGarbageCollector()
protected void createSql(String tableName) throws IOException
IOException
protected Dialect getDialect() throws IOException
IOException
protected Connection getConnection() throws SQLException
SQLException
protected static void logSQL(String sql, Serializable... values)
protected static String loggedValue(Serializable value)
protected static boolean isDuplicateKeyException(SQLException e)
public Binary getBinary(String digest)
BinaryManager
Binary
corresponding to the given digest.
A null
is returned if the digest could not be found.
getBinary
in interface BinaryManager
getBinary
in class CachingBinaryManager
digest
- the digest, or null
public Binary getBinary(InputStream in) throws IOException
AbstractBinaryManager
getBinary
in class CachingBinaryManager
IOException
Copyright © 2015 Nuxeo SA. All rights reserved.