Java Doc for EntityStore.java in  » JMX » je » com » sleepycat » persist » 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 » JMX » je » com.sleepycat.persist 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sleepycat.persist.EntityStore

EntityStore
public class EntityStore (Code)



Constructor Summary
public  EntityStore(Environment env, String storeName, StoreConfig config)
     Opens an entity store in a given environment.
Parameters:
  env - an open Berkeley DB Environment.
Parameters:
  storeName - the name of the entity store within the givenenvironment.

Method Summary
public  voidclose()
     Closes all databases and sequences that were opened via this store.
public  voidcloseClass(Class entityClass)
     Closes the primary and secondary databases for the given entity class that were opened via this store.
 voiddumpCatalog()
     Only public for debugging.
public  EvolveStatsevolve(EvolveConfig config)
     Performs conversion of unevolved objects in order to reduce lazy conversion overhead.
public  StoreConfiggetConfig()
     Returns a copy of the entity store configuration.
public  EnvironmentgetEnvironment()
     Returns the environment associated with this store.
public  EntityModelgetModel()
     Returns the current entity model for this store.
public  MutationsgetMutations()
     Returns the set of mutations that were configured when the store was opened, or if none were configured, the set of mutations that were configured and stored previously.
public  DatabaseConfiggetPrimaryConfig(Class entityClass)
     Returns the default primary database Berkeley DB engine API configuration for an entity class.

The returned configuration is as follows.
public  PrimaryIndex<PK, E>getPrimaryIndex(Class<PK> primaryKeyClass, Class<E> entityClass)
     Returns the primary index for a given entity class, opening it if necessary.

If they are not already open, the primary and secondary databases for the entity class are created/opened together in a single internal transaction.

public  SecondaryConfiggetSecondaryConfig(Class entityClass, String keyName)
     Returns the default secondary database Berkeley DB engine API configuration for an entity class and key name.

The returned configuration is as follows.
public  SecondaryIndex<SK, PK, E>getSecondaryIndex(PrimaryIndex<PK, E> primaryIndex, Class<SK> keyClass, String keyName)
     Returns a secondary index for a given primary index and secondary key, opening it if necessary.

NOTE: If the secondary key field is declared in a subclass of the entity class, use EntityStore.getSubclassIndex instead.

If a SecondaryKey.relatedEntity is used and the primary index for the related entity is not already open, it will be opened by this method.

public  SequencegetSequence(String name)
     Returns a named sequence for using Berkeley DB engine API directly, opening it if necessary.
Parameters:
  name - the sequence name, which is normally defined using thePrimaryKey.sequence annotation property.
public  SequenceConfiggetSequenceConfig(String name)
     Returns the default Berkeley DB engine API configuration for a named key sequence.

The returned configuration is as follows.
public  StringgetStoreName()
     Returns the name of this store.
public static  Set<String>getStoreNames(Environment env)
     Returns the names of all entity stores in the given environment. the store names.
public  SecondaryIndex<SK, PK, E2>getSubclassIndex(PrimaryIndex<PK, E1> primaryIndex, Class<E2> entitySubclass, Class<SK> keyClass, String keyName)
     Returns a secondary index for a secondary key in an entity subclass, opening it if necessary.

If a SecondaryKey.relatedEntity is used and the primary index for the related entity is not already open, it will be opened by this method.

public  voidsetPrimaryConfig(Class entityClass, DatabaseConfig config)
     Configures the primary database for an entity class using the Berkeley DB engine API.

To be compatible with the entity model and the Direct Persistence Layer, the configuration should be retrieved using EntityStore.getPrimaryConfig getPrimaryConfig , modified, and then passed to this method.

public  voidsetSecondaryConfig(Class entityClass, String keyName, SecondaryConfig config)
     Configures a secondary database for an entity class and key name using the Berkeley DB engine API.

To be compatible with the entity model and the Direct Persistence Layer, the configuration should be retrieved using EntityStore.getSecondaryConfig getSecondaryConfig , modified, and then passed to this method.

public  voidsetSequenceConfig(String name, SequenceConfig config)
     Configures a named key sequence using the Berkeley DB engine API.
public  voidsync()
     Flushes each modified index to disk that was opened in deferred-write mode.

All indexes are opened in deferred-write mode if true was passed to StoreConfig.setDeferredWrite for the store.

Alternatively, individual databases may be configured for deferred write using DatabaseConfig.setDeferredWrite along with EntityStore.getPrimaryConfig and EntityStore.setPrimaryConfig .

public  voidtruncateClass(Class entityClass)
     Deletes all instances of this entity class and its (non-entity) subclasses.

This is the equivalent of Environment.truncateDatabaseEnvironment.truncateDatabase .

public  voidtruncateClass(Transaction txn, Class entityClass)
     Deletes all instances of this entity class and its (non-entity) subclasses.

This is the equivalent of Environment.truncateDatabaseEnvironment.truncateDatabase .



Constructor Detail
EntityStore
public EntityStore(Environment env, String storeName, StoreConfig config) throws DatabaseException, IncompatibleClassException(Code)
Opens an entity store in a given environment.
Parameters:
  env - an open Berkeley DB Environment.
Parameters:
  storeName - the name of the entity store within the givenenvironment. An empty string is allowed. Named stores may be used todistinguish multiple sets of persistent entities for the same entityclasses in a single environment. Underlying database names are prefixedwith the store name.
Parameters:
  config - the entity store configuration, or null to use defaultconfiguration properties.
throws:
  IncompatibleClassException - if an incompatible class change hasbeen made and mutations are not configured for handling the change. Seecom.sleepycat.persist.evolve Class Evolution for moreinformation.




Method Detail
close
public void close() throws DatabaseException(Code)
Closes all databases and sequences that were opened via this store. The caller must ensure that no databases opened via this store are in use.



closeClass
public void closeClass(Class entityClass) throws DatabaseException(Code)
Closes the primary and secondary databases for the given entity class that were opened via this store. The caller must ensure that the primary and secondary indices obtained from this store are no longer in use.
Parameters:
  entityClass - the entity class whose databases are to be closed.



dumpCatalog
void dumpCatalog()(Code)
Only public for debugging.



evolve
public EvolveStats evolve(EvolveConfig config) throws DatabaseException(Code)
Performs conversion of unevolved objects in order to reduce lazy conversion overhead. Evolution may be performed concurrently with normal access to the store.

Conversion is performed one entity class at a time. An entity class is converted only if it has Mutations associated with it via StoreConfig.setMutations StoreConfig.setMutations .

Conversion of an entity class is performed by reading each entity, converting it if necessary, and updating it if conversion was performed. When all instances of an entity class are converted, references to the appropriate Mutations are deleted. Therefore, if this method is called twice successfully without changing class definitions, the second call will do nothing.


See Also:   com.sleepycat.persist.evolve
See Also:    Class Evolution



getConfig
public StoreConfig getConfig()(Code)
Returns a copy of the entity store configuration. the config.



getEnvironment
public Environment getEnvironment()(Code)
Returns the environment associated with this store. the environment.



getModel
public EntityModel getModel()(Code)
Returns the current entity model for this store. The current model is derived from the configured entity model and the live entity class definitions. the model.



getMutations
public Mutations getMutations()(Code)
Returns the set of mutations that were configured when the store was opened, or if none were configured, the set of mutations that were configured and stored previously. the mutations.



getPrimaryConfig
public DatabaseConfig getPrimaryConfig(Class entityClass)(Code)
Returns the default primary database Berkeley DB engine API configuration for an entity class.

The returned configuration is as follows. All other properties have default values.


Parameters:
  entityClass - the entity class identifying the primary database. the default configuration for the given entity class.



getPrimaryIndex
public PrimaryIndex<PK, E> getPrimaryIndex(Class<PK> primaryKeyClass, Class<E> entityClass) throws DatabaseException(Code)
Returns the primary index for a given entity class, opening it if necessary.

If they are not already open, the primary and secondary databases for the entity class are created/opened together in a single internal transaction. When the secondary indices are opened, that can cascade to open other related primary indices.


Parameters:
  primaryKeyClass - the class of the entity's primary key field, orthe corresponding primitive wrapper class if the primary key field typeis a primitive.
Parameters:
  entityClass - the entity class for which to open the primary index. the primary index.
throws:
  IllegalArgumentException - if the entity class or classesreferenced by it are not persistent, or the primary key class does notmatch the entity's primary key field, or if metadata for the entity orprimary key is invalid.



getSecondaryConfig
public SecondaryConfig getSecondaryConfig(Class entityClass, String keyName)(Code)
Returns the default secondary database Berkeley DB engine API configuration for an entity class and key name.

The returned configuration is as follows. All other properties have default values.


Parameters:
  entityClass - the entity class containing the given secondary keyname.
Parameters:
  keyName - the name of the secondary key field, or the SecondaryKey.name if this name annotation property was specified. the default configuration for the given secondary key.



getSecondaryIndex
public SecondaryIndex<SK, PK, E> getSecondaryIndex(PrimaryIndex<PK, E> primaryIndex, Class<SK> keyClass, String keyName) throws DatabaseException(Code)
Returns a secondary index for a given primary index and secondary key, opening it if necessary.

NOTE: If the secondary key field is declared in a subclass of the entity class, use EntityStore.getSubclassIndex instead.

If a SecondaryKey.relatedEntity is used and the primary index for the related entity is not already open, it will be opened by this method. That will, in turn, open its secondary indices, which can casade to open other primary indices.


Parameters:
  primaryIndex - the primary index associated with the returnedsecondary index. The entity class of the primary index, or one of itssuperclasses, must contain a secondary key with the given secondary keyclass and key name.
Parameters:
  keyClass - the class of the secondary key field, or thecorresponding primitive wrapper class if the secondary key field type isa primitive.
Parameters:
  keyName - the name of the secondary key field, or the SecondaryKey.name if this name annotation property was specified. the secondary index.
throws:
  IllegalArgumentException - if the entity class or one of itssuperclasses does not contain a key field of the given key class and keyname, or if the metadata for the secondary key is invalid.



getSequence
public Sequence getSequence(String name) throws DatabaseException(Code)
Returns a named sequence for using Berkeley DB engine API directly, opening it if necessary.
Parameters:
  name - the sequence name, which is normally defined using thePrimaryKey.sequence annotation property. the open sequence for the given sequence name.



getSequenceConfig
public SequenceConfig getSequenceConfig(String name)(Code)
Returns the default Berkeley DB engine API configuration for a named key sequence.

The returned configuration is as follows. All other properties have default values.


Parameters:
  name - the sequence name, which is normally defined using thePrimaryKey.sequence annotation property. the default configuration for the given sequence name.



getStoreName
public String getStoreName()(Code)
Returns the name of this store. the name.



getStoreNames
public static Set<String> getStoreNames(Environment env) throws DatabaseException(Code)
Returns the names of all entity stores in the given environment. the store names. An empty set is returned if no stores arepresent.



getSubclassIndex
public SecondaryIndex<SK, PK, E2> getSubclassIndex(PrimaryIndex<PK, E1> primaryIndex, Class<E2> entitySubclass, Class<SK> keyClass, String keyName) throws DatabaseException(Code)
Returns a secondary index for a secondary key in an entity subclass, opening it if necessary.

If a SecondaryKey.relatedEntity is used and the primary index for the related entity is not already open, it will be opened by this method. That will, in turn, open its secondary indices, which can casade to open other primary indices.


Parameters:
  primaryIndex - the primary index associated with the returnedsecondary index. The entity class of the primary index, or one of itssuperclasses, must contain a secondary key with the given secondary keyclass and key name.
Parameters:
  entitySubclass - a subclass of the entity class for the primaryindex. The entity subclass must contain a secondary key with the givensecondary key class and key name.
Parameters:
  keyClass - the class of the secondary key field, or thecorresponding primitive wrapper class if the secondary key field type isa primitive.
Parameters:
  keyName - the name of the secondary key field, or the SecondaryKey.name if this name annotation property was specified. the secondary index.
throws:
  IllegalArgumentException - if the given entity subclass does notcontain a key field of the given key class and key name, or if themetadata for the secondary key is invalid.



setPrimaryConfig
public void setPrimaryConfig(Class entityClass, DatabaseConfig config)(Code)
Configures the primary database for an entity class using the Berkeley DB engine API.

To be compatible with the entity model and the Direct Persistence Layer, the configuration should be retrieved using EntityStore.getPrimaryConfig getPrimaryConfig , modified, and then passed to this method. The following configuration properties may not be changed:


Parameters:
  entityClass - the entity class identifying the primary database.
Parameters:
  config - the configuration to use for the given entity class.
throws:
  IllegalArgumentException - if the configuration is incompatiblewith the entity model or the Direct Persistence Layer.
throws:
  IllegalStateException - if the database has already been opened.



setSecondaryConfig
public void setSecondaryConfig(Class entityClass, String keyName, SecondaryConfig config)(Code)
Configures a secondary database for an entity class and key name using the Berkeley DB engine API.

To be compatible with the entity model and the Direct Persistence Layer, the configuration should be retrieved using EntityStore.getSecondaryConfig getSecondaryConfig , modified, and then passed to this method. The following configuration properties may not be changed:


Parameters:
  entityClass - the entity class containing the given secondary keyname.
Parameters:
  keyName - the name of the secondary key field, or the SecondaryKey.name if this name annotation property was specified.
Parameters:
  config - the configuration to use for the given secondary key.
throws:
  IllegalArgumentException - if the configuration is incompatiblewith the entity model or the Direct Persistence Layer.
throws:
  IllegalStateException - if the database has already been opened.



setSequenceConfig
public void setSequenceConfig(String name, SequenceConfig config)(Code)
Configures a named key sequence using the Berkeley DB engine API.

To be compatible with the entity model and the Direct Persistence Layer, the configuration should be retrieved using EntityStore.getSequenceConfig getSequenceConfig , modified, and then passed to this method.

If the range is changed to include the value zero, see PrimaryKey for restrictions.


Parameters:
  name - the sequence name, which is normally defined using thePrimaryKey.sequence annotation property.
Parameters:
  config - the configuration to use for the given sequence name.
throws:
  IllegalArgumentException - if the configuration is incompatiblewith the entity model or the Direct Persistence Layer.
throws:
  IllegalStateException - if the sequence has already been opened.



sync
public void sync() throws DatabaseException(Code)
Flushes each modified index to disk that was opened in deferred-write mode.

All indexes are opened in deferred-write mode if true was passed to StoreConfig.setDeferredWrite for the store.

Alternatively, individual databases may be configured for deferred write using DatabaseConfig.setDeferredWrite along with EntityStore.getPrimaryConfig and EntityStore.setPrimaryConfig . Caution should be used when configuring only some databases for deferred-write, since durability will be different for these databases than for other databases in the same store.

This method is functionally equivalent to calling Database.sync for each deferred-write index Database that is open for this store. However, while Database.sync flushes the log to disk each time it is called, this method flushes the log only once after syncing all databases; this method therefore causes less I/O than calling Database.sync multiple times.

Instead of calling this method, Environment.sync may be used. The difference is that this method will only flush the databases for this store, while Environment.sync will sync all deferred-write databases currently open for the environment and will also perform a full checkpoint. This method is therefore less expensive than a full sync of the environment.




truncateClass
public void truncateClass(Class entityClass) throws DatabaseException(Code)
Deletes all instances of this entity class and its (non-entity) subclasses.

This is the equivalent of Environment.truncateDatabaseEnvironment.truncateDatabase . The primary and secondary databases associated with the entity class must not be open except by this store, since database truncation is only possible when the database is not open. The databases to be truncated will be closed before performing this operation, if they were previously opened by this store.

Auto-commit is used implicitly if the store is transactional.


Parameters:
  entityClass - the entity class whose instances are to be deleted.



truncateClass
public void truncateClass(Transaction txn, Class entityClass) throws DatabaseException(Code)
Deletes all instances of this entity class and its (non-entity) subclasses.

This is the equivalent of Environment.truncateDatabaseEnvironment.truncateDatabase . The primary and secondary databases associated with the entity class must not be open except by this store, since database truncation is only possible when the database is not open. The databases to be truncated will be closed before performing this operation, if they were previously opened by this store.


Parameters:
  txn - the transaction used to protect this operation, null to useauto-commit, or null if the store is non-transactional.
Parameters:
  entityClass - the entity class whose instances are to be deleted.



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.