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);
|