diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-14 15:45:33 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-14 15:45:33 +0000 |
commit | 6222ba67f2fd06e34dde842a82e553d3280acaaa (patch) | |
tree | 5ebf9d891df80d8b5fb46ab62655543048a38b9b /sandbox/travelsample/contributions/flight-contribution | |
parent | f7cdb52f0e6c981a78eb4c9c4787688023685b8f (diff) |
Extend the launcher for the interaction examples based on components from the travel sample
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@784575 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/contributions/flight-contribution')
-rw-r--r-- | sandbox/travelsample/contributions/flight-contribution/src/main/java/scatours/flight/FlightImpl.java | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/sandbox/travelsample/contributions/flight-contribution/src/main/java/scatours/flight/FlightImpl.java b/sandbox/travelsample/contributions/flight-contribution/src/main/java/scatours/flight/FlightImpl.java index e2f945b392..307c740ca1 100644 --- a/sandbox/travelsample/contributions/flight-contribution/src/main/java/scatours/flight/FlightImpl.java +++ b/sandbox/travelsample/contributions/flight-contribution/src/main/java/scatours/flight/FlightImpl.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List;
import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ComponentName;
import org.osoa.sca.annotations.Init;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
@@ -35,7 +36,7 @@ import scatours.common.TripLeg; /**
* An implementation of the Hotel service
*/
-@Scope("STATELESS")
+@Scope("CONVERSATION")
@Service(interfaces={Search.class, Book.class})
public class FlightImpl implements Search, Book {
@@ -43,6 +44,11 @@ public class FlightImpl implements Search, Book { @Callback
protected SearchCallback searchCallback;
+
+ @ComponentName
+ protected String componentName;
+
+ protected int percentComplete = 0;
@Init
public void init() {
@@ -118,16 +124,25 @@ public class FlightImpl implements Search, Book { public void searchAsynch(TripLeg tripLeg) {
System.out.println("Starting flight search");
- try {
- this.wait(3000);
- } catch(Exception ex){
- // do nothing
+ // pretend that this processing takes some time to complete
+ while ( percentComplete < 100 ){
+ try {
+ Thread.sleep(50);
+ } catch(Exception ex){
+ // do nothing
+ }
+ percentComplete = percentComplete + 10;
+ searchCallback.setPercentComplete(componentName, percentComplete);
}
- // return available hotels
+ // return available flights
searchCallback.searchResults(searchSynch(tripLeg));
}
+ public int getPercentComplete(){
+ return 100;
+ }
+
public String book(TripItem tripItem) {
return "flight1";
}
|