org.datanucleus.store.mapped.scostore
Class JoinMapStore

java.lang.Object
  extended by org.datanucleus.store.mapped.scostore.BaseContainerStore
      extended by org.datanucleus.store.mapped.scostore.AbstractMapStore
          extended by org.datanucleus.store.mapped.scostore.JoinMapStore
All Implemented Interfaces:
MapStore, Store

public abstract class JoinMapStore
extends AbstractMapStore

Representation of the backing store for a Map. Uses a join table to link the owning container object with the values/keys contained in the map.


Field Summary
protected  JavaTypeMapping adapterMapping
          when the element mappings columns can't be part of the primary key by datastore limitations like BLOB types.
protected  ClassLoaderResolver clr
           
 
Fields inherited from class org.datanucleus.store.mapped.scostore.AbstractMapStore
iterateUsingDiscriminator, keyMapping, keysAreEmbedded, keysAreSerialised, keyType, kmd, mapTable, specialization, valueMapping, valuesAreEmbedded, valuesAreSerialised, valueTable, valueType, vmd
 
Fields inherited from class org.datanucleus.store.mapped.scostore.BaseContainerStore
allowNulls, dba, LOCALISER, ownerMapping, ownerMemberMetaData, relationType, storeMgr
 
Constructor Summary
JoinMapStore(DatastoreContainerObject mapTable, ClassLoaderResolver clr, JavaTypeMapping ownerMapping, JavaTypeMapping keyMapping, JavaTypeMapping valueMapping, JavaTypeMapping orderMapping, java.lang.String keyType, boolean isEmbeddedKey, boolean isSerialisedKey, java.lang.String valueType, boolean isEmbeddedValue, boolean isSerialisedValue, AbstractMemberMetaData ownerMemberMetaData, AbstractMapStoreSpecialization specialization)
          Constructor for an Inverse Map.
 
Method Summary
 void clear(ObjectProvider ownerSM)
          Method to clear the map of all values.
protected abstract  void clearInternal(ObjectProvider ownerSM)
           
 SetStore entrySetStore()
          Accessor for the map entries in the Map.
 JavaTypeMapping getAdapterMapping()
           
protected abstract  int[] internalPut(ObjectProvider ownerSM, ManagedConnection conn, boolean batched, java.lang.Object key, java.lang.Object value, boolean executeNow)
           
protected abstract  void internalUpdate(ObjectProvider ownerSM, ManagedConnection conn, boolean batched, java.lang.Object key, java.lang.Object value, boolean executeNow)
           
 SetStore keySetStore()
          Accessor for the keys in the Map.
protected abstract  MapEntrySetStore newMapEntrySetStore()
           
protected abstract  MapKeySetStore newMapKeySetStore()
           
protected abstract  MapValueSetStore newMapValueSetStore()
           
 java.lang.Object put(ObjectProvider sm, java.lang.Object key, java.lang.Object value)
          Method to put an item in the Map.
 void putAll(ObjectProvider sm, java.util.Map m)
          Method to put all elements from a Map into our Map.
 java.lang.Object remove(ObjectProvider sm, java.lang.Object key)
          Method to remove an item from the map.
protected abstract  void removeInternal(ObjectProvider sm, java.lang.Object key)
           
 SetStore valueSetStore()
          Accessor for the values in the Map.
 
Methods inherited from class org.datanucleus.store.mapped.scostore.AbstractMapStore
containsKey, containsValue, get, getKeyMapping, getKeyType, getKmd, getMapTable, getValue, getValueMapping, getValueType, getVmd, isValuesAreEmbedded, isValuesAreSerialised, keysAreEmbedded, keysAreSerialised, updateEmbeddedKey, updateEmbeddedValue, validateKeyForReading, validateKeyForWriting, validateKeyType, validateValueForReading, validateValueForWriting, validateValueType, valuesAreEmbedded, valuesAreSerialised
 
Methods inherited from class org.datanucleus.store.mapped.scostore.BaseContainerStore
allowsBatching, getDatastoreAdapter, getOwnerMapping, getOwnerMemberMetaData, getRelationType, getStateManagerForEmbeddedPCObject, getStoreManager, isEmbeddedMapping, setOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.datanucleus.store.scostore.Store
getStoreManager
 

Field Detail

adapterMapping

protected final JavaTypeMapping adapterMapping
when the element mappings columns can't be part of the primary key by datastore limitations like BLOB types. An adapter mapping is used to be a kind of "index"


clr

protected ClassLoaderResolver clr
Constructor Detail

JoinMapStore

public JoinMapStore(DatastoreContainerObject mapTable,
                    ClassLoaderResolver clr,
                    JavaTypeMapping ownerMapping,
                    JavaTypeMapping keyMapping,
                    JavaTypeMapping valueMapping,
                    JavaTypeMapping orderMapping,
                    java.lang.String keyType,
                    boolean isEmbeddedKey,
                    boolean isSerialisedKey,
                    java.lang.String valueType,
                    boolean isEmbeddedValue,
                    boolean isSerialisedValue,
                    AbstractMemberMetaData ownerMemberMetaData,
                    AbstractMapStoreSpecialization specialization)
Constructor for an Inverse Map.

Parameters:
mapTable - Join table for the Map
clr - The ClassLoaderResolver
specialization - The Specialization
Method Detail

putAll

public void putAll(ObjectProvider sm,
                   java.util.Map m)
Method to put all elements from a Map into our Map.

Specified by:
putAll in interface MapStore
Overrides:
putAll in class AbstractMapStore
Parameters:
sm - State Manager for the Map
m - The Map to add

put

public java.lang.Object put(ObjectProvider sm,
                            java.lang.Object key,
                            java.lang.Object value)
Method to put an item in the Map.

Parameters:
sm - State Manager for the map.
key - The key to store the value against
value - The value to store.
Returns:
The value stored.

remove

public java.lang.Object remove(ObjectProvider sm,
                               java.lang.Object key)
Method to remove an item from the map.

Parameters:
sm - State Manager for the map.
key - Key of the item to remove.
Returns:
The value that was removed.

removeInternal

protected abstract void removeInternal(ObjectProvider sm,
                                       java.lang.Object key)

clear

public void clear(ObjectProvider ownerSM)
Method to clear the map of all values.

Parameters:
ownerSM - State Manager for the map.

clearInternal

protected abstract void clearInternal(ObjectProvider ownerSM)

keySetStore

public SetStore keySetStore()
Accessor for the keys in the Map.

Returns:
The keys

valueSetStore

public SetStore valueSetStore()
Accessor for the values in the Map.

Returns:
The values.

entrySetStore

public SetStore entrySetStore()
Accessor for the map entries in the Map.

Returns:
The map entries.

getAdapterMapping

public JavaTypeMapping getAdapterMapping()

newMapKeySetStore

protected abstract MapKeySetStore newMapKeySetStore()

newMapValueSetStore

protected abstract MapValueSetStore newMapValueSetStore()

newMapEntrySetStore

protected abstract MapEntrySetStore newMapEntrySetStore()

internalUpdate

protected abstract void internalUpdate(ObjectProvider ownerSM,
                                       ManagedConnection conn,
                                       boolean batched,
                                       java.lang.Object key,
                                       java.lang.Object value,
                                       boolean executeNow)
                                throws MappedDatastoreException
Throws:
MappedDatastoreException

internalPut

protected abstract int[] internalPut(ObjectProvider ownerSM,
                                     ManagedConnection conn,
                                     boolean batched,
                                     java.lang.Object key,
                                     java.lang.Object value,
                                     boolean executeNow)
                              throws MappedDatastoreException
Throws:
MappedDatastoreException


Copyright © 2011. All Rights Reserved.