VectorLayerInfo info = layer.getLayerInfo();
if (info != null) {
// check for invalid attribute names
for (AttributeInfo attributeInfo : info.getFeatureInfo().getAttributes()) {
if (attributeInfo.getName().contains(".") || attributeInfo.getName().contains("/")) {
throw new LayerException(ExceptionCode.INVALID_ATTRIBUTE_NAME, attributeInfo.getName(),
layer.getId());
}
}
// apply defaults to all styles
for (NamedStyleInfo namedStyle : info.getNamedStyleInfos()) {
// check sld location
if (namedStyle.getSldLocation() != null) {
Resource resource = applicationContext.getResource(namedStyle.getSldLocation());
IBindingFactory bindingFactory;
try {
bindingFactory = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
IUnmarshallingContext unmarshallingContext = bindingFactory.createUnmarshallingContext();
StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) unmarshallingContext
.unmarshalDocument(new InputStreamReader(resource.getInputStream()));
namedStyle.setStyledLayerInfo(sld);
} catch (JiBXException e) {
throw new LayerException(e, ExceptionCode.INVALID_SLD, namedStyle.getSldLocation(),
layer.getId());
} catch (IOException e) {
throw new LayerException(e, ExceptionCode.INVALID_SLD, namedStyle.getSldLocation(),
layer.getId());
}
String layerName = (namedStyle.getSldLayerName() != null ? namedStyle.getSldLayerName() : layer
.getId());
String styleName = (namedStyle.getSldStyleName() != null ? namedStyle.getSldStyleName() : layer