|
Cumulus4j API (1.1.1) |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.cumulus4j.store.crypto.CryptoManagerRegistry
public class CryptoManagerRegistry
Registry holding instances of CryptoManager
.
There is one JVM-singleton-instance of CryptoManagerRegistry
per NucleusContext
.
Since it is held in a WeakHashMap
, a CryptoManagerRegistry
will be garbage-collected
when the corresponding NucleusContext
is "forgotten".
Method Summary | |
---|---|
CryptoManager |
getCryptoManager(String cryptoManagerID)
Get a CryptoManager for the specified cryptoManagerID . |
NucleusContext |
getNucleusContext()
Get the NucleusContext for which this CryptoManagerRegistry
has been created. |
static CryptoManagerRegistry |
sharedInstance(NucleusContext nucleusContext)
Get the CryptoManagerRegistry corresponding to a given NucleusContext . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static CryptoManagerRegistry sharedInstance(NucleusContext nucleusContext)
Get the CryptoManagerRegistry
corresponding to a given NucleusContext
.
If there is no registry known for the given NucleusContext
, yet, it will be created and
associated to this context. If this method is later on called again for the same NucleusContext
,
the same CryptoManagerRegistry
will be returned.
This method is thread-safe.
nucleusContext
- the NucleusContext
for which to get the CryptoManagerRegistry
.
CryptoManagerRegistry
associated to the given NucleusContext
; never null
.public CryptoManager getCryptoManager(String cryptoManagerID) throws UnknownCryptoManagerIDException
Get a CryptoManager
for the specified cryptoManagerID
.
Within the context of one CryptoManagerRegistry
instance, this method will always
return the same instance of CryptoManager
for a certain cryptoManagerID
.
In other words, there is exactly one CryptoManager
instance for each unique combination
of NucleusContext
and cryptoManagerID
.
This method is thread-safe.
cryptoManagerID
- the identifier used in the extension-declaration (in the plugin.xml
).
CryptoManager
for the specified cryptoManagerID
; never null
.
UnknownCryptoManagerIDException
- if there is no CryptoManager
registered for the given identifier.public NucleusContext getNucleusContext()
Get the NucleusContext
for which this CryptoManagerRegistry
has been created.
This method returns null
, if the
NucleusContext
has already been garbage-collected (the reference
is kept as a WeakReference
).
Important: Hold the result of this method only in a stack variable (i.e. scope = method)
or a WeakReference
! Otherwise you run the risk of a memory leak!!!
NucleusContext
or null
, if it was already garbage-collected.
It is never null
as long as the NucleusContext
is still valid
(i.e. not garbage-collected).
|
Cumulus4j API (1.1.1) |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |