public class RawStore
extends java.lang.Object
implements java.io.Closeable
RawStore
provides access to stored entities without using
entity classes or key classes. Keys are represented as simple type objects
or, for composite keys, as RawObject
instances, and entities are
represented as RawObject
instances.
RawStore
objects are thread-safe. Multiple threads may safely
call the methods of a shared RawStore
object.
When using a RawStore
, the current persistent class definitions
are not used. Instead, the previously stored metadata and class definitions
are used. This has several implications:
EntityModel
may not be specified using StoreConfig.setModel(com.sleepycat.persist.model.EntityModel)
. In other words, the configured model must be
null (the default).Constructor and Description |
---|
RawStore(Environment env,
java.lang.String storeName,
StoreConfig config)
Opens an entity store for raw data access.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes all databases and sequences that were opened by this model.
|
StoreConfig |
getConfig()
Returns a copy of the entity store configuration.
|
Environment |
getEnvironment()
Returns the environment associated with this store.
|
EntityModel |
getModel()
Returns the last configured and stored entity model for this store.
|
Mutations |
getMutations()
Returns the set of mutations that were configured and stored previously.
|
PrimaryIndex<java.lang.Object,RawObject> |
getPrimaryIndex(java.lang.String entityClass)
Opens the primary index for a given entity class.
|
SecondaryIndex<java.lang.Object,java.lang.Object,RawObject> |
getSecondaryIndex(java.lang.String entityClass,
java.lang.String keyName)
Opens the secondary index for a given entity class and secondary key
name.
|
java.lang.String |
getStoreName()
Returns the name of this store.
|
public RawStore(Environment env, java.lang.String storeName, StoreConfig config) throws StoreNotFoundException, DatabaseException
env
- an open Berkeley DB environment.storeName
- the name of the entity store within the given
environment.config
- the store configuration, or null to use default
configuration properties.StoreNotFoundException
- when the AllowCreate
configuration parameter is false
and the store's internal catalog database does not exist.java.lang.IllegalArgumentException
- if the Environment
is
read-only and the config ReadOnly
property is false.DatabaseException
- the base class for all BDB exceptions.public PrimaryIndex<java.lang.Object,RawObject> getPrimaryIndex(java.lang.String entityClass) throws DatabaseException
entityClass
- the name of the entity class.DatabaseException
- the base class for all BDB exceptions.public SecondaryIndex<java.lang.Object,java.lang.Object,RawObject> getSecondaryIndex(java.lang.String entityClass, java.lang.String keyName) throws DatabaseException
entityClass
- the name of the entity class.keyName
- the secondary key name.DatabaseException
- the base class for all BDB exceptions.public Environment getEnvironment()
public StoreConfig getConfig()
public java.lang.String getStoreName()
public EntityModel getModel()
public Mutations getMutations()
public void close() throws DatabaseException
WARNING: To guard against memory leaks, the application should discard all references to the closed handle. While BDB makes an effort to discard references from closed objects to the allocated memory for an environment, this behavior is not guaranteed. The safe course of action for an application is to discard all references to closed BDB objects.
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
DatabaseException
- the base class for all BDB exceptions.Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.