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 010 * trunk/opends/resource/legal-notices/OpenDS.LICENSE 011 * or https://OpenDS.dev.java.net/OpenDS.LICENSE. 012 * See the License for the specific language governing permissions 013 * and limitations under the License. 014 * 015 * When distributing Covered Code, include this CDDL HEADER in each 016 * file and include the License file at 017 * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, 018 * add the following below this CDDL HEADER, with the fields enclosed 019 * by brackets "[]" replaced with your own identifying information: 020 * Portions Copyright [yyyy] [name of copyright owner] 021 * 022 * CDDL HEADER END 023 * 024 * 025 * Copyright 2006-2008 Sun Microsystems, Inc. 026 */ 027 package 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) 050 public final class RestoreConfig extends OperationConfig 051 { 052 // The reference to the directory containing the backup file(s) to 053 // restore. 054 private BackupDirectory backupDirectory; 055 056 // Indicates whether the "restore" should be verify-only but not 057 // actually move or restore any files. 058 private boolean verifyOnly; 059 060 // The unique ID assigned to the backup that is to be restored. 061 private String backupID; 062 063 064 065 /** 066 * Creates a new restore configuration with the provided 067 * information. 068 * 069 * @param backupDirectory The reference to the directory 070 * containing the backup file(s) to 071 * restore. 072 * @param backupID The unique ID assigned to the backup 073 * that is to be restored. 074 * @param verifyOnly Indicates whether the specified backup 075 * should be verified only and not actually 076 * restored. 077 */ 078 public RestoreConfig(BackupDirectory backupDirectory, 079 String backupID, boolean verifyOnly) 080 { 081 this.backupDirectory = backupDirectory; 082 this.backupID = backupID; 083 this.verifyOnly = verifyOnly; 084 } 085 086 087 088 /** 089 * Retrieves a reference to the directory containing the backup 090 * file(s) to restore. 091 * 092 * @return A reference to the directory containing the backup 093 * file(s) to restore. 094 */ 095 public BackupDirectory getBackupDirectory() 096 { 097 return backupDirectory; 098 } 099 100 101 102 /** 103 * Retrieves the identifier of the backup to be restored. This ID 104 * must be unique among all backups (both full and incremental) at 105 * least within the specified backup directory. 106 * 107 * @return The identifier of the backup to be restored. 108 */ 109 public String getBackupID() 110 { 111 return backupID; 112 } 113 114 115 116 /** 117 * Indicates whether the restore process should only attempt to 118 * verify the validity and/or integrity of the backup files to the 119 * best of its ability rather than actually trying to restore. Note 120 * that in some cases, the ability to verify a backup files will not 121 * be able to guarantee that they may be used, but will it must at 122 * least verify that the appropriate file(s) exist, that any hashes 123 * or signatures are valid, and that any encryption can be 124 * decrypted. 125 * 126 * @return <CODE>true</CODE> if this restore process should only 127 * attempt to verify the validity and/or integrity of the 128 * backup files, or <CODE>false</CODE> if it should 129 * actually attempt to restore the backup. 130 */ 131 public boolean verifyOnly() 132 { 133 return verifyOnly; 134 } 135 } 136