if (null == layerName) {
throw new WmsException("A UserLayer without layer name was passed");
}
final WMS wms = request.getWMS();
if (sl instanceof UserLayer && ((((UserLayer) sl)).getRemoteOWS() != null)) {
// this beast can define multiple feature sources and multiple styles, we'll
// have to mix and match them (ugh)
ul = ((UserLayer) sl);
try {
addRemoteLayersFromUserLayer(request, ul, layers, styles);
} catch (IOException e) {
throw new WmsException("Error accessing remote layers", "RemoteAccessFailed", e);
}
} else {
// simpler case, one layer, eventually multiple styles
currLayer = null;
// handle the InLineFeature stuff
if ((sl instanceof UserLayer)
&& ((((UserLayer) sl)).getInlineFeatureDatastore() != null)) {
// SPECIAL CASE - we make the temporary version
ul = ((UserLayer) sl);
try {
currLayer = initializeInlineFeatureLayer(request, ul);
} catch (Exception e) {
throw new WmsException(e);
}
} else {
if(wms.getLayerGroupByName(layerName) != null) {
LayerGroupInfo group = wms.getLayerGroupByName(layerName);
for(int i = 0; i < group.getLayers().size(); i++) {
LayerInfo layer = group.getLayers().get(i);
layers.add(new MapLayerInfo(layer));
StyleInfo style = group.getStyles().get(i);
if(style != null) {
styles.add(style.getStyle());
} else {
styles.add(layer.getDefaultStyle().getStyle());
}
}
// move to the next named layer
continue;
} else {
LayerInfo layerInfo = wms.getLayerByName(layerName);
if(layerInfo == null)
throw new WmsException("Unknown layer: " + layerName);
currLayer = new MapLayerInfo(layerInfo);