1 22 package org.jboss.services.loggingmonitor; 23 24 import java.util.HashMap ; 25 import java.util.Map ; 26 27 34 class RolloverPeriod 35 { 36 private static final Map periodFormatsMap; 37 static 38 { 39 periodFormatsMap = new HashMap (); 40 periodFormatsMap.put("MONTH", "\'.\'yyyy-MM"); 41 periodFormatsMap.put("MONTHLY", "\'.\'yyyy-MM"); 42 periodFormatsMap.put("WEEK", "\'.\'yyyy-ww"); 43 periodFormatsMap.put("WEEKLY", "\'.\'yyyy-ww"); 44 periodFormatsMap.put("DAY", "\'.\'yyyy-MM-dd"); 45 periodFormatsMap.put("DAILY", "\'.\'yyyy-MM-dd"); 46 periodFormatsMap.put("HALFDAY", "\'.\'yyyy-MM-dd-a"); 47 periodFormatsMap.put("HALFDAILY", "\'.\'yyyy-MM-dd-a"); 48 periodFormatsMap.put("HOUR", "\'.\'yyyy-MM-dd-HH"); 49 periodFormatsMap.put("HOURLY", "\'.\'yyyy-MM-dd-HH"); 50 periodFormatsMap.put("MINUTE", "\'.\'yyyy-MM-dd-HH-mm"); 51 } 52 53 private String rolloverPeriod; 54 private String rolloverFormat; 55 56 61 public RolloverPeriod(String rolloverPeriod) 62 { 63 this.rolloverFormat = (String )periodFormatsMap.get(rolloverPeriod.toUpperCase()); 64 65 if (this.rolloverFormat == null) 66 { 67 throw new IllegalArgumentException ("Unknown rollover period: " + rolloverPeriod); 68 } 69 this.rolloverPeriod = rolloverPeriod; 70 } 71 72 76 public String getRolloverFormat() 77 { 78 return rolloverFormat; 79 } 80 81 84 public String toString() 85 { 86 return rolloverPeriod; 87 } 88 } 89 | Popular Tags |