throw error;
}
}
private void runPollAndLaunchSeed() throws IOException {
final TileLayer layer = poll.getLayer();
final GeoRSSFeedDefinition pollDef = poll.getPollDef();
logger.info("Polling GeoRSS feed for layer " + layer.getName() + ": " + pollDef.toString());
final String gridSetId = pollDef.getGridSetId();
final URL feedUrl = new URL(templateFeedUrl(pollDef.getFeedUrl()));
final String httpUsername = pollDef.getHttpUsername();
final String httpPassword = pollDef.getHttpUsername();
logger.debug("Getting GeoRSS reader for " + feedUrl.toExternalForm());
final GeoRSSReaderFactory geoRSSReaderFactory = new GeoRSSReaderFactory();
GeoRSSReader geoRSSReader = null;
try {
geoRSSReader = geoRSSReaderFactory.createReader(feedUrl, httpUsername, httpPassword);
} catch (IOException ioe) {
logger.error("Failed to fetch RSS feed from " + feedUrl + "\n" + ioe.getMessage());
return;
}
logger.debug("Got reader for " + pollDef.getFeedUrl()
+ ". Creating geometry filter matrix for gridset " + gridSetId + " on layer "
+ layer.getName());
final int maxMaskLevel = pollDef.getMaxMaskLevel();
final GeoRSSTileRangeBuilder matrixBuilder = new GeoRSSTileRangeBuilder(layer, gridSetId,
maxMaskLevel);
logger.debug("Creating tile range mask based on GeoRSS feed's geometries from "
+ feedUrl.toExternalForm() + " for " + layer.getName());
final GeometryRasterMaskBuilder tileRangeMask = matrixBuilder.buildTileRangeMask(
geoRSSReader, this.lastUpdatedEntry);
if (tileRangeMask == null) {
logger.info("Did not create a tileRangeMask, presumably no new entries in feed.");
return;
}
this.lastUpdatedEntry = matrixBuilder.getLastEntryUpdate();
logger.debug("Created tile range mask based on GeoRSS geometry feed from " + pollDef
+ " for " + layer.getName() + ". Calculating number of affected tiles...");
_logImagesToDisk(tileRangeMask);
final boolean tilesAffected = tileRangeMask.hasTilesSet();
if (tilesAffected) {
logger.info("Launching reseed process " + pollDef + " for " + layer.getName());
} else {
logger.info(pollDef + " for " + layer.getName()
+ " did not affect any tile. No need to reseed.");
return;
}
launchSeeding(layer, pollDef, gridSetId, tileRangeMask);