--- android/TrainInfo/src/dk/thoerup/traininfo/provider/ProviderFactory.java 2010/09/02 18:37:49 1026 +++ android/TrainInfo/src/dk/thoerup/traininfo/provider/ProviderFactory.java 2010/09/08 06:03:45 1027 @@ -1,6 +1,8 @@ package dk.thoerup.traininfo.provider; + + public class ProviderFactory { private static DepartureProvider departureProvider = null; private static StationProvider stationProvider = null; @@ -8,6 +10,24 @@ private static final boolean DEBUG = false; + //TODO: this one really doesn't belong here ... and damn it is ugly code + public static void purgeOldEntries() { + synchronized (ProviderFactory.class) { + if (stationProvider != null && stationProvider instanceof XmlStationProvider) { + ((XmlStationProvider)stationProvider).stationCache.purgeOldEntries(); + } + + if (departureProvider != null && departureProvider instanceof XmlDepartureProvider) { + ((XmlDepartureProvider)departureProvider).departureCache.purgeOldEntries(); + } + + if (timetableProvider != null && timetableProvider instanceof XmlTimetableProvider) { + ((XmlTimetableProvider)timetableProvider).timetableCache.purgeOldEntries(); + } + } + + } + public static DepartureProvider getDepartureProvider() { if (departureProvider == null) { if (!DEBUG) {