urlFileUpdaterBuilder
.setCacheMetadataFile(destinationCacheData)
.setCachedContent(destinationTempFile)
.setUseCaching(true);
}
final URLFileUpdater updater = urlFileUpdaterBuilder.createURLFileUpdater();
try {
if (null != interaction) {
//allow mock
updater.setInteraction(interaction);
}
UpdateUtils.update(updater, destinationTempFile);
logger.debug("Updated nodes resources file: " + destinationTempFile);
} catch (UpdateUtils.UpdateException e) {
if (!destinationTempFile.isFile() || destinationTempFile.length() < 1) {
throw new ResourceModelSourceException(
"Error requesting URL Resource Model Source: " + configuration.nodesUrl + ": " + e.getMessage(), e);
} else {
logger.error("Error requesting URL Resource Model Source: " + configuration.nodesUrl + ": " + e.getMessage(), e);
}
}
final ResourceFormatParser parser;
if ("file".equalsIgnoreCase(configuration.nodesUrl.getProtocol())) {
try {
parser = framework.getResourceFormatParserService().getParserForFileExtension(new File(
configuration.nodesUrl.toURI()));
} catch (UnsupportedFormatException e) {
throw new ResourceModelSourceException(
"Error requesting URL Resource Model Source: " + configuration.nodesUrl + ": No supported format available for file extension", e);
} catch (URISyntaxException e) {
throw new ResourceModelSourceException(
"Error requesting URL Resource Model Source: " + configuration.nodesUrl + ": " + e.getMessage(), e);
}
logger.debug("Determined URL content format from file name: " + configuration.nodesUrl);
} else {
final String mimetype = updater.getContentType();
try {
parser = framework.getResourceFormatParserService().getParserForMIMEType(mimetype);
} catch (UnsupportedFormatException e) {
throw new ResourceModelSourceException(
"Error requesting URL Resource Model Source: " + configuration.nodesUrl