org.alliance.core.file.filedatabase
Class FileDatabase

java.lang.Object
  extended by org.alliance.core.file.filedatabase.FileDatabase

public class FileDatabase
extends java.lang.Object

Created by IntelliJ IDEA. User: maciek Date: 2006-jan-06 Time: 15:49:43 To change this template use File | Settings | File Templates.


Field Summary
static int MINIMUM_TIME_BETWEEN_FLUSHES_IN_MS
           
static int VERSION
           
 
Constructor Summary
FileDatabase(java.lang.String indexFilePath, java.lang.String databaseFilePath)
           
 
Method Summary
 FileDescriptor add(FileDescriptor fd)
           
 void cleanupDuplicates()
           
 boolean contains(Hash rootHash)
           
 boolean contains(java.lang.String path)
           
 void flush()
           
 java.util.Set<Hash> getAllHashes()
           
 java.util.Collection<java.lang.String> getDuplicates()
           
 FileDescriptor getFd(Hash hash)
           
 FileDescriptor getFd(int index)
           
 Hash getHashForDuplicate(java.lang.String path)
           
 KeywordIndex getKeywordIndex()
           
 int getNumberOfFiles()
           
 long getTotalSize()
           
 boolean isDuplicate(java.lang.String fullPath)
           
 boolean isEmpty()
           
 void printToSout()
           
 FileDescriptor[] search(java.lang.String query, int maxHits, FileType ft)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINIMUM_TIME_BETWEEN_FLUSHES_IN_MS

public static final int MINIMUM_TIME_BETWEEN_FLUSHES_IN_MS
See Also:
Constant Field Values

VERSION

public static final int VERSION
See Also:
Constant Field Values
Constructor Detail

FileDatabase

public FileDatabase(java.lang.String indexFilePath,
                    java.lang.String databaseFilePath)
             throws java.io.IOException
Throws:
java.io.IOException
Method Detail

isEmpty

public boolean isEmpty()
                throws java.io.IOException
Throws:
java.io.IOException

add

public FileDescriptor add(FileDescriptor fd)
                   throws java.io.IOException
Parameters:
fd -
Returns:
null if everything is ok. If the hash root is aldready in database the older FD is returned (the one in database, not the one sent to this method)
Throws:
java.io.IOException

getFd

public FileDescriptor getFd(int index)
                     throws java.io.IOException
Throws:
java.io.IOException

getFd

public FileDescriptor getFd(Hash hash)
                     throws java.io.IOException
Throws:
java.io.IOException

getNumberOfFiles

public int getNumberOfFiles()

printToSout

public void printToSout()
                 throws java.io.IOException
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException

cleanupDuplicates

public void cleanupDuplicates()

contains

public boolean contains(java.lang.String path)
                 throws java.io.IOException
Throws:
java.io.IOException

contains

public boolean contains(Hash rootHash)

getKeywordIndex

public KeywordIndex getKeywordIndex()

getTotalSize

public long getTotalSize()

getAllHashes

public java.util.Set<Hash> getAllHashes()

search

public FileDescriptor[] search(java.lang.String query,
                               int maxHits,
                               FileType ft)
                        throws java.io.IOException
Throws:
java.io.IOException

isDuplicate

public boolean isDuplicate(java.lang.String fullPath)
                    throws java.io.IOException
Throws:
java.io.IOException

getDuplicates

public java.util.Collection<java.lang.String> getDuplicates()

getHashForDuplicate

public Hash getHashForDuplicate(java.lang.String path)