Package org.apache.solr.schema
Class FileExchangeRateProvider
- java.lang.Object
- 
- org.apache.solr.schema.FileExchangeRateProvider
 
- 
- All Implemented Interfaces:
- ExchangeRateProvider
 
 public class FileExchangeRateProvider extends Object implements ExchangeRateProvider Configuration for currency. Provides currency exchange rates.
- 
- 
Field SummaryFields Modifier and Type Field Description protected static StringPARAM_CURRENCY_CONFIG
 - 
Constructor SummaryConstructors Constructor Description FileExchangeRateProvider()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)doublegetExchangeRate(String sourceCurrencyCode, String targetCurrencyCode)Returns the currently known exchange rate between two currencies.inthashCode()voidinform(org.apache.lucene.util.ResourceLoader loader)Passes a ResourceLoader, used to read config files from e.g.voidinit(Map<String,String> params)Initializes the provider by passing in a set of key/value configs as a map.Set<String>listAvailableCurrencies()List all configured currency codes which are valid as source/target for this Providerbooleanreload()Ask the currency provider to explicitly reload/refresh its configuration.StringtoString()
 
- 
- 
- 
Field Detail- 
PARAM_CURRENCY_CONFIGprotected static final String PARAM_CURRENCY_CONFIG - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getExchangeRatepublic double getExchangeRate(String sourceCurrencyCode, String targetCurrencyCode) Returns the currently known exchange rate between two currencies. If a direct rate has been loaded, it is used. Otherwise, if a rate is known to convert the target currency to the source, the inverse exchange rate is computed.- Specified by:
- getExchangeRatein interface- ExchangeRateProvider
- Parameters:
- sourceCurrencyCode- The source currency being converted from.
- targetCurrencyCode- The target currency being converted to.
- Returns:
- The exchange rate.
- Throws:
- org.apache.solr.common.SolrException- if the requested currency pair cannot be found
 
 - 
listAvailableCurrenciespublic Set<String> listAvailableCurrencies() Description copied from interface:ExchangeRateProviderList all configured currency codes which are valid as source/target for this Provider- Specified by:
- listAvailableCurrenciesin interface- ExchangeRateProvider
- Returns:
- a Set of ISO 4217 currency code strings
 
 - 
reloadpublic boolean reload() throws org.apache.solr.common.SolrExceptionDescription copied from interface:ExchangeRateProviderAsk the currency provider to explicitly reload/refresh its configuration. If this does not make sense for a particular provider, simply do nothing- Specified by:
- reloadin interface- ExchangeRateProvider
- Returns:
- true if reload of rates succeeded, else false
- Throws:
- org.apache.solr.common.SolrException- if there is a problem reloading
 
 - 
initpublic void init(Map<String,String> params) throws org.apache.solr.common.SolrException Description copied from interface:ExchangeRateProviderInitializes the provider by passing in a set of key/value configs as a map. Note that the map also contains other fieldType parameters, so make sure to avoid name clashes.Important: Custom config params must be removed from the map before returning - Specified by:
- initin interface- ExchangeRateProvider
- Parameters:
- params- a @Map of key/value config params to initialize the provider
- Throws:
- org.apache.solr.common.SolrException
 
 - 
informpublic void inform(org.apache.lucene.util.ResourceLoader loader) throws org.apache.solr.common.SolrExceptionDescription copied from interface:ExchangeRateProviderPasses a ResourceLoader, used to read config files from e.g. ZooKeeper. Implementations not needing resource loader can implement this as NOOP.Typically called after init - Specified by:
- informin interface- ExchangeRateProvider
- Parameters:
- loader- a @ResourceLoader instance
- Throws:
- org.apache.solr.common.SolrException
 
 
- 
 
-