1 6 7 package com.sun.enterprise.config.backup; 8 9 import com.sun.enterprise.config.backup.pluggable.BackupEnvironment; 10 import com.sun.enterprise.config.backup.pluggable.EnvironmentFactory; 11 import com.sun.enterprise.config.backup.status.StatusConstants; 12 import java.io.File ; 13 14 18 public class SnapShotFileNameFilter implements java.io.FilenameFilter { 19 20 private final String _backupFileNamePrefix; 21 22 public SnapShotFileNameFilter(String backupFileNamePrefix) { 23 _backupFileNamePrefix = backupFileNamePrefix; 24 } 25 26 public boolean accept(java.io.File dir, String name) { 27 try { 28 return test(name); 29 } catch(Exception e) { 30 } 31 return false; 32 } 33 34 private boolean test(String name) throws Exception { 35 String [] parts = 36 name.split(DefaultConstants.INTRA_FILENAME_SEPARATOR); 37 38 BackupEnvironment be = 39 EnvironmentFactory.getEnvironmentFactory(). 40 getBackupEnvironment(); 41 if (!be.getSnapshotFileNamePrefix().equals(parts[0])) 42 return false; 43 44 try { 45 new Long (parts[1]).longValue(); 46 return true; 47 } catch(Exception e) { 48 return false; 49 } 50 } 51 } 52 | Popular Tags |