001/* 002 * #%L 003 * Netarchivesuite - archive 004 * %% 005 * Copyright (C) 2005 - 2014 The Royal Danish Library, the Danish State and University Library, 006 * the National Library of France and the Austrian National Library. 007 * %% 008 * This program is free software: you can redistribute it and/or modify 009 * it under the terms of the GNU Lesser General Public License as 010 * published by the Free Software Foundation, either version 2.1 of the 011 * License, or (at your option) any later version. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Lesser Public License for more details. 017 * 018 * You should have received a copy of the GNU General Lesser Public 019 * License along with this program. If not, see 020 * <http://www.gnu.org/licenses/lgpl-2.1.html>. 021 * #L% 022 */ 023 024package dk.netarkivet.archive.arcrepositoryadmin; 025 026import java.io.File; 027import java.sql.Connection; 028 029import dk.netarkivet.common.exceptions.ArgumentNotValid; 030 031/** 032 * Implementation of DB-specific functions for the server-based Derby. 033 */ 034public class DerbyServerSpecifics extends DerbySpecifics { 035 /** 036 * Get an instance of the Server Derby specifics. 037 * 038 * @return Instance of the Derby specifics implementation 039 */ 040 public static DBSpecifics getInstance() { 041 return new DerbyServerSpecifics(); 042 } 043 044 /** 045 * Inherited function. We do not shut down external derby databases, only the embedded ones. 046 */ 047 public void shutdownDatabase() { 048 log.warn("The external database will not be shut down from within " + "the code."); 049 } 050 051 /** 052 * Backup the database. For server-based databases, where the administrator is expected to perform the backups, this 053 * method should do nothing. This method gets called within one hour of the hour-of-day indicated by the 054 * DB_BACKUP_INIT_HOUR settings. 055 * 056 * @param backupDir Directory to which the database should be backed up 057 * @param c The connection to the database to backup. 058 * @throws ArgumentNotValid If the connection or the backup directory is null. 059 */ 060 public void backupDatabase(Connection c, File backupDir) throws ArgumentNotValid { 061 ArgumentNotValid.checkNotNull(backupDir, "File backupDir"); 062 ArgumentNotValid.checkTrue(!backupDir.isFile(), "The file backupDir is " + "a file and not a directory."); 063 ArgumentNotValid.checkNotNull(c, "Connection c"); 064 log.warn("Attempt to backup the database to directory '" + backupDir.getAbsolutePath() 065 + "'. ignored. Backup of your " + "external Derby database should be done by your SysOp"); 066 } 067 068 /** 069 * Get the name of the JDBC driver class that handles interfacing to this server. 070 * 071 * @return The name of a JDBC driver class 072 */ 073 public String getDriverClassName() { 074 return "org.apache.derby.jdbc.ClientDriver"; 075 } 076}