Changeset 2326
- Timestamp:
- Apr 7, 2014, 4:31:23 PM (9 years ago)
- Location:
- extensions/net.sf.basedb.labenv/trunk/src/net/sf/basedb/labenv
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.labenv/trunk/src/net/sf/basedb/labenv/LabEnvironment.java
r2321 r2326 29 29 30 30 protected LabEnvironment() 31 throws Exception32 31 { 33 32 // Exists only to defeat instantiation … … 43 42 44 43 public static LabEnvironment getInstance() 45 throws Exception46 44 { 47 45 if (instance == null) … … 57 55 { 58 56 return this.labEnvironmentConfiguration; 57 } 58 59 public void reloadLabEnvironmentConfiguration() 60 { 61 this.labEnvironmentConfiguration = new LabEnvironmentConfiguration(); 59 62 } 60 63 -
extensions/net.sf.basedb.labenv/trunk/src/net/sf/basedb/labenv/LabEnvironmentConfiguration.java
r2321 r2326 134 134 135 135 public LabEnvironmentConfiguration() 136 throws Exception137 136 { 138 137 // Get configuration from configuration file … … 146 145 @SuppressWarnings("unchecked") 147 146 private void fetchConfiguration() 148 throws Exception149 147 { 150 148 //String logPrefix = "LabEnvironmentConfiguration:: fetchConfiguration(): "; … … 303 301 log.debug("Exception thrown when accessing configuration file labenv-config.xml: " + e); 304 302 //System.out.println(logPrefix + "Exception thrown when accessing configuration file " + confFilePath + ": " + e); 305 throw e;303 throw new RuntimeException("Exception thrown when accessing configuration file labenv-config.xml: " + e.getMessage()); 306 304 } 307 305 } -
extensions/net.sf.basedb.labenv/trunk/src/net/sf/basedb/labenv/service/LabEnvService.java
r2313 r2326 117 117 this.labEnvironment = LabEnvironment.getInstance(); 118 118 } 119 // Force reloading configuration file when service is started again 120 labEnvironment.reloadLabEnvironmentConfiguration(); 119 121 // Set timer interval from configuration 120 122 long measurementIntervalInSeconds = getLabEnvironment().getLabEnvironmentConfiguration().getMeasurementIntervalInSeconds(); … … 142 144 catch (Exception e) 143 145 { 144 System.out.println(new Date() + " Exception thrown when trying to start service LabEnv: " + e); 146 //System.out.println(new Date() + " Exception thrown when trying to start service LabEnv: " + e); 147 throw new RuntimeException(e.getMessage()); 145 148 } 146 149 } … … 162 165 } 163 166 running = false; 167 System.out.println(new Date() + " Service LabEnv stopped. running = " + running); 164 168 } 165 169 // --------------------------------------------- -
extensions/net.sf.basedb.labenv/trunk/src/net/sf/basedb/labenv/servlet/LabEnvironmentServlet.java
r2321 r2326 354 354 //System.out.println("\n" + logPrefix + "Start " + new Date()); 355 355 // Get lab environment configuration from singleton LabEnvironment 356 LabEnvironment labEnvironment; 357 try 358 { 359 labEnvironment = LabEnvironment.getInstance(); 360 } 361 catch (Exception e) 362 { 363 throw new ServletException("Exception thrown when trying to get LabEnvironment instance: " + e); 364 } 356 LabEnvironment labEnvironment = LabEnvironment.getInstance(); 365 357 LabEnvironmentConfiguration labEnvironmentConfiguration = labEnvironment.getLabEnvironmentConfiguration(); 366 358 List<LabSensorConfig> labSensorConfigList = labEnvironmentConfiguration.getLabSensorConfigList(); -
extensions/net.sf.basedb.labenv/trunk/src/net/sf/basedb/labenv/servlet/LabEnvironmentStatisticsServlet.java
r2321 r2326 276 276 List<String> viewTypeList = new ArrayList<String>(); 277 277 // Get lab environment configuration from singleton LabEnvironment 278 LabEnvironment labEnvironment; 279 try 280 { 281 labEnvironment = LabEnvironment.getInstance(); 282 } 283 catch (Exception e) 284 { 285 throw new ServletException("Exception thrown when trying to get LabEnvironment instance: " + e); 286 } 278 LabEnvironment labEnvironment = LabEnvironment.getInstance(); 287 279 LabEnvironmentConfiguration labEnvironmentConfiguration = labEnvironment.getLabEnvironmentConfiguration(); 288 280 List<LabSensorConfig> labSensorConfigList = labEnvironmentConfiguration.getLabSensorConfigList(); … … 949 941 // Set report start date to earliest configured sensor start date 950 942 // Get lab environment configuration from singleton LabEnvironment 951 LabEnvironment labEnvironment; 952 try 953 { 954 labEnvironment = LabEnvironment.getInstance(); 955 } 956 catch (Exception e) 957 { 958 throw new ServletException("Exception thrown when trying to get LabEnvironment instance: " + e); 959 } 943 LabEnvironment labEnvironment = LabEnvironment.getInstance(); 960 944 LabEnvironmentConfiguration labEnvironmentConfiguration = labEnvironment.getLabEnvironmentConfiguration(); 961 945 List<LabSensorConfig> labSensorConfigList = labEnvironmentConfiguration.getLabSensorConfigList(); -
extensions/net.sf.basedb.labenv/trunk/src/net/sf/basedb/labenv/util/LabEnvironmentStorageUtil.java
r2321 r2326 34 34 import java.util.Date; 35 35 import java.util.List; 36 import javax.servlet.ServletException;37 36 38 37 import org.apache.log4j.Logger; … … 63 62 //String logPrefix = "LabEnvironmentStorageUtil:: LabEnvironmentStorageUtil(): "; 64 63 // Get lab environment configuration 65 LabEnvironment labEnvironment = null; 66 try 67 { 68 labEnvironment = LabEnvironment.getInstance(); 69 } 70 catch (Exception e) 71 { 72 System.out.println(new Date() + " LabEnvironmentStorageUtil(): Exception thrown when trying to get LabEnvironment instance: " + e); 73 } 64 LabEnvironment labEnvironment = LabEnvironment.getInstance(); 74 65 LabEnvironmentConfiguration labEnvironmentConfiguration = labEnvironment.getLabEnvironmentConfiguration(); 75 66 String dbFileNameConf = labEnvironmentConfiguration.getDbFileName(); … … 287 278 } 288 279 // Get lab environment configuration from singleton LabEnvironment 289 LabEnvironment labEnvironment = null; 290 try 291 { 292 labEnvironment = LabEnvironment.getInstance(); 293 } 294 catch (Exception e) 295 { 296 System.out.println(new Date() + " LabEnvironmentStorageUtil(): Exception thrown when trying to get LabEnvironment instance: " + e); 297 } 280 LabEnvironment labEnvironment = LabEnvironment.getInstance(); 298 281 LabEnvironmentConfiguration labEnvironmentConfiguration = labEnvironment.getLabEnvironmentConfiguration(); 299 282 List<LabEnvironmentData> labEnvironmentDataList = new ArrayList<LabEnvironmentData>();
Note: See TracChangeset
for help on using the changeset viewer.