Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## main
Class RepositoryAdministrator

    java.lang.Object
      main.RepositoryAdministrator

    public class RepositoryAdministrator

extends java.lang.Object

This clas is administrator of local repository. Local repository is folder located on local host used to store backup fragments and checksums.

Constructor Summary
`RepositoryAdministrator()`

Method Summary
`static void` | `addBackup(BackupMetaContainer meta)` Registers backup metadata.
`static void` | `cleanRepository()`
`static void` | `deleteBackup(BackupMetaContainer meta)` Deletes backup from local repository.
`static int` | `getBackupCount()` Returns number of backup currently stored on localhost.
`static java.io.InputStream` | `getInputStream(java.lang.String filename)` Reads requested file stored in repository.
`static java.util.ArrayList<java.io.InputStream>` | `getInputStreamsForBackup(BackupMetaContainer meta)` Returns list of inputstreams used to read existing parts of backup identified by backup metadata.
`static java.io.OutputStream` | `getOutputStream(java.lang.String filename)` Creates or overwrites file in repository.
`static java.util.ArrayList<java.io.OutputStream>` | `getOutputStreamsForBackup(BackupMetaContainer meta)` Returns list of outputstreams used to write missing parts of backup identified by backup metadata.
`static java.util.ArrayList<java.io.OutputStream>` | `getOutputStreamsForBackup(BackupMetaContainer meta, boolean overChecksums)` Same as getOutputStreamsForBackup(BackupMetaContainer meta) exept it allows for iteration over data checksums when overChecksums parameter is set to true.
`static long` | `getRepositoryUsed()` Returns current size of repository.
`static boolean` | `isRegistered(java.lang.String bcpName)` Checks whether file is registered.
`static BackupMetaContainer[]` | `listBackups(java.lang.String filename)` This method searches local repository for backups of given file.
`static java.lang.String[]` | `listFragments(BackupMetaContainer meta)` Given backup metadata file, list of fragments stored in local repository are returned.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RepositoryAdministrator

    public RepositoryAdministrator()

Method Detail

### getRepositoryUsed

    public static long getRepositoryUsed()

  Returns current size of repository.

  Returns:
    size of repository in bytes

### getBackupCount

    public static int getBackupCount()

  Returns number of backup currently stored on localhost.

  Returns:
    number of backups

### addBackup

    public static void addBackup(BackupMetaContainer meta)

  Registers backup metadata. If localhost is requested to store some of related backup files, it accepts. If backup is not registered, requests to store files are rejected by servers.

  Parameters:
    `meta` -
  See Also:
    `FanInClient`

### cleanRepository

    public static void cleanRepository()

### getOutputStream

    public static java.io.OutputStream getOutputStream(java.lang.String filename)

  Creates or overwrites file in repository. Returns outputstream which writes int specified filename.

  Parameters:
    `filename` - name of file
  Returns:
    outputstream writing into filename

### getInputStream

    public static java.io.InputStream getInputStream(java.lang.String filename)
                                              throws java.io.FileNotFoundException

  Reads requested file stored in repository.

  Parameters:
    `filename` - name of file in repositoty to read
  Returns:
    inputstream reading specified file
  Throws:
    `java.io.FileNotFoundException` - if file could not be read

### isRegistered

    public static boolean isRegistered(java.lang.String bcpName)

  Checks whether file is registered.

  Parameters:
    `bcpName` - name of backup
  Returns:
    true if backup is registered

### listFragments

    public static java.lang.String[] listFragments(BackupMetaContainer meta)

  Given backup metadata file, list of fragments stored in local repository are returned.

  Parameters:
    `meta` - metadata of backup
  Returns:
    String array of locally stored files

### listBackups

    public static BackupMetaContainer[] listBackups(java.lang.String filename)

  This method searches local repository for backups of given file. If no backup of file with that name is localy stored, empty array is returned. Otherwise list of backup metadata container is returned as array.

  Parameters:
    `filename` - name of file to look for
  Returns:
    array of backup metadata containers

### getInputStreamsForBackup

    public static java.util.ArrayList<java.io.InputStream> getInputStreamsForBackup(BackupMetaContainer meta)

  Returns list of inputstreams used to read existing parts of backup identified by backup metadata. Metadata contains information on how many data and checksum files should exist in ideal case. For every fragment and data checksum one entry in list exists, however if file is missing, entry is equal to null.

  Parameters:
    `meta` - information about backup
  Returns:
    list of inputstreams

### getOutputStreamsForBackup

    public static java.util.ArrayList<java.io.OutputStream> getOutputStreamsForBackup(BackupMetaContainer meta)

  Returns list of outputstreams used to write missing parts of backup identified by backup metadata. Metadata contains information on how many data and checksum files should exist in ideal case. For every fragment one entry in list exists. If file already exists this entry is equal to null, otherwise entry represents valid output stream

  Parameters:
    `meta` - information about backup
  Returns:
    list of outputstreams
  See Also:
    `getOutputStreamsForBackup(BackupMetaContainer meta, boolean overChecksums)`

### getOutputStreamsForBackup

    public static java.util.ArrayList<java.io.OutputStream> getOutputStreamsForBackup(BackupMetaContainer meta,
                                                                                      boolean overChecksums)

  Same as getOutputStreamsForBackup(BackupMetaContainer meta) exept it allows for iteration over data checksums when overChecksums parameter is set to true.

  Parameters:
    `meta` - information about backup
    `overChecksums` - true if data checksums are to be listed
  Returns:
    list of outputstreams
  See Also:
    `getOutputStreamsForBackup(BackupMetaContainer meta)`

### deleteBackup

    public static void deleteBackup(BackupMetaContainer meta)

  Deletes backup from local repository.

  Parameters:
    `meta` - backup metadata of backup to be deleted

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD