Save This Page
Home » apache-openjpa-1.1.0-source » org.apache.openjpa » kernel » [javadoc | source]
org.apache.openjpa.kernel
public class: BrokerImpl [javadoc | source]
java.lang.Object
   org.apache.openjpa.kernel.BrokerImpl

All Implemented Interfaces:
    Cloneable, Broker, Serializable, FindCallbacks

Direct Known Subclasses:
    FinalizingBrokerImpl, DistributedBrokerImpl

Concrete Broker . The broker handles object-level behavior, but leaves all interaction with the data store to a StoreManager that must be supplied at initialization.
Nested Class Summary:
static class  BrokerImpl.TransactionalCache  Transactional cache that holds soft refs to clean instances. 
Field Summary
protected static final  int FLUSH_INC    Incremental flush. 
protected static final  int FLUSH_COMMIT    Flush in preparation of commit. 
protected static final  int FLUSH_ROLLBACK    Flush to check consistency of cache, then immediately rollback changes. 
protected static final  int FLUSH_LOGICAL    Run persistence-by-reachability and other flush-time operations without accessing the database. 
static final  int STATUS_INIT     
static final  int STATUS_TRANSIENT     
static final  int STATUS_OID_ASSIGN     
static final  int STATUS_COMMIT_NEW     
Method from org.apache.openjpa.kernel.BrokerImpl Summary:
addDereferencedDependent,   addLifecycleListener,   addToPendingTransaction,   addToTransaction,   addTransactionListener,   afterCompletion,   assertActiveTransaction,   assertNontransactionalRead,   assertOpen,   assertPersistenceCapable,   assertWriteOperation,   assignObjectId,   attach,   attachAll,   beforeCompletion,   begin,   beginOperation,   beginStore,   cancelAll,   checkForDuplicateId,   clone,   close,   commit,   commitAndResume,   copy,   delete,   delete,   deleteAll,   detach,   detachAll,   detachAll,   detachAll,   dirtyType,   embed,   endOperation,   endTransaction,   evict,   evictAll,   evictAll,   evictAll,   extentIterator,   find,   find,   find,   findAll,   findAll,   findAll,   findCached,   fireLifecycleEvent,   flush,   flush,   free,   gatherCascadeRefresh,   getAutoClear,   getAutoDetach,   getBroker,   getBrokerFactory,   getClassLoader,   getConfiguration,   getConnection,   getConnectionPassword,   getConnectionRetainMode,   getConnectionUserName,   getDeletedTypes,   getDetachState,   getDirtyObjects,   getDirtyStates,   getEvictFromDataCache,   getFetchConfiguration,   getIdentitySequence,   getIgnoreChanges,   getInstanceExceptionTranslator,   getInverseManager,   getLifecycleEventManager,   getLifecycleListenerCallbackMode,   getLockLevel,   getLockManager,   getManagedObjects,   getManagedRuntime,   getManagedStates,   getMultithreaded,   getNontransactionalRead,   getNontransactionalWrite,   getObjectId,   getObjectIdType,   getOperatingSet,   getOptimistic,   getOrderDirtyObjects,   getPendingTransactionalObjects,   getPendingTransactionalStates,   getPersistedTypes,   getPopulateDataCache,   getRestoreState,   getRetainState,   getRollbackCause,   getRollbackOnly,   getStateManager,   getStateManagerImpl,   getStateManagerImplById,   getStoreManager,   getSyncWithManagedTransactions,   getSynchronization,   getTransactionListenerCallbackMode,   getTransactionalObjects,   getTransactionalStates,   getUpdatedTypes,   getUserObject,   getValueSequence,   getVersion,   hasConnection,   initialize,   initialize,   isActive,   isCloseInvoked,   isClosed,   isDeleted,   isDetached,   isDetachedNew,   isDirty,   isManaged,   isNew,   isPersistent,   isSerializing,   isStoreActive,   isTrackChangesByType,   isTransactionEnding,   isTransactional,   lock,   lock,   lock,   lockAll,   lockAll,   newExtent,   newInstance,   newManagedObjectCache,   newObjectId,   newQuery,   newQuery,   newQueryImpl,   newStateManagerImpl,   nontransactional,   nontransactionalAll,   persist,   persist,   persist,   persist,   persistAll,   persistAll,   popFetchConfiguration,   preFlush,   processArgument,   processReturn,   pushFetchConfiguration,   putUserObject,   refresh,   refreshAll,   refreshInternal,   refreshInternal,   release,   releaseAll,   releaseSavepoint,   releaseSavepoint,   removeDereferencedDependent,   removeFromPendingTransaction,   removeFromTransaction,   removeLifecycleListener,   removeTransactionListener,   retrieve,   retrieveAll,   rollback,   rollbackAndResume,   rollbackToSavepoint,   rollbackToSavepoint,   setAuthentication,   setAutoClear,   setAutoDetach,   setAutoDetach,   setDetachState,   setDetachedNew,   setDirty,   setEvictFromDataCache,   setIgnoreChanges,   setImplicitBehavior,   setLifecycleListenerCallbackMode,   setMultithreaded,   setNontransactionalRead,   setNontransactionalWrite,   setOptimistic,   setOrderDirtyObjects,   setPopulateDataCache,   setRestoreState,   setRetainState,   setRollbackOnly,   setRollbackOnly,   setSavepoint,   setStateManager,   setSyncWithManagedTransactions,   setSynchronization,   setTrackChangesByType,   setTransactionListenerCallbackMode,   syncWithManagedTransaction,   transactional,   transactionalAll,   unlock,   validateChanges
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.openjpa.kernel.BrokerImpl Detail:
  void addDereferencedDependent(StateManagerImpl sm) 
    Add a dereferenced dependent object to the persistence manager's cache. On flush, these objects will be deleted.
 public  void addLifecycleListener(Object listener,
    Class[] classes) 
  void addToPendingTransaction(StateManagerImpl sm) 
    Notify the broker that the given state manager should be added to the set of instances that will become transactional on the next transaction
  void addToTransaction(StateManagerImpl sm) 
    Notify the broker that the given state manager should be added to the set of instances involved in the current transaction.
 public  void addTransactionListener(Object tl) 
 public  void afterCompletion(int status) 
 public  void assertActiveTransaction() 
 public  void assertNontransactionalRead() 
 public  void assertOpen() 
    Throw an exception if the context is closed. The exact message and content of the exception varies whether TRACE is enabled or not.
 protected PersistenceCapable assertPersistenceCapable(Object obj) 
    Return the given instance as a PersistenceCapable . If the instance is not manageable throw the proper exception.
 public  void assertWriteOperation() 
 protected  void assignObjectId(Object cache,
    Object id,
    StateManagerImpl sm) 
    Assign the object id to the cache. Exception will be thrown if the id already exists in the cache.
 public Object attach(Object obj,
    boolean copyNew,
    OpCallbacks call) 
 public Object[] attachAll(Collection objs,
    boolean copyNew,
    OpCallbacks call) 
 public  void beforeCompletion() 
 public  void begin() 
 public boolean beginOperation(boolean syncTrans) 
 public  void beginStore() 
 public boolean cancelAll() 
 protected  void checkForDuplicateId(Object id,
    Object obj) 
    This method makes sure we don't already have the instance cached
 public Object clone() throws CloneNotSupportedException 
 public  void close() 
 public  void commit() 
 public  void commitAndResume() 
 OpenJPAStateManager copy(OpenJPAStateManager copy,
    PCState state) 
    If not already cached, create an empty copy of the given state manager in the given state.
 public  void delete(Object obj,
    OpCallbacks call) 
  void delete(Object obj,
    StateManagerImpl sm,
    OpCallbacks call) 
    Internal delete.
 public  void deleteAll(Collection objs,
    OpCallbacks call) 
 public Object detach(Object obj,
    OpCallbacks call) 
 public  void detachAll(OpCallbacks call) 
 public Object[] detachAll(Collection objs,
    OpCallbacks call) 
 public  void detachAll(OpCallbacks call,
    boolean flush) 
 public  void dirtyType(Class cls) 
 public OpenJPAStateManager embed(Object obj,
    Object id,
    OpenJPAStateManager owner,
    ValueMetaData ownerMeta) 
 public boolean endOperation() 
    Mark the operation over. If outermost caller of stack, returns true and will detach managed instances if necessary.
 protected  void endTransaction(int status) 
    End the current transaction, making appropriate state transitions.
 public  void evict(Object obj,
    OpCallbacks call) 
 public  void evictAll(OpCallbacks call) 
 public  void evictAll(Collection objs,
    OpCallbacks call) 
 public  void evictAll(Extent extent,
    OpCallbacks call) 
 public Iterator extentIterator(Class type,
    boolean subclasses,
    FetchConfiguration fetch,
    boolean ignoreChanges) 
 public Object find(Object oid,
    boolean validate,
    FindCallbacks call) 
 public Object find(Object oid,
    FetchConfiguration fetch,
    BitSet exclude,
    Object edata,
    int flags) 
 protected Object find(Object oid,
    FetchConfiguration fetch,
    BitSet exclude,
    Object edata,
    int flags,
    FindCallbacks call) 
    Internal finder.
 public Object[] findAll(Collection oids,
    boolean validate,
    FindCallbacks call) 
 public Object[] findAll(Collection oids,
    FetchConfiguration fetch,
    BitSet exclude,
    Object edata,
    int flags) 
 protected Object[] findAll(Collection oids,
    FetchConfiguration fetch,
    BitSet exclude,
    Object edata,
    int flags,
    FindCallbacks call) 
    Internal finder.
 public Object findCached(Object oid,
    FindCallbacks call) 
 boolean fireLifecycleEvent(Object src,
    Object related,
    ClassMetaData meta,
    int eventType) 
    Fire given lifecycle event, handling any exceptions appropriately.
 public  void flush() 
 protected  void flush(int reason) 
    Flush the transactional state to the data store. Subclasses that customize commit behavior should override this method. The method assumes that the persistence manager is locked, is not closed, and has an active transaction.
 protected  void free() 
    Free the resources used by this persistence manager.
  void gatherCascadeRefresh(Object obj,
    OpCallbacks call) 
    Gathers all objects reachable through cascade-refresh relations into the operating set.
 public int getAutoClear() 
 public int getAutoDetach() 
 public Broker getBroker() 
 public BrokerFactory getBrokerFactory() 
 public ClassLoader getClassLoader() 
 public OpenJPAConfiguration getConfiguration() 
 public Object getConnection() 
 public String getConnectionPassword() 
 public int getConnectionRetainMode() 
 public String getConnectionUserName() 
 public Collection getDeletedTypes() 
 public int getDetachState() 
 public Collection getDirtyObjects() 
 protected Collection getDirtyStates() 
    Return a copy of all dirty state managers.
 public boolean getEvictFromDataCache() 
 public FetchConfiguration getFetchConfiguration() 
 public Seq getIdentitySequence(ClassMetaData meta) 
 public boolean getIgnoreChanges() 
 RuntimeExceptionTranslator getInstanceExceptionTranslator() 
 public InverseManager getInverseManager() 
 public LifecycleEventManager getLifecycleEventManager() 
    Give state managers access to the lifecycle event manager.
 public int getLifecycleListenerCallbackMode() 
 public int getLockLevel(Object o) 
 public LockManager getLockManager() 
 public Collection getManagedObjects() 
 public ManagedRuntime getManagedRuntime() 
 protected Collection getManagedStates() 
    Return a copy of all managed state managers.
 public boolean getMultithreaded() 
 public boolean getNontransactionalRead() 
 public boolean getNontransactionalWrite() 
 public Object getObjectId(Object obj) 
 public Class getObjectIdType(Class cls) 
 protected Set getOperatingSet() 
    Gets the unmodifiable set of instances being operated.
 public boolean getOptimistic() 
 public boolean getOrderDirtyObjects() 
 public Collection getPendingTransactionalObjects() 
 protected Collection getPendingTransactionalStates() 
    Return a copy of all state managers which will become transactional upon the next transaction.
 public Collection getPersistedTypes() 
 public boolean getPopulateDataCache() 
 public int getRestoreState() 
 public boolean getRetainState() 
 public Throwable getRollbackCause() 
 public boolean getRollbackOnly() 
 public OpenJPAStateManager getStateManager(Object obj) 
 protected StateManagerImpl getStateManagerImpl(Object obj,
    boolean assertThisContext) 
    Return the state manager for the given instance, or null.
 protected StateManagerImpl getStateManagerImplById(Object oid,
    boolean allowNew) 
    Return the state manager for the given oid.
 public DelegatingStoreManager getStoreManager() 
 public boolean getSyncWithManagedTransactions() 
 public Synchronization getSynchronization() 
 public int getTransactionListenerCallbackMode() 
 public Collection getTransactionalObjects() 
 protected Collection getTransactionalStates() 
    Return a copy of all transactional state managers.
 public Collection getUpdatedTypes() 
 public Object getUserObject(Object key) 
 public Seq getValueSequence(FieldMetaData fmd) 
 public Object getVersion(Object obj) 
 public boolean hasConnection() 
 protected StateManagerImpl initialize(StateManagerImpl sm,
    boolean load,
    FetchConfiguration fetch,
    Object edata) 
    Initialize a newly-constructed state manager.
 public  void initialize(AbstractBrokerFactory factory,
    DelegatingStoreManager sm,
    boolean managed,
    int connMode,
    boolean fromDeserialization) 
    Initialize the persistence manager. This method is called automatically by the factory before use.
 public boolean isActive() 
 public boolean isCloseInvoked() 
 public boolean isClosed() 
 public boolean isDeleted(Object obj) 
 public boolean isDetached(Object obj) 
 public boolean isDetachedNew() 
 public boolean isDirty(Object obj) 
 public boolean isManaged() 
 public boolean isNew(Object obj) 
 public boolean isPersistent(Object obj) 
 boolean isSerializing() 
    Whether or not this broker is in the midst of being serialized.
 public boolean isStoreActive() 
 public boolean isTrackChangesByType() 
 boolean isTransactionEnding() 
    Return whether the current transaction is ending, i.e. in the 2nd phase of a commit or rollback
 public boolean isTransactional(Object obj) 
 public  void lock() 
 public  void lock(Object obj,
    OpCallbacks call) 
 public  void lock(Object obj,
    int level,
    int timeout,
    OpCallbacks call) 
 public  void lockAll(Collection objs,
    OpCallbacks call) 
 public  void lockAll(Collection objs,
    int level,
    int timeout,
    OpCallbacks call) 
 public Extent newExtent(Class type,
    boolean subclasses) 
 public Object newInstance(Class cls) 
 protected Map newManagedObjectCache() 
    Create a Map to be used for the primary managed object cache. Maps oids to state managers. By default, this creates a ReferenceMap with soft values.
 public Object newObjectId(Class cls,
    Object val) 
 public Query newQuery(String lang,
    Object query) 
 public Query newQuery(String lang,
    Class cls,
    Object query) 
 protected QueryImpl newQueryImpl(String lang,
    StoreQuery sq) 
    Create a new query.
 protected StateManagerImpl newStateManagerImpl(Object oid,
    ClassMetaData meta) 
    Create a state manager for the given oid and metadata.
 public  void nontransactional(Object obj,
    OpCallbacks call) 
 public  void nontransactionalAll(Collection objs,
    OpCallbacks call) 
 public  void persist(Object obj,
    OpCallbacks call) 
 public OpenJPAStateManager persist(Object obj,
    Object id,
    OpCallbacks call) 
 public  void persist(Object obj,
    boolean explicit,
    OpCallbacks call) 
    Persist the given object. Indicate whether this was an explicit persist (PNEW) or a provisonal persist (PNEWPROVISIONAL)
 public OpenJPAStateManager persist(Object obj,
    Object id,
    boolean explicit,
    OpCallbacks call) 
    Persist the given object. Indicate whether this was an explicit persist (PNEW) or a provisonal persist (PNEWPROVISIONAL). See Broker for details on this method.
 public  void persistAll(Collection objs,
    OpCallbacks call) 
 public  void persistAll(Collection objs,
    boolean explicit,
    OpCallbacks call) 
    Persist the given objects. Indicate whether this was an explicit persist (PNEW) or a provisonal persist (PNEWPROVISIONAL).
 public  void popFetchConfiguration() 
 public  void preFlush() 
 public Object processArgument(Object oid) 
 public Object processReturn(Object oid,
    OpenJPAStateManager sm) 
 public FetchConfiguration pushFetchConfiguration() 
 public Object putUserObject(Object key,
    Object val) 
 public  void refresh(Object obj,
    OpCallbacks call) 
 public  void refreshAll(Collection objs,
    OpCallbacks call) 
 protected  void refreshInternal(Collection objs,
    OpCallbacks call) 
    This method is called with the full set of objects reachable via cascade-refresh relations from the user-given instances.
 protected  void refreshInternal(Object obj,
    OpCallbacks call) 
    Optimization for single-object refresh.
 public  void release(Object obj,
    OpCallbacks call) 
 public  void releaseAll(Collection objs,
    OpCallbacks call) 
 public  void releaseSavepoint() 
 public  void releaseSavepoint(String savepoint) 
  void removeDereferencedDependent(StateManagerImpl sm) 
    Remove the given previously dereferenced dependent object from the cache. It is now referenced.
  void removeFromPendingTransaction(StateManagerImpl sm) 
    Notify the persistence manager that the given state manager should be removed from the set of instances involved in the next transaction.
  void removeFromTransaction(StateManagerImpl sm) 
    Notify the persistence manager that the given state manager should be removed from the set of instances involved in the current transaction.
 public  void removeLifecycleListener(Object listener) 
 public  void removeTransactionListener(Object tl) 
 public  void retrieve(Object obj,
    boolean dfgOnly,
    OpCallbacks call) 
 public  void retrieveAll(Collection objs,
    boolean dfgOnly,
    OpCallbacks call) 
 public  void rollback() 
 public  void rollbackAndResume() 
 public  void rollbackToSavepoint() 
 public  void rollbackToSavepoint(String savepoint) 
 public  void setAuthentication(String user,
    String pass) 
    Set the persistence manager's authentication. This is the first method called after construction.
 public  void setAutoClear(int val) 
 public  void setAutoDetach(int detachFlags) 
 public  void setAutoDetach(int detachFlag,
    boolean on) 
 public  void setDetachState(int mode) 
 public  void setDetachedNew(boolean isNew) 
  void setDirty(StateManagerImpl sm,
    boolean firstDirty) 
    Notification that the given instance has been dirtied. This notification is given when an object first transitions to a dirty state, and every time the object is modified by the user thereafter.
 public  void setEvictFromDataCache(boolean evict) 
 public  void setIgnoreChanges(boolean val) 
 public  void setImplicitBehavior(OpCallbacks call,
    RuntimeExceptionTranslator ex) 
 public  void setLifecycleListenerCallbackMode(int mode) 
 public  void setMultithreaded(boolean multithreaded) 
 public  void setNontransactionalRead(boolean val) 
 public  void setNontransactionalWrite(boolean val) 
 public  void setOptimistic(boolean val) 
 public  void setOrderDirtyObjects(boolean order) 
 public  void setPopulateDataCache(boolean cache) 
 public  void setRestoreState(int val) 
 public  void setRetainState(boolean val) 
 public  void setRollbackOnly() 
 public  void setRollbackOnly(Throwable cause) 
 public  void setSavepoint(String name) 
  void setStateManager(Object id,
    StateManagerImpl sm,
    int status) 
    Set the cached StateManager for the instance that had the given oid. This method must not be called multiple times for new instances.
 public  void setSyncWithManagedTransactions(boolean sync) 
 public  void setSynchronization(Synchronization sync) 
 public  void setTrackChangesByType(boolean largeTransaction) 
 public  void setTransactionListenerCallbackMode(int mode) 
 public boolean syncWithManagedTransaction() 
 public  void transactional(Object obj,
    boolean updateVersion,
    OpCallbacks call) 
    Make the given instances transactional.
 public  void transactionalAll(Collection objs,
    boolean updateVersion,
    OpCallbacks call) 
    Make the given instances transactional.
 public  void unlock() 
 public  void validateChanges()