Java Doc for StoreManager.java in  » Database-ORM » openjpa » org » apache » openjpa » kernel » 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 » openjpa » org.apache.openjpa.kernel 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.openjpa.kernel.StoreManager

All known Subclasses:   org.apache.openjpa.abstractstore.AbstractStoreManager,  org.apache.openjpa.kernel.DelegatingStoreManager,  org.apache.openjpa.jdbc.kernel.JDBCStoreManager,
StoreManager
public interface StoreManager extends Closeable(Code)
Interface to be implemented by data store mechanisms to interact with this runtime.
author:
   Abe White


Field Summary
final public static  intFORCE_LOAD_ALL
    
final public static  intFORCE_LOAD_DFG
    
final public static  intFORCE_LOAD_NONE
    
final public static  intFORCE_LOAD_REFRESH
    
final public static  intVERSION_DIFFERENT
    
final public static  intVERSION_EARLIER
    
final public static  intVERSION_LATER
    
final public static  intVERSION_SAME
    


Method Summary
public  booleanassignField(OpenJPAStateManager sm, int field, boolean preFlush)
     Assign a value to the given field.
public  booleanassignObjectId(OpenJPAStateManager sm, boolean preFlush)
     Assign an object id to the given new instance.
public  voidbeforeStateChange(OpenJPAStateManager sm, PCState fromState, PCState toState)
     Notification that the given state manager is about to change its lifecycle state.
public  voidbegin()
     Begin a data store transaction.
public  voidbeginOptimistic()
     Notification that an optimistic transaction has started.
public  booleancancelAll()
     Cancel all pending data store statements.
public  voidclose()
     Free any resources this store manager is using.
public  voidcommit()
     Commit the current data store transaction.
public  intcompareVersion(OpenJPAStateManager state, Object v1, Object v2)
     Compare the two version objects.
public  ObjectcopyDataStoreId(Object oid, ClassMetaData meta)
     Copy the given object id value.
public  ResultObjectProviderexecuteExtent(ClassMetaData meta, boolean subclasses, FetchConfiguration fetch)
     Return a provider for all instances of the given candidate class, optionally including subclasses.
public  booleanexists(OpenJPAStateManager sm, Object edata)
     Verify that the given instance exists in the data store; return false if it does not.
public  Collectionflush(Collection sms)
     Flush the given state manager collection to the datastore, returning a collection of exceptions encountered during flushing. The given collection may include states that do not require data store action, such as persistent-clean instances or persistent-dirty instances that have not been modified since they were last flushed. For datastore updates and inserts, the dirty, non-flushed fields of each state should be flushed.
public  ObjectgetClientConnection()
     Return a connection to the data store suitable for client use.
public  SeqgetDataStoreIdSequence(ClassMetaData forClass)
     Return a sequence that generates datastore identity values for the given class.
public  ClassgetDataStoreIdType(ClassMetaData meta)
     Return the class used by this StoreManager for datastore identity values.
public  ClassgetManagedType(Object oid)
     Return the persistent class for the given data store identity value.
public  SeqgetValueSequence(FieldMetaData forField)
     Return a sequence that generates values for the given field.
public  booleaninitialize(OpenJPAStateManager sm, PCState state, FetchConfiguration fetch, Object edata)
     Initialize the given state manager.
public  booleanload(OpenJPAStateManager sm, BitSet fields, FetchConfiguration fetch, int lockLevel, Object edata)
     Load the given state manager. Note that any collection or map types loaded into the state manager will be proxied with the correct type; therefore the store manager does not have to load the same concrete collection/map types as the instance declares.
public  CollectionloadAll(Collection sms, PCState state, int load, FetchConfiguration fetch, Object edata)
     Initialize, load, or validate the existance of all of the given objects.
public  ObjectnewDataStoreId(Object oidVal, ClassMetaData meta)
     Create a new unique datastore identity for the given type from the given oid value (presumably pk, stringified oid, or oid instance).
public  FetchConfigurationnewFetchConfiguration()
     Return a fetch configuration suitable for this runtime.
public  StoreQuerynewQuery(String language)
     Return a query implementation suitable for this store.
public  voidreleaseConnection()
     Instruct the store to release a retained connection.
public  voidretainConnection()
     Instruct the store to retain a connection for continued use.
public  voidrollback()
     Rollback the current data store transaction.
public  voidrollbackOptimistic()
     Notification that an optimistic transaction was rolled back before a data store transaction ever began.
public  voidsetContext(StoreContext ctx)
     Set a reference to the corresponding context.
public  booleansyncVersion(OpenJPAStateManager sm, Object edata)
     Update the version information in the given state manager to the version stored in the data store.

Field Detail
FORCE_LOAD_ALL
final public static int FORCE_LOAD_ALL(Code)



FORCE_LOAD_DFG
final public static int FORCE_LOAD_DFG(Code)



FORCE_LOAD_NONE
final public static int FORCE_LOAD_NONE(Code)



FORCE_LOAD_REFRESH
final public static int FORCE_LOAD_REFRESH(Code)



VERSION_DIFFERENT
final public static int VERSION_DIFFERENT(Code)



VERSION_EARLIER
final public static int VERSION_EARLIER(Code)



VERSION_LATER
final public static int VERSION_LATER(Code)



VERSION_SAME
final public static int VERSION_SAME(Code)





Method Detail
assignField
public boolean assignField(OpenJPAStateManager sm, int field, boolean preFlush)(Code)
Assign a value to the given field. Return false if the value cannot be assigned because a flush is required (for example, the field value is determined by the datastore on insert). This method is called the first time a user requests the value of a field with a value-strategy on a new instance before flush.
Parameters:
  preFlush - whether this assignment is being requested by thesystem as part of pre-flush activities, and canbe ignored if it is more efficient to assign within StoreManager.flush
See Also:   org.apache.openjpa.util.ImplHelper.generateFieldValue
since:
   0.4.0



assignObjectId
public boolean assignObjectId(OpenJPAStateManager sm, boolean preFlush)(Code)
Assign an object id to the given new instance. Return false if the instance cannot be assigned an identity because a flush is required (for example, the identity is determined by the datastore on insert). For application identity instances, the assigned object id should be based on field state. The implementation is responsible for using the proper value strategy according to the instance metadata. This method is called the first time a user requests the oid of a new instance before flush.
Parameters:
  preFlush - whether this assignment is being requested by thesystem as part of pre-flush activities, and canbe ignored if it is more efficient to assign within StoreManager.flush
See Also:   org.apache.openjpa.util.ImplHelper.generateFieldValue
See Also:   org.apache.openjpa.util.ImplHelper.generateIdentityValue
See Also:   org.apache.openjpa.util.ApplicationIds.assign
since:
   0.3.3



beforeStateChange
public void beforeStateChange(OpenJPAStateManager sm, PCState fromState, PCState toState)(Code)
Notification that the given state manager is about to change its lifecycle state. The store manager is not required to do anything in this method, but some back ends may need to.
since:
   0.3.0



begin
public void begin()(Code)
Begin a data store transaction. After this method is called, it is assumed that all further operations are operating in a single transaction that can be committed or rolled back. If optimistic transactions are in use, this method will only be called when the system requires a transactionally consistent connection due to a user request to flush or commit the transaction. In this case, it is possible that the optimistic transaction does not have the latest versions of all instances (i.e. another transaction has modified the same instances and committed since the optimistic transaction started). On commit, an exception must be thrown on any attempt to overwrite data for an instance with an older version.
since:
   0.2.5



beginOptimistic
public void beginOptimistic()(Code)
Notification that an optimistic transaction has started. This method does not replace the StoreManager.begin method, which will still be called when a true data store transaction should begin.



cancelAll
public boolean cancelAll()(Code)
Cancel all pending data store statements. true if any statements cancelled, false otherwise
since:
   0.3.1



close
public void close()(Code)
Free any resources this store manager is using.
since:
   0.2.5



commit
public void commit()(Code)
Commit the current data store transaction.



compareVersion
public int compareVersion(OpenJPAStateManager state, Object v1, Object v2)(Code)
Compare the two version objects.
Parameters:
  state - the state manager for the object
Parameters:
  v1 - the first version object to compare
Parameters:
  v2 - the second version object to compare



copyDataStoreId
public Object copyDataStoreId(Object oid, ClassMetaData meta)(Code)
Copy the given object id value. Use the described type of the given metadata, which may be a subclass of the given oid's described type.



executeExtent
public ResultObjectProvider executeExtent(ClassMetaData meta, boolean subclasses, FetchConfiguration fetch)(Code)
Return a provider for all instances of the given candidate class, optionally including subclasses. The given candidate may be an unmapped type with mapped subclasses. If the provider is iterated within a data store transaction, returned instances should be locked.



exists
public boolean exists(OpenJPAStateManager sm, Object edata)(Code)
Verify that the given instance exists in the data store; return false if it does not.



flush
public Collection flush(Collection sms)(Code)
Flush the given state manager collection to the datastore, returning a collection of exceptions encountered during flushing. The given collection may include states that do not require data store action, such as persistent-clean instances or persistent-dirty instances that have not been modified since they were last flushed. For datastore updates and inserts, the dirty, non-flushed fields of each state should be flushed. New instances without an assigned object id should be given one via OpenJPAStateManager.setObjectId . New instances with value-strategy fields that have not been assigned yet should have their fields set. Datastore version information should be updated during flush, and the state manager's version indicator updated through the OpenJPAStateManager.setNextVersion method. The current version will roll over to this next version upon successful commit.
See Also:   org.apache.openjpa.util.ApplicationIds.assign



getClientConnection
public Object getClientConnection()(Code)
Return a connection to the data store suitable for client use. If this method is called during a data store transaction, thie connection must be transactional. If no connection is in use, this method should create one to return.



getDataStoreIdSequence
public Seq getDataStoreIdSequence(ClassMetaData forClass)(Code)
Return a sequence that generates datastore identity values for the given class. This method will only be called when the identity strategy for the class is one of: If the identity strategy cannot be represented as a sequence, return null.
since:
   0.4.0



getDataStoreIdType
public Class getDataStoreIdType(ClassMetaData meta)(Code)
Return the class used by this StoreManager for datastore identity values. The given metadata may be null, in which case the return value should the common datastore identity class for all classes, or null if this store manager does not use a common identity class.



getManagedType
public Class getManagedType(Object oid)(Code)
Return the persistent class for the given data store identity value. If the given value is not a datastore identity object, return null.
since:
   0.3.0



getValueSequence
public Seq getValueSequence(FieldMetaData forField)(Code)
Return a sequence that generates values for the given field. This method will only be called when the value strategy for the field is one of: If the value strategy cannot be represented as a sequence, return null.
since:
   0.4.0



initialize
public boolean initialize(OpenJPAStateManager sm, PCState state, FetchConfiguration fetch, Object edata)(Code)
Initialize the given state manager. The object id of the state manager will be set, and the state manager's metadata be set to the class of the instance to load, or possibly one of its superclasses. Initialization involves first calling the OpenJPAStateManager.initialize method with a new instance of the correct type constructed with the org.apache.openjpa.enhance.PCRegistry.newInstance(Classorg.apache.openjpa.enhance.StateManagerboolean) method (this will reset the state manager's metadata if the actual type was a subclass). After instance initialization, load any the fields for the given fetch configuration that can be efficiently retrieved. If any of the configured fields are not loaded in this method, they will be loaded with a subsequent call to StoreManager.load . If this method is called during a data store transaction, the instance's database record should be locked. Version information can be loaded if desired through the OpenJPAStateManager.setVersion method.
Parameters:
  sm - the instance to initialize
Parameters:
  state - the lifecycle state to initialize the state manager with
Parameters:
  fetch - configuration for how to load the instance
Parameters:
  edata - the current execution data, or null if notgiven to the calling method of the broker true if the matching instance exists in the datastore, false otherwise



load
public boolean load(OpenJPAStateManager sm, BitSet fields, FetchConfiguration fetch, int lockLevel, Object edata)(Code)
Load the given state manager. Note that any collection or map types loaded into the state manager will be proxied with the correct type; therefore the store manager does not have to load the same concrete collection/map types as the instance declares. However, array types must be consistent with the array type stored by the persistence capable instance. If this method is called during a data store transaction, the instance should be locked. If the given state manager does not have its version set already, version information can be loaded if desired through the OpenJPAStateManager.setVersion method.
Parameters:
  sm - the instance to load
Parameters:
  fields - set of fields to load; all field indexes in thisset must be loaded; this set is mutable
Parameters:
  fetch - the fetch configuration to use when loadingrelated objects
Parameters:
  lockLevel - attempt to load simple fields at this lock level;relations should be loaded at the read lock levelof the fetch configuration
Parameters:
  edata - the current execution data, or null if notgiven to the calling method of the broker false if the object no longer exists in thedatabase, true otherwise



loadAll
public Collection loadAll(Collection sms, PCState state, int load, FetchConfiguration fetch, Object edata)(Code)
Initialize, load, or validate the existance of all of the given objects. This method is called from various broker methods that act on multiple objects, such as StoreContext.retrieveAll . It gives the store manager an opportunity to efficiently batch-load data for several objects. Each of the given state managers will be in one of three states, each requiring a different action:
  • stateManager.getO () == null: An uninitialized state manager. Perform the same actions as in StoreManager.initialize .
  • load != FORCE_LOAD_NONE || stateManager.getPCState () == PCState.HOLLOW: A hollow state manager, or one whose fields must be loaded because this is a refresh or retrieve action. Peform the same actions as in StoreManager.load , choosing the fields to load based on the fetch configuration, or loading all fields if load == FORCE_LOAD_ALL. Any required fields left unloaded will cause a subsequent invocation of StoreManager.load on the individual object in question.
  • load == FORCE_LOAD_NONE && stateManager.getPCState () != PCState.HOLLOW: A non-hollow state manager. Perform the same actions as in StoreManager.exists , and load additional state if desired. Non-hollow objects will only be included outside of refresh invocations if a user calls findAll with the validate parameter set to true.
Store managers that cannot efficiently batch load can simply test for these conditions and delegate to the proper methods.
Parameters:
  sms - the state manager instances to load
Parameters:
  state - the lifecycle state to initialize uninitializedstate managers with; may be null if no uninitializedinstances are included in sms
Parameters:
  load - one of the FORCE_LOAD_* constants describing thefields to force-load if this is a refresh or retrieve action
Parameters:
  fetch - the current fetch configuration to use when loadingrelated objects
Parameters:
  edata - the current execution data, or null if notgiven to the calling method of the broker a collection of the state manager identities forwhich no data store record exists
See Also:   org.apache.openjpa.util.ImplHelper.loadAll



newDataStoreId
public Object newDataStoreId(Object oidVal, ClassMetaData meta)(Code)
Create a new unique datastore identity for the given type from the given oid value (presumably pk, stringified oid, or oid instance).



newFetchConfiguration
public FetchConfiguration newFetchConfiguration()(Code)
Return a fetch configuration suitable for this runtime. Typically will be or extend FetchConfigurationImpl.



newQuery
public StoreQuery newQuery(String language)(Code)
Return a query implementation suitable for this store. If the query is iterated within a data store transaction, returned instances should be locked. Return null if this store does not support native execution of the given language. OpenJPA can execute JPQL in memory even without back end support.
Parameters:
  language - the query language



releaseConnection
public void releaseConnection()(Code)
Instruct the store to release a retained connection. This will be invoked automatically based on the user's configured connection retain mode.



retainConnection
public void retainConnection()(Code)
Instruct the store to retain a connection for continued use. This will be invoked automatically based on the user's configured connection retain mode.



rollback
public void rollback()(Code)
Rollback the current data store transaction.



rollbackOptimistic
public void rollbackOptimistic()(Code)
Notification that an optimistic transaction was rolled back before a data store transaction ever began.



setContext
public void setContext(StoreContext ctx)(Code)
Set a reference to the corresponding context. This method will be called before the store manager is used. The store manager is responsible for pulling any necessary configuration data from the context, including the transaction mode and connection retain mode.



syncVersion
public boolean syncVersion(OpenJPAStateManager sm, Object edata)(Code)
Update the version information in the given state manager to the version stored in the data store.
Parameters:
  sm - the instance to check
Parameters:
  edata - the current execution data, or null if notgiven to the calling method of the context true if the instance still exists in thedatastore and is up-to-date, false otherwise



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