org.datanucleus.store.mapped.scostore
Class BaseContainerStore

java.lang.Object
  extended by org.datanucleus.store.mapped.scostore.BaseContainerStore
Direct Known Subclasses:
AbstractMapStore, ElementContainerStore, MapEntrySetStore

public abstract class BaseContainerStore
extends java.lang.Object

Base class for all mapped container stores (collections, maps, arrays). Provides a series of helper methods for handling the store process.


Field Summary
protected  boolean allowNulls
          Whether the container allows null elements/values.
protected  DatastoreAdapter dba
          Datastore adapter in use by this store.
protected static Localiser LOCALISER
          Localiser for messages.
protected  JavaTypeMapping ownerMapping
          Mapping to the owner of the container.
protected  AbstractMemberMetaData ownerMemberMetaData
          MetaData for the field/property in the owner with this container.
protected  int relationType
          Type of relation (1-N uni, 1-N bi, M-N).
protected  MappedStoreManager storeMgr
          Manager for the store.
 
Constructor Summary
protected BaseContainerStore(StoreManager storeMgr)
          Constructor.
 
Method Summary
protected  boolean allowsBatching()
          Convenience method to return if the datastore supports batching and the user wants batching.
 DatastoreAdapter getDatastoreAdapter()
           
 JavaTypeMapping getOwnerMapping()
          Accessor for the owner mapping.
 AbstractMemberMetaData getOwnerMemberMetaData()
           
 int getRelationType()
           
 ObjectProvider getStateManagerForEmbeddedPCObject(ObjectProvider sm, java.lang.Object obj, AbstractMemberMetaData ownerFmd)
          Method to return the StateManager for an embedded PC object (element, key, value).
 MappedStoreManager getStoreManager()
          Accessor for the MappedStoreManager.
protected  boolean isEmbeddedMapping(JavaTypeMapping mapping)
          Check if the mapping correspond to a non pc object or embedded field
protected  void setOwner(AbstractMemberMetaData mmd, ClassLoaderResolver clr)
          Method to set the owner for this backing store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localiser for messages.


storeMgr

protected MappedStoreManager storeMgr
Manager for the store.


dba

protected DatastoreAdapter dba
Datastore adapter in use by this store.


ownerMapping

protected JavaTypeMapping ownerMapping
Mapping to the owner of the container.


ownerMemberMetaData

protected AbstractMemberMetaData ownerMemberMetaData
MetaData for the field/property in the owner with this container.


relationType

protected int relationType
Type of relation (1-N uni, 1-N bi, M-N).


allowNulls

protected boolean allowNulls
Whether the container allows null elements/values.

Constructor Detail

BaseContainerStore

protected BaseContainerStore(StoreManager storeMgr)
Constructor.

Parameters:
storeMgr - Manager for the datastore being used
Method Detail

setOwner

protected void setOwner(AbstractMemberMetaData mmd,
                        ClassLoaderResolver clr)
Method to set the owner for this backing store. Sets the metadata of the owner field/property, as well as whether nulls are allowed, and the relation type.

Parameters:
mmd - MetaData for the member owning this backing store.
clr - ClassLoader resolver

getStoreManager

public MappedStoreManager getStoreManager()
Accessor for the MappedStoreManager.

Returns:
The MappedStoreManager.

getOwnerMapping

public JavaTypeMapping getOwnerMapping()
Accessor for the owner mapping.

Returns:
Owner mapping.

isEmbeddedMapping

protected boolean isEmbeddedMapping(JavaTypeMapping mapping)
Check if the mapping correspond to a non pc object or embedded field

Parameters:
mapping - the mapping
Returns:
true if the field is embedded into one column

getStateManagerForEmbeddedPCObject

public ObjectProvider getStateManagerForEmbeddedPCObject(ObjectProvider sm,
                                                         java.lang.Object obj,
                                                         AbstractMemberMetaData ownerFmd)
Method to return the StateManager for an embedded PC object (element, key, value). It creates one if the element is not currently managed.

Parameters:
sm - State Manager of the owner
obj - The embedded PC object
ownerFmd - The meta data for the owner field
Returns:
The state manager

allowsBatching

protected boolean allowsBatching()
Convenience method to return if the datastore supports batching and the user wants batching.

Returns:
If batching of statements is permissible

getRelationType

public int getRelationType()

getOwnerMemberMetaData

public AbstractMemberMetaData getOwnerMemberMetaData()

getDatastoreAdapter

public DatastoreAdapter getDatastoreAdapter()


Copyright © 2011. All Rights Reserved.