|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.egothor.repository.DocumentsDB
public class DocumentsDB
DocumentsDB implements a documents DB structure on disc. The structure
consists of two files: the first one is used as an index, and the
second one as a data store. When you want to read the element with key
uid
the algorithm works as follows:
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.egothor.repository.DataRepository |
---|
DataRepository.TupleSequence |
Constructor Summary | |
---|---|
DocumentsDB(java.lang.String location,
boolean compressed)
Constructor for the DocumentsDB object. |
Method Summary | |
---|---|
int |
addItem(long uid,
byte[] document,
int length)
Adds another document into the repository. |
void |
close()
Closes the structure. |
void |
destroy()
Destroy this data structure. |
DataInputStream |
elementAt(long uid,
int revision)
Retrieves a data block. |
DataRepository.TupleSequence |
elements()
The tuples are [long:uid;int:rev;Object:DataInputStream]. |
protected void |
finalize()
Close this structure and attempt garbage collection. |
void |
flush()
|
boolean |
removeDoc(long uid)
Removes an element of the given uid . |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DocumentsDB(java.lang.String location, boolean compressed)
location
- the location where the files will be createdcompressed
- true iff the DocumentData will be saved in gzip format
java.io.IOException
- if an I/O error occursMethod Detail |
---|
public int addItem(long uid, byte[] document, int length)
DataRepository
addItem
in interface DataRepository
public DataInputStream elementAt(long uid, int revision)
DataRepository
elementAt
in interface DataRepository
uid
- the key of the blockrevision
- revision number of the block, 0 is used for the latest (current) revision
public void destroy()
close()
. Then
it removes these files from the directory where the structure is
stored: bitmap, idocs, docs.
destroy
in interface DataRepository
public boolean removeDoc(long uid)
uid
.
uid
- the element to remove
public void close()
#commit
and then it closes
both data files (idocs and docs).
close
in interface DataRepository
#DocumentsDB(String)
public DataRepository.TupleSequence elements()
elements
in interface DataRepository
public void flush()
flush
in interface DataRepository
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- you never know what might happen!
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |