}
create(e, collection.getSchema());
Transaction tx = new DefaultTransaction();
SimpleFeatureWriter w = writer(e, true, null, tx);
SimpleFeatureIterator it = collection.features();
try {
while(it.hasNext()) {
SimpleFeature f = it.next();
SimpleFeature g = w.next();
for (PropertyDescriptor pd : collection.getSchema().getDescriptors()) {
String name = pd.getName().getLocalPart();
g.setAttribute(name, f.getAttribute(name));
}
w.write();
}
tx.commit();
}
catch(Exception ex) {
tx.rollback();
throw new IOException(ex);
}
finally {
w.close();
it.close();
tx.close();
}
entry.init(e);