org.datanucleus.store.rdbms.scostore
Class AbstractArrayStore

java.lang.Object
  extended by org.datanucleus.store.rdbms.scostore.BaseContainerStore
      extended by org.datanucleus.store.rdbms.scostore.ElementContainerStore
          extended by org.datanucleus.store.rdbms.scostore.AbstractArrayStore
All Implemented Interfaces:
org.datanucleus.store.scostore.ArrayStore, org.datanucleus.store.scostore.Store
Direct Known Subclasses:
RDBMSFKArrayStore, RDBMSJoinArrayStore

public abstract class AbstractArrayStore
extends ElementContainerStore
implements org.datanucleus.store.scostore.ArrayStore

Abstract representation of the backing store for an array.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
ElementContainerStore.ElementInfo
 
Field Summary
 
Fields inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
addStmt, clearStmt, clr, containerTable, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, emd, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, removeStmt, sizeStmt, usingDiscriminatorInSizeStmt
 
Fields inherited from class org.datanucleus.store.rdbms.scostore.BaseContainerStore
allowNulls, dba, LOCALISER, ownerMapping, ownerMemberMetaData, relationType, storeMgr
 
Constructor Summary
protected AbstractArrayStore(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
          Constructor.
 
Method Summary
 boolean add(org.datanucleus.store.ObjectProvider sm, Object element, int position)
          Adds one element to the association owner vs elements
 void clear(org.datanucleus.store.ObjectProvider ownerSM)
          Clear the association from owner to all elements.
 void clearInternal(org.datanucleus.store.ObjectProvider ownerSM)
           
 List getArray(org.datanucleus.store.ObjectProvider ownerSM)
          Accessor for the array from the datastore.
 int[] internalAdd(org.datanucleus.store.ObjectProvider sm, Object element, org.datanucleus.store.connection.ManagedConnection conn, boolean batched, int orderId, boolean executeNow)
          Internal method to add a row to the join table.
abstract  Iterator iterator(org.datanucleus.store.ObjectProvider ownerSM)
          Accessor for an iterator through the array elements.
 void processBatchedWrites(org.datanucleus.store.connection.ManagedConnection mconn)
           
 boolean set(org.datanucleus.store.ObjectProvider ownerSM, Object array)
          Method to set the array for the specified owner to the passed value.
 
Methods inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
executeClear, getAddStmt, getClearStmt, getContainerTable, getElementInfo, getElementInformationForClass, getElementMapping, getEmd, getOrderMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, getSize, getSizeStmt, hasOrderMapping, invalidateAddStmt, isElementsAreEmbedded, isElementsAreSerialised, size, validateElementForReading, validateElementForWriting, validateElementType
 
Methods inherited from class org.datanucleus.store.rdbms.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.ArrayStore
size
 
Methods inherited from interface org.datanucleus.store.scostore.Store
getStoreManager
 

Constructor Detail

AbstractArrayStore

protected AbstractArrayStore(RDBMSStoreManager storeMgr,
                             org.datanucleus.ClassLoaderResolver clr)
Constructor.

Parameters:
storeMgr - Manager for the store
clr - ClassLoader resolver
Method Detail

getArray

public List getArray(org.datanucleus.store.ObjectProvider ownerSM)
Accessor for the array from the datastore.

Specified by:
getArray in interface org.datanucleus.store.scostore.ArrayStore
Parameters:
ownerSM - SM for the owner
Returns:
The array (as a List of objects)

clear

public void clear(org.datanucleus.store.ObjectProvider ownerSM)
Clear the association from owner to all elements. Observes the necessary dependent field settings with respect to whether it should delete the element when doing so.

Specified by:
clear in interface org.datanucleus.store.scostore.ArrayStore
Overrides:
clear in class ElementContainerStore
Parameters:
ownerSM - State Manager for the container.

set

public boolean set(org.datanucleus.store.ObjectProvider ownerSM,
                   Object array)
Method to set the array for the specified owner to the passed value.

Specified by:
set in interface org.datanucleus.store.scostore.ArrayStore
Parameters:
ownerSM - State Manager for the owner
array - the array
Returns:
Whether the array was updated successfully

add

public boolean add(org.datanucleus.store.ObjectProvider sm,
                   Object element,
                   int position)
Adds one element to the association owner vs elements

Parameters:
sm - State Manager for the container
element - The element to add
position - The position to add this element at
Returns:
Whether it was successful

iterator

public abstract Iterator iterator(org.datanucleus.store.ObjectProvider ownerSM)
Accessor for an iterator through the array elements.

Specified by:
iterator in interface org.datanucleus.store.scostore.ArrayStore
Specified by:
iterator in class ElementContainerStore
Parameters:
ownerSM - State Manager for the container.
Returns:
The Iterator

clearInternal

public void clearInternal(org.datanucleus.store.ObjectProvider ownerSM)

internalAdd

public int[] internalAdd(org.datanucleus.store.ObjectProvider sm,
                         Object element,
                         org.datanucleus.store.connection.ManagedConnection conn,
                         boolean batched,
                         int orderId,
                         boolean executeNow)
                  throws org.datanucleus.store.mapped.exceptions.MappedDatastoreException
Internal method to add a row to the join table. Used by add() and set() to add a row to the join table.

Parameters:
sm - StateManager for the owner of the collection
element - The element to add the relation to
conn - The connection
batched - Whether we are batching
orderId - The order id to use for this element relation
executeNow - Whether to execute the statement now (and not wait for any batch)
Returns:
Whether a row was inserted
Throws:
SQLException - Thrown if an error occurs
org.datanucleus.store.mapped.exceptions.MappedDatastoreException

processBatchedWrites

public void processBatchedWrites(org.datanucleus.store.connection.ManagedConnection mconn)
                          throws org.datanucleus.store.mapped.exceptions.MappedDatastoreException
Throws:
org.datanucleus.store.mapped.exceptions.MappedDatastoreException


Copyright © 2012. All Rights Reserved.