public class ApiPreconditionCheckerHook implements UploadHook {
@Override
public boolean checkUpload(APIDataSet apiData) {
OsmApi api = OsmApi.getOsmApi();
try {
// FIXME: this should run asynchronously and a progress monitor
// should be displayed.
api.initialize(NullProgressMonitor.INSTANCE);
long maxNodes = 0;
if (api.getCapabilities().isDefined("waynodes", "maximum")) {
maxNodes = api.getCapabilities().getLong("waynodes","maximum");
}
if (maxNodes > 0) {
if( !checkMaxNodes(apiData.getPrimitivesToAdd(), maxNodes))
return false;
if( !checkMaxNodes(apiData.getPrimitivesToUpdate(), maxNodes))