service=(IService) services.get(0);
}
}
if( deleteService ){
if( service.resolve(MemoryDataStore.class, null) instanceof ActiveMemoryDataStore ){
ActiveMemoryDataStore ds=(ActiveMemoryDataStore) service.resolve(MemoryDataStore.class, null);
ds.removeSchema(features[0].getFeatureType().getTypeName());
} else {
List< ? extends IGeoResource> members = service.resources(new NullProgressMonitor());
for( IGeoResource resource : members ) {
FeatureStore<SimpleFeatureType, SimpleFeature> s = resource
.resolve(FeatureStore.class, new NullProgressMonitor());
if (s.getSchema().getTypeName().equals(
features[0].getName().getLocalPart()))
s.removeFeatures(Filter.INCLUDE);
}
}
}
MemoryDataStore ds=service.resolve(MemoryDataStore.class, null);
try{
ds.getSchema(features[0].getFeatureType().getTypeName());
// if( deleteService)
// throw new IOException("SimpleFeatureType already exists in Service"); //$NON-NLS-1$
}catch( SchemaNotFoundException exception){
// verified that schema does not yet exist.
}
ds.addFeatures(features);
return service;
}