Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/conditions on MAIN
TestRunConditionsReader.java+18-91.3 -> 1.4
Make this class extend DatabaseConditionsReader so that database and text file conditions are both available.  This change was tested by running the trigger simulation and the database reader test cases.

hps-java/src/main/java/org/lcsim/hps/conditions
TestRunConditionsReader.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- TestRunConditionsReader.java	20 Nov 2012 19:56:40 -0000	1.3
+++ TestRunConditionsReader.java	17 Oct 2013 23:04:19 -0000	1.4
@@ -8,40 +8,49 @@
 /**
  *
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: TestRunConditionsReader.java,v 1.3 2012/11/20 19:56:40 meeg Exp $
+ * @author Jeremy McCormick <[log in to unmask]>
+ * @version $Id: TestRunConditionsReader.java,v 1.4 2013/10/17 23:04:19 jeremy Exp $
  */
-public class TestRunConditionsReader extends ConditionsReader {
+public class TestRunConditionsReader extends DatabaseConditionsReader {
 
     private String detectorName = null;
-    private int run;
+    //private int run;
 
     public TestRunConditionsReader(ConditionsReader reader) {
+        super(reader);
     }
 
-    @Override
     public InputStream open(String name, String type) throws IOException {
+        // 1) Check the detector base directory.
         InputStream in = getClass().getResourceAsStream("/" + detectorName + "/" + name + "." + type);
         if (in == null) {
+            // 2) Check for embedded jar resources.
             in = getClass().getResourceAsStream("/org/lcsim/hps/calib/testrun/" + name + "." + type);
             if (in == null) {
-                throw new IOException("Conditions " + name + " for " + detectorName + " with type " + type + " were not found");
+                // 3) Use super's open method.
+                in = super.open(name, type);
+                
+                // If all of these failed to find conditions, then something went wrong.
+                if (in == null) {
+                    throw new IOException("Conditions " + name + " for " + detectorName + " with type " + type + " were not found");
+                }       
             }
         }
         return in;
     }
 
-    @Override
     public void close() throws IOException {
     }
 
-    @Override
-    protected boolean update(ConditionsManager manager, String detectorName, int run) throws IOException {
+
+    public boolean update(ConditionsManager manager, String detectorName, int run) throws IOException {
 //            loadCalibsByRun(run);
 //        Detector detector = manager.getCachedConditions(Detector.class,"compact.xml").getCachedData();
 //        HPSEcalConditions.detectorChanged(detector, "Ecal");
 //        HPSSVTCalibrationConstants.loadCalibration(run);
         this.detectorName = detectorName;
-        this.run = run;
+        //this.run = run;
+        super.update(manager, detectorName, run);
 //        System.out.println(detectorName+run);
         return true;
     }
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1