/[projects]/android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/TimetableFetcher.java
ViewVC logotype

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/TimetableFetcher.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 420 by torben, Fri Oct 2 17:18:31 2009 UTC revision 421 by torben, Thu Oct 8 12:19:42 2009 UTC
# Line 14  import com.gargoylesoftware.htmlunit.htm Line 14  import com.gargoylesoftware.htmlunit.htm
14  import com.gargoylesoftware.htmlunit.html.HtmlElement;  import com.gargoylesoftware.htmlunit.html.HtmlElement;
15  import com.gargoylesoftware.htmlunit.html.HtmlPage;  import com.gargoylesoftware.htmlunit.html.HtmlPage;
16    
17    import dk.thoerup.curcuitbreaker.CircuitBreaker;
18    import dk.thoerup.curcuitbreaker.CircuitBreakerManager;
19    
20  public class TimetableFetcher {  public class TimetableFetcher {
21                    
22          class NullRefreshHandler implements RefreshHandler {          class NullRefreshHandler implements RefreshHandler {
# Line 28  public class TimetableFetcher { Line 31  public class TimetableFetcher {
31          Logger logger = Logger.getLogger(TimetableFetcher.class.getName());          Logger logger = Logger.getLogger(TimetableFetcher.class.getName());
32                    
33                    
34          List<TimetableBean> cachedLookupTimetable(String trainID, String type) throws Exception {          List<TimetableBean> cachedLookupTimetable(String trainID, String type) throws Throwable {
35                  String key = trainID+type;                  String key = trainID+type;
36                  List<TimetableBean> list = cache.get(key);                  List<TimetableBean> list = cache.get(key);
37                                    
# Line 41  public class TimetableFetcher { Line 44  public class TimetableFetcher {
44                  return list;                  return list;
45          }          }
46    
47          List<TimetableBean> lookupTimetable(String trainID, String type) throws Exception {                      List<TimetableBean> lookupTimetable(String trainID, String type) throws Throwable {            
48                  List<TimetableBean> timetableList = new ArrayList<TimetableBean>();                  List<TimetableBean> timetableList = new ArrayList<TimetableBean>();
49                                    
50                  String url = "http://www.bane.dk/visRute.asp?W=" + type + "&TogNr=" + trainID + "&artikelId=4276";                  String url = "http://www.bane.dk/visRute.asp?W=" + type + "&TogNr=" + trainID + "&artikelId=4276";
# Line 54  public class TimetableFetcher { Line 57  public class TimetableFetcher {
57              webClient.setCssEnabled(false);              webClient.setCssEnabled(false);
58                            
59                            
60              final HtmlPage page = webClient.getPage(url);              BanedkInvocation wrapper = new BanedkInvocation(webClient, url);
61                CircuitBreaker breaker = CircuitBreakerManager.getManager().getCircuitBreaker("banedk");
62                            
63                HtmlPage page = (HtmlPage) breaker.invoke(wrapper);
64                        
65                            
66              boolean currentStation = false;              boolean currentStation = false;
67              boolean currentStationSaved = false;              boolean currentStationSaved = false;

Legend:
Removed from v.420  
changed lines
  Added in v.421

  ViewVC Help
Powered by ViewVC 1.1.20