| Line | Hits | Source |
|---|---|---|
| 1 | /******************************************************************************* | |
| 2 | * Demetrix process modelling system | |
| 3 | * | |
| 4 | * Copyright (c) 2003, 2004 Dimitri A. Pissarenko | |
| 5 | * | |
| 6 | * This file is part of Demetrix. | |
| 7 | * | |
| 8 | * Demetrix is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2.1 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * Demetrix is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with Demetrix; if not, write to the Free Software | |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 | * | |
| 22 | * For further information you may | |
| 23 | * | |
| 24 | * - send an e-mail in Russian, German or English to dimitri.pissarenko@gmx.net | |
| 25 | * - look at http://sourceforge.net/projects/demetrix/ | |
| 26 | * - look at http://demetrix.sourceforge.net/ | |
| 27 | * - look at http://members.inode.at/d.pissarenko/ | |
| 28 | * | |
| 29 | *****************************************************************************/ | |
| 30 | ||
| 31 | package net.sourceforge.demetrix.ui; | |
| 32 | ||
| 33 | import java.io.File; | |
| 34 | ||
| 35 | import net.sourceforge.demetrix.util.XmlSerializerDeserializer; | |
| 36 | ||
| 37 | /** | |
| 38 | * @author Dimitri Pissarenko | |
| 39 | * | |
| 40 | */ | |
| 41 | ||
| 42 | public class DemetrixConfigurationSingleton { | |
| 43 | ||
| 44 | 0 | public final static File CONFIGURATION_DATA_FILE = |
| 45 | new File("config/demetrix-config.xml"); | |
| 46 | ||
| 47 | public final static String CONFIGURATION_DATA_CONFIG_NAME = | |
| 48 | "DemetrixConfigurationData"; | |
| 49 | ||
| 50 | private static DemetrixConfigurationSingleton instance; | |
| 51 | ||
| 52 | private DemetrixConfigurationData data; | |
| 53 | ||
| 54 | 0 | private DemetrixConfigurationSingleton() { |
| 55 | ||
| 56 | 0 | this.data = new DemetrixConfigurationData(); |
| 57 | ||
| 58 | 0 | } |
| 59 | ||
| 60 | public static DemetrixConfigurationSingleton getInstance() { | |
| 61 | ||
| 62 | 0 | if (instance == null) { |
| 63 | ||
| 64 | 0 | instance = new DemetrixConfigurationSingleton(); |
| 65 | ||
| 66 | } | |
| 67 | ||
| 68 | 0 | return instance; |
| 69 | ||
| 70 | } | |
| 71 | ||
| 72 | public DemetrixConfigurationData getData() { | |
| 73 | ||
| 74 | 0 | return this.data; |
| 75 | ||
| 76 | } | |
| 77 | ||
| 78 | public void loadData() { | |
| 79 | ||
| 80 | 0 | this.data = |
| 81 | (DemetrixConfigurationData) XmlSerializerDeserializer | |
| 82 | .getInstance() | |
| 83 | .readObject( | |
| 84 | CONFIGURATION_DATA_FILE, | |
| 85 | 0 | DemetrixConfigurationData.class, |
| 86 | CONFIGURATION_DATA_CONFIG_NAME); | |
| 87 | ||
| 88 | 0 | if (this.data == null) { |
| 89 | ||
| 90 | 0 | this.data = new DemetrixConfigurationData(); |
| 91 | ||
| 92 | } | |
| 93 | ||
| 94 | 0 | } |
| 95 | ||
| 96 | public void writeData() { | |
| 97 | ||
| 98 | 0 | XmlSerializerDeserializer.getInstance().writeObject( |
| 99 | this.data, | |
| 100 | CONFIGURATION_DATA_FILE, | |
| 101 | CONFIGURATION_DATA_CONFIG_NAME); | |
| 102 | ||
| 103 | 0 | } |
| 104 | ||
| 105 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |