org.opends.server.types
Class BackupInfo

java.lang.Object
  extended by org.opends.server.types.BackupInfo

@PublicAPI(stability=VOLATILE,
           mayInstantiate=false,
           mayExtend=false,
           mayInvoke=true)
public final class BackupInfo
extends java.lang.Object

This class defines a data structure for holding information about a backup that is available in a backup directory.


Field Summary
static java.lang.String PROPERTY_BACKUP_DATE
          The name of the property that holds the date that the backup was created.
static java.lang.String PROPERTY_BACKUP_ID
          The name of the property that holds the backup ID in encoded representations.
static java.lang.String PROPERTY_CUSTOM_PREFIX
          The prefix to use with custom backup properties.
static java.lang.String PROPERTY_DEPENDENCY
          The name of the property that holds the set of dependencies in encoded representations (one dependency per instance).
static java.lang.String PROPERTY_IS_COMPRESSED
          The name of the property that holds the compressed flag in encoded representations.
static java.lang.String PROPERTY_IS_ENCRYPTED
          The name of the property that holds the encrypted flag in encoded representations.
static java.lang.String PROPERTY_IS_INCREMENTAL
          The name of the property that holds the incremental flag in encoded representations.
static java.lang.String PROPERTY_SIGNED_HASH
          The name of the property that holds the signed hash in encoded representations.
static java.lang.String PROPERTY_UNSIGNED_HASH
          The name of the property that holds the unsigned hash in encoded representations.
 
Constructor Summary
BackupInfo(BackupDirectory backupDirectory, java.lang.String backupID, java.util.Date backupDate, boolean isIncremental, boolean isCompressed, boolean isEncrypted, byte[] unsignedHash, byte[] signedHash, java.util.HashSet<java.lang.String> dependencies, java.util.HashMap<java.lang.String,java.lang.String> backupProperties)
          Creates a new backup info structure with the provided information.
 
Method Summary
static BackupInfo decode(BackupDirectory backupDirectory, java.util.LinkedList<java.lang.String> encodedInfo)
          Decodes the provided list of strings as the representation of a backup info structure.
 boolean dependsOn(java.lang.String backupID)
          Indicates whether this backup has a dependency on the backup with the provided ID.
 java.util.LinkedList<java.lang.String> encode()
          Encodes this backup info structure to a multi-line string representation.
 java.util.Date getBackupDate()
          Retrieves the date that this backup was created.
 BackupDirectory getBackupDirectory()
          Retrieves the reference to the backup directory in which this backup is stored.
 java.lang.String getBackupID()
          Retrieves the unique ID for this backup.
 java.util.HashMap<java.lang.String,java.lang.String> getBackupProperties()
          Retrieves a set of additional properties that should be associated with this backup.
 java.lang.String getBackupProperty(java.lang.String name)
          Retrieves the value of the backup property with the specified name.
 java.util.HashSet<java.lang.String> getDependencies()
          Retrieves the set of the backup IDs for the backups on which this backup is dependent.
 byte[] getSignedHash()
          Retrieves the data for the signed hash for this backup, if appropriate.
 byte[] getUnsignedHash()
          Retrieves the data for the unsigned hash for this backup, if appropriate.
 boolean isCompressed()
          Indicates whether this backup is compressed.
 boolean isEncrypted()
          Indicates whether this backup is encrypted.
 boolean isIncremental()
          Indicates whether this is an incremental or a full backup.
 java.lang.String toString()
          Retrieves a multi-line string representation of this backup info structure.
 void toString(java.lang.StringBuilder buffer)
          Appends a multi-line string representation of this backup info structure to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_BACKUP_DATE

public static final java.lang.String PROPERTY_BACKUP_DATE
The name of the property that holds the date that the backup was created.

See Also:
Constant Field Values

PROPERTY_BACKUP_ID

public static final java.lang.String PROPERTY_BACKUP_ID
The name of the property that holds the backup ID in encoded representations.

See Also:
Constant Field Values

PROPERTY_IS_INCREMENTAL

public static final java.lang.String PROPERTY_IS_INCREMENTAL
The name of the property that holds the incremental flag in encoded representations.

See Also:
Constant Field Values

PROPERTY_IS_COMPRESSED

public static final java.lang.String PROPERTY_IS_COMPRESSED
The name of the property that holds the compressed flag in encoded representations.

See Also:
Constant Field Values

PROPERTY_IS_ENCRYPTED

public static final java.lang.String PROPERTY_IS_ENCRYPTED
The name of the property that holds the encrypted flag in encoded representations.

See Also:
Constant Field Values

PROPERTY_UNSIGNED_HASH

public static final java.lang.String PROPERTY_UNSIGNED_HASH
The name of the property that holds the unsigned hash in encoded representations.

See Also:
Constant Field Values

PROPERTY_SIGNED_HASH

public static final java.lang.String PROPERTY_SIGNED_HASH
The name of the property that holds the signed hash in encoded representations.

See Also:
Constant Field Values

PROPERTY_DEPENDENCY

public static final java.lang.String PROPERTY_DEPENDENCY
The name of the property that holds the set of dependencies in encoded representations (one dependency per instance).

See Also:
Constant Field Values

PROPERTY_CUSTOM_PREFIX

public static final java.lang.String PROPERTY_CUSTOM_PREFIX
The prefix to use with custom backup properties. The name of the property will be appended to this prefix.

See Also:
Constant Field Values
Constructor Detail

BackupInfo

public BackupInfo(BackupDirectory backupDirectory,
                  java.lang.String backupID,
                  java.util.Date backupDate,
                  boolean isIncremental,
                  boolean isCompressed,
                  boolean isEncrypted,
                  byte[] unsignedHash,
                  byte[] signedHash,
                  java.util.HashSet<java.lang.String> dependencies,
                  java.util.HashMap<java.lang.String,java.lang.String> backupProperties)
Creates a new backup info structure with the provided information.

Parameters:
backupDirectory - A reference to the backup directory in which this backup is stored.
backupID - The unique ID for this backup.
backupDate - The time that this backup was created.
isIncremental - Indicates whether this is an incremental or a full backup.
isCompressed - Indicates whether the backup is compressed.
isEncrypted - Indicates whether the backup is encrypted.
unsignedHash - The unsigned hash for this backup, if appropriate.
signedHash - The signed hash for this backup, if appropriate.
dependencies - The backup IDs of the previous backups on which this backup is dependent.
backupProperties - The set of additional backend-specific properties that should be stored with this backup information. It should be a mapping between property names and values, where the names do not contain any equal signs and neither the names nor the values contain line breaks.
Method Detail

getBackupDirectory

public BackupDirectory getBackupDirectory()
Retrieves the reference to the backup directory in which this backup is stored.

Returns:
A reference to the backup directory in which this backup is stored.

getBackupID

public java.lang.String getBackupID()
Retrieves the unique ID for this backup.

Returns:
The unique ID for this backup.

getBackupDate

public java.util.Date getBackupDate()
Retrieves the date that this backup was created.

Returns:
The date that this backup was created.

isIncremental

public boolean isIncremental()
Indicates whether this is an incremental or a full backup.

Returns:
true if this is an incremental backup, or false if it is a full backup.

isCompressed

public boolean isCompressed()
Indicates whether this backup is compressed.

Returns:
true if this backup is compressed, or false if it is not.

isEncrypted

public boolean isEncrypted()
Indicates whether this backup is encrypted.

Returns:
true if this backup is encrypted, or false if it is not.

getUnsignedHash

public byte[] getUnsignedHash()
Retrieves the data for the unsigned hash for this backup, if appropriate.

Returns:
The data for the unsigned hash for this backup, or null if there is none.

getSignedHash

public byte[] getSignedHash()
Retrieves the data for the signed hash for this backup, if appropriate.

Returns:
The data for the signed hash for this backup, or null if there is none.

getDependencies

public java.util.HashSet<java.lang.String> getDependencies()
Retrieves the set of the backup IDs for the backups on which this backup is dependent. This is primarily intended for use with incremental backups (which should be dependent on at least a full backup and possibly one or more other incremental backups). The contents of this hash should not be directly updated by the caller.

Returns:
The set of the backup IDs for the backups on which this backup is dependent.

dependsOn

public boolean dependsOn(java.lang.String backupID)
Indicates whether this backup has a dependency on the backup with the provided ID.

Parameters:
backupID - The backup ID for which to make the determination.
Returns:
true if this backup has a dependency on the backup with the provided ID, or false if not.

getBackupProperties

public java.util.HashMap<java.lang.String,java.lang.String> getBackupProperties()
Retrieves a set of additional properties that should be associated with this backup. This may be used by the backend to store arbitrary information that may be needed later to restore the backup or perform an incremental backup based on this backup. The mapping will be between property names and values, where the names are not allowed to contain equal signs, and neither the names nor the values may have line breaks. The contents of the mapping should not be altered by the caller.

Returns:
A set of additional properties that should be associated with this backup.

getBackupProperty

public java.lang.String getBackupProperty(java.lang.String name)
Retrieves the value of the backup property with the specified name.

Parameters:
name - The name of the backup property to retrieve.
Returns:
The value of the backup property with the specified name, or null if there is no such property.

encode

public java.util.LinkedList<java.lang.String> encode()
Encodes this backup info structure to a multi-line string representation. This representation may be parsed by the decode method to reconstruct the structure.

Returns:
A multi-line string representation of this backup info structure.

decode

public static BackupInfo decode(BackupDirectory backupDirectory,
                                java.util.LinkedList<java.lang.String> encodedInfo)
                         throws ConfigException
Decodes the provided list of strings as the representation of a backup info structure.

Parameters:
backupDirectory - The reference to the backup directory with which the backup info is associated.
encodedInfo - The list of strings that comprise the string representation of the backup info structure.
Returns:
The decoded backup info structure.
Throws:
ConfigException - If a problem occurs while attempting to decode the backup info data.

toString

public java.lang.String toString()
Retrieves a multi-line string representation of this backup info structure.

Overrides:
toString in class java.lang.Object
Returns:
A multi-line string representation of this backup info structure.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a multi-line string representation of this backup info structure to the provided buffer.

Parameters:
buffer - The buffer to which the information should be written.