// TODO: support aliasing (renaming), reprojection, versioning, and locking for DataAccess
if (!(dataAccess instanceof DataStore)) {
return dataAccess.getFeatureSource(info.getQualifiedName());
}
DataStore dataStore = (DataStore) dataAccess;
FeatureSource<SimpleFeatureType, SimpleFeature> fs;
//
// aliasing and type mapping
//
final String typeName = info.getNativeName();
final String alias = info.getName();
final SimpleFeatureType nativeFeatureType = dataStore.getSchema( typeName );
final SimpleFeatureType featureType = (SimpleFeatureType) getFeatureType( info );
if ( !typeName.equals( alias ) || DataUtilities.compare(nativeFeatureType,featureType) != 0 ) {
RetypingDataStore retyper = new RetypingDataStore(dataStore) {
@Override
protected String transformFeatureTypeName(String originalName) {
if(!typeName.equals(originalName))
return originalName;
return alias;
}
@Override
protected SimpleFeatureType transformFeatureType(SimpleFeatureType original)
throws IOException {
if ( original.getTypeName().equals( typeName ) ) {
return featureType;
}
return super.transformFeatureType(original);
}
};
fs = retyper.getFeatureSource(alias);
}
else {
//normal case
fs = dataStore.getFeatureSource(info.getQualifiedName());
}
//
// reprojection
//