1 11 package org.eclipse.pde.internal.runtime.logview; 12 13 import java.text.ParseException ; 14 import com.ibm.icu.text.SimpleDateFormat; 15 import java.util.Date ; 16 import java.util.StringTokenizer ; 17 18 public class LogSession { 19 private String sessionData; 20 private Date date; 21 22 25 public LogSession() { 26 } 27 28 public Date getDate() { 29 return date; 30 } 31 32 public void setDate(String dateString) { 33 SimpleDateFormat formatter = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.SS"); try { 35 date = formatter.parse(dateString); 36 } catch (ParseException e) { 37 } 38 } 39 40 public String getSessionData() { 41 return sessionData; 42 } 43 44 void setSessionData(String data) { 45 this.sessionData = data; 46 } 47 48 public void processLogLine(String line) { 49 StringTokenizer tokenizer = new StringTokenizer (line); 50 if (tokenizer.countTokens() == 6) { 51 tokenizer.nextToken(); 52 StringBuffer dateBuffer = new StringBuffer (); 53 for (int i = 0; i < 4; i++) { 54 dateBuffer.append(tokenizer.nextToken()); 55 dateBuffer.append(" "); } 57 setDate(dateBuffer.toString().trim()); 58 } 59 } 60 } 61 | Popular Tags |