Class ObjectProviderFactoryImpl

    • Field Detail

      • OBJECT_PROVIDER_CTR_ARG_CLASSES

        public static final Class[] OBJECT_PROVIDER_CTR_ARG_CLASSES
    • Method Detail

      • newForHollow

        public <T> ObjectProvider<T> newForHollow​(ExecutionContext ec,
                                                  Class<T> 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
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - the ExecutionContext
        pcClass - the class of the new instance to be created.
        id - the identity of the object.
        Returns:
        The ObjectProvider
      • newForHollow

        public <T> ObjectProvider<T> newForHollow​(ExecutionContext ec,
                                                  Class<T> 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
        Type Parameters:
        T - Type of the persistable class
        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.
        Returns:
        The ObjectProvider
      • newForHollowPreConstructed

        public <T> ObjectProvider<T> newForHollowPreConstructed​(ExecutionContext ec,
                                                                Object id,
                                                                T 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
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        id - the identity of the object.
        pc - The object that is hollow that we are going to manage
        Returns:
        The ObjectProvider
      • newForHollowPopulatedAppId

        public <T> ObjectProvider<T> newForHollowPopulatedAppId​(ExecutionContext ec,
                                                                Class<T> 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
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        pcClass - the class of the new instance to be created.
        fv - the initial field values of the object.
        Returns:
        The ObjectProvider
      • newForPersistentClean

        public <T> ObjectProvider<T> newForPersistentClean​(ExecutionContext ec,
                                                           Object id,
                                                           T pc)
        Constructs an ObjectProvider to manage the specified persistent instance having the given object ID.
        Specified by:
        newForPersistentClean in interface ObjectProviderFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        id - the identity of the object.
        pc - The object that is persistent that we are going to manage
        Returns:
        The ObjectProvider
      • newForEmbedded

        public <T> ObjectProvider<T> newForEmbedded​(ExecutionContext ec,
                                                    T 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
        Type Parameters:
        T - Type of the persistable class
        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
        Returns:
        The ObjectProvider
      • 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
        Returns:
        The ObjectProvider
      • newForPersistentNew

        public <T> ObjectProvider<T> newForPersistentNew​(ExecutionContext ec,
                                                         T 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
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        pc - the instance being make persistent.
        preInsertChanges - Any changes to make before inserting
        Returns:
        The ObjectProvider
      • newForTransactionalTransient

        public <T> ObjectProvider<T> newForTransactionalTransient​(ExecutionContext ec,
                                                                  T 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
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        pc - the instance being make persistent.
        Returns:
        The ObjectProvider
      • newForDetached

        public <T> ObjectProvider<T> newForDetached​(ExecutionContext ec,
                                                    T pc,
                                                    Object id,
                                                    Object version)
        Constructor for creating an ObjectProvider to manage a persistable object in detached state.
        Specified by:
        newForDetached in interface ObjectProviderFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        pc - the detached object
        id - the identity of the object.
        version - the detached version
        Returns:
        The ObjectProvider
      • newForPNewToBeDeleted

        public <T> ObjectProvider<T> newForPNewToBeDeleted​(ExecutionContext ec,
                                                           T 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
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - Execution Context
        pc - the object being deleted from persistence
        Returns:
        The ObjectProvider
      • newForCachedPC

        public <T> ObjectProvider<T> 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
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        id - Id to assign to the persistable object
        cachedPC - CachedPC object from the L2 cache
        Returns:
        The ObjectProvider
      • disconnectObjectProvider

        public void disconnectObjectProvider​(ObjectProvider op)
        Hook to allow an ObjectProvider to mark itself as disconnected so that it is returned to the pool.
        Specified by:
        disconnectObjectProvider in interface ObjectProviderFactory
        Parameters:
        op - The ObjectProvider to re-pool