private Map <String, List<LayerRequest>> createDownloadRequestMap (Map<String, String> layerMap, String[] bounds) throws Exception {
this.layerInfo = this.layerInfoRetriever.fetchAllLayerInfo(layerMap.keySet());
Map <String, List<LayerRequest>> downloadMap = new HashMap<String, List<LayerRequest>>();
for (SolrRecord record: this.layerInfo){
logger.debug("Requested format: " + layerMap.get(record.getLayerId()));
LayerRequest layerRequest = this.createLayerRequest(record, layerMap.get(record.getLayerId()), bounds);
if (!isAuthorizedToDownload(record)){
layerRequest.setStatus(Status.FAILED);
logger.info("User is not authorized to download: '" + record.getLayerId() +"'");
continue;
}
String currentClassKey = null;
try {
currentClassKey = this.downloadConfigRetriever.getClassKey(layerRequest);
if (currentClassKey == null){
throw new Exception();
}
logger.info("DownloadKey: " + currentClassKey);
} catch(Exception e) {
e.printStackTrace();
layerRequest.setStatus(Status.FAILED);
logger.info("No download method found for: '" + record.getLayerId() +"'");
continue;
}
if (downloadMap.containsKey(currentClassKey)){
List<LayerRequest> currentLayerList = downloadMap.get(currentClassKey);