* Load Layer data
******************/
this.listenerForwarder.progressing(15, "Searching layer in GeoStore");
final Resource layerRes;
try {
layerRes = geostore.searchLayer(layername);
} catch(Exception e) {
throw new ActionException(this, "Error loading Layer "+layername, e);
}
if(layerRes == null)
throw new ActionException(this, "Layer not found: "+layername);
UNREDDLayer layer = new UNREDDLayer(layerRes);
LOGGER.info("Layer resource found ");
if( ! layer.getAttribute(Attributes.LAYERTYPE).equalsIgnoreCase(request.getFormat().getName()))
throw new ActionException(this, "Bad Layer format "
+ "(declared:"+ request.getFormat().getName()
+ ", expected:"+layer.getAttribute(Attributes.LAYERTYPE) );
// this attribute is read for moving the raster file to the destination directory, not for rasterization
String mosaicDirPath = layer.getAttribute(UNREDDLayer.Attributes.MOSAICPATH);
if( mosaicDirPath == null) {
throw new ActionException(this, "Null mosaic directory for layer: '" + layername + "'... check the layer configuration on geostore");
}
File mosaicDir = new File(mosaicDirPath);
if( ! mosaicDir.isDirectory() && ! mosaicDir.isAbsolute()) {
throw new ActionException(this, "Bad mosaic directory for layer '" + layername + "': " + mosaicDir + " doesn't exist... create it or check the layer configuration on geostore");
}
// ******************
// Check for LayerUpdate
// ******************
this.listenerForwarder.progressing(20, "Check for existing LayerUpdate in GeoStore");
Resource existingLayerUpdate = null;
try {
existingLayerUpdate = geostore.searchLayerUpdate(layername, year, month, day);
} catch (Exception e) {
LOGGER.debug("Parameter : [layerSnapshot=" + layerUpdateName + "]");
throw new ActionException(this, "Error searching for a LayerUpdate (layer:"+layername+" year:"+year+ " month:"+month+")", e);