From 3d3670cdd4ee1aaf6d3e22fd7de7fb362c9eefba Mon Sep 17 00:00:00 2001 From: slaws Date: Sun, 24 Jan 2010 14:24:14 +0000 Subject: Copy into trunk from sandbox git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@902572 13f79535-47bb-0310-9956-ffa450edef68 --- .../clients/currency-converter-rmi/build.xml | 36 +++++++++++++ .../clients/currency-converter-rmi/pom.xml | 59 ++++++++++++++++++++++ .../currencyconverter/CurrencyConverter.java | 30 +++++++++++ .../java/scatours/CurrencyConverterRMIClient.java | 36 +++++++++++++ 4 files changed, 161 insertions(+) create mode 100644 sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/build.xml create mode 100644 sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/pom.xml create mode 100644 sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java create mode 100644 sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java (limited to 'sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi') diff --git a/sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/build.xml b/sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/build.xml new file mode 100644 index 0000000000..2d9d3bc9d9 --- /dev/null +++ b/sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/build.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/pom.xml new file mode 100644 index 0000000000..9b41782f82 --- /dev/null +++ b/sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + scatours + 1.0-SNAPSHOT + ../../pom.xml + 1.0-SNAPSHOT + scatours-client-currency-converter-rmi + Apache Tuscany SCA Tours Currency Converter RMI Client + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + true + ../lib/ + scatours.CurrencyConverterRMIClient + + + + + + + diff --git a/sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java b/sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java new file mode 100644 index 0000000000..e12a95c964 --- /dev/null +++ b/sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java @@ -0,0 +1,30 @@ +/* + * 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 com.tuscanyscatours.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/sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java b/sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java new file mode 100644 index 0000000000..32e4fccfce --- /dev/null +++ b/sca-java-1.x/trunk/tutorials/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java @@ -0,0 +1,36 @@ +/* + * 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; + +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; + +import com.tuscanyscatours.currencyconverter.CurrencyConverter; + +public class CurrencyConverterRMIClient { + + public static void main(String[] args) throws Exception { + Registry registry = LocateRegistry.getRegistry("localhost", 8099); + String name = "CurrencyConverterRMI"; + CurrencyConverter converter = (CurrencyConverter)registry.lookup(name); + + System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP")); + System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP"); + } +} -- cgit v1.2.3