1 6 7 package com.sun.enterprise.config.backup.status; 8 9 import java.util.Date ; 10 import com.sun.enterprise.config.backup.BackupException; 11 import com.sun.enterprise.config.backup.utils.BackupHelper; 12 import com.sun.enterprise.config.backup.utils.FactoryHelper; 13 14 19 public class BackupStatus extends Status { 20 21 private String _absoluteBackupFileName; 22 23 25 private String _backupDir; 26 27 28 private long _backupFileSize; 29 30 31 private String _userInfo; 32 33 34 public BackupStatus() { 35 } 36 37 public BackupStatus(String userInfo, boolean initialize) throws BackupException { 38 super(initialize); 39 _userInfo = userInfo; 40 if(initialize) { 41 init(); 42 } 43 } 44 45 56 private void init() throws BackupException { 57 setBackupDirectory(getDirectory()); 58 setAbsoluteBackupFileName(getAbsoluteName(getCreationTimeStamp())); 59 } 60 61 protected String getDirectory() throws BackupException { 62 return FactoryHelper.getEnv().getDirectoryToStoreBackupFiles(); 63 } 64 65 private String getAbsoluteName(long ts) { 66 return BackupHelper.getAbsoluteBackupFileName(ts); 67 } 68 69 public String getAbsoluteBackupFileName() { 70 return _absoluteBackupFileName; 71 } 72 73 public String getBackupDirectory() { 74 return _backupDir; 75 } 76 77 public long getBackupFileSize() { 78 return _backupFileSize; 79 } 80 81 public void setBackupFileSize(long size) { 82 _backupFileSize = size; 83 } 84 85 public String getUserInfo() { 86 return _userInfo; 87 } 88 89 protected void setUserInfo(String s) { 90 _userInfo = s; 91 } 92 93 public void setAbsoluteBackupFileName(String name) { 94 _absoluteBackupFileName = name; 95 } 96 97 98 private void setBackupDirectory(String dir) { 99 _backupDir = dir; 100 } 101 102 protected String thisToString() { 103 104 String result = 105 "Backup FileName " + _absoluteBackupFileName + ", " + 106 "Backup File Size " + _backupFileSize; 107 108 String userInfo = getUserInfo(); 109 110 if(userInfo != null && !userInfo.equals("") ) { 111 result += ", User Info=" + userInfo; 112 } 113 114 return result; 115 } 116 117 public String getOperation() { 118 return "backup"; 119 } 120 121 public String [] getDirectoriesToBackup() { 122 return FactoryHelper.getEnv().getDirectoriesToBackup(); 123 } 124 } 125 | Popular Tags |