@Override
public Future<?> loadUrl(boolean newLayer, String url, ProgressMonitor progressMonitor) {
CheckParameterUtil.ensureParameterNotNull(url, "url");
if (url.matches(PATTERN_TRACE_ID) || url.matches(PATTERN_EXTERNAL_GPX_SCRIPT) || url.matches(PATTERN_EXTERNAL_GPX_FILE)) {
downloadTask = new DownloadTask(newLayer,
new OsmServerLocationReader(url), progressMonitor);
// Extract .gpx filename from URL to set the new layer name
Matcher matcher = Pattern.compile(PATTERN_EXTERNAL_GPX_FILE).matcher(url);
newLayerName = matcher.matches() ? matcher.group(1) : null;
// We need submit instead of execute so we can wait for it to finish and get the error
// message if necessary. If no one calls getErrorMessage() it just behaves like execute.