Cumulus4j API
(1.1.0)

org.cumulus4j.store.model
Class DataEntry

java.lang.Object
  extended by org.cumulus4j.store.model.DataEntry
All Implemented Interfaces:
StoreCallback

public class DataEntry
extends Object
implements StoreCallback

Persistent container holding an entity's data in encrypted form.

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

Nested Class Summary
protected static class DataEntry.NamedQueries
           
 
Constructor Summary
protected DataEntry()
          Internal constructor.
  DataEntry(ClassMeta classMeta, int keyStoreRefID, String objectID)
          Create an instance of DataEntry.
 
Method Summary
 boolean equals(Object obj)
           
 ClassMeta getClassMeta()
           Get the type of the entity persisted in this container.
 long getDataEntryID()
          Get the single primary key field (= object-identifier) of DataEntry.
 long getKeyID()
          Get the identifier of the encryption-key used to encrypt the value.
 int getKeyStoreRefID()
          Get the numeric identifier of the key store.
 String getObjectID()
           Get the String-representation of the entity's identifier.
protected  PersistenceManager getPersistenceManager()
           
 byte[] getValue()
          Get the encrypted data of an entity.
 int hashCode()
           
 void jdoPreStore()
           
 void setKeyID(long keyID)
          Set the identifier of the encryption-key used to encrypt the value.
 void setKeyStoreRefID(int keyStoreRefID)
          Deprecated. Never call this method! It exists only for downward compatibility (needs to be accessible by IntroduceKeyStoreRefID).
 void setValue(byte[] value)
          Set the encrypted data of an entity.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataEntry

protected DataEntry()
Internal constructor. This exists only for JDO and should not be used by application code!


DataEntry

public DataEntry(ClassMeta classMeta,
                 int keyStoreRefID,
                 String objectID)
Create an instance of DataEntry.

Parameters:
classMeta - the type of the entity persisted in this container (which must be the entity's concrete type - not the root-type of the inheritance tree!). See getClassMeta() for further details.
keyStoreRefID - TODO
objectID - the String-representation of the entity's identifier (aka OID or object-ID). See getObjectID() for further details.
Method Detail

getDataEntryID

public long getDataEntryID()
Get the single primary key field (= object-identifier) of DataEntry.

Returns:
the object-identifier (= primary key).

getClassMeta

public ClassMeta getClassMeta()

Get the type of the entity persisted in this container.

Note, that this is the concrete type of the persisted object and not the root-type of the persistable hierarchy. For example, if bbb is persisted and bbb is an instance of class BBB which extends AAA and both classes are persistable, this will point to class BBB (and not AAA).

Therefore, if you want to query all instances of a certain type including subclasses, you have to ask for the sub-classes via StoreManager.getSubClassesForClass(String, boolean, org.datanucleus.ClassLoaderResolver) first and then query for all these classes individually.

Returns:
the type of the entity.

getPersistenceManager

protected PersistenceManager getPersistenceManager()

getKeyStoreRefID

public int getKeyStoreRefID()
Get the numeric identifier of the key store. The key store's String-ID is mapped to this numeric ID via KeyStoreRef instances.

Returns:
the numeric identifier of the key store.

setKeyStoreRefID

@Deprecated
public void setKeyStoreRefID(int keyStoreRefID)
Deprecated. Never call this method! It exists only for downward compatibility (needs to be accessible by IntroduceKeyStoreRefID).

Set the numeric identifier of the key store.

Parameters:
keyStoreRefID - the numeric identifier of the key store.

getObjectID

public String getObjectID()

Get the String-representation of the entity's identifier.

For JDO, please read the following (and related) documentation:

For JPA, please read the following (and related) documentation:

Returns:
the OID in String-form (e.g. the result of JDOHelper.getObjectId(entity).toString() when using JDO).

getKeyID

public long getKeyID()
Get the identifier of the encryption-key used to encrypt the value.

Returns:
the encryption-key used to encrypt this DataEntry's contents.
See Also:
setKeyID(long)

setKeyID

public void setKeyID(long keyID)
Set the identifier of the encryption-key used to encrypt the value.

Parameters:
keyID - the encryption-key used to encrypt this DataEntry's contents.
See Also:
getKeyID()

getValue

public byte[] getValue()
Get the encrypted data of an entity. The entity is transformed ("made flat") into an ObjectContainer which is then serialised using Java native serialisation and finally encrypted.

Returns:
the encrypted serialised data of an ObjectContainer holding the entity's data.
See Also:
setValue(byte[])

setValue

public void setValue(byte[] value)
Set the encrypted data of an entity.

Parameters:
value - the encrypted serialised data of an ObjectContainer holding the entity's data.
See Also:
getValue()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

jdoPreStore

public void jdoPreStore()
Specified by:
jdoPreStore in interface StoreCallback

Cumulus4j API
(1.1.0)

Copyright © 2013 NightLabs Consulting GmbH. All Rights Reserved.