}
} catch (IOException e) {
throw new WFSException(request, e);
}
FeatureIterator reader = null;
int numberLocked = -1;
try {
for (reader = features.features(); reader.hasNext();) {
SimpleFeature feature = (SimpleFeature) reader.next();
FeatureId fid = fid(feature.getID());
Id fidFilter = fidFilter(fid);
if (!(source instanceof FeatureLocking)) {
LOGGER.fine("Lock " + fid + " not supported by data store (authID:"
+ fLock.getAuthorization() + ")");
response.addNotLockedFeature(fid);
// lockFailedFids.add(fid);
} else {
// DEFQuery is just some indirection, should be in
// the locking interface.
// int numberLocked =
// ((DEFQueryFeatureLocking)source).lockFeature(feature);
// HACK: Query.NO_NAMES isn't working in postgis
// right now,
// so we'll just use all.
Query query = new Query(meta.getName(), (Filter) fidFilter,
Query.DEFAULT_MAX, Query.ALL_NAMES, lock.getHandle());
numberLocked = ((FeatureLocking) source).lockFeatures(query);
if (numberLocked == 1) {
LOGGER.fine("Lock " + fid + " (authID:" + fLock.getAuthorization()
+ ")");
response.addLockedFeature( fid);
// lockedFids.add(fid);
} else if (numberLocked == 0) {
LOGGER.fine("Lock " + fid + " conflict (authID:"
+ fLock.getAuthorization() + ")");
response.addNotLockedFeature(fid);
// lockFailedFids.add(fid);
} else {
LOGGER.warning("Lock " + numberLocked + " " + fid + " (authID:"
+ fLock.getAuthorization() + ") duplicated FeatureID!");
response.addLockedFeature(fid);
// lockedFids.add(fid);
}
}
}
} catch (IOException ioe) {
throw new WFSException(request, ioe);
} finally {
if (reader != null) {
reader.close();
}
}
// refresh lock times, so they all start the same instant and we
// are nearer