summaryrefslogtreecommitdiffstats
path: root/sandbox/travelsample/clients/currency-converter-corba-client/src/main/java/scatours/CurrencyConverterCORBAClient.java
diff options
context:
space:
mode:
authormcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2009-05-19 20:22:02 +0000
committermcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2009-05-19 20:22:02 +0000
commit0e0aa3e9b9596964ce91058fe8c06dee7d95032e (patch)
tree9f41746d8ca121fc5de6042bc3202f45195437a6 /sandbox/travelsample/clients/currency-converter-corba-client/src/main/java/scatours/CurrencyConverterCORBAClient.java
parent1ae1a4992c9e2d7777a4c6c213217f47c620b056 (diff)
Initial commit of currency converter CORBA client that will access the CORBA interface exposed by the currency converter CORBA service
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@776443 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/clients/currency-converter-corba-client/src/main/java/scatours/CurrencyConverterCORBAClient.java')
-rw-r--r--sandbox/travelsample/clients/currency-converter-corba-client/src/main/java/scatours/CurrencyConverterCORBAClient.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/sandbox/travelsample/clients/currency-converter-corba-client/src/main/java/scatours/CurrencyConverterCORBAClient.java b/sandbox/travelsample/clients/currency-converter-corba-client/src/main/java/scatours/CurrencyConverterCORBAClient.java
new file mode 100644
index 0000000000..f6651aa6cd
--- /dev/null
+++ b/sandbox/travelsample/clients/currency-converter-corba-client/src/main/java/scatours/CurrencyConverterCORBAClient.java
@@ -0,0 +1,40 @@
+/*
+ * 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 org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+
+import scatours.currencyconverter.CurrencyConverter;
+import scatours.currencyconverter.CurrencyConverterHelper;
+
+public class CurrencyConverterCORBAClient {
+
+ public static void main(String[] args) throws Exception {
+
+ String[] orbArgs = {"-ORBInitialPort", "5080"};
+ ORB orb = ORB.init( orbArgs, null );
+
+ Object obj = orb.string_to_object("corbaname::localhost:5080#CurrencyConverterCORBAService");
+ CurrencyConverter converter = CurrencyConverterHelper.narrow(obj);
+
+ System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
+ System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP");
+ }
+}