1 13 14 package se.anatom.ejbca.log; 15 16 import java.io.Serializable ; 17 import java.util.HashMap ; 18 19 import org.ejbca.core.model.log.LogEntry; 20 21 22 30 public class LogConfiguration implements Serializable { 31 private static final long serialVersionUID = -6349974447455748715L; 32 33 public LogConfiguration() { 36 this.useexternaldevices = true; 37 this.uselogdb = true; 38 this.configurationdata = new HashMap (); 39 40 for (int i = 0; i < LogEntry.EVENTNAMES_INFO.length; i++) { 42 configurationdata.put(new Integer (i), Boolean.TRUE); 43 } 44 45 for (int i = 0; i < LogEntry.EVENTNAMES_ERROR.length; i++) { 46 configurationdata.put(new Integer (i + LogEntry.EVENT_ERROR_BOUNDRARY), Boolean.TRUE); 47 } 48 } 49 50 public boolean logEvent(int event) { 52 Boolean log = (Boolean ) configurationdata.get(new Integer (event)); 53 54 if (log == null) { 55 return true; } 57 return log.booleanValue(); 58 } 59 60 67 public Boolean getLogEvent(int event) { 68 return (Boolean ) configurationdata.get(new Integer (event)); 69 } 70 71 77 public void setLogEvent(int event, boolean log) { 78 configurationdata.put(new Integer (event), Boolean.valueOf(log)); 79 } 80 81 86 public boolean useLogDB() { 87 return uselogdb; 88 } 89 90 95 public void setUseLogDB(boolean use) { 96 this.uselogdb = use; 97 } 98 99 104 public boolean useExternalLogDevices() { 105 return this.useexternaldevices; 106 } 107 108 113 public void setUseExternalLogDevices(boolean use) { 114 this.useexternaldevices = use; 115 } 116 117 public String getStringRepresentationOfEventId(int event) { 119 if (event >= LogEntry.EVENT_ERROR_BOUNDRARY) { 120 return LogEntry.EVENTNAMES_ERROR[event]; 121 } 122 return LogEntry.EVENTNAMES_INFO[event]; 123 } 124 129 public HashMap getConfigurationData() { 130 return this.configurationdata; 131 } 132 133 private HashMap configurationdata; 135 private boolean uselogdb; 136 private boolean useexternaldevices; 137 } 138 | Popular Tags |