org.apache.openjpa.kernel
Class AttachManager

java.lang.Object
  extended by org.apache.openjpa.kernel.AttachManager

public class AttachManager
extends Object

Handles attaching instances.

Author:
Marc Prud'hommeaux

Constructor Summary
AttachManager(BrokerImpl broker, boolean copyNew, OpCallbacks call)
          Constructor.
 
Method Summary
(package private)  StateManagerImpl assertManaged(Object obj)
          Throw an exception if the given object is not managed; otherwise return its state manager.
 Object attach(Object pc)
          Return an attached version of the given instance.
(package private)  Object attach(Object toAttach, PersistenceCapable into, OpenJPAStateManager owner, ValueMetaData ownerMeta, boolean explicit)
          Attach.
 Object[] attachAll(Collection instances)
          Return attached versions of the given instances.
(package private)  void fireBeforeAttach(Object pc, ClassMetaData meta)
          Fire before-attach event.
(package private)  PersistenceCapable getAttachedCopy(Object pc)
          If the passed in argument has already been attached, return the (cached) attached copy.
 OpCallbacks getBehavior()
          Return the behavior supplied on construction.
(package private)  BrokerImpl getBroker()
          Owning broker.
 boolean getCopyNew()
          Return whether to copy new instances being persisted.
(package private)  Object getDetachedObjectId(Object pc)
          Return the detached oid of the given instance.
(package private)  ProxyManager getProxyManager()
          System proxy manager.
(package private)  void setAttachedCopy(Object from, PersistenceCapable into)
          Record the attached copy in the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttachManager

public AttachManager(BrokerImpl broker,
                     boolean copyNew,
                     OpCallbacks call)
Constructor. Supply broker attaching to.

Method Detail

getBehavior

public OpCallbacks getBehavior()
Return the behavior supplied on construction.


getCopyNew

public boolean getCopyNew()
Return whether to copy new instances being persisted.


attach

public Object attach(Object pc)
Return an attached version of the given instance.


attachAll

public Object[] attachAll(Collection instances)
Return attached versions of the given instances.


attach

Object attach(Object toAttach,
              PersistenceCapable into,
              OpenJPAStateManager owner,
              ValueMetaData ownerMeta,
              boolean explicit)
Attach.

Parameters:
toAttach - the detached object
into - the instance we're attaching into
owner - state manager for into
ownerMeta - the field we traversed to find toAttach
explicit - whether to make new instances explicitly persistent

getBroker

BrokerImpl getBroker()
Owning broker.


getProxyManager

ProxyManager getProxyManager()
System proxy manager.


getAttachedCopy

PersistenceCapable getAttachedCopy(Object pc)
If the passed in argument has already been attached, return the (cached) attached copy.


setAttachedCopy

void setAttachedCopy(Object from,
                     PersistenceCapable into)
Record the attached copy in the cache.


fireBeforeAttach

void fireBeforeAttach(Object pc,
                      ClassMetaData meta)
Fire before-attach event.


getDetachedObjectId

Object getDetachedObjectId(Object pc)
Return the detached oid of the given instance.


assertManaged

StateManagerImpl assertManaged(Object obj)
Throw an exception if the given object is not managed; otherwise return its state manager.



Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.