// TODO: support reprojection for non-simple FeatureType
if (ft instanceof SimpleFeatureType) {
SimpleFeatureType sft = (SimpleFeatureType) ft;
//create the feature type so it lines up with the "declared" schema
SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder();
tb.setName( info.getName() );
tb.setNamespaceURI( info.getNamespace().getURI() );
if ( info.getAttributes() == null || info.getAttributes().isEmpty() ) {
//take this to mean just load all native
for ( PropertyDescriptor pd : ft.getDescriptors() ) {
if ( !( pd instanceof AttributeDescriptor ) ) {
continue;
}
AttributeDescriptor ad = (AttributeDescriptor) pd;
ad = handleDescriptor(ad, info);
tb.add( ad );
}
}
else {
//only load native attributes configured
for ( AttributeTypeInfo att : info.getAttributes() ) {
String attName = att.getName();
//load the actual underlying attribute type
PropertyDescriptor pd = ft.getDescriptor( attName );
if ( pd == null || !( pd instanceof AttributeDescriptor) ) {
throw new IOException("the SimpleFeatureType " + info.getPrefixedName()
+ " does not contains the configured attribute " + attName
+ ". Check your schema configuration");
}
AttributeDescriptor ad = (AttributeDescriptor) pd;
ad = handleDescriptor(ad, info);
tb.add( (AttributeDescriptor) ad );
}
}
ft = tb.buildFeatureType();
} // end special case for SimpleFeatureType
featureTypeCache.put( info, ft );
}
}