SimpleFeatureType schema = (SimpleFeatureType) getFeatureType(info);
try {
if (!CRS.equalsIgnoreMetadata(resultCRS, schema.getCoordinateReferenceSystem()))
schema = FeatureTypes.transform(schema, resultCRS);
} catch (Exception e) {
throw new DataSourceException(
"Problem forcing CRS onto feature type", e);
}
//
// versioning
//
try {
// only support versioning if on classpath
if (VERSIONING_FS != null && GS_VERSIONING_FS != null && VERSIONING_FS.isAssignableFrom( fs.getClass() ) ) {
//class implements versioning, reflectively create the versioning wrapper
try {
Method m = GS_VERSIONING_FS.getMethod( "create", VERSIONING_FS,
SimpleFeatureType.class, Filter.class, CoordinateReferenceSystem.class, int.class );
return (FeatureSource) m.invoke(null, fs, schema, info.getFilter(),
resultCRS, info.getProjectionPolicy().getCode());
}
catch( Exception e ) {
throw new DataSourceException(
"Creation of a versioning wrapper failed", e);
}
}
} catch( ClassCastException e ) {
//fall through