org.helidb.backend
Class SingleDatabaseFile

java.lang.Object
  extended by org.helidb.backend.SingleDatabaseFile
All Implemented Interfaces:
DatabaseFiles

public class SingleDatabaseFile
extends Object
implements DatabaseFiles

This DatabaseFiles implementation contains a single ReadWritableFile.

Since:
1.0
Author:
Karl Gustafsson
In_jar:
helidb-core

Constructor Summary
SingleDatabaseFile(ReadWritableFile f)
          Create a SingleDatabaseFile.
 
Method Summary
 void delete()
          Delete the database file(s).
 ReadWritableFile getFile()
          Get the file.
 void replaceContents(DatabaseFiles f2)
          Replace the contents of the database file(s) with the contents of the supplied file(s).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleDatabaseFile

public SingleDatabaseFile(ReadWritableFile f)
Create a SingleDatabaseFile.

Parameters:
f - The file.
Method Detail

getFile

public ReadWritableFile getFile()
Get the file.

Returns:
The file.

replaceContents

public void replaceContents(DatabaseFiles f2)
Description copied from interface: DatabaseFiles
Replace the contents of the database file(s) with the contents of the supplied file(s). The implementation of this method should be able to assume that the supplied object is of the same implementation as itself. (It is up to the database backend implementation to guarantee that.)

The contents of the database files should be replaced using the ReadWritableFile.replaceContents(org.entityfs.ReadWritableFile) method. A consequence of that is that the source files should be deleted.

Specified by:
replaceContents in interface DatabaseFiles
Parameters:
f2 - The file(s) containing the data.

delete

public void delete()
Description copied from interface: DatabaseFiles
Delete the database file(s).

Specified by:
delete in interface DatabaseFiles