1 6 7 package com.quikj.application.utilities.postinstall; 8 9 import java.io.*; 10 11 15 public class TextBackup implements ScreenPrinterInterface 16 { 17 private String home; 18 19 20 public TextBackup(String home) 21 { 22 this.home = home; 23 } 24 25 public void backup() 26 { 27 System.out.println("This utility will backup all the essential system configuration files. Press ENTER to continue"); 28 29 try 30 { 31 BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); 32 reader.readLine(); 33 34 File f = null; 35 if (home == null) 36 { 37 f = new File("."); 38 } 39 else 40 { 41 f = new File (home); 42 } 43 44 String abs_path = f.getAbsolutePath(); 45 if (abs_path.endsWith(File.separator + ".") == true) 46 { 47 abs_path = abs_path.substring(0, abs_path.length() - 2); 48 } 49 50 f = new File(abs_path, "sql/init_ace.sql.orig"); 52 if (f.exists() == false) 53 { 54 System.out.println("You have not started this utility from the ACE Home folder. Backup cannot be done"); 55 } 56 else 57 { 58 BackupFiles backup = new BackupFiles(); 60 String error = backup.backup(abs_path, this); 61 if (error != null) 62 { 63 System.out.println (error); 64 } 65 else 66 { 67 System.out.println("Backup completed."); 68 } 69 } 70 71 } 72 catch (IOException ex) 73 { 74 System.out.println("An IO error occured: " + ex.getMessage()); 75 } 76 77 System.exit(0); 78 } 79 80 public void print(String message) 81 { 82 System.out.print(message); 83 } 84 85 public void println(String message) 86 { 87 System.out.println(message); 88 } 89 90 } 91 | Popular Tags |