Print

Print


Commit in java/trunk/conditions/src/main/java/org/hps/conditions on MAIN
TestRunConditionsReader.java+13-29323 -> 324
Revert TestRunConditionsReader to not support database conditions.  Database support is provided by the new DatabaseConditionsManager class instead.

java/trunk/conditions/src/main/java/org/hps/conditions
TestRunConditionsReader.java 323 -> 324
--- java/trunk/conditions/src/main/java/org/hps/conditions/TestRunConditionsReader.java	2014-03-20 17:38:04 UTC (rev 323)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/TestRunConditionsReader.java	2014-03-20 20:31:40 UTC (rev 324)
@@ -2,45 +2,40 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+
 import org.lcsim.conditions.ConditionsManager;
 import org.lcsim.conditions.ConditionsReader;
 
-import org.hps.conditions.DatabaseConditionsReader;
-
 /**
- *
+ * This is a simple extension of [log in to unmask] to find
+ * text file conditions data for the HPS Test Run 2012.  It basically just checks
+ * two resource locations for files and fails if they do not exist.
+ * 
  * @author Sho Uemura <[log in to unmask]>
  * @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 DatabaseConditionsReader {
+public class TestRunConditionsReader extends ConditionsReader {
 
     private String detectorName = null;
-    //private int run;
 
-    public TestRunConditionsReader(ConditionsReader reader) {        
-        super(reader);
-        System.out.println("TestRunConditionsReader - " + reader.getClass().getSimpleName());
+    public TestRunConditionsReader(ConditionsReader reader) {       
     }
 
     public InputStream open(String name, String type) throws IOException {
         
-        System.out.println(this.getClass().getSimpleName() + ".open - " + name);
+        //System.out.println(this.getClass().getSimpleName() + ".open - " + name + ", " + type);
         
         // 1) Check the detector base directory.
         InputStream in = getClass().getResourceAsStream("/" + detectorName + "/" + name + "." + type);
         if (in == null) {
-            // 2) Check for embedded jar resources.
+            // 2) Check for embedded jar resources e.g. in hps-java.
             in = getClass().getResourceAsStream("/org/lcsim/hps/calib/testrun/" + name + "." + type);
+
+            // If these failed to find conditions, then something went wrong.
             if (in == null) {
-                // 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");
-                }       
-            }
+                throw new IOException("Conditions " + name + " for " + detectorName + " with type " + type + " were not found");
+            }       
         }
         return in;
     }
@@ -49,18 +44,7 @@
     }
 
     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;
-        super.update(manager, detectorName, run);
-//        System.out.println(detectorName+run);
         return true;
     }
-//        private void loadCalibsByRun(int run) {
-//        HPSSVTCalibrationConstants.loadCalibration(run);
-//        FieldMap.loadFieldMap(run);
-//    }
 }
SVNspam 0.1