public IGeoResource createResource( Object param ) throws IOException {
SimpleFeatureType featureType = (SimpleFeatureType) param;
IService service = getMemoryService();
MemoryDataStore ds = service.resolve(MemoryDataStore.class, new NullProgressMonitor());
List<String> typeNamesList = Arrays.asList(ds.getTypeNames());
String localPart = featureType.getName().getLocalPart();
if (typeNamesList.contains(localPart)) {
try {
ds.updateSchema(localPart, featureType);
} catch (Exception e) {
// some datastores do not support schema update, try a name change
// create the feature type
String name = checkSameName(typeNamesList, localPart);
SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
b.setName(name);
b.setCRS(featureType.getCoordinateReferenceSystem());
List<AttributeDescriptor> attributeDescriptors = featureType.getAttributeDescriptors();
b.addAll(attributeDescriptors);
featureType = b.buildFeatureType();
ds.createSchema(featureType);
}
} else {
ds.createSchema(featureType);
}
IGeoResource resource = null;
for( IResolve resolve : service.resources(new NullProgressMonitor()) ) {
if (resolve instanceof IGeoResource) {