summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java')
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscahotels/HotelOffers.java26
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscahotels/impl/HotelOffersImpl.java35
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Address.java172
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java18
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/BillingAddress.java174
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java19
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CustomerInfo.java27
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java2
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java2
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java37
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CustomerImpl.java47
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java26
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/AirportCodesClientImpl.java36
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/BookingsClientImpl.java36
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/BookingsZeroClientImpl.java36
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/CarBookingsClientImpl.java38
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/ConverterClientImpl.java43
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/HotelOffersClientImpl.java36
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/Orders1ClientImpl.java36
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/Orders2ClientImpl.java38
20 files changed, 863 insertions, 21 deletions
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscahotels/HotelOffers.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscahotels/HotelOffers.java
new file mode 100644
index 0000000000..8abc5af687
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscahotels/HotelOffers.java
@@ -0,0 +1,26 @@
+/*
+ * 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.tuscanyscahotels;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HotelOffers {
+ String bookTodaysSpecial();
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscahotels/impl/HotelOffersImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscahotels/impl/HotelOffersImpl.java
new file mode 100644
index 0000000000..fccef2beed
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscahotels/impl/HotelOffersImpl.java
@@ -0,0 +1,35 @@
+/*
+ * 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.tuscanyscahotels.impl;
+
+import java.util.Date;
+import org.osoa.sca.annotations.Reference;
+
+import com.tuscanyscahotels.HotelOffers;
+import com.tuscanyscatours.Hotels;
+
+public class HotelOffersImpl implements HotelOffers {
+
+ @Reference
+ protected Hotels hotels;
+
+ public String bookTodaysSpecial() {
+ return hotels.bookHotel("LBH", new Date(), 3, "STD");
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Address.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Address.java
new file mode 100644
index 0000000000..614da1e2ad
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Address.java
@@ -0,0 +1,172 @@
+/*
+ * 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.
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2010.03.27 at 05:55:25 AM GMT
+//
+
+
+package com.tuscanyscatours;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for Address complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="Address">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="street" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="city" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="state" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="zip" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "Address", propOrder = {
+ "street",
+ "city",
+ "state",
+ "zip"
+})
+public class Address {
+
+ @XmlElement(required = true)
+ protected String street;
+ @XmlElement(required = true)
+ protected String city;
+ @XmlElement(required = true)
+ protected String state;
+ @XmlElement(required = true)
+ protected String zip;
+
+ /**
+ * Gets the value of the street property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStreet() {
+ return street;
+ }
+
+ /**
+ * Sets the value of the street property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStreet(String value) {
+ this.street = value;
+ }
+
+ /**
+ * Gets the value of the city property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCity() {
+ return city;
+ }
+
+ /**
+ * Sets the value of the city property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCity(String value) {
+ this.city = value;
+ }
+
+ /**
+ * Gets the value of the state property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Sets the value of the state property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setState(String value) {
+ this.state = value;
+ }
+
+ /**
+ * Gets the value of the zip property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getZip() {
+ return zip;
+ }
+
+ /**
+ * Sets the value of the zip property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setZip(String value) {
+ this.zip = value;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java
index 54826a4254..577f22250a 100644
--- a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java
@@ -1,3 +1,21 @@
+/*
+ * 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;
public class AirportCodes {
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/BillingAddress.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/BillingAddress.java
new file mode 100644
index 0000000000..4687cf1116
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/BillingAddress.java
@@ -0,0 +1,174 @@
+/*
+ * 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.
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2010.03.27 at 05:55:25 AM GMT
+//
+
+
+package com.tuscanyscatours;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="street" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="city" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="state" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="zip" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "street",
+ "city",
+ "state",
+ "zip"
+})
+@XmlRootElement(name = "billingAddress")
+public class BillingAddress {
+
+ @XmlElement(required = true)
+ protected String street;
+ @XmlElement(required = true)
+ protected String city;
+ @XmlElement(required = true)
+ protected String state;
+ @XmlElement(required = true)
+ protected String zip;
+
+ /**
+ * Gets the value of the street property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStreet() {
+ return street;
+ }
+
+ /**
+ * Sets the value of the street property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStreet(String value) {
+ this.street = value;
+ }
+
+ /**
+ * Gets the value of the city property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCity() {
+ return city;
+ }
+
+ /**
+ * Sets the value of the city property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCity(String value) {
+ this.city = value;
+ }
+
+ /**
+ * Gets the value of the state property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Sets the value of the state property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setState(String value) {
+ this.state = value;
+ }
+
+ /**
+ * Gets the value of the zip property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getZip() {
+ return zip;
+ }
+
+ /**
+ * Sets the value of the zip property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setZip(String value) {
+ this.zip = value;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java
index 88db57a35f..9c201813e1 100644
--- a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java
@@ -1,4 +1,23 @@
+/*
+ * 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;
+
import java.math.BigDecimal;
import org.osoa.sca.annotations.Remotable;
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CustomerInfo.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CustomerInfo.java
new file mode 100644
index 0000000000..958ca6cf8c
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CustomerInfo.java
@@ -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.
+ */
+package com.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CustomerInfo {
+ String getBillingAddress();
+ String getDeliveryAddress();
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java
index 3482090405..687fc49230 100644
--- a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java
@@ -29,7 +29,7 @@ public class CarPartnerImpl implements Cars {
@Reference(required=false)
protected Cars[] luxuryCars;
-
+
public String bookCar(Date pickup, int days, String carClass) {
return cars[0].bookCar(pickup, days, carClass);
}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java
index 7b440467d2..f8644bab2c 100644
--- a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java
@@ -23,6 +23,8 @@ import com.tuscanyscatours.Cars;
public class CarVendorImpl implements Cars {
+ protected int minAge; // implicitly defines an SCA property
+
public String bookCar(Date pickup, int days, String carClass) {
System.out.println("Booking confirmed for pickup date " + pickup +
" duration " + days + " days in a " + carClass +
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java
index 55ed3e7c55..3749221aa9 100644
--- a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java
@@ -1,4 +1,23 @@
+/*
+ * 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.using.impl;
+
import java.math.BigDecimal;
import org.osoa.sca.annotations.Property;
import com.tuscanyscatours.CurrencyConverter;
@@ -13,22 +32,14 @@ public class CurrencyConverterImpl implements CurrencyConverter {
public BigDecimal convert(BigDecimal amount) {
return amount.multiply(getRate(toCurrency))
- .divide(getRate(fromCurrency));
+ .divide(getRate(fromCurrency), 2, 0);
}
private BigDecimal getRate(String currency) {
- lastRate = lastRate.add(increment); // test code
- return lastRate; // test code A
- }
-
- private BigDecimal lastRate; // test code
- private BigDecimal increment; // test code
-
- CurrencyConverterImpl() { // test code
- try {
- lastRate = new BigDecimal("1.1");
- increment = new BigDecimal("0.2");
- } catch (Exception e) {
+ int rate = 0;
+ for (int i = 0; i < currency.length(); i++) {
+ rate += currency.codePointAt(i);
}
+ return new BigDecimal(rate).divide(new BigDecimal(100));
}
}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CustomerImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CustomerImpl.java
new file mode 100644
index 0000000000..84ca6c7593
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CustomerImpl.java
@@ -0,0 +1,47 @@
+/*
+ * 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.using.impl;
+
+import org.osoa.sca.annotations.Property;
+import com.tuscanyscatours.Address;
+import com.tuscanyscatours.BillingAddress;
+import com.tuscanyscatours.CustomerInfo;
+
+public class CustomerImpl implements CustomerInfo {
+
+ @Property
+ protected BillingAddress billingAddress;
+
+ @Property
+ protected Address deliveryAddress;
+
+ public String getBillingAddress() {
+ return billingAddress.getStreet() + ", " +
+ billingAddress.getCity() + ", " +
+ billingAddress.getState() + " " +
+ billingAddress.getZip();
+ }
+
+ public String getDeliveryAddress() {
+ return deliveryAddress.getStreet() + ", " +
+ deliveryAddress.getCity() + ", " +
+ deliveryAddress.getState() + " " +
+ deliveryAddress.getZip();
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java
index 670d14b3d7..9d81a0d4ed 100644
--- a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java
@@ -29,7 +29,7 @@ import com.tuscanyscatours.Hotels;
public class TripBookingImpl implements Bookings {
- TripBookingImpl(@Reference(name="cars") Cars cars) {
+ public TripBookingImpl(@Reference(name="cars") Cars cars) {
this.cars = cars;
}
@@ -46,16 +46,28 @@ public class TripBookingImpl implements Bookings {
}
public String newBooking(String trip, int people) {
- Date startDate = null;
+ /* In a real implementation this method would look up the trip code
+ in the travel catalog to get details of the car, flight and hotel
+ bookings needed. Instead these details are hard-wired here for
+ test purposes. */
+ Date startDate = new Date(); //TEMP - need to fix
+ /*
try {
- startDate = DateFormat.getInstance().parse("07/07/2012");
+ startDate = DateFormat.getInstance().parse("7 Jul, 2012");
} catch (Exception e) {
+ e.printStackTrace();
}
+ */
- cars.bookCar(startDate, 7, "B");
- flights.bookFlight("AA123", startDate, people, "Y");
- hotels.bookHotel("DBH", startDate, 7, "SUP");
+ if (people > 0) {
+ cars.bookCar(startDate, 7, "B");
+ flights.bookFlight("AA123", startDate, people, "Y");
+ hotels.bookHotel("DBH", startDate, 7, "SUP");
- return "HW3546";
+ return "HW3546";
+
+ } else {
+ return "NONE";
+ }
}
}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/AirportCodesClientImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/AirportCodesClientImpl.java
new file mode 100644
index 0000000000..4857b25fb6
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/AirportCodesClientImpl.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.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.AirportCodes;
+
+@Service(Runnable.class)
+public class AirportCodesClientImpl {
+
+ @Reference
+ protected AirportCodes airportcodes;
+
+ public void run() {
+ String airport = airportcodes.getAirport("AAB");
+ System.out.println("AAB is the airport code for " + airport);
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/BookingsClientImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/BookingsClientImpl.java
new file mode 100644
index 0000000000..aa842c80f7
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/BookingsClientImpl.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.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.Bookings;
+
+@Service(Runnable.class)
+public class BookingsClientImpl {
+
+ @Reference
+ protected Bookings bookings;
+
+ public void run() {
+ String bookingCode = bookings.newBooking("VR3MAY9", 2);
+ System.out.println("Booking code is " + bookingCode);
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/BookingsZeroClientImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/BookingsZeroClientImpl.java
new file mode 100644
index 0000000000..1fd519d5e9
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/BookingsZeroClientImpl.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.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.Bookings;
+
+@Service(Runnable.class)
+public class BookingsZeroClientImpl {
+
+ @Reference
+ protected Bookings bookings;
+
+ public void run() {
+ String bookingCode = bookings.newBooking("DUMMY", 0);
+ System.out.println("Booking code is " + bookingCode);
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/CarBookingsClientImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/CarBookingsClientImpl.java
new file mode 100644
index 0000000000..0c78a77825
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/CarBookingsClientImpl.java
@@ -0,0 +1,38 @@
+/*
+ * 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.client.impl;
+
+import java.util.Date;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.Cars;
+
+@Service(Runnable.class)
+public class CarBookingsClientImpl {
+
+ @Reference
+ protected Cars cars;
+
+ public void run() {
+ String bookingCode = cars.bookCar(new Date(), 3, "K"); // need to FIX
+ System.out.println("Booking code is " + bookingCode);
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/ConverterClientImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/ConverterClientImpl.java
new file mode 100644
index 0000000000..5eab8f8a16
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/ConverterClientImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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.client.impl;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.CurrencyConverter;
+
+@Service(Runnable.class)
+public class ConverterClientImpl {
+
+ @Reference
+ protected CurrencyConverter eur2jpy;
+
+ @Reference
+ protected CurrencyConverter usd2gbp;
+
+ public void run() {
+ BigDecimal jpy = eur2jpy.convert(new BigDecimal("1000.00"));
+ System.out.println("Converted EUR 1000.00 to JPY " + jpy);
+ BigDecimal gbp = usd2gbp.convert(new BigDecimal("1000.00"));
+ System.out.println("Converted USD 1000.00 to GBP " + gbp);
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/HotelOffersClientImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/HotelOffersClientImpl.java
new file mode 100644
index 0000000000..e581273113
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/HotelOffersClientImpl.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.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscahotels.HotelOffers;
+
+@Service(Runnable.class)
+public class HotelOffersClientImpl {
+
+ @Reference
+ protected HotelOffers offers;
+
+ public void run() {
+ String bookingCode = offers.bookTodaysSpecial();
+ System.out.println("Hotel offers booking code is " + bookingCode);
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/Orders1ClientImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/Orders1ClientImpl.java
new file mode 100644
index 0000000000..af21ad3683
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/Orders1ClientImpl.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.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.CustomerInfo;
+
+@Service(Runnable.class)
+public class Orders1ClientImpl {
+
+ @Reference
+ protected CustomerInfo customer;
+
+ public void run() {
+ String address = customer.getBillingAddress();
+ System.out.println("Customer billing address: " + address);
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/Orders2ClientImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/Orders2ClientImpl.java
new file mode 100644
index 0000000000..41727ac621
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/scatours/client/impl/Orders2ClientImpl.java
@@ -0,0 +1,38 @@
+/*
+ * 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.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.CustomerInfo;
+
+@Service(Runnable.class)
+public class Orders2ClientImpl {
+
+ @Reference
+ protected CustomerInfo customer;
+
+ public void run() {
+ String address = customer.getBillingAddress();
+ System.out.println("Customer billing address: " + address);
+ address = customer.getDeliveryAddress();
+ System.out.println("Customer delivery address: " + address);
+ }
+}