@Override
 public CurveConstructionConfiguration getCurveConstructionConfiguration(
     final String name, final VersionCorrection versionCorrection) {
   ArgumentChecker.notNull(name, "name");
   ArgumentChecker.notNull(versionCorrection, "version correction");
   return _query.get(name, versionCorrection);
 }
 @Override
 public CompiledFunctionDefinition compile(
     final FunctionCompilationContext context, final Instant atInstant) {
   final MultiCurveCalculationConfig impliedConfiguration =
       _multiCurveCalculationConfig.get(_curveCalculationConfig);
   if (impliedConfiguration == null) {
     throw new OpenGammaRuntimeException(
         "Multi-curve calculation called " + _curveCalculationConfig + " was null");
   }
   ComputationTarget target =
       context.getComputationTargetResolver().resolve(impliedConfiguration.getTarget());
   if (!(target.getValue() instanceof Currency)) {
     throw new OpenGammaRuntimeException(
         "Target of curve calculation configuration was not a currency");
   }
   final Currency impliedCurrency = (Currency) target.getValue();
   if (!IMPLIED_DEPOSIT.equals(impliedConfiguration.getCalculationMethod())) {
     throw new OpenGammaRuntimeException(
         "Curve calculation method was not "
             + IMPLIED_DEPOSIT
             + " for configuration called "
             + _curveCalculationConfig);
   }
   final String[] impliedCurveNames = impliedConfiguration.getYieldCurveNames();
   if (impliedCurveNames.length != 1) {
     throw new OpenGammaRuntimeException(
         "Can only handle configurations with a single implied curve");
   }
   final LinkedHashMap<String, String[]> originalConfigurationName =
       impliedConfiguration.getExogenousConfigData();
   if (originalConfigurationName == null || originalConfigurationName.size() != 1) {
     throw new OpenGammaRuntimeException("Need a configuration with one exogenous configuration");
   }
   final Map.Entry<String, String[]> entry =
       Iterables.getOnlyElement(originalConfigurationName.entrySet());
   final String[] originalCurveNames = entry.getValue();
   if (originalCurveNames.length != 1) {
     s_logger.warn("Found more than one exogenous configuration name; using only the first");
   }
   final MultiCurveCalculationConfig originalConfiguration =
       _multiCurveCalculationConfig.get(entry.getKey());
   if (originalConfiguration == null) {
     throw new OpenGammaRuntimeException(
         "Multi-curve calculation called " + entry.getKey() + " was null");
   }
   target = context.getComputationTargetResolver().resolve(originalConfiguration.getTarget());
   if (!(target.getValue() instanceof Currency)) {
     throw new OpenGammaRuntimeException(
         "Target of curve calculation configuration was not a currency");
   }
   final Currency originalCurrency = (Currency) target.getValue();
   if (!originalCurrency.equals(impliedCurrency)) {
     throw new OpenGammaRuntimeException(
         "Currency targets for configurations "
             + _curveCalculationConfig
             + " and "
             + entry.getKey()
             + " did not match");
   }
   final YieldCurveDefinition impliedDefinition =
       _yieldCurveDefinition.get(impliedCurveNames[0] + "_" + impliedCurrency.getCode());
   if (impliedDefinition == null) {
     throw new OpenGammaRuntimeException(
         "Could not get implied definition called "
             + impliedCurveNames[0]
             + "_"
             + impliedCurrency.getCode());
   }
   final Set<FixedIncomeStrip> strips = impliedDefinition.getStrips();
   for (final FixedIncomeStrip strip : strips) {
     if (strip.getInstrumentType() != StripInstrumentType.CASH) {
       throw new OpenGammaRuntimeException(
           "Can only handle yield curve definitions with CASH strips");
     }
   }
   final ZonedDateTime atZDT = ZonedDateTime.ofInstant(atInstant, ZoneOffset.UTC);
   return new MyCompiledFunction(
       atZDT.with(LocalTime.MIDNIGHT),
       atZDT.plusDays(1).with(LocalTime.MIDNIGHT).minusNanos(1000000),
       impliedConfiguration,
       impliedDefinition,
       originalConfiguration,
       originalCurveNames[0]);
 };
 @Override
 public void init(final FunctionCompilationContext context) {
   _multiCurveCalculationConfig =
       ConfigSourceQuery.init(context, this, MultiCurveCalculationConfig.class);
   _yieldCurveDefinition = ConfigSourceQuery.init(context, this, YieldCurveDefinition.class);
 }
 @Override
 public CurveConstructionConfiguration getCurveConstructionConfiguration(final String name) {
   ArgumentChecker.notNull(name, "name");
   return _query.get(name);
 }
 public static ConfigDBCurveConstructionConfigurationSource init(
     final FunctionCompilationContext context, final FunctionDefinition function) {
   return new ConfigDBCurveConstructionConfigurationSource(
       ConfigSourceQuery.init(context, function, CurveConstructionConfiguration.class));
 }