Interface ObjectProviderFactory

  • All Known Implementing Classes:
    ObjectProviderFactoryImpl

    public interface ObjectProviderFactory
    Factory for ObjectProviders. Whenever we have a persistable object that needs to be managed and the values of its fields accessed/updated we associate the object with an ObjectProvider. Should be implemented by whichever type of ObjectProvider we want to instantiate.
    • Method Detail

      • close

        void close()
      • disconnectObjectProvider

        void disconnectObjectProvider​(ObjectProvider op)
        Method to be called when an ObjectProvider is disconnected (finished with). This facilitates its reuse within a pool.
        Parameters:
        op - The ObjectProvider
      • newForHollow

        <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.
        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
      • newForHollowPreConstructed

        <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.
        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
      • newForHollow

        <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.
        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
      • newForPersistentClean

        <T> ObjectProvider<T> newForPersistentClean​(ExecutionContext ec,
                                                    Object id,
                                                    T pc)
        Constructs an ObjectProvider to manage the specified persistent instance having the given object ID.
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - the execution context controlling this state manager.
        id - the identity of the object.
        pc - The object that is persistent that we are going to manage
        Returns:
        The ObjectProvider
      • newForHollowPopulatedAppId

        <T> ObjectProvider<T> newForHollowPopulatedAppId​(ExecutionContext ec,
                                                         Class<T> pcClass,
                                                         FieldValues fv)
        Deprecated.
        Use newForHollowPopulated instead
        Constructs an ObjectProvider to manage a hollow (or pclean) instance having the given FieldValues. This constructor is used for creating new instances of existing persistent objects using application identity.
        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
      • newForEmbedded

        <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.
        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

        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.
        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

        <T> ObjectProvider<T> newForPersistentNew​(ExecutionContext ec,
                                                  T pc,
                                                  FieldValues fv)
        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 state managers to existing instances that are transitioning to a persistent state.
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        pc - the instance being make persistent.
        fv - Any changes to make before inserting
        Returns:
        The ObjectProvider
      • newForTransactionalTransient

        <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 state managers to transient instances that are transitioning to a transient clean state.
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        pc - the instance being make persistent.
        Returns:
        The ObjectProvider
      • newForDetached

        <T> ObjectProvider<T> newForDetached​(ExecutionContext ec,
                                             T pc,
                                             Object id,
                                             Object version)
        Constructor for creating ObjectProvider instances to manage persistable objects in detached state.
        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

        <T> ObjectProvider<T> newForPNewToBeDeleted​(ExecutionContext ec,
                                                    T pc)
        Constructor for creating ObjectProvider instances to manage persistable objects that are not persistent yet are about to be deleted. Consequently the initial lifecycle state will be P_NEW, but will soon move to P_NEW_DELETED.
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - Execution Context
        pc - the object being deleted from persistence
        Returns:
        The ObjectProvider
      • newForCachedPC

        <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. Makes a copy of the cached object, assigns a ObjectProvider to it, and copies across the fields that were loaded when cached.
        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