org.datanucleus.state
Class JDOStateManagerFactory

java.lang.Object
  extended by org.datanucleus.state.JDOStateManagerFactory
All Implemented Interfaces:
ObjectProviderFactory

public class JDOStateManagerFactory
extends Object
implements ObjectProviderFactory

Factory for ObjectProviders of type JDOStateManager. This type of ObjectProvider is used where we want all features of persistence, and we are using the JDO byte-code enhancement contract.


Field Summary
protected static Localiser LOCALISER
          Localiser for messages.
 
Constructor Summary
protected JDOStateManagerFactory()
           
 
Method Summary
static JDOStateManagerFactory getInstance()
           
 ObjectProvider newForCachedPC(ExecutionContext ec, Object id, CachedPC cachedPC)
          Constructor to create an ObjectProvider for an object taken from the L2 cache with the specified id.
 ObjectProvider newForDetached(ExecutionContext ec, Object pc, Object id, Object version)
          Constructor for creating an ObjectProvider to manage a persistable object in detached state.
 ObjectProvider newForEmbedded(ExecutionContext ec, AbstractClassMetaData cmd, ObjectProvider ownerOP, int ownerFieldNumber)
          Constructs an ObjectProvider for an object of the specified type, creating the PC object to hold the values where this object will be EMBEDDED/SERIALISED into another persistable object.
 ObjectProvider newForEmbedded(ExecutionContext ec, Object pc, boolean copyPc, ObjectProvider ownerOP, int ownerFieldNumber)
          Constructs an ObjectProvider to manage a persistable instance that will be EMBEDDED/SERIALISED into another persistable object.
 ObjectProvider newForHollow(ExecutionContext ec, Class pcClass, Object id)
          Constructs an ObjectProvider to manage a hollow instance having the given object ID.
 ObjectProvider newForHollow(ExecutionContext ec, Class pcClass, Object id, FieldValues fv)
          Constructs an ObjectProvider to manage a recently populated hollow instance having the given object ID and the given field values.
 ObjectProvider newForHollowPopulatedAppId(ExecutionContext ec, Class pcClass, FieldValues fv)
          Deprecated. Use newForHollowPopulated instead
 ObjectProvider newForHollowPreConstructed(ExecutionContext ec, Object id, Object pc)
          Constructs an ObjectProvider to manage a hollow instance having the given object ID.
 ObjectProvider newForPersistentClean(ExecutionContext ec, Object id, Object pc)
          Constructs an ObjectProvider to manage the specified persistent instance having the given object ID.
 ObjectProvider newForPersistentNew(ExecutionContext ec, Object pc, FieldValues preInsertChanges)
          Constructs an ObjectProvider to manage a transient instance that is becoming newly persistent.
 ObjectProvider newForPNewToBeDeleted(ExecutionContext ec, Object pc)
          Constructor for creating an ObjectProvider to manage a persistable object that is not persistent yet is about to be deleted.
 ObjectProvider newForTransactionalTransient(ExecutionContext ec, Object pc)
          Constructs an ObjectProvider to manage a transactional-transient instance.
 
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.

Constructor Detail

JDOStateManagerFactory

protected JDOStateManagerFactory()
Method Detail

getInstance

public static JDOStateManagerFactory getInstance()

newForHollow

public ObjectProvider newForHollow(ExecutionContext ec,
                                   Class pcClass,
                                   Object id)
Constructs an ObjectProvider to manage a hollow instance having the given object ID. This constructor is used for creating new instances of existing persistent objects.

Specified by:
newForHollow in interface ObjectProviderFactory
Parameters:
ec - the ExecutionContext
pcClass - the class of the new instance to be created.
id - the identity of the object.

newForHollow

public ObjectProvider newForHollow(ExecutionContext ec,
                                   Class pcClass,
                                   Object id,
                                   FieldValues fv)
Constructs an ObjectProvider to manage a recently populated hollow instance having the given object ID and the given field values. This constructor is used for creating new instances of persistent objects obtained e.g. via a Query or backed by a view.

Specified by:
newForHollow in interface ObjectProviderFactory
Parameters:
ec - ExecutionContext
pcClass - the class of the new instance to be created.
id - the identity of the object.
fv - the initial field values of the object.

newForHollowPreConstructed

public ObjectProvider newForHollowPreConstructed(ExecutionContext ec,
                                                 Object id,
                                                 Object pc)
Constructs an ObjectProvider to manage a hollow instance having the given object ID. The instance is already supplied.

Specified by:
newForHollowPreConstructed in interface ObjectProviderFactory
Parameters:
ec - ExecutionContext
id - the identity of the object.
pc - The object that is hollow that we are going to manage

newForHollowPopulatedAppId

public ObjectProvider newForHollowPopulatedAppId(ExecutionContext ec,
                                                 Class pcClass,
                                                 FieldValues fv)
Deprecated. Use newForHollowPopulated instead

Constructs an ObjectProvider to manage a hollow (or P-clean) instance having the given FieldValues. This constructor is used for creating new instances of existing persistent objects using application identity.

Specified by:
newForHollowPopulatedAppId in interface ObjectProviderFactory
Parameters:
ec - ExecutionContext
pcClass - the class of the new instance to be created.
fv - the initial field values of the object.

newForPersistentClean

public ObjectProvider newForPersistentClean(ExecutionContext ec,
                                            Object id,
                                            Object pc)
Constructs an ObjectProvider to manage the specified persistent instance having the given object ID.

Specified by:
newForPersistentClean in interface ObjectProviderFactory
Parameters:
ec - ExecutionContext
id - the identity of the object.
pc - The object that is persistent that we are going to manage

newForEmbedded

public ObjectProvider newForEmbedded(ExecutionContext ec,
                                     Object pc,
                                     boolean copyPc,
                                     ObjectProvider ownerOP,
                                     int ownerFieldNumber)
Constructs an ObjectProvider to manage a persistable instance that will be EMBEDDED/SERIALISED into another persistable object. The instance will not be assigned an identity in the process since it is a SCO.

Specified by:
newForEmbedded in interface ObjectProviderFactory
Parameters:
ec - ExecutionContext
pc - The persistable to manage (see copyPc also)
copyPc - Whether the SM should manage a copy of the passed PC or that one
ownerOP - Owner ObjectProvider
ownerFieldNumber - Field number in owner object where this is stored

newForEmbedded

public ObjectProvider newForEmbedded(ExecutionContext ec,
                                     AbstractClassMetaData cmd,
                                     ObjectProvider ownerOP,
                                     int ownerFieldNumber)
Constructs an ObjectProvider for an object of the specified type, creating the PC object to hold the values where this object will be EMBEDDED/SERIALISED into another persistable object. The instance will not be assigned an identity in the process since it is a SCO.

Specified by:
newForEmbedded in interface ObjectProviderFactory
Parameters:
ec - ExecutionContext
cmd - Meta-data for the class that this is an instance of.
ownerOP - Owner ObjectProvider
ownerFieldNumber - Field number in owner object where this is stored

newForPersistentNew

public ObjectProvider newForPersistentNew(ExecutionContext ec,
                                          Object pc,
                                          FieldValues preInsertChanges)
Constructs an ObjectProvider to manage a transient instance that is becoming newly persistent. A new object ID for the instance is obtained from the store manager and the object is inserted in the data store. This constructor is used for assigning ObjectProviders to existing instances that are transitioning to a persistent state.

Specified by:
newForPersistentNew in interface ObjectProviderFactory
Parameters:
ec - ExecutionContext
pc - the instance being make persistent.
preInsertChanges - Any changes to make before inserting

newForTransactionalTransient

public ObjectProvider newForTransactionalTransient(ExecutionContext ec,
                                                   Object pc)
Constructs an ObjectProvider to manage a transactional-transient instance. A new object ID for the instance is obtained from the store manager and the object is inserted in the data store. This constructor is used for assigning an ObjectProvider to a transient instance that is transitioning to a transient clean state.

Specified by:
newForTransactionalTransient in interface ObjectProviderFactory
Parameters:
ec - ExecutionContext
pc - the instance being make persistent.

newForDetached

public ObjectProvider newForDetached(ExecutionContext ec,
                                     Object pc,
                                     Object id,
                                     Object version)
Constructor for creating an ObjectProvider to manage a persistable object in detached state.

Specified by:
newForDetached in interface ObjectProviderFactory
Parameters:
ec - ExecutionContext
pc - the detached object
id - the identity of the object.
version - the detached version

newForPNewToBeDeleted

public ObjectProvider newForPNewToBeDeleted(ExecutionContext ec,
                                            Object pc)
Constructor for creating an ObjectProvider to manage a persistable object that is not persistent yet is about to be deleted. Consequently the initial lifecycle state will be P_NEW, but will soon move to P_NEW_DELETED.

Specified by:
newForPNewToBeDeleted in interface ObjectProviderFactory
Parameters:
ec - Execution Context
pc - the object being deleted from persistence

newForCachedPC

public ObjectProvider newForCachedPC(ExecutionContext ec,
                                     Object id,
                                     CachedPC cachedPC)
Constructor to create an ObjectProvider for an object taken from the L2 cache with the specified id. Creates an object that the cached object represents, assigns a ObjectProvider to it, and copies across the fields that were cached, and its version (if available).

Specified by:
newForCachedPC in interface ObjectProviderFactory
Parameters:
ec - ExecutionContext
id - Id to assign to the persistable object
cachedPC - CachedPC object from the L2 cache


Copyright © 2012. All Rights Reserved.