--- android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/MetroFetcher.java 2010/09/16 09:11:23 1059 +++ android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/MetroFetcher.java 2010/09/16 13:32:10 1060 @@ -2,38 +2,54 @@ import java.net.URL; - import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.logging.Logger; - import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; +import org.simpleframework.xml.ElementList; +import org.simpleframework.xml.Root; import dk.thoerup.circuitbreaker.CircuitBreaker; import dk.thoerup.circuitbreaker.CircuitBreakerManager; -import dk.thoerup.traininfoservice.StationBean; import dk.thoerup.traininfoservice.StationDAO; import dk.thoerup.traininfoservice.Statistics; +import dk.thoerup.traininfoservice.StationBean.StationEntry; public class MetroFetcher { + @Root(name="entry") public static class MetroEntry { + + @org.simpleframework.xml.Element String metro; + + @org.simpleframework.xml.Element String destination; + + @org.simpleframework.xml.Element String minutes; } + @Root(name="metrodepatures") public static class MetroBean { + + @org.simpleframework.xml.Element String head; - String operationInfo; //driftsinfo - String plan; // koereplan + + @org.simpleframework.xml.Element(name="operations") + String operationInfo; //driftsinfo + + @ElementList List entries = new ArrayList(); + + @org.simpleframework.xml.Element + String plan; // koereplan } Logger logger = Logger.getLogger(MetroFetcher.class.getName()); @@ -58,7 +74,7 @@ public MetroBean lookupMetroDepartures(int stationID) throws Exception { - StationBean station = stationDAO.getById(stationID) ; + StationEntry station = stationDAO.getById(stationID) ; URL url = new URL("http://www.m.dk/layouts/Metro/Widgets/MetroWidget.ashx?StationId=" + station.getMetro() + "&Congestion=true&Application=MyMetro&Expiration=true");