public class EncryptingDataSource
extends java.lang.Object
implements javax.sql.DataSource
| Constructor and Description |
|---|
EncryptingDataSource(javax.sql.DataSource delegate,
java.util.Properties encryptionProperties)
Creates an encrypting DataSource that wraps the provided DataSource.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the encryption plugin and releases resources.
|
java.sql.Connection |
getConnection() |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password) |
javax.sql.DataSource |
getDelegate()
Gets the underlying DataSource.
|
KmsEncryptionUtility |
getEncryptionPlugin()
Gets the encryption plugin instance.
|
int |
getLoginTimeout() |
java.io.PrintWriter |
getLogWriter() |
java.util.logging.Logger |
getParentLogger() |
boolean |
isClosed()
Checks if this DataSource has been closed.
|
boolean |
isConnectionAvailable()
Tests if the DataSource can provide a valid connection.
|
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(java.io.PrintWriter out) |
<T> T |
unwrap(java.lang.Class<T> iface) |
public EncryptingDataSource(javax.sql.DataSource delegate,
java.util.Properties encryptionProperties)
throws java.sql.SQLException
delegate - The underlying DataSource to wrapencryptionProperties - Properties for configuring encryptionjava.sql.SQLException - if encryption plugin initialization failspublic java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic java.sql.Connection getConnection(java.lang.String username,
java.lang.String password)
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic java.io.PrintWriter getLogWriter()
throws java.sql.SQLException
getLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic void setLogWriter(java.io.PrintWriter out)
throws java.sql.SQLException
setLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic void setLoginTimeout(int seconds)
throws java.sql.SQLException
setLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic int getLoginTimeout()
throws java.sql.SQLException
getLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic java.util.logging.Logger getParentLogger()
throws java.sql.SQLFeatureNotSupportedException
getParentLogger in interface javax.sql.CommonDataSourcejava.sql.SQLFeatureNotSupportedExceptionpublic <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap in interface java.sql.Wrapperjava.sql.SQLExceptionpublic boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperjava.sql.SQLExceptionpublic javax.sql.DataSource getDelegate()
public KmsEncryptionUtility getEncryptionPlugin()
public boolean isConnectionAvailable()
public void close()
public boolean isClosed()