Java Doc for ObjectManagerImpl.java in  » Database-ORM » JPOX » org » jpox » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » JPOX » org.jpox 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jpox.ObjectManagerImpl

ObjectManagerImpl
public class ObjectManagerImpl implements ObjectManager(Code)
Representation of an ObjectManager. An object manager provides management for the persistence of objects into a datastore and the retrieval of these objects using various methods.

Caching

An ObjectManager has its own Level 1 cache. This stores objects against their identity. The Level 1 Cache is typically a weak referenced map and so cached objects can be garbage collected. Objects are similarly placed in the Level 2 cache of the owning PersistenceManagerFactory. This Level 2 cache caches objects across multiple ObjectManagers, and so we can use this to get objects retrieved by other ObjectManagers. The Caches exist for performance enhancement.

Transactions

Has a single transaction (the "current" transaction).

Persisted Objects

When an object involved in the current transaction it is enlisted (calling enlistInTransaction()). Its' identity is saved (in "txEnlistedIds") for use later in any "persistenceByReachability" process run at commit. Any object that is passed via makePersistent() will be stored (as an identity) in "txKnownPersistedIds" and objects persisted due to reachability from these objects will also have their identity stored (in "txFlushedNewIds"). All of this information is used in the "persistence-by-reachability-at-commit" process which detects if some objects originally persisted are no longer reachable and hence should not be persistent after all.

Queries

ALl queries run during a transaction are registered here. When the transaction commits/rolls back then all queries are notified that the connection is closing so that they can read in any remaining results (and the queries remain usable after). When this manager closes all queries registered here will also be closed meaning that a query has its lifetime defined by the owning PersistenceManager.


version:
   $Revision: 1.100 $

Inner Class :class ThreadContextInfo

Field Summary
final protected static  LocaliserLOCALISER
    
 HashSetmanagedRelationDirtySMs
     StateManagers of all objects that have had managed relationships changed in the last flush-cycle.

Constructor Summary
public  ObjectManagerImpl(ObjectManagerFactoryImpl omf, Object owner, String userName, String password)
     Constructor.

Method Summary
public  voidaddListener(Object listener, Class[] classes)
     Method to register a listener for instances of the specified classes.
public synchronized  voidaddStateManager(StateManager sm)
     Method to add the object managed by the specified StateManager to the cache.
protected  voidassertActiveTransaction()
     Method to assert if the current transaction is active.
protected  voidassertActiveTransactionOrNontransactionRead(String operation)
     Method to assert if no active transaction and nontransactionalRead is not set.
public  voidassertClassPersistable(Class cls)
     Method to assert if the specified class is Persistence Capable.
protected  voidassertDetachable(Object object)
     Method to assert if the specified object is Detachable.
protected  voidassertHasImplementationCreator()
     Validates that an ImplementationCreator instance is accessible.
protected  voidassertIsOpen()
     Method to assert if this Object Manager is open.
protected  voidassertNotDetached(Object object)
     Method to assert if the specified object is detached.
protected  voidassertWritable()
     Method to assert if the current transaction is active or non transactional writes are allowed.
public synchronized  voidattachObject(Object pc, boolean sco)
     Method to attach a persistent detached object.
public synchronized  ObjectattachObjectCopy(Object pc, boolean sco)
     Method to attach a persistent detached object returning an attached copy of the object.
public synchronized  voidclearDirty(StateManager sm)
     Method to clear an object from the list of dirty objects.
public synchronized  voidclearDirty()
     Method to clear all objects marked as dirty (whether directly or indirectly).
public synchronized  voidclose()
     Method to close the Persistence Manager.
public  voiddeleteObject(Object obj)
     Method to delete an object from the datastore. NOT to be called by internal JPOX methods.
public  voiddeleteObjectInternal(Object obj)
     Method to delete an object from persistence which should be called from internal calls only.
public  voiddeleteObjects(Object[] objs)
     Method to delete an array of objects from the datastore.
public  voiddeleteObjects(Collection objs)
     Method to delete an array of objects from the datastore.
public  voiddetachAll()
     Method to detach all objects in the ObjectManager.
public synchronized  voiddetachObject(Object obj, FetchPlanState state)
     Method to detach a persistent object without making a copy.
public  ObjectdetachObjectCopy(Object pc, FetchPlanState state)
     Detach a copy of the passed persistent object using the provided detach state.
public  voiddisconnectLifecycleListener()
    
public  voiddisconnectSMCache()
    
public synchronized  voidenlistInTransaction(StateManager sm)
     Method to enlist the specified StateManager in the current transaction.
public synchronized  voidevictAllObjects()
     Method to evict all current objects from L1 cache.
public synchronized  voidevictFromTransaction(StateManager sm)
     Method to evict the specified StateManager from the current transaction.
public  voidevictObject(Object obj)
     Internal method to evict an object from L1 cache.
public  voidevictObjects(Class cls, boolean subclasses)
     Method to evict all objects of the specified type (and optionaly its subclasses).
public  booleanexists(Object obj)
     Method to return if the specified object exists in the datastore.
public synchronized  ObjectfindObject(Object id, FieldValues fv, Class cls, boolean ignoreCache)
     Accessor for an object given the object id.
public synchronized  ObjectfindObject(Object id, FieldValues fv)
     Accessor for an object given the object id.
public synchronized  ObjectfindObject(Object id, boolean validate, boolean checkInheritance, String objectClassName)
     Accessor for an object given the object id.
public synchronized  ObjectfindObjectUsingAID(Class pcClass, FieldValues fv, boolean ignoreCache, boolean checkInheritance)
     Accessor for the StateManager of an object given the object AID.
Parameters:
  pcClass - The class of the PC object
Parameters:
  fv - The field values to be loaded
Parameters:
  ignoreCache - true if it must ignore the cache
Parameters:
  checkInheritance - Whether look to the database to determine whichclass this object is.
public synchronized  StateManagerfindStateManager(Object pc)
     Method to find the StateManager for an object.
Parameters:
  pc - The object we require the StateManager for.
public  voidflush()
     Method callable from external APIs for user-management of flushing.
public synchronized  voidflushInternal(boolean flushToDatastore)
     This method flushes all dirty, new, and deleted instances to the datastore.
public  ApiAdaptergetApiAdapter()
     Accessor for the API adapter.
public  CallbackHandlergetCallbackHandler()
     Retrieve the callback handler for this ObjectManager.
public  ClassLoaderResolvergetClassLoaderResolver()
    
public  booleangetCopyOnAttach()
     Accessor for whether to copy on attaching.
public  booleangetDetachAllOnCommit()
     Accessor for whether to detach all objects on commit of the transaction.
public  booleangetDetachOnClose()
     Accessor for whether to detach objects on close of the ObjectManager.
public synchronized  ExtentgetExtent(Class pcClass, boolean subclasses)
     Extents are collections of datastore objects managed by the datastore, not by explicit user operations on collections.
public  FetchPlangetFetchPlan()
    
public  booleangetIgnoreCache()
     Accessor for whether to ignore the cache.
public  SetgetManagedObjects()
     Accessor for the currently managed objects for the current transaction.
public  SetgetManagedObjects(Class[] classes)
     Accessor for the currently managed objects for the current transaction.
public  SetgetManagedObjects(String[] states)
     Accessor for the currently managed objects for the current transaction.
public  SetgetManagedObjects(String[] states, Class[] classes)
     Accessor for the currently managed objects for the current transaction.
public  MetaDataManagergetMetaDataManager()
     Accessor for the MetaDataManager for this ObjectManager (and its factory).
public  booleangetMultithreaded()
     Accessor for whether the Persistence Manager is multithreaded.
public  OMFContextgetOMFContext()
    
public synchronized  ObjectgetObjectFromCache(Object id)
     Convenience method to access an object in the cache.
public  ObjectgetOwner()
     Method to return the owner PM/EM object.
public synchronized  StateManagergetStateManagerById(Object id)
     Accessor for the StateManager of an object given the object id.
Parameters:
  id - Id of the object.
public  StoreManagergetStoreManager()
     Accessor for the Store Manager.
protected  ThreadContextInfogetThreadContextInfo()
     Accessor for the thread context information, for the current thread.
public  TransactiongetTransaction()
     Accessor for the current transaction.
public  booleanhasPersistenceInformationForClass(Class cls)
     Utility method to check if the specified class has reachable metadata or annotations.
public synchronized  voidhereIsStateManager(StateManager sm, Object pc)
     Method to add the StateManager for an object to this ObjectManager's list.
protected  voidinitialiseLevel1Cache()
     Method to initialise the L1 cache.
public  booleanisClosed()
     Accessor for whether this ObjectManager is closed.
public  booleanisDelayDatastoreOperationsEnabled()
     Whether the datastore operations are delayed until commit/flush.
public  booleanisEnlistedInTransaction(Object id)
     Method to return if an object is enlisted in the current transaction.
public  booleanisFlushing()
     Returns whether the ObjectManager is in the process of flushing.
public  booleanisInserted(Object pc, int fieldNumber)
     Convenience method to find if the specified field of the specified object has been inserted yet.
public  booleanisInserted(Object pc, String className)
     Convenience method to find if the specified object is inserted down to the specified class level yet.
public  booleanisInserting(Object pc)
     Tests whether this persistable object is in the process of being inserted.
public  booleanisManagingRelations()
     Returns whether this ObjectManager is currently performing the manage relationships task.
public  booleanisRunningDetachAllOnCommit()
     Accessor for whether this ObjectManager is currently running detachAllOnCommit.
public  voidmakeObjectNontransactional(Object obj)
     Method to make an object nontransactional.
public  voidmakeObjectTransactional(Object obj)
     Method to make an object transactional.
public synchronized  voidmakeObjectTransient(Object obj, FetchPlanState state)
     Method to migrate an object to transient state.
public synchronized  voidmarkDirty(StateManager sm, boolean directUpdate)
     Method to mark an object (StateManager) as dirty.
public  voidmarkManagedRelationDirty(StateManager sm)
     Method to mark the specified StateManager as needing an update due to managed relation constraints.
public  ObjectnewInstance(Class cls)
     Method to generate an instance of an interface, abstract class, or concrete PC class.
public  ObjectnewObjectId(Class pcClass, Object key)
     This method returns an object id instance corresponding to the pcClass and key arguments.
public synchronized  QuerynewQuery()
     Construct an empty query instance.
protected  voidperformManagedRelationships()
     Method to perform managed relationships tasks.
public  ObjectpersistObject(Object obj)
     Method to make an object persistent. NOT to be called by internal JPOX methods.
public  ObjectpersistObjectInternal(Object obj, FieldValues preInsertChanges, StateManager ownerSM, int ownerFieldNum, int objectType)
     Method to make an object persistent which should be called from internal calls only.
public synchronized  voidpostBegin()
     Method to perform any post-begin checks.
public  voidpostClose()
    
public synchronized  voidpostCommit()
     Commit any changes made to objects managed by the persistence manager to the database.
public synchronized  voidpreCommit()
     Method to perform any pre-commit checks.
public synchronized  voidpreRollback()
     Rollback any changes made to objects managed by the persistence manager to the database.
public synchronized  voidputObjectIntoCache(StateManager sm, boolean level1, boolean level2)
     Convenience method to add an object to the cache(s).
public synchronized  voidrefreshAllObjects()
     Method to do a refresh of all objects.
public  voidrefreshObject(Object obj)
     Method to do a refresh of an object, updating it from its datastore representation.
public  voidremoveAllInstanceLifecycleListeners()
     This method removes all previously registered lifecycle listeners.
public  voidremoveListener(Object listener)
     Method to remove a currently registered listener.
public synchronized  voidremoveObjectFromCache(Object pc, Object id, boolean level1, boolean level2)
     Convenience method to evict an object from the cache(s).
public synchronized  voidremoveStateManager(StateManager sm)
     Method to remove the object managed by the specified StateManager from the cache.
protected  voidremoveThreadContextInfo()
     Method to remove the current thread context info for the current thread.
public synchronized  voidreplaceObjectId(Object pc, Object oldID, Object newID)
     Replace the previous object id for a persistable object with a new one.
public  voidretrieveObject(Object obj, boolean fgOnly)
     Method to retrieve an object.
public  voidsetCopyOnAttach(boolean flag)
     Mutator for whether to copy on attaching.
public  voidsetDetachAllOnCommit(boolean flag)
     Mutator for whether to detach all objects on commit of the transaction.
public  voidsetDetachOnClose(boolean flag)
     Mutator for whether to detach objects on close of the ObjectManager.
public  voidsetIgnoreCache(boolean flag)
     Mutator for whether to ignore the cache.
public  voidsetMultithreaded(boolean flag)
     Mutator for whether the Persistence Manager is multithreaded.

Field Detail
LOCALISER
final protected static Localiser LOCALISER(Code)
Localisation utility for output messages



managedRelationDirtySMs
HashSet managedRelationDirtySMs(Code)
StateManagers of all objects that have had managed relationships changed in the last flush-cycle.




Constructor Detail
ObjectManagerImpl
public ObjectManagerImpl(ObjectManagerFactoryImpl omf, Object owner, String userName, String password)(Code)
Constructor.
Parameters:
  omf - Object Manager Factory
Parameters:
  owner - The owning PM/EM
Parameters:
  userName - Username for the datastore
Parameters:
  password - Password for the datastore
throws:
  JPOXUserException - if an error occurs allocating the necessary requested components




Method Detail
addListener
public void addListener(Object listener, Class[] classes)(Code)
Method to register a listener for instances of the specified classes.
Parameters:
  listener - The listener to sends events to
Parameters:
  classes - The classes that it is interested in



addStateManager
public synchronized void addStateManager(StateManager sm)(Code)
Method to add the object managed by the specified StateManager to the cache.
Parameters:
  sm - The StateManager



assertActiveTransaction
protected void assertActiveTransaction()(Code)
Method to assert if the current transaction is active. Throws a TransactionNotActiveException if not active



assertActiveTransactionOrNontransactionRead
protected void assertActiveTransactionOrNontransactionRead(String operation)(Code)
Method to assert if no active transaction and nontransactionalRead is not set.
Parameters:
  operation - The operation being performed (used in error reporting)
throws:
  JPOXUserException - if the tx is not active and no non-transactional read is available



assertClassPersistable
public void assertClassPersistable(Class cls)(Code)
Method to assert if the specified class is Persistence Capable.
Parameters:
  cls - The class to check
throws:
  ClassNotPersistableException - if class is not persistable
throws:
  NoPersistenceInformationException - if no metadata/annotations are found for class



assertDetachable
protected void assertDetachable(Object object)(Code)
Method to assert if the specified object is Detachable. Throws a ClassNotDetachableException if not capable
Parameters:
  object - The object to check



assertHasImplementationCreator
protected void assertHasImplementationCreator()(Code)
Validates that an ImplementationCreator instance is accessible.
throws:
  JPOXUserException - if an ImplementationCreator instance does not exist



assertIsOpen
protected void assertIsOpen()(Code)
Method to assert if this Object Manager is open. Throws a JPOXUserException if the ObjectManager is closed.



assertNotDetached
protected void assertNotDetached(Object object)(Code)
Method to assert if the specified object is detached. Throws a ObjectDetachedException if it is detached.
Parameters:
  object - The object to check



assertWritable
protected void assertWritable()(Code)
Method to assert if the current transaction is active or non transactional writes are allowed.
throws:
  a - TransactionNotActiveException if not active and non transactional writes are disabled



attachObject
public synchronized void attachObject(Object pc, boolean sco)(Code)
Method to attach a persistent detached object. If a different object with the same identity as this object exists in the L1 cache then an exception will be thrown.
Parameters:
  pc - The persistable object
Parameters:
  sco - Whether the PC object is stored without an identity (embedded/serialised)



attachObjectCopy
public synchronized Object attachObjectCopy(Object pc, boolean sco)(Code)
Method to attach a persistent detached object returning an attached copy of the object. If the object is of class that is not detachable, a ClassNotDetachableException will be thrown.
Parameters:
  pc - The object
Parameters:
  sco - Whether it has no identity (second-class object) The attached object



clearDirty
public synchronized void clearDirty(StateManager sm)(Code)
Method to clear an object from the list of dirty objects.
Parameters:
  sm - The StateManager



clearDirty
public synchronized void clearDirty()(Code)
Method to clear all objects marked as dirty (whether directly or indirectly).



close
public synchronized void close()(Code)
Method to close the Persistence Manager.



deleteObject
public void deleteObject(Object obj)(Code)
Method to delete an object from the datastore. NOT to be called by internal JPOX methods. Only callable by external APIs (JDO/JPA).
Parameters:
  obj - The object



deleteObjectInternal
public void deleteObjectInternal(Object obj)(Code)
Method to delete an object from persistence which should be called from internal calls only. All PM/EM calls should go via deleteObject(Object obj).
Parameters:
  obj - Object to delete



deleteObjects
public void deleteObjects(Object[] objs)(Code)
Method to delete an array of objects from the datastore.
Parameters:
  objs - The objects
throws:
  JPOXUserException - Thrown if an error occurs during the deletion process.Any exception could have several nested exceptions for each failed object deletion



deleteObjects
public void deleteObjects(Collection objs)(Code)
Method to delete an array of objects from the datastore.
Parameters:
  objs - The objects
throws:
  JPOXUserException - Thrown if an error occurs during the deletion process.Any exception could have several nested exceptions for each failed object deletion



detachAll
public void detachAll()(Code)
Method to detach all objects in the ObjectManager.



detachObject
public synchronized void detachObject(Object obj, FetchPlanState state)(Code)
Method to detach a persistent object without making a copy. Note that also all the objects which are refered to from this object are detached. If the object is of class that is not detachable a ClassNotDetachableException will be thrown. If the object is not persistent a JDOUserException is thrown. For internal use only
Parameters:
  obj - The object
Parameters:
  state - State for the detachment process



detachObjectCopy
public Object detachObjectCopy(Object pc, FetchPlanState state)(Code)
Detach a copy of the passed persistent object using the provided detach state. If the object is of class that is not detachable it will be detached as transient. If it is not yet persistent it will be first persisted.
Parameters:
  pc - The object
Parameters:
  state - State for the detachment process The detached object



disconnectLifecycleListener
public void disconnectLifecycleListener()(Code)
Disconnect the registered LifecycleListener



disconnectSMCache
public void disconnectSMCache()(Code)
Disconnect SM instances, clear cache and reset settings



enlistInTransaction
public synchronized void enlistInTransaction(StateManager sm)(Code)
Method to enlist the specified StateManager in the current transaction.
Parameters:
  sm - The StateManager



evictAllObjects
public synchronized void evictAllObjects()(Code)
Method to evict all current objects from L1 cache.



evictFromTransaction
public synchronized void evictFromTransaction(StateManager sm)(Code)
Method to evict the specified StateManager from the current transaction.
Parameters:
  sm - The StateManager



evictObject
public void evictObject(Object obj)(Code)
Internal method to evict an object from L1 cache.
Parameters:
  obj - The object
throws:
  JPOXException - if an error occurs evicting the object



evictObjects
public void evictObjects(Class cls, boolean subclasses)(Code)
Method to evict all objects of the specified type (and optionaly its subclasses).
Parameters:
  cls - Type of persistable object
Parameters:
  subclasses - Whether to include subclasses



exists
public boolean exists(Object obj)(Code)
Method to return if the specified object exists in the datastore.
Parameters:
  obj - The (persistable) object Whether it exists



findObject
public synchronized Object findObject(Object id, FieldValues fv, Class cls, boolean ignoreCache)(Code)
Accessor for an object given the object id.
Parameters:
  id - Id of the object.
Parameters:
  fv - Field values for the object
Parameters:
  cls - the type which the object is. This type will be used to instanciat the object
Parameters:
  ignoreCache - true if it must ignore the cache The Object



findObject
public synchronized Object findObject(Object id, FieldValues fv)(Code)
Accessor for an object given the object id. Checks the inheritance level of the object
Parameters:
  id - Id of the object.
Parameters:
  fv - Field values for the object The Object



findObject
public synchronized Object findObject(Object id, boolean validate, boolean checkInheritance, String objectClassName)(Code)
Accessor for an object given the object id. If validate is false, we return the object if found in the cache, or otherwise a Hollow object with that id. If validate is true we check with the datastore and return an object with the FetchPlan fields loaded (unless the object doesnt exist in the datastore, where we throw a JPOXObjectNotFoundException).
Parameters:
  id - Id of the object.
Parameters:
  validate - Whether to validate the object state
Parameters:
  checkInheritance - Whether look to the database to determine whichclass this object is.
Parameters:
  objectClassName - Class name for the object with this id (if known, optional) The Object with this id



findObjectUsingAID
public synchronized Object findObjectUsingAID(Class pcClass, FieldValues fv, boolean ignoreCache, boolean checkInheritance)(Code)
Accessor for the StateManager of an object given the object AID.
Parameters:
  pcClass - The class of the PC object
Parameters:
  fv - The field values to be loaded
Parameters:
  ignoreCache - true if it must ignore the cache
Parameters:
  checkInheritance - Whether look to the database to determine whichclass this object is. This parameter is a hint. Set false, if it'salready determined the correct pcClass for this pc "object" in a certainlevel in the hierarchy. Set to true and it will look to the database. Object



findStateManager
public synchronized StateManager findStateManager(Object pc)(Code)
Method to find the StateManager for an object.
Parameters:
  pc - The object we require the StateManager for. The StateManager, null if StateManager not found.See JDO spec for the calling behavior when null is returned



flush
public void flush()(Code)
Method callable from external APIs for user-management of flushing. Called by JDO PM.flush, or JPA EM.flush(). Performs management of relations, prior to performing internal flush of all dirty/new/deleted instances to the datastore.



flushInternal
public synchronized void flushInternal(boolean flushToDatastore)(Code)
This method flushes all dirty, new, and deleted instances to the datastore. It has no effect if a transaction is not active. If a datastore transaction is active, this method synchronizes the cache with the datastore and reports any exceptions. If an optimistic transaction is active, this method obtains a datastore connection and synchronizes the cache with the datastore using this connection. The connection obtained by this method is held until the end of the transaction.
Parameters:
  flushToDatastore - Whether to ensure any changes reach the datastoreOtherwise they will be flushed to the datastore manager and leave it todecide the opportune moment to actually flush them to the datastore
throws:
  JPOXOptimisticException - when optimistic locking error(s) occur



getApiAdapter
public ApiAdapter getApiAdapter()(Code)
Accessor for the API adapter. API adapter.



getCallbackHandler
public CallbackHandler getCallbackHandler()(Code)
Retrieve the callback handler for this ObjectManager. the callback handler



getClassLoaderResolver
public ClassLoaderResolver getClassLoaderResolver()(Code)
Accessor for the ClassLoaderResolver the ClassLoaderResolver



getCopyOnAttach
public boolean getCopyOnAttach()(Code)
Accessor for whether to copy on attaching. Whether to copy on attaching



getDetachAllOnCommit
public boolean getDetachAllOnCommit()(Code)
Accessor for whether to detach all objects on commit of the transaction. Whether to detach all on commit.



getDetachOnClose
public boolean getDetachOnClose()(Code)
Accessor for whether to detach objects on close of the ObjectManager. This is a JPOX extension and will not work when in JCA mode. Whether to detach on close.



getExtent
public synchronized Extent getExtent(Class pcClass, boolean subclasses)(Code)
Extents are collections of datastore objects managed by the datastore, not by explicit user operations on collections. Extent capability is a boolean property of classes that are persistence capable. If an instance of a class that has a managed extent is made persistent via reachability, the instance is put into the extent implicitly.
Parameters:
  pcClass - The class to query
Parameters:
  subclasses - Whether to include subclasses in the query. returns an Extent that contains all of the instances in theparameter class, and if the subclasses flag is true, all of the instancesof the parameter class and its subclasses.



getFetchPlan
public FetchPlan getFetchPlan()(Code)
Acessor for the current FetchPlan FetchPlan
since:
   1.1



getIgnoreCache
public boolean getIgnoreCache()(Code)
Accessor for whether to ignore the cache. Whether to ignore the cache.



getManagedObjects
public Set getManagedObjects()(Code)
Accessor for the currently managed objects for the current transaction. If the transaction is not active this returns null. Collection of managed objects enlisted in the current transaction



getManagedObjects
public Set getManagedObjects(Class[] classes)(Code)
Accessor for the currently managed objects for the current transaction. If the transaction is not active this returns null.
Parameters:
  classes - Classes that we want the enlisted objects for Collection of managed objects enlisted in the current transaction



getManagedObjects
public Set getManagedObjects(String[] states)(Code)
Accessor for the currently managed objects for the current transaction. If the transaction is not active this returns null.
Parameters:
  states - States that we want the enlisted objects for Collection of managed objects enlisted in the current transaction



getManagedObjects
public Set getManagedObjects(String[] states, Class[] classes)(Code)
Accessor for the currently managed objects for the current transaction. If the transaction is not active this returns null.
Parameters:
  states - States that we want the enlisted objects for
Parameters:
  classes - Classes that we want the enlisted objects for Collection of managed objects enlisted in the current transaction



getMetaDataManager
public MetaDataManager getMetaDataManager()(Code)
Accessor for the MetaDataManager for this ObjectManager (and its factory). This is used as the interface to MetaData in the ObjectManager/Factory. Returns the MetaDataManager.



getMultithreaded
public boolean getMultithreaded()(Code)
Accessor for whether the Persistence Manager is multithreaded. Whether to run multithreaded.



getOMFContext
public OMFContext getOMFContext()(Code)
Gets the context in which this ObjectManager is running Returns the context.



getObjectFromCache
public synchronized Object getObjectFromCache(Object id)(Code)
Convenience method to access an object in the cache. Firstly looks in the L1 cache for this ObjectManager, and if not found looks in the L2 cache.
Parameters:
  id - Id of the object Persistence Capable object (with connected StateManager).



getOwner
public Object getOwner()(Code)
Method to return the owner PM/EM object. For JDO this will return the PersistenceManager owning this ObjectManager. For JPA this will return the EntityManager owning this ObjectManager. The owner manager object



getStateManagerById
public synchronized StateManager getStateManagerById(Object id)(Code)
Accessor for the StateManager of an object given the object id.
Parameters:
  id - Id of the object. The StateManager



getStoreManager
public StoreManager getStoreManager()(Code)
Accessor for the Store Manager. StoreManager



getThreadContextInfo
protected ThreadContextInfo getThreadContextInfo()(Code)
Accessor for the thread context information, for the current thread. If the current thread is not present, will add an info context for it. The thread context information



getTransaction
public Transaction getTransaction()(Code)
Accessor for the current transaction. The transaction



hasPersistenceInformationForClass
public boolean hasPersistenceInformationForClass(Class cls)(Code)
Utility method to check if the specified class has reachable metadata or annotations.
Parameters:
  cls - The class to check Whether the class has reachable metadata or annotations



hereIsStateManager
public synchronized void hereIsStateManager(StateManager sm, Object pc)(Code)
Method to add the StateManager for an object to this ObjectManager's list.
Parameters:
  sm - The StateManager
Parameters:
  pc - The object managed by the StateManager



initialiseLevel1Cache
protected void initialiseLevel1Cache()(Code)
Method to initialise the L1 cache.
throws:
  JPOXUserException - if an error occurs setting up the L1 cache



isClosed
public boolean isClosed()(Code)
Accessor for whether this ObjectManager is closed. Whether this manager is closed.



isDelayDatastoreOperationsEnabled
public boolean isDelayDatastoreOperationsEnabled()(Code)
Whether the datastore operations are delayed until commit/flush. In optimistic transactions this is automatically enabled. In datastore transactions there is a persistence property to enable it. If we are committing/flushing then will return false since the delay is no longer required. true if datastore operations are delayed until commit/flush



isEnlistedInTransaction
public boolean isEnlistedInTransaction(Object id)(Code)
Method to return if an object is enlisted in the current transaction. This is only of use when running "persistence-by-reachability-at-commit"
Parameters:
  id - Identity for the object Whether it is enlisted in the current transaction



isFlushing
public boolean isFlushing()(Code)
Returns whether the ObjectManager is in the process of flushing. true if the ObjectManager is flushing



isInserted
public boolean isInserted(Object pc, int fieldNumber)(Code)
Convenience method to find if the specified field of the specified object has been inserted yet.
Parameters:
  pc - The object
Parameters:
  fieldNumber - The absolute field number Whether it has been inserted into the datastore



isInserted
public boolean isInserted(Object pc, String className)(Code)
Convenience method to find if the specified object is inserted down to the specified class level yet.
Parameters:
  pc - The object
Parameters:
  className - Name of the class that we want to check the insertion level to Whether it has been inserted into the datastore



isInserting
public boolean isInserting(Object pc)(Code)
Tests whether this persistable object is in the process of being inserted.
Parameters:
  pc - the object to verify the status true if this instance is inserting.



isManagingRelations
public boolean isManagingRelations()(Code)
Returns whether this ObjectManager is currently performing the manage relationships task. Whether in the process of managing relations



isRunningDetachAllOnCommit
public boolean isRunningDetachAllOnCommit()(Code)
Accessor for whether this ObjectManager is currently running detachAllOnCommit. Whether running detachAllOnCommit



makeObjectNontransactional
public void makeObjectNontransactional(Object obj)(Code)
Method to make an object nontransactional.
Parameters:
  obj - The object



makeObjectTransactional
public void makeObjectTransactional(Object obj)(Code)
Method to make an object transactional.
Parameters:
  obj - The object
throws:
  JPOXException - Thrown when an error occurs



makeObjectTransient
public synchronized void makeObjectTransient(Object obj, FetchPlanState state)(Code)
Method to migrate an object to transient state.
Parameters:
  obj - The object
Parameters:
  state - Object containing the state of the fetch plan process (if any)
throws:
  JPOXException - When an error occurs in making the object transient



markDirty
public synchronized void markDirty(StateManager sm, boolean directUpdate)(Code)
Method to mark an object (StateManager) as dirty.
Parameters:
  sm - The StateManager
Parameters:
  directUpdate - Whether the object has had a direct update made on it (if known)



markManagedRelationDirty
public void markManagedRelationDirty(StateManager sm)(Code)
Method to mark the specified StateManager as needing an update due to managed relation constraints.
Parameters:
  sm - The StateManager



newInstance
public Object newInstance(Class cls)(Code)
Method to generate an instance of an interface, abstract class, or concrete PC class.
Parameters:
  cls - The class of the interface or abstract class, or concrete class defined in MetaData The instance of this type



newObjectId
public Object newObjectId(Class pcClass, Object key)(Code)
This method returns an object id instance corresponding to the pcClass and key arguments. Operates in 2 modes :-
  • The class uses SingleFieldIdentity and the key is the value of the key field
  • In all other cases the key is the String form of the object id instance

Parameters:
  pcClass - Class of the PersistenceCapable to create the identity for
Parameters:
  key - Value of the key for SingleFieldIdentity (or the toString value) The new object-id instance



newQuery
public synchronized Query newQuery()(Code)
Construct an empty query instance. The query



performManagedRelationships
protected void performManagedRelationships()(Code)
Method to perform managed relationships tasks.
throws:
  JPOXUserException - if a consistency check fails



persistObject
public Object persistObject(Object obj)(Code)
Method to make an object persistent. NOT to be called by internal JPOX methods. Only callable by external APIs (JDO/JPA).
Parameters:
  obj - The object The persisted object
throws:
  JPOXUserException - if the object is managed by a different manager



persistObjectInternal
public Object persistObjectInternal(Object obj, FieldValues preInsertChanges, StateManager ownerSM, int ownerFieldNum, int objectType)(Code)
Method to make an object persistent which should be called from internal calls only. All PM/EM calls should go via persistObject(Object obj).
Parameters:
  obj - The object
Parameters:
  preInsertChanges - Any changes to make before inserting
Parameters:
  ownerSM - StateManager of the owner when embedded
Parameters:
  ownerFieldNum - Field number in the owner where this is embedded (or -1 if not embedded)
Parameters:
  objectType - Type of object (see org.jpox.StateManager, e.g StateManager.PC) The persisted object
throws:
  JPOXUserException - if the object is managed by a different manager



postBegin
public synchronized void postBegin()(Code)
Method to perform any post-begin checks.



postClose
public void postClose()(Code)



postCommit
public synchronized void postCommit()(Code)
Commit any changes made to objects managed by the persistence manager to the database.



preCommit
public synchronized void preCommit()(Code)
Method to perform any pre-commit checks.



preRollback
public synchronized void preRollback()(Code)
Rollback any changes made to objects managed by the persistence manager to the database.



putObjectIntoCache
public synchronized void putObjectIntoCache(StateManager sm, boolean level1, boolean level2)(Code)
Convenience method to add an object to the cache(s).
Parameters:
  sm - The State Manager
Parameters:
  level1 - Whether to put it in the L1 cache
Parameters:
  level2 - Whether to put it in the L2 cache



refreshAllObjects
public synchronized void refreshAllObjects()(Code)
Method to do a refresh of all objects.
throws:
  JPOXUserException - thrown if instances could not be refreshed.



refreshObject
public void refreshObject(Object obj)(Code)
Method to do a refresh of an object, updating it from its datastore representation. Also updates the object in the L1/L2 caches.
Parameters:
  obj - The Object



removeAllInstanceLifecycleListeners
public void removeAllInstanceLifecycleListeners()(Code)
This method removes all previously registered lifecycle listeners. It is necessary to make sure, that a cached ObjectManager (in j2ee environment) will have no listener before the listeners are copied from the OMF. Otherwise they might be registered multiple times.



removeListener
public void removeListener(Object listener)(Code)
Method to remove a currently registered listener.
Parameters:
  listener - The listener to remove.



removeObjectFromCache
public synchronized void removeObjectFromCache(Object pc, Object id, boolean level1, boolean level2)(Code)
Convenience method to evict an object from the cache(s).
Parameters:
  pc - The Persistpable object
Parameters:
  id - The Persistable object id
Parameters:
  level1 - Whether to evict from the L1 cache
Parameters:
  level2 - Whether to evict from the L2 cache



removeStateManager
public synchronized void removeStateManager(StateManager sm)(Code)
Method to remove the object managed by the specified StateManager from the cache.
Parameters:
  sm - The StateManager



removeThreadContextInfo
protected void removeThreadContextInfo()(Code)
Method to remove the current thread context info for the current thread.



replaceObjectId
public synchronized void replaceObjectId(Object pc, Object oldID, Object newID)(Code)
Replace the previous object id for a persistable object with a new one. This is used where we have already added the object to the cache(s) and/or enlisted it in the txn before its real identity was fixed (attributed in the datastore).
Parameters:
  pc - The Persistable object
Parameters:
  oldID - the old id it was known by
Parameters:
  newID - the new id



retrieveObject
public void retrieveObject(Object obj, boolean fgOnly)(Code)
Method to retrieve an object.
Parameters:
  obj - The object
Parameters:
  fgOnly - Whether to retrieve the current fetch group fields only



setCopyOnAttach
public void setCopyOnAttach(boolean flag)(Code)
Mutator for whether to copy on attaching.
Parameters:
  flag - Whether to copy on attaching



setDetachAllOnCommit
public void setDetachAllOnCommit(boolean flag)(Code)
Mutator for whether to detach all objects on commit of the transaction.
Parameters:
  flag - Whether to detach all on commit.



setDetachOnClose
public void setDetachOnClose(boolean flag)(Code)
Mutator for whether to detach objects on close of the ObjectManager. This is a JPOX extension and will not work when in JCA mode.
Parameters:
  flag - Whether to detach on close.



setIgnoreCache
public void setIgnoreCache(boolean flag)(Code)
Mutator for whether to ignore the cache.
Parameters:
  flag - Whether to ignore the cache.



setMultithreaded
public void setMultithreaded(boolean flag)(Code)
Mutator for whether the Persistence Manager is multithreaded.
Parameters:
  flag - Whether to run multithreaded.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.