Class JdbcRevocationSource<R extends Revocation>
java.lang.Object
eu.europa.esig.dss.spi.x509.revocation.RepositoryRevocationSource<R>
eu.europa.esig.dss.spi.x509.revocation.JdbcRevocationSource<R>
- Type Parameters:
R
-CRL
orOCSP
- All Implemented Interfaces:
RevocationSource<R>
,Serializable
- Direct Known Subclasses:
JdbcCacheCRLSource
,JdbcCacheOCSPSource
public abstract class JdbcRevocationSource<R extends Revocation> extends RepositoryRevocationSource<R>
Abstract class to retrieve token from a JDBC datasource
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected DataSource
dataSource
Fields inherited from class eu.europa.esig.dss.spi.x509.revocation.RepositoryRevocationSource
proxiedSource
-
Constructor Summary
Constructors Constructor Description JdbcRevocationSource()
-
Method Summary
Modifier and Type Method Description protected abstract RevocationToken<R>
buildRevocationTokenFromResult(ResultSet rs, CertificateToken certificateToken, CertificateToken issuerCertificateToken)
BuildRevocationToken
from the obtainedResultSet
protected void
closeQuietly(Connection c, Statement s, ResultSet rs)
Close the statement and connection and resultset without throwing the exceptionvoid
destroyTable()
Removes table from DBprotected RevocationToken<R>
findRevocation(String key, CertificateToken certificateToken, CertificateToken issuerCertificateToken)
Finds a RevocationToken in the cacheprotected abstract String
getCreateTableQuery()
Returns CREATE_TABLE sql queryprotected abstract String
getDeleteTableQuery()
Returns an sql query to remove a table from DBprotected abstract String
getFindRevocationQuery()
Returns an sql query to get revocation data from DBprotected abstract String
getRemoveRevocationTokenEntryQuery()
Returns an sql query to remove a record from DBprotected abstract String
getTableExistenceQuery()
Returns an sql query to check table existencevoid
initTable()
Initialize the revocation token table by creating the table if it does not exist.boolean
isTableExists()
protected void
removeRevocation(RevocationToken<R> token)
Removes the RevocationToken from cacheprotected void
rollback(Connection c)
Rollaback transaction for the givenConnection
void
setDataSource(DataSource dataSource)
Methods inherited from class eu.europa.esig.dss.spi.x509.revocation.RepositoryRevocationSource
getRevocationToken, getRevocationToken, initRevocationTokenKey, insertRevocation, setDefaultNextUpdateDelay, setMaxNextUpdateDelay, setProxySource, setRemoveExpired, updateRevocation
-
Field Details
-
Constructor Details
-
JdbcRevocationSource
public JdbcRevocationSource()
-
-
Method Details
-
getCreateTableQuery
Returns CREATE_TABLE sql query- Returns:
String
sql query
-
getTableExistenceQuery
Returns an sql query to check table existence- Returns:
String
sql query
-
getFindRevocationQuery
Returns an sql query to get revocation data from DB- Returns:
String
sql query
-
getDeleteTableQuery
Returns an sql query to remove a table from DB- Returns:
String
sql query
-
getRemoveRevocationTokenEntryQuery
Returns an sql query to remove a record from DB- Returns:
String
sql query
-
buildRevocationTokenFromResult
protected abstract RevocationToken<R> buildRevocationTokenFromResult(ResultSet rs, CertificateToken certificateToken, CertificateToken issuerCertificateToken) throws RevocationExceptionBuildRevocationToken
from the obtainedResultSet
- Parameters:
rs
-ResultSet
answer from DBcertificateToken
-CertificateToken
of certificate to get revocation data forissuerCertificateToken
-CertificateToken
if issuer of the certificateToken- Returns:
RevocationToken
- Throws:
RevocationException
-
setDataSource
- Parameters:
dataSource
- the dataSource to set
-
findRevocation
protected RevocationToken<R> findRevocation(String key, CertificateToken certificateToken, CertificateToken issuerCertificateToken)Description copied from class:RepositoryRevocationSource
Finds a RevocationToken in the cache- Specified by:
findRevocation
in classRepositoryRevocationSource<R extends Revocation>
- Parameters:
key
- the keyString
certificateToken
-CertificateToken
issuerCertificateToken
-CertificateToken
- Returns:
RevocationToken
object
-
removeRevocation
Description copied from class:RepositoryRevocationSource
Removes the RevocationToken from cache- Specified by:
removeRevocation
in classRepositoryRevocationSource<R extends Revocation>
- Parameters:
token
-RevocationToken
-
initTable
Initialize the revocation token table by creating the table if it does not exist.- Throws:
SQLException
- in case of SQL connection error
-
isTableExists
public boolean isTableExists() -
destroyTable
Removes table from DB- Throws:
SQLException
- in case of error
-
rollback
Rollaback transaction for the givenConnection
- Parameters:
c
-Connection
-
closeQuietly
Close the statement and connection and resultset without throwing the exception- Parameters:
c
- the connections
- the statementrs
- the ResultSet
-