39 |
Logger logger = Logger.getLogger(MetroFetcher.class.getName()); |
Logger logger = Logger.getLogger(MetroFetcher.class.getName()); |
40 |
StationDAO stationDAO = new StationDAO(); |
StationDAO stationDAO = new StationDAO(); |
41 |
|
|
42 |
Map<String, MetroBean> cache = new TimeoutMap<String,MetroBean>(1000); |
Map<String, MetroBean> cache = new TimeoutMap<String,MetroBean>(60000); //TODO: make metro cache timeout configurable |
43 |
|
|
44 |
public MetroBean cachedLookupMetroDepartures(int stationID) throws Exception { |
public MetroBean cachedLookupMetroDepartures(int stationID) throws Exception { |
45 |
final String key = "metro:" + stationID; |
final String key = "metro:" + stationID; |
100 |
bean.entries.add(entry); |
bean.entries.add(entry); |
101 |
} |
} |
102 |
|
|
103 |
bean.operationInfo = contentElems.get(3).text(); |
bean.operationInfo = contentElems.get(3).text(); |
104 |
bean.plan = contentElems.get(5).text(); |
|
105 |
|
int planIndex; |
106 |
|
if (contentElems.get(4).text().trim().equalsIgnoreCase("stationsinformation")) { |
107 |
|
planIndex = 7; |
108 |
|
} else { |
109 |
|
planIndex = 5; |
110 |
|
} |
111 |
|
|
112 |
|
bean.plan = contentElems.get(planIndex).text(); |
113 |
|
|
114 |
return bean; |
return bean; |
115 |
} |
} |