1 6 7 package com.sun.enterprise.config.backup; 8 9 import java.io.Serializable ; 10 import java.util.ArrayList ; 11 import java.util.Date ; 12 import com.sun.enterprise.config.backup.status.StatusConstants; 13 import com.sun.enterprise.config.backup.status.Status; 14 import com.sun.enterprise.config.backup.utils.LoggerHelper; 15 16 20 public class HistoryEntry implements Serializable , 21 StatusConstants, 22 EnvironmentConstants, 23 DefaultConstants { 24 25 private String _operation = OPERATION_TYPE_UNKNOWN; 26 private long _timestamp=-1; 27 private Status _status; 28 private String _tmpStringValue; 29 30 32 public HistoryEntry() { 33 } 34 35 public HistoryEntry(String line) throws BackupException { 36 this(); 37 if(line == null || line == "") { 38 return; 39 } 40 41 54 _tmpStringValue = line; 55 } 56 57 public HistoryEntry(Status status) { 58 if(status!= null) { 59 _operation = status.getOperation(); 60 _timestamp = status.getCreationTimeStamp(); 61 _status = status; 62 _tmpStringValue = status.toString(); 63 } 64 } 65 68 private void initVariables(String [] vars) { 69 _operation = vars[0]; 70 _timestamp = new Long (vars[1]).longValue(); 71 72 } 75 76 public String toString() { 77 if(_tmpStringValue == null) { 78 return getDate() + HISTORY_FILE_INITIAL_SEPARATOR + 79 _operation + HISTORY_FILE_DATA_SEPARATOR + 80 _timestamp + HISTORY_FILE_DATA_SEPARATOR + 81 HISTORY_FILE_EXTRA_DATA_SEPARATOR_START + 82 getStatusAsString() + 83 HISTORY_FILE_EXTRA_DATA_SEPARATOR_END; 84 } else { 85 return _tmpStringValue; 86 } 87 } 88 private String getDate() { 89 return new Date (_timestamp).toString(); 90 } 91 private String getStatusAsString() { 92 if(_status == null) { 93 return "No Extra Details"; 94 } 95 return _status.toString(); 96 } 97 } 98 | Popular Tags |