tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r682169 - in /tuscany/sandbox/travelsample/flight-contribution: ./ META-INF/ META-INF/sca-contribution.xml pom.xml src/ src/scatours/ src/scatours/flight/ src/scatours/flight/FlightImpl.java src/scatours/flight/FlightInfo.java
Date Sun, 03 Aug 2008 13:34:32 GMT
Author: slaws
Date: Sun Aug  3 06:34:32 2008
New Revision: 682169

URL: http://svn.apache.org/viewvc?rev=682169&view=rev
Log:
add flights to the travel sample

Added:
    tuscany/sandbox/travelsample/flight-contribution/
    tuscany/sandbox/travelsample/flight-contribution/META-INF/
    tuscany/sandbox/travelsample/flight-contribution/META-INF/sca-contribution.xml   (with
props)
    tuscany/sandbox/travelsample/flight-contribution/pom.xml   (with props)
    tuscany/sandbox/travelsample/flight-contribution/src/
    tuscany/sandbox/travelsample/flight-contribution/src/scatours/
    tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/
    tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightImpl.java 
 (with props)
    tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightInfo.java 
 (with props)

Added: tuscany/sandbox/travelsample/flight-contribution/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/flight-contribution/META-INF/sca-contribution.xml?rev=682169&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/flight-contribution/META-INF/sca-contribution.xml (added)
+++ tuscany/sandbox/travelsample/flight-contribution/META-INF/sca-contribution.xml Sun Aug
 3 06:34:32 2008
@@ -0,0 +1,23 @@
+<?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.    
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+   <import.java package="scatours.common"/>
+   <export.java package="scatours.flight"/>
+</contribution>
\ No newline at end of file

Propchange: tuscany/sandbox/travelsample/flight-contribution/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/travelsample/flight-contribution/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sandbox/travelsample/flight-contribution/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/sandbox/travelsample/flight-contribution/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/flight-contribution/pom.xml?rev=682169&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/flight-contribution/pom.xml (added)
+++ tuscany/sandbox/travelsample/flight-contribution/pom.xml Sun Aug  3 06:34:32 2008
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you under the Apache License, Version 2.0 (the
+    * "License"); you may not use this file except in compliance
+    * with the License.  You may obtain a copy of the License at
+    * 
+    *   http://www.apache.org/licenses/LICENSE-2.0
+    * 
+    * Unless required by applicable law or agreed to in writing,
+    * software distributed under the License is distributed on an
+    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    * KIND, either express or implied.  See the License for the
+    * specific language governing permissions and limitations
+    * under the License.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-sca</artifactId>
+        <version>1.4-SNAPSHOT</version>
+        <!--relativePath>../../pom.xml</relativePath-->
+    </parent>
+    <artifactId>scatours-flight-contribution</artifactId>
+    <name>Apache Tuscany SCA Tours Flight Contribution</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-data-api</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>scatours-common-contribution</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency> 
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.2</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+       <finalName>${artifactId}</finalName>
+       <sourceDirectory>${basedir}/src</sourceDirectory>
+       <resources>
+          <resource>
+              <directory>${basedir}</directory>
+              <excludes>
+                  <exclude>**/*.java</exclude>
+                  <exclude>**/.*/**</exclude>
+                  <exclude>pom.xml</exclude>
+                  <exclude>build.xml</exclude>
+                  <exclude>target/**</exclude>
+                  <exclude>src/**</exclude>
+              </excludes>
+          </resource>
+       </resources>
+    </build>
+</project>

Propchange: tuscany/sandbox/travelsample/flight-contribution/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/travelsample/flight-contribution/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sandbox/travelsample/flight-contribution/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightImpl.java?rev=682169&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightImpl.java (added)
+++ tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightImpl.java Sun
Aug  3 06:34:32 2008
@@ -0,0 +1,120 @@
+/*
+ * 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.flight;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import scatours.common.Search;
+import scatours.common.SearchCallback;
+import scatours.common.TripItem;
+import scatours.common.TripLeg;
+
+/**
+ * An implementation of the Hotel service
+ */
+@Scope("STATELESS")
+@Service(interfaces={Search.class})
+public class FlightImpl implements Search {
+    
+    private List<FlightInfo> flights = new ArrayList<FlightInfo>();
+    
+    @Callback
+    protected SearchCallback searchCallback; 
+
+    @Init
+    public void init() {
+        flights.add(new FlightInfo("IA26", 
+                                   "Island Airlines Boeing 747",
+                                   "LGW",
+                                   "ANU",
+                                   "06/12/08",
+                                   "06/12/08",
+                                   "350",
+                                   250,
+                                   "USD",
+                                   "http://localhost:8085/tbd" ));
+        flights.add(new FlightInfo("IA27", 
+                                   "Island Airlines Boeing 747",
+                                   "ANU",
+                                   "LGW",
+                                   "13/12/08",
+                                   "13/12/08",
+                                   "350",
+                                   250,
+                                   "USD",
+                                   "http://localhost:8085/tbd" ));
+
+    }
+    
+    public TripItem[] searchSynch(TripLeg tripLeg) {
+        List<TripItem> items = new ArrayList<TripItem>();
+        
+        // find outbound leg
+        for(FlightInfo flight : flights){
+            if ((flight.getFromLocation().equals(tripLeg.getFromLocation())) &&
+                (flight.getToLocation().equals(tripLeg.getToLocation())) &&
+                (flight.getFromDate().equals(tripLeg.getFromDate()))){
+                TripItem item = new TripItem("1", 
+                                             "Flight",
+                                             flight.getName(), 
+                                             flight.getDescription(), 
+                                             flight.getFromLocation() + " - " + flight.getToLocation(),
+                                             flight.getFromDate(),
+                                             flight.getToDate(),
+                                             flight.getPricePerSeat(),
+                                             flight.getCurrency(),
+                                             flight.getLink());
+                items.add(item);
+            }
+        }
+        
+        // find return leg
+        for(FlightInfo flight : flights){
+            if ((flight.getFromLocation().equals(tripLeg.getToLocation())) &&
+                (flight.getToLocation().equals(tripLeg.getFromLocation())) &&
+                (flight.getFromDate().equals(tripLeg.getToDate()))){
+                TripItem item = new TripItem("1", 
+                                             "Flight",
+                                             flight.getName(), 
+                                             flight.getDescription(), 
+                                             flight.getFromLocation() + " - " + flight.getToLocation(),
+                                             flight.getFromDate(),
+                                             tripLeg.getToDate(),
+                                             flight.getPricePerSeat(),
+                                             flight.getCurrency(),
+                                             flight.getLink());
+                items.add(item);
+            }
+        }        
+        
+        return items.toArray(new TripItem[items.size()]);
+    }
+    
+    public void searchAsynch(TripLeg tripLeg) {
+        
+        // return available hotels
+        searchCallback.searchResults(searchSynch(tripLeg));  
+    }
+}

Propchange: tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightInfo.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightInfo.java?rev=682169&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightInfo.java (added)
+++ tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightInfo.java Sun
Aug  3 06:34:32 2008
@@ -0,0 +1,142 @@
+/*
+ * 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.flight;
+
+
+public class FlightInfo {
+    
+    private String name;
+    private String description;
+    private String fromLocation;
+    private String toLocation;
+    private String fromDate;
+    private String toDate;
+    private String seats;
+    private double pricePerSeat;
+    private String currency;
+    private String link;
+    
+    public FlightInfo() {
+    }  
+    
+    public FlightInfo(String name, 
+                      String description, 
+                      String fromLocation,
+                      String toLocation,
+                      String fromDate,
+                      String toDate,
+                      String seats,
+                      double pricePerSeat,
+                      String currency,
+                      String link) {
+
+        
+        this.name = name;
+        this.description = description;
+        this.fromLocation = fromLocation;
+        this.toLocation = toLocation;
+        this.fromDate = fromDate;
+        this.toDate = toDate;
+        this.seats = seats;
+        this.pricePerSeat = pricePerSeat;
+        this.currency = currency;
+        this.link = link;
+    }  
+    
+    public String getName() {
+        return name;
+    }
+    
+    public void setName(String name) {
+        this.name = name;
+    }    
+    
+    public String getDescription() {
+        return description;
+    }
+    
+    public void setDescription(String description) {
+        this.description = description; 
+    }   
+    
+    public String getFromLocation() {
+        return fromLocation;
+    }
+    
+    public void setFromLocation(String fromLocation) {
+        this.fromLocation = fromLocation;
+    }
+    
+    public String getToLocation() {
+        return toLocation;
+    }
+    
+    public void setToLocation(String toLocation) {
+        this.toLocation = toLocation;
+    }
+    
+    public String getFromDate() {
+        return fromDate;
+    }
+    
+    public void setFromDate(String fromDate) {
+        this.fromDate = fromDate;
+    }
+    
+    public String getToDate() {
+        return toDate;
+    }
+    
+    public void setToDate(String toDate) {
+        this.toDate = toDate;
+    }
+    
+    public String getSeats() {
+        return seats;
+    }
+    
+    public void setSeats(String seats) {
+        this.seats = seats;
+    }
+    
+    public double getPricePerSeat() {
+        return pricePerSeat;
+    }
+    
+    public void setPricePerSeat(double pricePerSeat) {
+        this.pricePerSeat = pricePerSeat;
+    }
+    
+    public String getCurrency() {
+        return currency;
+    }
+    
+    public void setCurrency(String currency) {
+        this.currency = currency;
+    }
+    
+    public String getLink() {
+        return link;
+    }
+    
+    public void setLink(String link) {
+        this.link = link;
+    }
+}
\ No newline at end of file

Propchange: tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/travelsample/flight-contribution/src/scatours/flight/FlightInfo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message