2424import static org .firebirdsql .util .FirebirdSupportInfo .supportInfoFor ;
2525
2626/**
27- * Implements the common functionality between regular and streaming backup/restore
27+ * Implements the common functionality between regular and streaming backup/restore.
2828 *
2929 * @author Roman Rokytskyy
3030 * @author Mark Rotteveel
@@ -79,8 +79,8 @@ public String toString() {
7979
8080 protected boolean verbose ;
8181
82- private int restoreBufferCount = -1 ;
83- private int restorePageSize = - 1 ;
82+ private int restorePageBufferCount = -1 ;
83+ private int restorePageSize = PageSizeConstants . USE_DEFAULT ;
8484 private boolean restoreReadOnly ;
8585 private boolean restoreReplace ;
8686 private @ Nullable String skipData ;
@@ -92,13 +92,13 @@ public String toString() {
9292 private static final int RESTORE_CREATE = isc_spb_res_create ;
9393
9494 /**
95- * Create a new instance of < code> FBBackupManagerBase</code> based on the default GDSType.
95+ * Create a new instance of {@ code FBBackupManagerBase} based on the default GDSType.
9696 */
9797 protected FBBackupManagerBase () {
9898 }
9999
100100 /**
101- * Create a new instance of < code> FBBackupManagerBase</code> based on a given GDSType.
101+ * Create a new instance of {@ code FBBackupManagerBase} based on a given GDSType.
102102 *
103103 * @param gdsType
104104 * type must be PURE_JAVA, EMBEDDED, or NATIVE
@@ -108,7 +108,7 @@ protected FBBackupManagerBase(String gdsType) {
108108 }
109109
110110 /**
111- * Create a new instance of < code> FBBackupManagerBase</code> based on a given GDSType.
111+ * Create a new instance of {@ code FBBackupManagerBase} based on a given GDSType.
112112 *
113113 * @param gdsType
114114 * type must be PURE_JAVA, EMBEDDED, or NATIVE
@@ -208,71 +208,61 @@ public void restoreDatabase() throws SQLException {
208208 restoreDatabase (0 );
209209 }
210210
211- /**
212- * Set whether the operations of this {@code BackupManager} will result in verbose logging to the configured logger.
213- *
214- * @param verbose
215- * If <code>true</code>, operations will be logged verbosely, otherwise they will not be logged verbosely
216- */
217211 @ Override
218212 public void setVerbose (boolean verbose ) {
219213 this .verbose = verbose ;
220214 }
221215
222- /**
223- * Set the default number of pages to be buffered (cached) by default in a restored database.
224- *
225- * @param bufferCount
226- * The page-buffer size to be used, a positive value
227- */
216+ @ Override
217+ public boolean isVerbose () {
218+ return verbose ;
219+ }
220+
228221 @ Override
229222 public void setRestorePageBufferCount (int bufferCount ) {
230- if (bufferCount < 0 ) {
231- throw new IllegalArgumentException ("Buffer count must be positive" );
223+ if (bufferCount < - 1 ) {
224+ throw new IllegalArgumentException ("Buffer count must be positive or -1 " );
232225 }
233- this .restoreBufferCount = bufferCount ;
226+ this .restorePageBufferCount = bufferCount ;
227+ }
228+
229+ @ Override
230+ public int getRestorePageBufferCount () {
231+ return restorePageBufferCount ;
234232 }
235233
236- /**
237- * Set the page size that will be used for a restored database. The value for {@code pageSize} must be
238- * one of {@link PageSizeConstants}. The default value depends on the Firebird version.
239- * <p>
240- * Be aware that not all page sizes are supported by all Firebird versions.
241- * </p>
242- *
243- * @param pageSize
244- * The page size to be used in a restored database, see {@link PageSizeConstants}
245- * @see PageSizeConstants
246- */
247234 @ Override
248235 public void setRestorePageSize (int pageSize ) {
249- this .restorePageSize = PageSizeConstants .requireValidPageSize (pageSize );
236+ this .restorePageSize = pageSize != PageSizeConstants .USE_DEFAULT
237+ ? PageSizeConstants .requireValidPageSize (pageSize )
238+ : PageSizeConstants .USE_DEFAULT ;
239+ }
240+
241+ @ Override
242+ public int getRestorePageSize () {
243+ return restorePageSize ;
250244 }
251245
252- /**
253- * Set the restore operation to create a new database, as opposed to overwriting an existing database. This is true
254- * by default.
255- *
256- * @param replace
257- * If <code>true</code>, the restore operation will attempt to create a new database, otherwise the restore
258- * operation will overwrite an existing database
259- */
260246 @ Override
261247 public void setRestoreReplace (boolean replace ) {
262248 this .restoreReplace = replace ;
263249 }
264250
265- /**
266- * Set the read-only attribute on a restored database.
267- *
268- * @param readOnly
269- * If <code>true</code>, a restored database will be read-only, otherwise it will be read-write.
270- */
251+ @ Override
252+ public boolean isRestoreReplace () {
253+ return restoreReplace ;
254+ }
255+
271256 @ Override
272257 public void setRestoreReadOnly (boolean readOnly ) {
273258 this .restoreReadOnly = readOnly ;
274259 }
275260
261+ @ Override
262+ public boolean isRestoreReadOnly () {
263+ return restoreReadOnly ;
264+ }
265+
276266 @ Override
277267 public void setSkipData (@ Nullable String skipData ) {
278268 this .skipData = skipData ;
@@ -342,8 +332,8 @@ protected ServiceRequestBuffer getRestoreSRB(FbService service, int options) thr
342332
343333 addBackupsToRestoreRequestBuffer (service , restoreSPB );
344334
345- if (restoreBufferCount != -1 ) {
346- restoreSPB .addArgument (isc_spb_res_buffers , restoreBufferCount );
335+ if (restorePageBufferCount != -1 ) {
336+ restoreSPB .addArgument (isc_spb_res_buffers , restorePageBufferCount );
347337 }
348338
349339 if (restorePageSize != -1 ) {
0 commit comments