use of org.javamoney.moneta.convert.internal.imf.IMFRateReadingHandler.RateIMFResult in project jsr354-ri by JavaMoney.
the class IMFHistoricRateProvider method loadFromRemote.
private void loadFromRemote(Map<IMFHistoricalType, InputStream> resources) {
try {
for (IMFHistoricalType type : resources.keySet()) {
RateIMFResult result = handler.read(resources.get(type));
combine(result.getSdrToCurrency(), this.sdrToCurrency);
combine(result.getCurrencyToSdr(), this.currencyToSdr);
}
} catch (Exception e) {
LOG.log(Level.SEVERE, "Error", e);
}
}
use of org.javamoney.moneta.convert.internal.imf.IMFRateReadingHandler.RateIMFResult in project jsr354-ri by JavaMoney.
the class IMFAbstractRateProvider method newDataLoaded.
@Override
public void newDataLoaded(String resourceId, InputStream is) {
try {
int oldSize = this.sdrToCurrency.size();
RateIMFResult result = handler.read(is);
this.sdrToCurrency = result.getSdrToCurrency();
this.currencyToSdr = result.getCurrencyToSdr();
int newSize = this.sdrToCurrency.size();
loadState = "Loaded " + resourceId + " exchange rates for days:" + (newSize - oldSize);
LOG.info(loadState);
loadLock.countDown();
} catch (Exception e) {
loadState = "Last Error during data load: " + e.getMessage();
throw new IllegalArgumentException("Failed to load IMF data provided.", e);
}
}
Aggregations