|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.impl.fostore.FOStoreDatabase
File/Object Store Database, using an underlying Btree implementation.
Field Summary | |
private static java.util.HashMap |
databaseMap
We manage a map of pools of databases by database name. |
private DBInfo |
dbInfo
|
(package private) static org.apache.commons.logging.Log |
logger
Logger |
private static I18NHelper |
msg
I18N support. |
private int |
openConnections
Count the number of connections open on this database. |
private Pool |
pool
Pool for this database. |
private static int |
poolSize
|
private java.util.HashMap |
provisionalCLIDs
|
private java.util.HashMap |
provisionalOIDs
|
private FOStoreBtreeStorage |
storage
|
Constructor Summary | |
(package private) |
FOStoreDatabase(java.lang.String name,
boolean isNew)
Create an FODatabase and create/open the files. |
Method Summary | |
void |
add(OID key,
java.lang.Object value)
Adds the specified value to values associated in this index with the specified key. |
void |
addConnection()
Increment the openConnections to allow proper close when the last connection closes the database. |
void |
close()
Decrement the open connections counter and close the database when it reaches zero. |
private void |
closeBtreeStorage(FOStoreBtreeStorage storage)
Helper method to close a BtreeStorage. |
static void |
closeDatabase(java.lang.String dbname)
|
void |
commitChanges()
|
(package private) static Block |
createBlock(FOStoreInput in,
int length)
|
private FOStoreBtreeStorage |
createBtreeStorage(java.lang.String name,
boolean isNew)
Helper method to create a BtreeStorage. |
private void |
deleteFile(java.io.File file)
Helper method to delete a file. |
private boolean |
existsFile(java.io.File file)
Helper method to check whether a file exists. |
java.lang.Object |
get(OID key)
Returns the value to which this index maps the specified key. |
static FOStoreDatabase |
getDatabase(java.lang.String dbname,
boolean create)
Find an open database of the given name. |
DBInfo |
getDBInfo()
Get the DBInfo for this database. |
java.lang.Object |
getIfExists(OID key)
Returns the value to which this index maps the specified key or null if there is no value for this key. |
java.lang.String |
getName()
Returns the unique name of the index in the Storage. |
CLID |
getRealCLIDFromProvisional(CLID provCLID)
Provides a datastore CLID corresponding to the given provisional CLID. |
(package private) OID |
getRealOIDFromProvisional(OID pOID)
Provides a datastore OID corresponding to the given provisional OID. |
java.util.Set |
keySet()
Returns a set view of the keys contained in this index. |
void |
mapProvisionalCLIDToReal(CLID pCLID,
CLID rCLID)
Establishes a mapping in this database from provisional to real CLIDs. |
(package private) void |
mapProvisionalOIDToReal(OID pOID,
OID rOID)
Establishes a mapping in this database from provisional to real OIDs. |
boolean |
put(OID key,
java.lang.Object value)
Associates the specified value with the specified key in this index. |
static void |
releaseDatabase(FOStoreDatabase db)
Release the database for other connections to use. |
boolean |
remove(OID key)
Removes all values assosiated in the index with specified key. |
void |
replace(OID key,
java.lang.Object value)
Replaces the original value associated with the specified key in this index with new value. |
void |
rollbackChanges()
|
private void |
setPool(Pool pool)
|
void |
verifyUserPassword(java.lang.String user,
long timestamp,
byte[] secret)
Verify that this user is authorized to use this database. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.util.HashMap databaseMap
private static final int poolSize
private FOStoreBtreeStorage storage
private final java.util.HashMap provisionalCLIDs
private final java.util.HashMap provisionalOIDs
private int openConnections
private DBInfo dbInfo
private Pool pool
private static final I18NHelper msg
static final org.apache.commons.logging.Log logger
Constructor Detail |
FOStoreDatabase(java.lang.String name, boolean isNew) throws FOStoreDatabaseException
name
- name of database, which is used to name the filesisNew
- true if the database is being createdMethod Detail |
public static FOStoreDatabase getDatabase(java.lang.String dbname, boolean create) throws java.lang.InterruptedException, FOStoreDatabaseException
java.lang.InterruptedException
FOStoreDatabaseException
public static void releaseDatabase(FOStoreDatabase db) throws java.lang.InterruptedException
java.lang.InterruptedException
public void verifyUserPassword(java.lang.String user, long timestamp, byte[] secret)
public DBInfo getDBInfo()
public boolean put(OID key, java.lang.Object value) throws FOStoreDatabaseException
key
- value
-
FOStoreDatabaseException
public void replace(OID key, java.lang.Object value) throws FOStoreDatabaseException
key
- value
-
FOStoreDatabaseException
public java.lang.Object get(OID key) throws FOStoreDatabaseException
key
-
FOStoreDatabaseException
public java.lang.Object getIfExists(OID key) throws FOStoreDatabaseException
key
-
FOStoreDatabaseException
public java.lang.String getName()
public java.util.Set keySet() throws FOStoreDatabaseException
FOStoreDatabaseException
public void add(OID key, java.lang.Object value) throws FOStoreDatabaseException
key
- value
-
FOStoreDatabaseException
public boolean remove(OID key) throws FOStoreDatabaseException
key
-
FOStoreDatabaseException
public void commitChanges() throws FOStoreDatabaseException
FOStoreDatabaseException
public void addConnection()
public void close() throws FOStoreDatabaseException
FOStoreDatabaseException
public static void closeDatabase(java.lang.String dbname) throws FOStoreDatabaseException, java.lang.InterruptedException
FOStoreDatabaseException
java.lang.InterruptedException
public void rollbackChanges() throws FOStoreDatabaseException
FOStoreDatabaseException
static Block createBlock(FOStoreInput in, int length)
public void mapProvisionalCLIDToReal(CLID pCLID, CLID rCLID)
pCLID
- A provisional CLID.rCLID
- The non-provisional, datastore CLID corresponding to
provCLID.
javax.jdo.JDOFatalException
- Thrown if the given CLID is not provisional.public CLID getRealCLIDFromProvisional(CLID provCLID)
provCLID
- A provisional CLID for which there
javax.jdo.JDOFatalException
- Thrown if the given CLID is not provisional.void mapProvisionalOIDToReal(OID pOID, OID rOID)
pOID
- A provisional OID.rOID
- The non-provisional, datastore OID corresponding to
pOID.
javax.jdo.JDOFatalException
- Thrown if the given OID is not provisional.OID getRealOIDFromProvisional(OID pOID)
pOID
- A provisional OID for which there
javax.jdo.JDOFatalException
- Thrown if the given OID is not provisional.private void setPool(Pool pool)
private FOStoreBtreeStorage createBtreeStorage(java.lang.String name, boolean isNew) throws FOStoreDatabaseException, javax.jdo.JDOFatalUserException
name
- name of database, which is used to name the filesisNew
- true if the database is being created
FOStoreDatabaseException
- wraps a StorageException thrown
by the create call.
javax.jdo.JDOFatalUserException
- wraps a possible SecurityException.private void closeBtreeStorage(FOStoreBtreeStorage storage) throws FOStoreDatabaseException
storage
- the database to be closed
FOStoreDatabaseException
- wraps a StorageException thrown
by the close call.private boolean existsFile(java.io.File file)
file
- the file to be checked
true
if the specified file exists.private void deleteFile(java.io.File file)
file
- the file to be deleted
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |