diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-05 18:05:09 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-05 18:05:09 +0000 |
commit | 3bfb5f6063848a808c71ccea9ba5754ea02ace66 (patch) | |
tree | 275f57b960b3109409972922b4aa2739cacae46e /sandbox/lresende/sca/samples/store-appengine-webapp/src/services/CurrencyConverterImpl.java | |
parent | 005cfd420ee44dc167639530ef567d99b4e1d962 (diff) |
Tuscany store scenario running on appengine - Dojo based UI front-end consuming a remote catalog service using JSON-RPC reference binding
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@821945 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sandbox/lresende/sca/samples/store-appengine-webapp/src/services/CurrencyConverterImpl.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sandbox/lresende/sca/samples/store-appengine-webapp/src/services/CurrencyConverterImpl.java b/sandbox/lresende/sca/samples/store-appengine-webapp/src/services/CurrencyConverterImpl.java new file mode 100644 index 0000000000..7de3894e2e --- /dev/null +++ b/sandbox/lresende/sca/samples/store-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 "?"; + } +} |