// Check attributes configured correctly against schema
String typeName = featureTypeDTO.getName();
try {
DataStore dataStore = dataStoreInfo.getDataStore();
FeatureType featureType = dataStore.getSchema(typeName);
Set attributeNames = new HashSet();
Set ATTRIBUTENames = new HashSet();
//as far as I can tell an emtpy list indicates that no
//schema.xml file was found. I may be approaching this
//all wrong, is this logic contained elsewhere?
//CH: Yeah, this shit was super messed up. It was causing null pointer
//exceptions, and then it created this createAttrDTO flag that wasn't
//then used by anyone. So I fixed the null and made it so it creates
//AttributeTypeInfoDTO's (once again, I hate these) from the FeatureType
//of the real datastore.
//boolean createAttrDTO = (featureTypeDTO.getSchemaAttributes().size() == 0);
LOGGER.fine("loading datastore " + typeName);
boolean createAttrDTO;
if (featureTypeDTO.getSchemaAttributes() == null) {
createAttrDTO = true;
} else {
createAttrDTO = featureTypeDTO.getSchemaAttributes().size() == 0;
}
if (createAttrDTO) {
List attributeDTOs = createAttrDTOsFromSchema(featureType);
featureTypeDTO.setSchemaAttributes(attributeDTOs);
LOGGER.finer(
"No schema found, setting featureTypeDTO with "
+ attributeDTOs);
} else {
for (int index = 0;
index < featureType.getAttributeCount(); index++) {
AttributeType attrib = featureType.getAttributeType(index);
attributeNames.add(attrib.getName());
ATTRIBUTENames.add(attrib.getName().toUpperCase());
}
if (featureTypeDTO.getSchemaAttributes() != null) {