|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthelma.objectmodel.dom.XmlDatabase
public final class XmlDatabase
A simple XML-database
Field Summary | |
---|---|
protected Application |
app
|
protected java.io.File |
dbHomeDir
|
protected java.lang.String |
encoding
|
protected XmlIDGenerator |
idgen
|
protected NodeManager |
nmgr
|
Constructor Summary | |
---|---|
XmlDatabase()
|
Method Summary | |
---|---|
void |
abortTransaction(ITransaction txn)
Abort the given transaction |
ITransaction |
beginTransaction()
Start a new transaction. |
void |
commitTransaction(ITransaction txn)
committ the given transaction, makint its changes persistent |
void |
deleteNode(ITransaction txn,
java.lang.String kstr)
Marks an element from the database as deleted |
java.lang.String |
getEncoding()
get the file encoding used by this database |
XmlIDGenerator |
getIDGenerator(ITransaction txn)
Get the id-generator for this database. |
INode |
getNode(ITransaction txn,
java.lang.String kstr)
Retrieves a Node from the database. |
void |
init(java.io.File dbHome,
Application app)
Initializes the database from an application. |
void |
insertNode(ITransaction txn,
java.lang.String kstr,
INode node)
Save a node with the given key. |
java.lang.String |
nextID()
Get the id for the next new object to be stored. |
void |
saveIDGenerator(ITransaction txn)
Write the id-generator to file. |
void |
setEncoding(java.lang.String encoding)
set the file encoding to use |
void |
shutdown()
Shut down the database |
void |
updateNode(ITransaction txn,
java.lang.String kstr,
INode node)
Update a node with the given key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.File dbHomeDir
protected Application app
protected NodeManager nmgr
protected XmlIDGenerator idgen
protected java.lang.String encoding
Constructor Detail |
---|
public XmlDatabase()
Method Detail |
---|
public void init(java.io.File dbHome, Application app) throws DatabaseException
init
in interface IDatabase
app
-
DatabaseException
public void shutdown()
shutdown
in interface IDatabase
public ITransaction beginTransaction() throws DatabaseException
beginTransaction
in interface IDatabase
DatabaseException
public void commitTransaction(ITransaction txn) throws DatabaseException
commitTransaction
in interface IDatabase
txn
-
DatabaseException
public void abortTransaction(ITransaction txn) throws DatabaseException
abortTransaction
in interface IDatabase
txn
-
DatabaseException
public java.lang.String nextID() throws ObjectNotFoundException
nextID
in interface IDatabase
ObjectNotFoundException
public XmlIDGenerator getIDGenerator(ITransaction txn) throws ObjectNotFoundException
txn
-
ObjectNotFoundException
public void saveIDGenerator(ITransaction txn) throws java.io.IOException
txn
-
java.io.IOException
public INode getNode(ITransaction txn, java.lang.String kstr) throws java.io.IOException, ObjectNotFoundException
getNode
in interface IDatabase
txn
- the current transactionkstr
- the key
java.io.IOException
- if an I/O error occurred loading the object.
ObjectNotFoundException
- if no object is stored by this key.public void insertNode(ITransaction txn, java.lang.String kstr, INode node) throws java.io.IOException
insertNode
in interface IDatabase
txn
- kstr
- node
-
java.io.IOException
public void updateNode(ITransaction txn, java.lang.String kstr, INode node) throws java.io.IOException
updateNode
in interface IDatabase
txn
- kstr
- node
-
java.io.IOException
public void deleteNode(ITransaction txn, java.lang.String kstr) throws java.io.IOException
deleteNode
in interface IDatabase
txn
- kstr
-
java.io.IOException
public void setEncoding(java.lang.String encoding)
encoding
- the database's file encodingpublic java.lang.String getEncoding()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |