001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2015 ForgeRock AS.
016 */
017package org.opends.server.types;
018
019
020/**
021 * This class defines a data structure for holding configuration
022 * information to use when restoring a backup of a Directory Server
023 * backend.  It is assumed that the only information necessary to
024 * restore a backup is the path to the directory containing the backup
025 * file(s) and the backup ID of the backup to restore.  Any other
026 * information that may be needed to restore a given backup must be
027 * saved in some way by the backup mechanism.  Note that if the
028 * associated backend supports taking incremental backups, it must be
029 * possible to restore the original full backup or any individual
030 * incremental backup taken since that full backup (i.e., an
031 * incremental backup must not prevent restoring an earlier
032 * incremental backup or the original full backup with which the
033 * incremental backups are associated).
034 */
035@org.opends.server.types.PublicAPI(
036     stability=org.opends.server.types.StabilityLevel.VOLATILE,
037     mayInstantiate=true,
038     mayExtend=false,
039     mayInvoke=true)
040public final class RestoreConfig extends OperationConfig
041{
042  /**
043   * The reference to the directory containing the backup file(s) to restore.
044   */
045  private BackupDirectory backupDirectory;
046
047  /**
048   * Indicates whether the "restore" should be verify-only but not
049   * actually move or restore any files.
050   */
051  private boolean verifyOnly;
052
053  /** The unique ID assigned to the backup that is to be restored. */
054  private String backupID;
055
056
057
058  /**
059   * Creates a new restore configuration with the provided
060   * information.
061   *
062   * @param  backupDirectory  The reference to the directory
063   *                          containing the backup file(s) to
064   *                          restore.
065   * @param  backupID         The unique ID assigned to the backup
066   *                          that is to be restored.
067   * @param  verifyOnly       Indicates whether the specified backup
068   *                          should be verified only and not actually
069   *                          restored.
070   */
071  public RestoreConfig(BackupDirectory backupDirectory,
072                       String backupID, boolean verifyOnly)
073  {
074    this.backupDirectory = backupDirectory;
075    this.backupID        = backupID;
076    this.verifyOnly      = verifyOnly;
077  }
078
079
080
081  /**
082   * Retrieves a reference to the directory containing the backup
083   * file(s) to restore.
084   *
085   * @return  A reference to the directory containing the backup
086   *          file(s) to restore.
087   */
088  public BackupDirectory getBackupDirectory()
089  {
090    return backupDirectory;
091  }
092
093
094
095  /**
096   * Retrieves the identifier of the backup to be restored.  This ID
097   * must be unique among all backups (both full and incremental) at
098   * least within the specified backup directory.
099   *
100   * @return  The identifier of the backup to be restored.
101   */
102  public String getBackupID()
103  {
104    return backupID;
105  }
106
107
108
109  /**
110   * Indicates whether the restore process should only attempt to
111   * verify the validity and/or integrity of the backup files to the
112   * best of its ability rather than actually trying to restore.  Note
113   * that in some cases, the ability to verify a backup files will not
114   * be able to guarantee that they may be used, but will it must at
115   * least verify that the appropriate file(s) exist, that any hashes
116   * or signatures are valid, and that any encryption can be
117   * decrypted.
118   *
119   * @return  <CODE>true</CODE> if this restore process should only
120   *          attempt to verify the validity and/or integrity of the
121   *          backup files, or <CODE>false</CODE> if it should
122   *          actually attempt to restore the backup.
123   */
124  public boolean verifyOnly()
125  {
126    return verifyOnly;
127  }
128}
129