From 02f65ca4eee882a3217de613bf0f63c5460d884e Mon Sep 17 00:00:00 2001 From: nash Date: Wed, 16 Sep 2009 07:05:17 +0000 Subject: Rename client modules git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@815635 13f79535-47bb-0310-9956-ffa450edef68 --- .../currency-converter-corba-client/build.xml | 44 -------- .../currency-converter-corba-client/pom.xml | 71 ------------- .../scatours/CurrencyConverterCORBAClient.java | 41 -------- .../src/main/resources/currency-converter.idl | 29 ------ .../clients/currency-converter-corba/build.xml | 44 ++++++++ .../clients/currency-converter-corba/pom.xml | 71 +++++++++++++ .../scatours/CurrencyConverterCORBAClient.java | 41 ++++++++ .../src/main/resources/currency-converter.idl | 29 ++++++ .../currency-converter-jms-client/build.xml | 45 -------- .../clients/currency-converter-jms-client/pom.xml | 89 ---------------- .../java/scatours/CurrencyConverterJMSClient.java | 104 ------------------- .../clients/currency-converter-jms/build.xml | 45 ++++++++ .../clients/currency-converter-jms/pom.xml | 89 ++++++++++++++++ .../java/scatours/CurrencyConverterJMSClient.java | 104 +++++++++++++++++++ .../currency-converter-rmi-client/build.xml | 44 -------- .../clients/currency-converter-rmi-client/pom.xml | 43 -------- .../currencyconverter/CurrencyConverter.java | 33 ------ .../java/scatours/CurrencyConverterRMIClient.java | 37 ------- .../clients/currency-converter-rmi/build.xml | 44 ++++++++ .../clients/currency-converter-rmi/pom.xml | 43 ++++++++ .../currencyconverter/CurrencyConverter.java | 33 ++++++ .../java/scatours/CurrencyConverterRMIClient.java | 37 +++++++ .../currency-converter-ws-jaxws-client/build.xml | 52 ---------- .../currency-converter-ws-jaxws-client/pom.xml | 74 ------------- .../java/scatours/CurrencyConverterWSClient.java | 33 ------ .../src/main/resources/wsdl/CurrencyConverter.wsdl | 115 --------------------- .../clients/currency-converter-ws-jaxws/build.xml | 52 ++++++++++ .../clients/currency-converter-ws-jaxws/pom.xml | 74 +++++++++++++ .../java/scatours/CurrencyConverterWSClient.java | 33 ++++++ .../src/main/resources/wsdl/CurrencyConverter.wsdl | 115 +++++++++++++++++++++ sandbox/travelsample/clients/pom.xml | 8 +- 31 files changed, 858 insertions(+), 858 deletions(-) delete mode 100644 sandbox/travelsample/clients/currency-converter-corba-client/build.xml delete mode 100644 sandbox/travelsample/clients/currency-converter-corba-client/pom.xml delete mode 100644 sandbox/travelsample/clients/currency-converter-corba-client/src/main/java/scatours/CurrencyConverterCORBAClient.java delete mode 100644 sandbox/travelsample/clients/currency-converter-corba-client/src/main/resources/currency-converter.idl create mode 100644 sandbox/travelsample/clients/currency-converter-corba/build.xml create mode 100644 sandbox/travelsample/clients/currency-converter-corba/pom.xml create mode 100644 sandbox/travelsample/clients/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBAClient.java create mode 100644 sandbox/travelsample/clients/currency-converter-corba/src/main/resources/currency-converter.idl delete mode 100644 sandbox/travelsample/clients/currency-converter-jms-client/build.xml delete mode 100644 sandbox/travelsample/clients/currency-converter-jms-client/pom.xml delete mode 100644 sandbox/travelsample/clients/currency-converter-jms-client/src/main/java/scatours/CurrencyConverterJMSClient.java create mode 100644 sandbox/travelsample/clients/currency-converter-jms/build.xml create mode 100644 sandbox/travelsample/clients/currency-converter-jms/pom.xml create mode 100644 sandbox/travelsample/clients/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSClient.java delete mode 100644 sandbox/travelsample/clients/currency-converter-rmi-client/build.xml delete mode 100644 sandbox/travelsample/clients/currency-converter-rmi-client/pom.xml delete mode 100644 sandbox/travelsample/clients/currency-converter-rmi-client/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java delete mode 100644 sandbox/travelsample/clients/currency-converter-rmi-client/src/main/java/scatours/CurrencyConverterRMIClient.java create mode 100644 sandbox/travelsample/clients/currency-converter-rmi/build.xml create mode 100644 sandbox/travelsample/clients/currency-converter-rmi/pom.xml create mode 100644 sandbox/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java create mode 100644 sandbox/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java delete mode 100644 sandbox/travelsample/clients/currency-converter-ws-jaxws-client/build.xml delete mode 100644 sandbox/travelsample/clients/currency-converter-ws-jaxws-client/pom.xml delete mode 100644 sandbox/travelsample/clients/currency-converter-ws-jaxws-client/src/main/java/scatours/CurrencyConverterWSClient.java delete mode 100644 sandbox/travelsample/clients/currency-converter-ws-jaxws-client/src/main/resources/wsdl/CurrencyConverter.wsdl create mode 100644 sandbox/travelsample/clients/currency-converter-ws-jaxws/build.xml create mode 100644 sandbox/travelsample/clients/currency-converter-ws-jaxws/pom.xml create mode 100644 sandbox/travelsample/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java create mode 100644 sandbox/travelsample/clients/currency-converter-ws-jaxws/src/main/resources/wsdl/CurrencyConverter.wsdl (limited to 'sandbox/travelsample') diff --git a/sandbox/travelsample/clients/currency-converter-corba-client/build.xml b/sandbox/travelsample/clients/currency-converter-corba-client/build.xml deleted file mode 100644 index 84fc3bf1d3..0000000000 --- a/sandbox/travelsample/clients/currency-converter-corba-client/build.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/travelsample/clients/currency-converter-corba-client/pom.xml b/sandbox/travelsample/clients/currency-converter-corba-client/pom.xml deleted file mode 100644 index e124ce1272..0000000000 --- a/sandbox/travelsample/clients/currency-converter-corba-client/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.6-SNAPSHOT - - 1.0-SNAPSHOT - scatours-client-currency-converter-corba - Apache Tuscany SCA Tours Currency Converter CORBA Client - - - - junit - junit - 4.5 - test - - - - - ${artifactId} - - - - org.codehaus.mojo - idlj-maven-plugin - 1.1 - - - - generate - - - - - idlj - - - - currency-converter.idl - - true - false - - - ${basedir}/src/main/resources - - - - - 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 deleted file mode 100644 index 8581c09d5f..0000000000 --- a/sandbox/travelsample/clients/currency-converter-corba-client/src/main/java/scatours/CurrencyConverterCORBAClient.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 com.tuscanyscatours.currencyconverter.CurrencyConverter; -import com.tuscanyscatours.currencyconverter.CurrencyConverterHelper; - -public class CurrencyConverterCORBAClient { - - public static void main(String[] args) throws Exception { - - String[] orbArgs = {"-ORBInitialPort", "5080"}; - ORB orb = ORB.init( orbArgs, null ); - - String ior = "corbaname::localhost:5080#CurrencyConverterCORBAService"; - Object obj = orb.string_to_object(ior); - 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 deleted file mode 100644 index 1ff24291f5..0000000000 --- a/sandbox/travelsample/clients/currency-converter-corba-client/src/main/resources/currency-converter.idl +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 com { - module tuscanyscatours { - module currencyconverter { - interface CurrencyConverter { - double getExchangeRate(in string fromCurrencyCode, in string toCurrencyCode); - double convert(in string fromCurrencyCode, in string toCurrencyCode, in double amount); - }; - }; - }; -}; diff --git a/sandbox/travelsample/clients/currency-converter-corba/build.xml b/sandbox/travelsample/clients/currency-converter-corba/build.xml new file mode 100644 index 0000000000..84fc3bf1d3 --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-corba/build.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/clients/currency-converter-corba/pom.xml b/sandbox/travelsample/clients/currency-converter-corba/pom.xml new file mode 100644 index 0000000000..e124ce1272 --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-corba/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.6-SNAPSHOT + + 1.0-SNAPSHOT + scatours-client-currency-converter-corba + Apache Tuscany SCA Tours Currency Converter CORBA Client + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + + org.codehaus.mojo + idlj-maven-plugin + 1.1 + + + + generate + + + + + idlj + + + + currency-converter.idl + + true + false + + + ${basedir}/src/main/resources + + + + + diff --git a/sandbox/travelsample/clients/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBAClient.java b/sandbox/travelsample/clients/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBAClient.java new file mode 100644 index 0000000000..8581c09d5f --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBAClient.java @@ -0,0 +1,41 @@ +/* + * 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 com.tuscanyscatours.currencyconverter.CurrencyConverter; +import com.tuscanyscatours.currencyconverter.CurrencyConverterHelper; + +public class CurrencyConverterCORBAClient { + + public static void main(String[] args) throws Exception { + + String[] orbArgs = {"-ORBInitialPort", "5080"}; + ORB orb = ORB.init( orbArgs, null ); + + String ior = "corbaname::localhost:5080#CurrencyConverterCORBAService"; + Object obj = orb.string_to_object(ior); + 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/src/main/resources/currency-converter.idl b/sandbox/travelsample/clients/currency-converter-corba/src/main/resources/currency-converter.idl new file mode 100644 index 0000000000..1ff24291f5 --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-corba/src/main/resources/currency-converter.idl @@ -0,0 +1,29 @@ +/* + * 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 com { + module tuscanyscatours { + module currencyconverter { + interface CurrencyConverter { + double getExchangeRate(in string fromCurrencyCode, in string toCurrencyCode); + double convert(in string fromCurrencyCode, in string toCurrencyCode, in double amount); + }; + }; + }; +}; diff --git a/sandbox/travelsample/clients/currency-converter-jms-client/build.xml b/sandbox/travelsample/clients/currency-converter-jms-client/build.xml deleted file mode 100644 index 0014765a4c..0000000000 --- a/sandbox/travelsample/clients/currency-converter-jms-client/build.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/travelsample/clients/currency-converter-jms-client/pom.xml b/sandbox/travelsample/clients/currency-converter-jms-client/pom.xml deleted file mode 100644 index 5349e9cd2d..0000000000 --- a/sandbox/travelsample/clients/currency-converter-jms-client/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.6-SNAPSHOT - - - 1.0-SNAPSHOT - scatours-client-currency-converter-jms - Apache Tuscany SCA Tours Currency Converter JMS Client - - - - org.apache.activemq - activemq-all - 5.2.0 - - - org.apache.activemq - activemq-web-demo - - - - - - org.apache.ws.commons.axiom - axiom-api - 1.2.7 - - - xerces - xercesImpl - - - stax - stax-api - - - xml-apis - xml-apis - - - - - - org.apache.ws.commons.axiom - axiom-impl - 1.2.7 - runtime - - - stax - stax-api - - - - - - junit - junit - 4.5 - test - - - - - ${artifactId} - - diff --git a/sandbox/travelsample/clients/currency-converter-jms-client/src/main/java/scatours/CurrencyConverterJMSClient.java b/sandbox/travelsample/clients/currency-converter-jms-client/src/main/java/scatours/CurrencyConverterJMSClient.java deleted file mode 100644 index cc4618307c..0000000000 --- a/sandbox/travelsample/clients/currency-converter-jms-client/src/main/java/scatours/CurrencyConverterJMSClient.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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.io.ByteArrayInputStream; - -import javax.jms.Connection; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.xml.stream.XMLStreamException; - -import org.apache.activemq.ActiveMQConnectionFactory; -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.axiom.om.OMText; -import org.apache.axiom.om.impl.builder.StAXOMBuilder; - -public class CurrencyConverterJMSClient { - - private static Connection activeMQConnection; - private static Session activeMQSession; - private static Destination requestDestination; - private static MessageProducer activeMQProducer; - private static Destination responseDestination; - private static MessageConsumer consumer; - private static OMFactory omFactory; - - public static void main(String[] args) throws JMSException, XMLStreamException { - startActiveMQSession(); - - OMElement request = omFactory.createOMElement("convert", "http://goodvaluetrips.com/", "ns2"); - request.addChild(createArg(0, "USD")); - request.addChild(createArg(1, "GBP")); - request.addChild(createArg(2, "100.0")); - - TextMessage message = activeMQSession.createTextMessage("convert"); - message.setStringProperty("scaOperationName", "convert"); - message.setJMSReplyTo(responseDestination); - message.setText(request.toString()); - activeMQProducer.send(message); - - TextMessage response = (TextMessage) consumer.receive(); - StAXOMBuilder builder = new StAXOMBuilder( - new ByteArrayInputStream(response.getText().getBytes())); - OMText returnElement = (OMText) builder.getDocumentElement().getFirstOMChild(); - String returnValue = returnElement.getText(); - System.out.println("100 USD = " + returnValue + "GBP"); - - stopActiveMQSession(); - } - - private static void startActiveMQSession() throws JMSException { - ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61619"); - - activeMQConnection = connectionFactory.createConnection(); - activeMQConnection.start(); - - activeMQSession = activeMQConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - requestDestination = activeMQSession.createQueue("RequestQueue"); - activeMQProducer = activeMQSession.createProducer(requestDestination); - - responseDestination = activeMQSession.createQueue("ResponseQueue"); - consumer = activeMQSession.createConsumer(responseDestination); - - omFactory = OMAbstractFactory.getOMFactory(); - } - - private static void stopActiveMQSession() throws JMSException { - consumer.close(); - activeMQProducer.close(); - activeMQSession.close(); - activeMQConnection.close(); - } - - private static OMElement createArg(int argNumber, String value) { - OMFactory omFactory = OMAbstractFactory.getOMFactory(); - OMElement arg = omFactory.createOMElement("arg" + argNumber, null); - OMText senderOM = omFactory.createOMText(value); - arg.addChild(senderOM); - return arg; - } - } diff --git a/sandbox/travelsample/clients/currency-converter-jms/build.xml b/sandbox/travelsample/clients/currency-converter-jms/build.xml new file mode 100644 index 0000000000..0014765a4c --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-jms/build.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/clients/currency-converter-jms/pom.xml b/sandbox/travelsample/clients/currency-converter-jms/pom.xml new file mode 100644 index 0000000000..5349e9cd2d --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-jms/pom.xml @@ -0,0 +1,89 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.6-SNAPSHOT + + + 1.0-SNAPSHOT + scatours-client-currency-converter-jms + Apache Tuscany SCA Tours Currency Converter JMS Client + + + + org.apache.activemq + activemq-all + 5.2.0 + + + org.apache.activemq + activemq-web-demo + + + + + + org.apache.ws.commons.axiom + axiom-api + 1.2.7 + + + xerces + xercesImpl + + + stax + stax-api + + + xml-apis + xml-apis + + + + + + org.apache.ws.commons.axiom + axiom-impl + 1.2.7 + runtime + + + stax + stax-api + + + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + diff --git a/sandbox/travelsample/clients/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSClient.java b/sandbox/travelsample/clients/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSClient.java new file mode 100644 index 0000000000..cc4618307c --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSClient.java @@ -0,0 +1,104 @@ +/* + * 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.io.ByteArrayInputStream; + +import javax.jms.Connection; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.xml.stream.XMLStreamException; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMText; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; + +public class CurrencyConverterJMSClient { + + private static Connection activeMQConnection; + private static Session activeMQSession; + private static Destination requestDestination; + private static MessageProducer activeMQProducer; + private static Destination responseDestination; + private static MessageConsumer consumer; + private static OMFactory omFactory; + + public static void main(String[] args) throws JMSException, XMLStreamException { + startActiveMQSession(); + + OMElement request = omFactory.createOMElement("convert", "http://goodvaluetrips.com/", "ns2"); + request.addChild(createArg(0, "USD")); + request.addChild(createArg(1, "GBP")); + request.addChild(createArg(2, "100.0")); + + TextMessage message = activeMQSession.createTextMessage("convert"); + message.setStringProperty("scaOperationName", "convert"); + message.setJMSReplyTo(responseDestination); + message.setText(request.toString()); + activeMQProducer.send(message); + + TextMessage response = (TextMessage) consumer.receive(); + StAXOMBuilder builder = new StAXOMBuilder( + new ByteArrayInputStream(response.getText().getBytes())); + OMText returnElement = (OMText) builder.getDocumentElement().getFirstOMChild(); + String returnValue = returnElement.getText(); + System.out.println("100 USD = " + returnValue + "GBP"); + + stopActiveMQSession(); + } + + private static void startActiveMQSession() throws JMSException { + ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61619"); + + activeMQConnection = connectionFactory.createConnection(); + activeMQConnection.start(); + + activeMQSession = activeMQConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); + + requestDestination = activeMQSession.createQueue("RequestQueue"); + activeMQProducer = activeMQSession.createProducer(requestDestination); + + responseDestination = activeMQSession.createQueue("ResponseQueue"); + consumer = activeMQSession.createConsumer(responseDestination); + + omFactory = OMAbstractFactory.getOMFactory(); + } + + private static void stopActiveMQSession() throws JMSException { + consumer.close(); + activeMQProducer.close(); + activeMQSession.close(); + activeMQConnection.close(); + } + + private static OMElement createArg(int argNumber, String value) { + OMFactory omFactory = OMAbstractFactory.getOMFactory(); + OMElement arg = omFactory.createOMElement("arg" + argNumber, null); + OMText senderOM = omFactory.createOMText(value); + arg.addChild(senderOM); + return arg; + } + } diff --git a/sandbox/travelsample/clients/currency-converter-rmi-client/build.xml b/sandbox/travelsample/clients/currency-converter-rmi-client/build.xml deleted file mode 100644 index 0a7a607fda..0000000000 --- a/sandbox/travelsample/clients/currency-converter-rmi-client/build.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/travelsample/clients/currency-converter-rmi-client/pom.xml b/sandbox/travelsample/clients/currency-converter-rmi-client/pom.xml deleted file mode 100644 index ab29b6ab8f..0000000000 --- a/sandbox/travelsample/clients/currency-converter-rmi-client/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.6-SNAPSHOT - - 1.0-SNAPSHOT - scatours-client-currency-converter-rmi - Apache Tuscany SCA Tours Currency Converter RMI Client - - - - junit - junit - 4.5 - test - - - - - ${artifactId} - - diff --git a/sandbox/travelsample/clients/currency-converter-rmi-client/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java b/sandbox/travelsample/clients/currency-converter-rmi-client/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java deleted file mode 100644 index 68753adc3a..0000000000 --- a/sandbox/travelsample/clients/currency-converter-rmi-client/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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/sandbox/travelsample/clients/currency-converter-rmi-client/src/main/java/scatours/CurrencyConverterRMIClient.java b/sandbox/travelsample/clients/currency-converter-rmi-client/src/main/java/scatours/CurrencyConverterRMIClient.java deleted file mode 100644 index c825ecc64f..0000000000 --- a/sandbox/travelsample/clients/currency-converter-rmi-client/src/main/java/scatours/CurrencyConverterRMIClient.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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"); - } -} diff --git a/sandbox/travelsample/clients/currency-converter-rmi/build.xml b/sandbox/travelsample/clients/currency-converter-rmi/build.xml new file mode 100644 index 0000000000..0a7a607fda --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-rmi/build.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/clients/currency-converter-rmi/pom.xml b/sandbox/travelsample/clients/currency-converter-rmi/pom.xml new file mode 100644 index 0000000000..ab29b6ab8f --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-rmi/pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.6-SNAPSHOT + + 1.0-SNAPSHOT + scatours-client-currency-converter-rmi + Apache Tuscany SCA Tours Currency Converter RMI Client + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + diff --git a/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java b/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java new file mode 100644 index 0000000000..68753adc3a --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/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 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/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java b/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java new file mode 100644 index 0000000000..c825ecc64f --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.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; + +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"); + } +} diff --git a/sandbox/travelsample/clients/currency-converter-ws-jaxws-client/build.xml b/sandbox/travelsample/clients/currency-converter-ws-jaxws-client/build.xml deleted file mode 100644 index 8b866698ff..0000000000 --- a/sandbox/travelsample/clients/currency-converter-ws-jaxws-client/build.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/travelsample/clients/currency-converter-ws-jaxws-client/pom.xml b/sandbox/travelsample/clients/currency-converter-ws-jaxws-client/pom.xml deleted file mode 100644 index eb7a33583c..0000000000 --- a/sandbox/travelsample/clients/currency-converter-ws-jaxws-client/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.6-SNAPSHOT - - - 1.0-SNAPSHOT - scatours-client-currency-converter-ws-jaxws - Apache Tuscany SCA Tours Currency Converter Web Service JAX-WS Client - - - - junit - junit - 4.5 - test - - - - - - java.net2 - java.net Maven 2.x Repository - http://download.java.net/maven/2 - - false - - - - - - ${artifactId} - - - - org.codehaus.mojo - jaxws-maven-plugin - 1.12 - - - - wsimport - - - ${basedir}/src/main/resources/wsdl - scatours.curencyconverter.client - - - - - - - diff --git a/sandbox/travelsample/clients/currency-converter-ws-jaxws-client/src/main/java/scatours/CurrencyConverterWSClient.java b/sandbox/travelsample/clients/currency-converter-ws-jaxws-client/src/main/java/scatours/CurrencyConverterWSClient.java deleted file mode 100644 index 46e2914582..0000000000 --- a/sandbox/travelsample/clients/currency-converter-ws-jaxws-client/src/main/java/scatours/CurrencyConverterWSClient.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 scatours.curencyconverter.client.CurrencyConverter; -import scatours.curencyconverter.client.CurrencyConverterService; - -public class CurrencyConverterWSClient { - - public static void main(String[] args) throws Exception { - CurrencyConverterService service = new CurrencyConverterService(); - CurrencyConverter converter = service.getPort(CurrencyConverter.class); - - 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-ws-jaxws-client/src/main/resources/wsdl/CurrencyConverter.wsdl b/sandbox/travelsample/clients/currency-converter-ws-jaxws-client/src/main/resources/wsdl/CurrencyConverter.wsdl deleted file mode 100644 index 055431bbf2..0000000000 --- a/sandbox/travelsample/clients/currency-converter-ws-jaxws-client/src/main/resources/wsdl/CurrencyConverter.wsdl +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/travelsample/clients/currency-converter-ws-jaxws/build.xml b/sandbox/travelsample/clients/currency-converter-ws-jaxws/build.xml new file mode 100644 index 0000000000..8b866698ff --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-ws-jaxws/build.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/clients/currency-converter-ws-jaxws/pom.xml b/sandbox/travelsample/clients/currency-converter-ws-jaxws/pom.xml new file mode 100644 index 0000000000..eb7a33583c --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-ws-jaxws/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.6-SNAPSHOT + + + 1.0-SNAPSHOT + scatours-client-currency-converter-ws-jaxws + Apache Tuscany SCA Tours Currency Converter Web Service JAX-WS Client + + + + junit + junit + 4.5 + test + + + + + + java.net2 + java.net Maven 2.x Repository + http://download.java.net/maven/2 + + false + + + + + + ${artifactId} + + + + org.codehaus.mojo + jaxws-maven-plugin + 1.12 + + + + wsimport + + + ${basedir}/src/main/resources/wsdl + scatours.curencyconverter.client + + + + + + + diff --git a/sandbox/travelsample/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java b/sandbox/travelsample/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java new file mode 100644 index 0000000000..46e2914582 --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.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; + +import scatours.curencyconverter.client.CurrencyConverter; +import scatours.curencyconverter.client.CurrencyConverterService; + +public class CurrencyConverterWSClient { + + public static void main(String[] args) throws Exception { + CurrencyConverterService service = new CurrencyConverterService(); + CurrencyConverter converter = service.getPort(CurrencyConverter.class); + + 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-ws-jaxws/src/main/resources/wsdl/CurrencyConverter.wsdl b/sandbox/travelsample/clients/currency-converter-ws-jaxws/src/main/resources/wsdl/CurrencyConverter.wsdl new file mode 100644 index 0000000000..055431bbf2 --- /dev/null +++ b/sandbox/travelsample/clients/currency-converter-ws-jaxws/src/main/resources/wsdl/CurrencyConverter.wsdl @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/clients/pom.xml b/sandbox/travelsample/clients/pom.xml index 8c341d4061..193ff2f3f5 100644 --- a/sandbox/travelsample/clients/pom.xml +++ b/sandbox/travelsample/clients/pom.xml @@ -37,10 +37,10 @@ true - currency-converter-corba-client - currency-converter-jms-client - currency-converter-rmi-client - currency-converter-ws-jaxws-client + currency-converter-corba + currency-converter-jms + currency-converter-rmi + currency-converter-ws-jaxws -- cgit v1.2.3