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