1 6 7 package com.sun.enterprise.config.backup; 8 9 import java.io.IOException ; 10 import java.io.File ; 11 import java.util.Arrays ; 12 import java.util.ArrayList ; 13 import java.util.List ; 14 import java.io.FilenameFilter ; 15 import com.sun.enterprise.config.backup.utils.LoggerHelper; 16 import com.sun.enterprise.config.backup.pluggable.EnvironmentFactory; 17 import com.sun.enterprise.config.backup.pluggable.BackupEnvironment; 18 import com.sun.enterprise.config.backup.utils.FactoryHelper; 19 import com.sun.enterprise.config.backup.status.BackupStatus; 20 import com.sun.enterprise.config.backup.status.ListBackupStatus; 21 22 23 28 public class BackupStorageMonitor extends StorageMonitor { 29 30 31 public BackupStorageMonitor() { 32 } 33 34 protected int getMaxBackups() { 35 return getEnv().getMaxBackups(); 36 } 37 38 39 protected String getFileNamePrefix() { 40 return getEnv().getBackupFileNamePrefix(); 41 } 42 43 protected FilenameFilter getFileNameFilter() { 44 return new BackupFileNameFilter( 45 getEnv().getBackupFileNamePrefix()); 46 } 47 48 protected String getMonitoredDirectory() { 49 return getEnv().getDirectoryToStoreBackupFiles(); 50 } 51 52 public BackupStatus[] listBackupStatus() { 53 File [] f = null; 54 BackupStatus[] bss = null; 55 try { 56 f = getFiles(); 57 58 if(f == null || f.length == 0) return null; 59 60 bss = new BackupStatus[f.length]; 61 for (int i = 0 ; i < f.length; i++) { 62 BackupStatus bs = new ListBackupStatus(f[i]); 63 bss[i] = bs; 64 } 65 } catch(Exception e) { 66 LoggerHelper.error("error_listing_backups", e); 68 } 69 70 return bss; 71 } 72 } | Popular Tags |