org.apache.ace.repository.ext
Interface BackupRepository

All Known Implementing Classes:
FilebasedBackupRepository

public interface BackupRepository

Provides an interface for backing up objects. write and read allow writing and reading of the current version of the object. backup backs up the object, and restore restores it from a previously backed up version, if any. There is no way to directly use the backup.


Method Summary
 boolean backup()
          Backs up the current version of the object, overwriting a previous backup, if any.
 InputStream read()
          Reads the input stream from the current object.
 boolean restore()
          Restores a previously backuped version of the object.
 void write(InputStream data)
          Writes the input stream to the current object.
 

Method Detail

write

void write(InputStream data)
           throws IOException
Writes the input stream to the current object.

Parameters:
data - The data to be written. Remember to close this stream, if necessary.
Throws:
IOException - Will be thrown when (a) the input stream gets closed unexpectedly, or (b) there is an error writing the data.

read

InputStream read()
                 throws IOException
Reads the input stream from the current object. If there is no current version, an empty stream will be returned.

Returns:
An input stream, from which can be read. Remember to close it.
Throws:
IOException - Will be thrown when there is a problem storing the data.

restore

boolean restore()
                throws IOException
Restores a previously backuped version of the object.

Returns:
True when there was a previously backup version which has now been restored, false otherwise.
Throws:
IOException - Thrown when the restore process goes bad.

backup

boolean backup()
               throws IOException
Backs up the current version of the object, overwriting a previous backup, if any.

Returns:
True when there was a current version to be backed up, false otherwise.
Throws:
IOException - Thrown when the restore process goes bad.


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.