Cumulus4j API
(1.2.0)

org.cumulus4j.store
Class KeyStoreRefManager

java.lang.Object
  extended by org.cumulus4j.store.KeyStoreRefManager

public class KeyStoreRefManager
extends Object


Constructor Summary
KeyStoreRefManager()
           
 
Method Summary
protected  KeyStoreRef _createOrGetKeyStoreRef(boolean create, PersistenceManagerConnection persistenceManagerConnection, String keyStoreID)
           Get the KeyStoreRef identified by the given properties.
 KeyStoreRef createKeyStoreRef(PersistenceManagerConnection persistenceManagerConnection, String keyStoreID)
           Get the KeyStoreRef identified by the given properties.
 KeyStoreRef getKeyStoreRef(PersistenceManagerConnection persistenceManagerConnection, int keyStoreRefID)
          Get the KeyStoreRef identified by the given keyStoreRefID.
 KeyStoreRef getKeyStoreRef(PersistenceManagerConnection persistenceManagerConnection, String keyStoreID)
           Get the KeyStoreRef identified by the given properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyStoreRefManager

public KeyStoreRefManager()
Method Detail

getKeyStoreRef

public KeyStoreRef getKeyStoreRef(PersistenceManagerConnection persistenceManagerConnection,
                                  int keyStoreRefID)
Get the KeyStoreRef identified by the given keyStoreRefID. If no such KeyStoreRef exists, null is returned.

Parameters:
persistenceManagerConnection - the connection to the underlying datastore(s).
keyStoreRefID - identifier of the KeyStoreRef to be retrieved.
Returns:
the KeyStoreRef identified by the given keyStoreRefID or null.

_createOrGetKeyStoreRef

protected KeyStoreRef _createOrGetKeyStoreRef(boolean create,
                                              PersistenceManagerConnection persistenceManagerConnection,
                                              String keyStoreID)

Get the KeyStoreRef identified by the given properties.

If it does not yet exist in the in-memory-cache, it is looked up in the datastore. If it is found there, it is detached, cached and returned. If it does not exist in the datastore either, it is - if create == true - created, persisted, detached, cached and returned; if create == false, null is returned instead.

The KeyStoreRef instances are only held in the data-datastore (not in the index-datastore). This might change in the future (in case replication becomes necessary).

Parameters:
create - whether to create a new instance, if it does not yet exist. If true, a new instance will be created, persisted, detached, cached and returned, if it does not yet exist. If false, null will be returned instead.
persistenceManagerConnection - the connection to the underlying datastore(s).
keyStoreID - the KeyStore's ID. Must not be null.
Returns:
the KeyStoreRef (detached) matching the given properties. If create == true, this is never null. If create == false and there does not yet exist an appropriate KeyStoreRef, this is null.

getKeyStoreRef

public KeyStoreRef getKeyStoreRef(PersistenceManagerConnection persistenceManagerConnection,
                                  String keyStoreID)

Get the KeyStoreRef identified by the given properties.

If there is no appropriate KeyStoreRef (neither in the in-memory-cache nor in the datastore), null is returned.

This method delegates to #_createOrGetKeyStoreRef(boolean, PersistenceManagerConnection, String, String) with create == false.

Parameters:
persistenceManagerConnection - the connection to the underlying datastore(s).
keyStoreID - the KeyStore's ID. Must not be null.
Returns:
the KeyStoreRef (detached) matching the given properties or null.

createKeyStoreRef

public KeyStoreRef createKeyStoreRef(PersistenceManagerConnection persistenceManagerConnection,
                                     String keyStoreID)

Get the KeyStoreRef identified by the given properties.

If there is no appropriate KeyStoreRef (neither in the in-memory-cache nor in the datastore), it is created and persisted.

This method delegates to #_createOrGetKeyStoreRef(boolean, PersistenceManagerConnection, String, String) with create == true.

Parameters:
persistenceManagerConnection - the connection to the underlying datastore(s).
keyStoreID - the KeyStore's ID. Must not be null.
Returns:
the KeyStoreRef (detached) matching the given properties; never null.

Cumulus4j API
(1.2.0)

Copyright © 2013 NightLabs Consulting GmbH. All Rights Reserved.