You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by na...@apache.org on 2010/03/22 09:03:54 UTC

svn commit: r925991 - in /tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using: ./ src/ src/main/ src/main/java/ src/main/java/com/ src/main/java/com/tuscanyscatours/ src/main/java/com/tuscanyscatours/using/ src/main/java/com/tuscanysc...

Author: nash
Date: Mon Mar 22 08:03:53 2010
New Revision: 925991

URL: http://svn.apache.org/viewvc?rev=925991&view=rev
Log:
Add new contribution "using" with examples for using SCA components

Added:
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/build.xml
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/pom.xml
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Bookings.java
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Cars.java
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Flights.java
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Hotels.java
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/FlightPartnerImpl.java
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/HotelPartnerImpl.java
    tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/build.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/build.xml?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/build.xml (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/build.xml Mon Mar 22 08:03:53 2010
@@ -0,0 +1,22 @@
+<!--
+ * 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 name="scatours-contribution-using" default="compile">
+    <import file="../../antdefs.xml"/>
+</project>

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/pom.xml?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/pom.xml (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/pom.xml Mon Mar 22 08:03:53 2010
@@ -0,0 +1,56 @@
+<?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>scatours</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent><version>1.0-SNAPSHOT</version>
+    <artifactId>scatours-contribution-using</artifactId>
+    <name>Apache Tuscany SCA Tours Using Components Contribution</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <version>${tuscany.version}</version>
+        </dependency>        
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>${tuscany.version}</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.5</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>${artifactId}</finalName>
+    </build>
+</project>

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java Mon Mar 22 08:03:53 2010
@@ -0,0 +1,10 @@
+package com.tuscanyscatours;
+
+public class AirportCodes {
+    public String getAirport(String code) {
+        if ("AAA".equals(code)) return "Anaa";
+        else if ("AAB".equals(code)) return "Arrabury";
+        // other airport codes and cities would follow here
+        else return null;
+    }
+}

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Bookings.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Bookings.java?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Bookings.java (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Bookings.java Mon Mar 22 08:03:53 2010
@@ -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.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Bookings {
+    String newBooking(String trip, int people);
+}

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Cars.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Cars.java?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Cars.java (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Cars.java Mon Mar 22 08:03:53 2010
@@ -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 java.util.Date;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Cars {
+    String bookCar(Date pickup, int days, String carClass);
+}

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java Mon Mar 22 08:03:53 2010
@@ -0,0 +1,8 @@
+package com.tuscanyscatours;
+import java.math.BigDecimal;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CurrencyConverter {
+    BigDecimal convert(BigDecimal amount);
+}

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Flights.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Flights.java?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Flights.java (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Flights.java Mon Mar 22 08:03:53 2010
@@ -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 java.util.Date;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Flights {
+    String bookFlight(String flightNumber, Date date, int seats, String flightClass);
+}

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Hotels.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Hotels.java?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Hotels.java (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/Hotels.java Mon Mar 22 08:03:53 2010
@@ -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 java.util.Date;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Hotels {
+    String bookHotel(String hotelCode, Date date, int days, String roomType);
+}

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java Mon Mar 22 08:03:53 2010
@@ -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 com.tuscanyscatours.using.impl;
+
+import java.util.Date;
+import org.osoa.sca.annotations.Reference;
+import com.tuscanyscatours.Cars;
+
+public class CarPartnerImpl implements Cars {
+
+    @Reference
+    protected Cars[] cars;
+
+    @Reference(required=false)
+    protected Cars[] luxuryCars;
+
+    public String bookCar(Date pickup, int days, String carClass) {
+        return cars[0].bookCar(pickup, days, carClass);
+    }
+}

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java Mon Mar 22 08:03:53 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.util.Date;
+import com.tuscanyscatours.Cars;
+
+public class CarVendorImpl implements Cars {
+
+    public String bookCar(Date pickup, int days, String carClass) {
+        System.out.println("Booking confirmed for pickup date " + pickup +
+                           " duration " + days + " days in a " + carClass +
+                           " class car"); 
+        return "CV234";
+    }
+}

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java Mon Mar 22 08:03:53 2010
@@ -0,0 +1,34 @@
+package com.tuscanyscatours.using.impl;
+import java.math.BigDecimal;
+import org.osoa.sca.annotations.Property;
+import com.tuscanyscatours.CurrencyConverter;
+
+public class CurrencyConverterImpl implements CurrencyConverter {
+
+    @Property
+    protected String fromCurrency;
+
+    @Property
+    protected String toCurrency;
+
+    public BigDecimal convert(BigDecimal amount) {
+        return amount.multiply(getRate(toCurrency))
+                     .divide(getRate(fromCurrency));
+    }
+
+    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) {
+        }
+    }
+}

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/FlightPartnerImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/FlightPartnerImpl.java?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/FlightPartnerImpl.java (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/FlightPartnerImpl.java Mon Mar 22 08:03:53 2010
@@ -0,0 +1,31 @@
+/*
+ * 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.util.Date;
+import com.tuscanyscatours.Flights;
+
+public class FlightPartnerImpl implements Flights {
+
+    public String bookFlight(String flightNumber, Date date, int seats, String flightClass) {
+        System.out.println("Booking confirmed for flight " + flightNumber + " on date " +
+                           date + " with " + seats + " seats in " + flightClass + " class"); 
+        return "FP345";
+    }
+}

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/HotelPartnerImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/HotelPartnerImpl.java?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/HotelPartnerImpl.java (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/HotelPartnerImpl.java Mon Mar 22 08:03:53 2010
@@ -0,0 +1,31 @@
+/*
+ * 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.util.Date;
+import com.tuscanyscatours.Hotels;
+
+public class HotelPartnerImpl implements Hotels {
+
+    public String bookHotel(String hotelCode, Date date, int days, String roomType) {
+        System.out.println("Booking confirmed for hotel " + hotelCode + " arriving on " +
+                           date + " for " + days + " days in a " + roomType + " room"); 
+        return "HP456";
+    }
+}

Added: tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java?rev=925991&view=auto
==============================================================================
--- tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java (added)
+++ tuscany/sca-java-1.x/trunk/tutorials/travelsample/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java Mon Mar 22 08:03:53 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.text.DateFormat;
+import java.util.Date;
+import org.osoa.sca.annotations.Reference;
+
+import com.tuscanyscatours.Bookings;
+import com.tuscanyscatours.Cars;
+import com.tuscanyscatours.Flights;
+import com.tuscanyscatours.Hotels;
+
+public class TripBookingImpl implements Bookings {
+
+    TripBookingImpl(@Reference(name="cars") Cars cars) {
+        this.cars = cars;
+    }
+    
+    protected Cars cars;
+
+    @Reference
+    protected Flights flights;
+
+    private Hotels hotels;
+
+    @Reference
+    public void setHotels(Hotels hotels) {
+        this.hotels = hotels;
+    }
+
+    public String newBooking(String trip, int people) {
+        Date startDate = null;
+        try {
+            startDate = DateFormat.getInstance().parse("07/07/2012");
+        } catch (Exception e) {
+        }
+
+        cars.bookCar(startDate, 7, "B");
+        flights.bookFlight("AA123", startDate, people, "Y");
+        hotels.bookHotel("DBH", startDate, 7, "SUP");
+
+        return "HW3546";
+    }
+}