001/** 002 * Copyright (C) 2014 Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/ 003 * 004 * This file is part of Dicoogle/dicoogle. 005 * 006 * Dicoogle/dicoogle is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * Dicoogle/dicoogle is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with Dicoogle. If not, see <http://www.gnu.org/licenses/>. 018 */ 019 020package pt.ua.dicoogle.DicomLog; 021 022import java.util.ArrayList; 023import org.slf4j.LoggerFactory; 024import javax.xml.transform.TransformerConfigurationException; 025 026/** 027 * 028 * @author Luís A. Bastião Silva <bastiao@ua.pt> 029 */ 030public class LogDICOM{ 031 032 private static LogDICOM instance = null ; 033 034 private ArrayList<LogLine> ll = new ArrayList<LogLine>(); 035 036 private LogDICOM() 037 { 038 // Nothing to do. 039 } 040 041 042 public static synchronized LogDICOM getInstance() 043 { 044 if (instance == null) { 045 instance = new LogDICOM(); 046 } 047 return instance; 048 } 049 050 051 public void addLine(LogLine l) 052 { 053 this.getLl().add(l); 054 } 055 056 public void clearLog(){ 057 this.getLl().clear(); 058 059 try { 060 LogXML log = new LogXML(); 061 log.printXML(); 062 } catch (TransformerConfigurationException ex) { 063 LoggerFactory.getLogger(LogDICOM.class.getName()).error(ex.getMessage(), ex); 064 } 065 } 066 067 /** 068 * @return the ll 069 */ 070 public ArrayList<LogLine> getLl() 071 { 072 return ll; 073 } 074 075 /** 076 * @param ll the ll to set 077 */ 078 public void setLl(ArrayList<LogLine> ll) 079 { 080 this.ll = ll; 081 } 082 083 084 085}