public abstract class AbstractLobType extends AbstractHibernateType
AbstractHibernateType for LOB types that encrypts as well as compresses
arbitrarily large binary data.AbstractHibernateTypeDEFAULT_CHARSET, random| Constructor and Description |
|---|
AbstractLobType() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configure(Properties parameters)
Loads the encryptor and any other necessary instance variables.
|
protected abstract Object |
createLob(byte[] bytes,
SessionImplementor session)
Converts the InputStream to a LOB.
|
protected abstract Object |
createLob(InputStream is,
long length,
SessionImplementor session)
Converts the InputStream to a LOB.
|
protected File |
createTempFile()
Returns a newly created temp file.
|
protected Object |
decrypt(String value)
Decrypts the given string using an appropriate method for the object type.
|
protected InputStream |
decryptStream(InputStream is)
Decrypts the given InputStream.
|
protected String |
encrypt(Object value)
Encrypts the given object using an appropriate method for the object type.
|
protected InputStream |
encryptStream(InputStream is)
Encrypts the given InputStream.
|
protected String |
generateTempFileName()
Returns a temp file name based on the current time and a random number.
|
protected int |
getMaxInMemoryBuffSize()
Returns the maxInMemoryBuffSize.
|
protected int |
getStreamBuffSize()
Returns the streamBuffSize.
|
protected void |
initializeIfNot() |
protected boolean |
isUseCompression()
Returns the useCompression.
|
protected abstract InputStream |
lobToStream(Object value)
Converts the LOB value to an InputStream.
|
Object |
nullSafeGet(ResultSet rs,
String[] names,
SessionImplementor session,
Object owner) |
void |
nullSafeSet(PreparedStatement st,
Object value,
int index,
SessionImplementor session) |
abstract Class<?> |
returnedClass() |
protected void |
setStream(PreparedStatement st,
int index,
InputStream is)
Sets the InputStream on the given PreparedStatement.
|
int[] |
sqlTypes() |
protected Object |
streamToLob(InputStream is,
SessionImplementor session) |
assemble, deepCopy, disassemble, equals, getCharset, getEncryptor, hashCode, isMutable, replace, setCharset, setParameterValuespublic int[] sqlTypes()
sqlTypes in interface UserTypesqlTypes in class AbstractHibernateTypeprotected void configure(Properties parameters)
configure in class AbstractHibernateTypeparameters - the parameter valuesprotected void initializeIfNot()
initializeIfNot in class AbstractHibernateTypepublic void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException
nullSafeSet in interface UserTypenullSafeSet in class AbstractHibernateTypeHibernateExceptionSQLExceptionpublic Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException
nullSafeGet in interface UserTypenullSafeGet in class AbstractHibernateTypeHibernateExceptionSQLExceptionprotected InputStream encryptStream(InputStream is) throws GeneralSecurityException, IOException
is - the InputStreamGeneralSecurityException - GeneralSecurityExceptionIOException - IOExceptionprotected InputStream decryptStream(InputStream is) throws GeneralSecurityException, IOException
is - the InputStreamGeneralSecurityException - GeneralSecurityExceptionIOException - IOExceptionprotected void setStream(PreparedStatement st, int index, InputStream is) throws IOException, SQLException
st - the PreparedStatementindex - the parameter indexis - the InputStreamIOException - IOExceptionSQLException - SQLExceptionprotected Object streamToLob(InputStream is, SessionImplementor session) throws IOException
IOExceptionprotected File createTempFile() throws IOException
IOException - IOExceptionprotected String generateTempFileName()
protected abstract InputStream lobToStream(Object value) throws SQLException
value - the LOB valueSQLException - an error converting the value to an InputStreamprotected abstract Object createLob(InputStream is, long length, SessionImplementor session) throws IOException
is - the InputStreamlength - the stream lengthsession - the SessionImplementorIOException - an error converting the stream to a LOBprotected abstract Object createLob(byte[] bytes, SessionImplementor session) throws IOException
bytes - the bytessession - the SessionImplementorIOException - an error converting the stream to a LOBprotected Object decrypt(String value) throws GeneralSecurityException
decrypt in class AbstractHibernateTypevalue - the string to be decryptedGeneralSecurityException - GeneralSecurityExceptionprotected String encrypt(Object value) throws GeneralSecurityException
encrypt in class AbstractHibernateTypevalue - the object to be encryptedGeneralSecurityException - GeneralSecurityExceptionpublic abstract Class<?> returnedClass()
protected boolean isUseCompression()
protected int getStreamBuffSize()
protected int getMaxInMemoryBuffSize()