summaryrefslogtreecommitdiffstats
path: root/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-07-28 08:04:28 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-07-28 08:04:28 +0000
commitbc0919b6fea37a236748fd1f7a480b6aad3baf46 (patch)
tree3fc6e6c04df85de803f0f408479cdb83b4caa155 /sandbox/travelsample/currency-contribution/src/scatours/currencyconverter
parent33f529e64bdf8510fd6b560578ba2e0e55327250 (diff)
Rename and reorganize
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@680280 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/currency-contribution/src/scatours/currencyconverter')
-rw-r--r--sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverter.java33
-rw-r--r--sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverterImpl.java37
2 files changed, 70 insertions, 0 deletions
diff --git a/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverter.java b/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverter.java
new file mode 100644
index 0000000000..9b3851721f
--- /dev/null
+++ b/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverter.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.currencyconverter;
+
+/**
+ * The CurrencyConverter service interface
+ */
+public interface CurrencyConverter {
+
+ double getExchangeRate(String fromCurrencyCode,
+ String toCurrencyCode);
+
+ double convert(String fromCurrencyCode,
+ String toCurrencyCode,
+ double amount);
+
+}
diff --git a/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverterImpl.java b/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverterImpl.java
new file mode 100644
index 0000000000..06d1d23535
--- /dev/null
+++ b/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverterImpl.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.currencyconverter;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of the CurrencyConverter service
+ */
+@Service(interfaces={CurrencyConverter.class})
+public class CurrencyConverterImpl implements CurrencyConverter {
+
+ public double getExchangeRate(String fromCurrencyCode, String toCurrencyCode){
+ // regardless of which currencies are specified return the same value
+ return 1.98;
+ }
+
+ public double convert(String fromCurrencyCode, String toCurrencyCode, double amount){
+ return amount * getExchangeRate(fromCurrencyCode, toCurrencyCode);
+ }
+}