Cumulus4j API
(1.1.0)

org.cumulus4j.store
Class EncryptionCoordinateSetManager

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

public class EncryptionCoordinateSetManager
extends Object

Manager for EncryptionCoordinateSet instances.

There exists one EncryptionCoordinateSetManager instance per Cumulus4jStoreManager. The EncryptionCoordinateSets held by this manager are detached (with all properties) and thus kept across all transactions.

Author:
Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de

Constructor Summary
EncryptionCoordinateSetManager()
          Create an instance.
 
Method Summary
protected  EncryptionCoordinateSet _createOrGetEncryptionCoordinateSet(boolean create, PersistenceManagerConnection persistenceManagerConnection, String cipherTransformation, String macAlgorithm)
           Get the EncryptionCoordinateSet identified by the given properties.
 EncryptionCoordinateSet createEncryptionCoordinateSet(PersistenceManagerConnection persistenceManagerConnection, String cipherTransformation, String macAlgorithm)
           Get the EncryptionCoordinateSet identified by the given properties.
 EncryptionCoordinateSet getEncryptionCoordinateSet(PersistenceManagerConnection persistenceManagerConnection, int encryptionCoordinateSetID)
          Get the EncryptionCoordinateSet identified by the given encryptionCoordinateSetID.
 EncryptionCoordinateSet getEncryptionCoordinateSet(PersistenceManagerConnection persistenceManagerConnection, String cipherTransformation, String macAlgorithm)
           Get the EncryptionCoordinateSet 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

EncryptionCoordinateSetManager

public EncryptionCoordinateSetManager()
Create an instance.

Method Detail

getEncryptionCoordinateSet

public EncryptionCoordinateSet getEncryptionCoordinateSet(PersistenceManagerConnection persistenceManagerConnection,
                                                          int encryptionCoordinateSetID)
Get the EncryptionCoordinateSet identified by the given encryptionCoordinateSetID. If no such EncryptionCoordinateSet exists, null is returned.

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

_createOrGetEncryptionCoordinateSet

protected EncryptionCoordinateSet _createOrGetEncryptionCoordinateSet(boolean create,
                                                                      PersistenceManagerConnection persistenceManagerConnection,
                                                                      String cipherTransformation,
                                                                      String macAlgorithm)

Get the EncryptionCoordinateSet 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 EncryptionCoordinateSet 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).
cipherTransformation - the transformation (as passed to CryptoRegistry.createCipher(String)) used to encrypt and decrypt the persistent data (or index).
macAlgorithm - the MAC algorithm (as passed to CryptoRegistry.createMACCalculator(String, boolean)) used to verify peristent records for integrity. Might be EncryptionCoordinateSet.MAC_ALGORITHM_NONE to deactivate the MAC calculation.
Returns:
the EncryptionCoordinateSet (detached) matching the given properties. If create == true, this is never null. If create == false and there does not yet exist an appropriate EncryptionCoordinateSet, this is null.

getEncryptionCoordinateSet

public EncryptionCoordinateSet getEncryptionCoordinateSet(PersistenceManagerConnection persistenceManagerConnection,
                                                          String cipherTransformation,
                                                          String macAlgorithm)

Get the EncryptionCoordinateSet identified by the given properties.

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

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

Parameters:
persistenceManagerConnection - the connection to the underlying datastore(s).
cipherTransformation - the transformation (as passed to CryptoRegistry.createCipher(String)) used to encrypt and decrypt the persistent data (or index).
macAlgorithm - the MAC algorithm (as passed to CryptoRegistry.createMACCalculator(String, boolean)) used to verify peristent records for integrity. Might be EncryptionCoordinateSet.MAC_ALGORITHM_NONE to deactivate the MAC calculation.
Returns:
the EncryptionCoordinateSet (detached) matching the given properties or null.

createEncryptionCoordinateSet

public EncryptionCoordinateSet createEncryptionCoordinateSet(PersistenceManagerConnection persistenceManagerConnection,
                                                             String cipherTransformation,
                                                             String macAlgorithm)

Get the EncryptionCoordinateSet identified by the given properties.

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

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

Parameters:
persistenceManagerConnection - the connection to the underlying datastore(s).
cipherTransformation - the transformation (as passed to CryptoRegistry.createCipher(String)) used to encrypt and decrypt the persistent data (or index).
macAlgorithm - the MAC algorithm (as passed to CryptoRegistry.createMACCalculator(String, boolean)) used to verify peristent records for integrity. Might be EncryptionCoordinateSet.MAC_ALGORITHM_NONE to deactivate the MAC calculation.
Returns:
the EncryptionCoordinateSet (detached) matching the given properties; never null.

Cumulus4j API
(1.1.0)

Copyright © 2013 NightLabs Consulting GmbH. All Rights Reserved.