LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  October 2014

HPS-SVN October 2014

Subject:

r1359 - in /java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt: AbstractSvtConditionsConverter.java SvtConditionsConverter.java TestRunSvtConditionsConverter.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Thu, 30 Oct 2014 21:43:21 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (143 lines)

Author: [log in to unmask]
Date: Thu Oct 30 14:43:19 2014
New Revision: 1359

Log:
Update to use the getCollection method that was moved to the class DatabaseConditionsManager.

Modified:
    java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditionsConverter.java
    java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsConverter.java
    java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditionsConverter.java

Modified: java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditionsConverter.java
 =============================================================================
--- java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditionsConverter.java	(original)
+++ java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditionsConverter.java	Thu Oct 30 14:43:19 2014
@@ -2,8 +2,8 @@
 
 import org.lcsim.conditions.ConditionsConverter;
 import org.lcsim.conditions.ConditionsManager;
+
 import org.hps.conditions.DatabaseConditionsManager;
-import org.hps.conditions.TableMetaData;
 import org.hps.conditions.svt.SvtBadChannel.SvtBadChannelCollection;
 import org.hps.conditions.svt.SvtCalibration.SvtCalibrationCollection;
 import org.hps.conditions.svt.SvtGain.SvtGainCollection;
@@ -32,7 +32,7 @@
     	DatabaseConditionsManager dbConditionsManager = (DatabaseConditionsManager) manager;
     
     	// Get the SVT calibrations (baseline, noise) from the conditions database
-        SvtCalibrationCollection calibrations = this.getCollection(SvtCalibrationCollection.class, dbConditionsManager);
+        SvtCalibrationCollection calibrations = dbConditionsManager.getCollection(SvtCalibrationCollection.class);
         for (SvtCalibration calibration : calibrations.getObjects()) {
             AbstractSvtChannel channel = conditions.getChannelMap().findChannel(calibration.getChannelID());
             conditions.getChannelConstants(channel).setCalibration(calibration);
@@ -40,7 +40,7 @@
 
         // Get the Channel pulse fit parameters from the conditions database
         SvtShapeFitParametersCollection shapeFitParametersCollection 
-        	= this.getCollection(SvtShapeFitParametersCollection.class, dbConditionsManager);
+        	= dbConditionsManager.getCollection(SvtShapeFitParametersCollection.class);
         for (SvtShapeFitParameters shapeFitParameters : shapeFitParametersCollection.getObjects()) {
             AbstractSvtChannel channel = conditions.getChannelMap().findChannel(shapeFitParameters.getChannelID());
             conditions.getChannelConstants(channel).setShapeFitParameters(shapeFitParameters);
@@ -49,7 +49,7 @@
         // Get the bad channels from the conditions database.  If there aren't any bad channels, 
         // notify the user and move on.
         try { 
-        	SvtBadChannelCollection badChannels = this.getCollection(SvtBadChannelCollection.class, dbConditionsManager);
+        	SvtBadChannelCollection badChannels = dbConditionsManager.getCollection(SvtBadChannelCollection.class);
         	for (SvtBadChannel badChannel : badChannels.getObjects()) {
         		AbstractSvtChannel channel = conditions.getChannelMap().findChannel(badChannel.getChannelId());
         		conditions.getChannelConstants(channel).setBadChannel(true);
@@ -59,7 +59,7 @@
         }
 
         // Get the gains and offsets from the conditions database
-        SvtGainCollection channelGains = this.getCollection(SvtGainCollection.class, dbConditionsManager);
+        SvtGainCollection channelGains = dbConditionsManager.getCollection(SvtGainCollection.class);
         for (SvtGain channelGain : channelGains.getObjects()) {
             int channelId = channelGain.getChannelID();
             AbstractSvtChannel channel = conditions.getChannelMap().findChannel(channelId);
@@ -68,25 +68,4 @@
 
         return conditions;
 	}
-
-	/**
-	 * Get a given collection of the given type from the conditions database.
-	 * 
-	 * @param type Class type
-	 * @param dbConditionsManager The database conditions manager
-	 * @return A collection of objects of the given type from the conditions database
-	 */
-	protected <U> U getCollection(Class<U> type, DatabaseConditionsManager dbConditionsManager){
-		
-		// Get the table name from the database configuration
-		TableMetaData metaData = dbConditionsManager.findTableMetaData(type);
-		if(metaData == null) 
-			throw new RuntimeException("Table name data for condition of type " + type.getSimpleName() + " was not found.");
-		String tableName = metaData.getTableName();
-
-		// FIXME: This should be changed to catch a conditions record not found exception instead of 
-		// 		  a runtime exception.
-		U conditionsCollection = dbConditionsManager.getCachedConditions(type, tableName).getCachedData(); 
-		return conditionsCollection; 
-	}
 }

Modified: java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsConverter.java
 =============================================================================
--- java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsConverter.java	(original)
+++ java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsConverter.java	Thu Oct 30 14:43:19 2014
@@ -31,17 +31,17 @@
     	DatabaseConditionsManager dbConditionsManager = (DatabaseConditionsManager) manager;
 
     	// Get the channel map from the conditions database
-        SvtChannelCollection channels = this.getCollection(SvtChannelCollection.class, dbConditionsManager); 
+        SvtChannelCollection channels = dbConditionsManager.getCollection(SvtChannelCollection.class); 
 
         // Create the SVT conditions object to use to encapsulate SVT condition collections
         conditions.setChannelMap(channels);
        
     	// Get the DAQ map from the conditions database
-    	SvtDaqMappingCollection daqMap= this.getCollection(SvtDaqMappingCollection.class, dbConditionsManager);
+    	SvtDaqMappingCollection daqMap= dbConditionsManager.getCollection(SvtDaqMappingCollection.class);
         conditions.setDaqMap(daqMap);
         
         // Get the collection of T0 shifts from the conditions database
-        SvtT0ShiftCollection t0Shifts = this.getCollection(SvtT0ShiftCollection.class, dbConditionsManager);
+        SvtT0ShiftCollection t0Shifts = dbConditionsManager.getCollection(SvtT0ShiftCollection.class);
         conditions.setT0Shifts(t0Shifts);
         
         conditions = super.getData(manager, name);

Modified: java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditionsConverter.java
 =============================================================================
--- java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditionsConverter.java	(original)
+++ java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditionsConverter.java	Thu Oct 30 14:43:19 2014
@@ -25,19 +25,17 @@
         DatabaseConditionsManager dbConditionsManager = (DatabaseConditionsManager) manager;
        
     	// Get the channel map from the conditions database
-        TestRunSvtChannelCollection channels = this.getCollection(TestRunSvtChannelCollection.class, dbConditionsManager);
+        TestRunSvtChannelCollection channels = dbConditionsManager.getCollection(TestRunSvtChannelCollection.class);
 
-        //System.out.println("Test run channels: " + channels.toString());
-        
         // Create the SVT conditions object to use to encapsulate SVT condition collections
         conditions.setChannelMap(channels);
         
         // Get the DAQ map from the conditions database
-        TestRunSvtDaqMappingCollection daqMap = this.getCollection(TestRunSvtDaqMappingCollection.class, dbConditionsManager);
+        TestRunSvtDaqMappingCollection daqMap = dbConditionsManager.getCollection(TestRunSvtDaqMappingCollection.class);
         conditions.setDaqMap(daqMap);
         
         // Get the collection of T0 shifts from the conditions database
-        TestRunSvtT0ShiftCollection t0Shifts = this.getCollection(TestRunSvtT0ShiftCollection.class, dbConditionsManager);
+        TestRunSvtT0ShiftCollection t0Shifts = dbConditionsManager.getCollection(TestRunSvtT0ShiftCollection.class);
         conditions.setT0Shifts(t0Shifts);
 
         conditions = super.getData(manager, name);

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use