diff options
author | mcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-19 20:22:02 +0000 |
---|---|---|
committer | mcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-19 20:22:02 +0000 |
commit | 0e0aa3e9b9596964ce91058fe8c06dee7d95032e (patch) | |
tree | 9f41746d8ca121fc5de6042bc3202f45195437a6 /sandbox/travelsample/clients | |
parent | 1ae1a4992c9e2d7777a4c6c213217f47c620b056 (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')
4 files changed, 139 insertions, 0 deletions
diff --git a/sandbox/travelsample/clients/currency-converter-corba-client/pom.xml b/sandbox/travelsample/clients/currency-converter-corba-client/pom.xml new file mode 100644 index 0000000000..fba248ebc9 --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-corba-client/pom.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>currency-converter-corba-client</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter CORBA Client</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>idlj-maven-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <compiler>idlj</compiler>
+ <sources>
+ <source>
+ <includes>
+ <include>currency-converter.idl</include>
+ </includes>
+ <emitStubs>true</emitStubs>
+ <emitSkeletons>false</emitSkeletons>
+ </source>
+ </sources>
+ <sourceDirectory>${basedir}/src/main/resources</sourceDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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"); + } +} diff --git a/sandbox/travelsample/clients/currency-converter-corba-client/src/main/resources/currency-converter.idl b/sandbox/travelsample/clients/currency-converter-corba-client/src/main/resources/currency-converter.idl new file mode 100644 index 0000000000..b592e03b06 --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-corba-client/src/main/resources/currency-converter.idl @@ -0,0 +1,27 @@ +/* + * 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. + */ + + module scatours { + module currencyconverter { + interface CurrencyConverter { + double getExchangeRate(in string fromCurrencyCode, in string toCurrencyCode); + double convert(in string fromCurrencyCode, in string toCurrencyCode, in double amount); + }; + }; +};
\ No newline at end of file diff --git a/sandbox/travelsample/clients/pom.xml b/sandbox/travelsample/clients/pom.xml index 56ecd4aa42..da97615723 100644 --- a/sandbox/travelsample/clients/pom.xml +++ b/sandbox/travelsample/clients/pom.xml @@ -36,6 +36,7 @@ <activeByDefault>true</activeByDefault> </activation> <modules> + <module>currency-converter-corba-client</module> <module>currency-converter-rmi-client</module> <module>currency-converter-ws-jaxws-client</module> </modules> |