diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-05 18:00:22 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-05 18:00:22 +0000 |
commit | 19f44a0ad09b20360714b68ec4f7376a58ee3fb6 (patch) | |
tree | 7cda0777791c2ba67dd4ac27568b049b4ac1430d /sandbox/lresende/sca/samples/store-catalog-appengine-webapp/src/services/CurrencyConverterImpl.java | |
parent | 75aadf4005983cd6e764b46de6595d56d01a6145 (diff) |
Tuscany store scenario running on appengine - Catalog service exposed as JSON-RPC binding
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@821943 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sandbox/lresende/sca/samples/store-catalog-appengine-webapp/src/services/CurrencyConverterImpl.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sandbox/lresende/sca/samples/store-catalog-appengine-webapp/src/services/CurrencyConverterImpl.java b/sandbox/lresende/sca/samples/store-catalog-appengine-webapp/src/services/CurrencyConverterImpl.java new file mode 100644 index 0000000000..7de3894e2e --- /dev/null +++ b/sandbox/lresende/sca/samples/store-catalog-appengine-webapp/src/services/CurrencyConverterImpl.java @@ -0,0 +1,24 @@ +package services; + +import org.oasisopen.sca.annotation.Service; + +@Service(CurrencyConverter.class) +public class CurrencyConverterImpl implements CurrencyConverter { + public double getConversion(String fromCurrencyCode, + String toCurrencyCode, + double amount) { + if (toCurrencyCode.equals("USD")) + return amount; + else if (toCurrencyCode.equals("EUR")) + return ((double)Math.round(amount * 0.7256 * 100)) /100; + return 0; + } + + public String getCurrencySymbol(String currencyCode) { + if (currencyCode.equals("USD")) + return "$"; + else if (currencyCode.equals("EUR")) + return "E"; //"€"; + return "?"; + } +} |