|
Cumulus4j API (1.1.0) |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.cumulus4j.store.crypto.AbstractCryptoSession
public abstract class AbstractCryptoSession
Abstract base-class for implementing CryptoSession
s.
Field Summary |
---|
Fields inherited from interface org.cumulus4j.store.crypto.CryptoSession |
---|
PROPERTY_CRYPTO_SESSION_ID |
Constructor Summary | |
---|---|
AbstractCryptoSession()
|
Method Summary | |
---|---|
protected void |
assertNotClosed()
Throws an IllegalStateException , if this session is already closed. |
void |
close()
Close the session. |
Date |
getCreationTimestamp()
|
CryptoManager |
getCryptoManager()
Get the CryptoManager to which this session belongs. |
String |
getCryptoSessionID()
|
String |
getKeyStoreID()
|
Date |
getLastUsageTimestamp()
Get the timestamp of the last call to #release() . |
boolean |
isClosed()
Indicate, whether the session was already closed . |
void |
setCryptoManager(CryptoManager cryptoManager)
Set the CryptoManager to which this session belongs. |
void |
setCryptoSessionID(String cryptoSessionID)
Set the cryptoSessionID . |
void |
updateLastUsageTimestamp()
Set the lastUsageTimestamp to now, i.e. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.cumulus4j.store.crypto.CryptoSession |
---|
decrypt, encrypt |
Constructor Detail |
---|
public AbstractCryptoSession()
Method Detail |
---|
public CryptoManager getCryptoManager()
CryptoSession
Get the CryptoManager
to which this session belongs.
getCryptoManager
in interface CryptoSession
CryptoManager
to which this session belongs.public void setCryptoManager(CryptoManager cryptoManager)
CryptoSession
Set the CryptoManager
to which this session belongs.
If you subclass AbstractCryptoManager
(instead of directly implementing the CryptoManager
interface)
you must never call this method. Otherwise, it is expected, that you call this method once in CryptoManager.getCryptoSession(String)
after creating a new CryptoSession
, before returning it.
setCryptoManager
in interface CryptoSession
cryptoManager
- the CryptoManager
to which this session belongs.CryptoSession.getCryptoManager()
public String getCryptoSessionID()
getCryptoSessionID
in interface CryptoSession
public void setCryptoSessionID(String cryptoSessionID)
CryptoSession
Set the cryptoSessionID
.
If you subclass AbstractCryptoManager
(instead of directly implementing the CryptoManager
interface)
you must never call this method. Otherwise, it is expected, that you call this method once in CryptoManager.getCryptoSession(String)
after creating a new CryptoSession
, before returning it.
setCryptoSessionID
in interface CryptoSession
cryptoSessionID
- the identifier of this session.CryptoSession.getCryptoSessionID()
public String getKeyStoreID()
getKeyStoreID
in interface CryptoSession
public Date getCreationTimestamp()
getCreationTimestamp
in interface CryptoSession
public Date getLastUsageTimestamp()
CryptoSession
Get the timestamp of the last call to #release()
.
If #release()
was not yet called, get the time when this
instance was created (just like CryptoSession.getCreationTimestamp()
does).
Therefore, this method always returns the time when the session was stopped being used the last time.
This timestamp is used for automatic closing of expired sessions.
getLastUsageTimestamp
in interface CryptoSession
public void updateLastUsageTimestamp()
CryptoSession
Set the lastUsageTimestamp
to now, i.e. new Date()
.
This method should be called by CryptoManager.getCryptoSession(String)
.
updateLastUsageTimestamp
in interface CryptoSession
CryptoSession.getLastUsageTimestamp()
public boolean isClosed()
closed
.
Implementors should use assertNotClosed()
in their subclasses to check
whether the operation is still allowed.
isClosed
in interface CryptoSession
true
, if CryptoSession.close()
was already called; false
otherwise.protected void assertNotClosed()
IllegalStateException
, if this session is already closed.
public void close()
Close the session.
After closing, the CryptoSession
cannot be used for encryption/decryption anymore, i.e.
CryptoSession.encrypt(CryptoContext, Plaintext)
and CryptoSession.decrypt(CryptoContext, Ciphertext)
very likely throw an exception. The other
methods might still work.
This method can be called multiple times - every following call will be silently ignored.
When overriding this method, you should first call super.close();
and
then perform your own closing operations.
close
in interface CryptoSession
|
Cumulus4j API (1.1.0) |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |