EMMA Coverage Report (generated Tue May 01 18:46:53 CEST 2007)
[all classes][dk.deepthought.sidious.supportsystem]

COVERAGE SUMMARY FOR SOURCE FILE [SystemSettings.java]

nameclass, %method, %block, %line, %
SystemSettings.java100% (1/1)96%  (23/24)87%  (151/174)90%  (47/52)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SystemSettings100% (1/1)96%  (23/24)87%  (151/174)90%  (47/52)
SystemSettings (): void 0%   (0/1)0%   (0/3)0%   (0/1)
readProperties (): Properties 100% (1/1)49%  (19/39)64%  (7/11)
<static initializer> 100% (1/1)100% (62/62)100% (11/11)
getCO2ID (): SuperLinkID 100% (1/1)100% (2/2)100% (1/1)
getCO2SetPointID (): SuperLinkID 100% (1/1)100% (7/7)100% (1/1)
getHeaterSetPointID (): SuperLinkID 100% (1/1)100% (7/7)100% (1/1)
getHumidityID (): SuperLinkID 100% (1/1)100% (2/2)100% (1/1)
getIrradianceID (): SuperLinkID 100% (1/1)100% (2/2)100% (1/1)
getOutsideHumidityID (): SuperLinkID 100% (1/1)100% (2/2)100% (1/1)
getOutsideTemperatureID (): SuperLinkID 100% (1/1)100% (2/2)100% (1/1)
getScreenSetPointID (): SuperLinkID 100% (1/1)100% (7/7)100% (1/1)
getTemperatureID (): SuperLinkID 100% (1/1)100% (2/2)100% (1/1)
getTimeID (): SuperLinkID 100% (1/1)100% (2/2)100% (1/1)
getTimestep (): int 100% (1/1)100% (2/2)100% (1/1)
getWindowSetPointID (): SuperLinkID 100% (1/1)100% (7/7)100% (1/1)
isTestMode (): boolean 100% (1/1)100% (2/2)100% (1/1)
setCO2ID (SuperLinkID): void 100% (1/1)100% (3/3)100% (2/2)
setHumidityID (SuperLinkID): void 100% (1/1)100% (3/3)100% (2/2)
setIrradianceID (SuperLinkID): void 100% (1/1)100% (3/3)100% (2/2)
setOutsideHumidityID (SuperLinkID): void 100% (1/1)100% (3/3)100% (2/2)
setOutsideTemperatureID (SuperLinkID): void 100% (1/1)100% (3/3)100% (2/2)
setTemperatureID (SuperLinkID): void 100% (1/1)100% (3/3)100% (2/2)
setTestMode (boolean): void 100% (1/1)100% (3/3)100% (2/2)
setTimeID (SuperLinkID): void 100% (1/1)100% (3/3)100% (2/2)

1package dk.deepthought.sidious.supportsystem;
2 
3import java.io.FileInputStream;
4import java.io.IOException;
5import java.util.Properties;
6 
7import org.apache.commons.logging.Log;
8import org.apache.commons.logging.LogFactory;
9 
10/**
11 * This class represent systemwide constants. All constants can supposably be
12 * collected from a properties file.
13 * <p>
14 * This implementation facilitates the replacement of specific sensor id's for
15 * testing purposes.
16 * 
17 * @author Deepthought
18 * 
19 */
20public final class SystemSettings {
21 
22        private static final Properties properties = readProperties();
23        
24        /**
25         * Logger for this class
26         */
27        private static final Log logger = LogFactory.getLog(SystemSettings.class);
28        
29        /**
30         * The <code>SuperLinkID</code> of the CO2 sensor
31         */
32        private static SuperLinkID co2ID = new SuperLinkID(properties.getProperty("co2"));
33 
34        /**
35         * The <code>SuperLinkID</code> of the humidity sensor
36         */
37        private static SuperLinkID humidityID = new SuperLinkID(properties.getProperty("humidity"));
38 
39        /**
40         * The <code>SuperLinkID</code> of the light irradiance sensor
41         */
42        private static SuperLinkID irradianceID = new SuperLinkID(properties.getProperty("irradiance"));
43 
44        /**
45         * The <code>SuperLinkID</code> of the outside humidity sensor
46         */
47        private static SuperLinkID outsideHumidityID = new SuperLinkID(properties.getProperty("outsidehumidity"));
48 
49        /**
50         * The <code>SuperLinkID</code> of the outside temperature sensor
51         */
52        private static SuperLinkID outsideTemperatureID = new SuperLinkID(
53                        properties.getProperty("outsidetemperature"));
54 
55        /**
56         * The <code>SuperLinkID</code> of the temperature sensor
57         */
58        private static SuperLinkID temperatureID = new SuperLinkID(properties.getProperty("temperature"));
59 
60        /**
61         * The <code>SuperLinkID</code> of the time sensor
62         */
63        private static SuperLinkID timeID = new SuperLinkID(properties.getProperty("time"));
64 
65        /**
66         * The systemwide timestep in minutes
67         */
68        private static int TIMESTEP = Integer.parseInt(properties.getProperty("TIMESTEP"));
69 
70        /**
71         * Used when system is set to debug mode
72         */
73        private static boolean testMode = false;
74 
75        /**
76         * Returns the <code>SuperLinkID</code> of the CO2 sensor.
77         * 
78         * @return id of the CO2 sensor
79         */
80        public static SuperLinkID getCO2ID() {
81                return co2ID;
82        }
83 
84        /**
85         * Returns the id of the CO2 setpoint.
86         * 
87         * @return the CO2 setpoint id
88         */
89        public static SuperLinkID getCO2SetPointID() {
90                return new SuperLinkID(properties.getProperty("co2_setpoint"));
91        }
92 
93        /**
94         * Returns the id of the heater setpoint.
95         * 
96         * @return the heater setpoint id
97         */
98        public static SuperLinkID getHeaterSetPointID() {
99                return new SuperLinkID(properties.getProperty("heater_setpoint")); 
100        }
101 
102        /**
103         * Returns the <code>SuperLinkID</code> of the humidity sensor.
104         * 
105         * @return id of the humidity sensor
106         */
107        public static SuperLinkID getHumidityID() {
108                return humidityID;
109        }
110 
111        /**
112         * Returns the <code>SuperLinkID</code> of the light irradiance sensor.
113         * 
114         * @return id of the outside irradiance sensor
115         */
116        public static SuperLinkID getIrradianceID() {
117                return irradianceID;
118        }
119 
120        /**
121         * Returns the <code>SuperLinkID</code> of the outside humidity sensor.
122         * 
123         * @return id of the outside humidity sensor
124         */
125        public static SuperLinkID getOutsideHumidityID() {
126                return outsideHumidityID;
127        }
128 
129        /**
130         * Returns the <code>SuperLinkID</code> of the outside temperature sensor.
131         * 
132         * @return id of the outside temperature sensor
133         */
134        public static SuperLinkID getOutsideTemperatureID() {
135                return outsideTemperatureID;
136        }
137 
138        /**
139         * Returns the id of the screen setpoint.
140         * 
141         * @return the screen setpoint id
142         */
143        public static SuperLinkID getScreenSetPointID() {
144                return new SuperLinkID(properties.getProperty("screen_setpoint")); 
145        }
146 
147        /**
148         * Returns the <code>SuperLinkID</code> of the temperature sensor.
149         * 
150         * @return id of the temperature sensor
151         */
152        public static SuperLinkID getTemperatureID() {
153                return temperatureID;
154        }
155 
156        /**
157         * @return the timeID
158         */
159        public static SuperLinkID getTimeID() {
160                return timeID;
161        }
162 
163        /**
164         * Returns the systemwide time step.
165         * 
166         * @return the timestep
167         */
168        public static int getTimestep() {
169                return TIMESTEP;
170        }
171 
172        /**
173         * Returns the id of the window setpoint.
174         * 
175         * @return the window setpoint id
176         */
177        public static SuperLinkID getWindowSetPointID() {
178                return new SuperLinkID(properties.getProperty("window_setpoint"));
179        }
180 
181        /**
182         * @param co2ID
183         *            the co2ID to set
184         */
185        public static void setCO2ID(SuperLinkID co2ID) {
186                SystemSettings.co2ID = co2ID;
187        }
188 
189        /**
190         * @param humidityID
191         *            the humidityID to set
192         */
193        public static void setHumidityID(SuperLinkID humidityID) {
194                SystemSettings.humidityID = humidityID;
195        }
196 
197        /**
198         * @param irradianceID
199         *            the irradianceID to set
200         */
201        public static void setIrradianceID(SuperLinkID irradianceID) {
202                SystemSettings.irradianceID = irradianceID;
203        }
204 
205        /**
206         * @param outsideHumidityID
207         *            the outsideHumidityID to set
208         */
209        public static void setOutsideHumidityID(SuperLinkID outsideHumidityID) {
210                SystemSettings.outsideHumidityID = outsideHumidityID;
211        }
212 
213        /**
214         * @param outsideTemperatureID
215         *            the outsideTemperatureID to set
216         */
217        public static void setOutsideTemperatureID(SuperLinkID outsideTemperatureID) {
218                SystemSettings.outsideTemperatureID = outsideTemperatureID;
219        }
220 
221        /**
222         * @param temperatureID
223         *            the temperatureID to set
224         */
225        public static void setTemperatureID(SuperLinkID temperatureID) {
226                SystemSettings.temperatureID = temperatureID;
227        }
228 
229        /**
230         * @param timeID
231         *            the timeID to set
232         */
233        public static void setTimeID(SuperLinkID timeID) {
234                SystemSettings.timeID = timeID;
235        }
236 
237        /**
238         * Tells whether or not the system is in testMode.
239         * @return <code>true</code> if system is in test mode.
240         */
241        public static boolean isTestMode() {
242                return testMode;
243        }
244 
245        /**
246         * Sets whether or not test mode is enabled.
247         * @param testMode true to enable test mode
248         */
249        public static void setTestMode(boolean testMode) {
250                SystemSettings.testMode = testMode;
251        }
252 
253        
254        /**
255         * Method returns the <code>Properties</code> object of this.
256         * 
257         * @return the properties of this
258         */
259        private static Properties readProperties() {
260                String propertiesFileName = "system.properties";
261                Properties properties = new Properties();
262                try {
263                        FileInputStream in = new FileInputStream(propertiesFileName);
264                        properties.load(in);
265                        in.close();
266                } catch (IOException e) {
267                        logger.error("readProperties(String prefixName=" + propertiesFileName
268                                        + ") - IOException, properties not read", e);
269                        if (logger.isDebugEnabled()) {
270                                logger.debug("Empty properties returned");
271                        }
272                }
273                return properties;
274        }
275 
276}

[all classes][dk.deepthought.sidious.supportsystem]
EMMA 2.0.5312 (C) Vladimir Roubtsov