Class ApiUrlTestTask
java.lang.Object
org.openstreetmap.josm.gui.PleaseWaitRunnable
org.openstreetmap.josm.gui.preferences.server.ApiUrlTestTask
- All Implemented Interfaces:
Runnable,ProgressMonitor.CancelListener
This is an asynchronous task for testing whether an URL points to an OSM API server.
It tries to retrieve capabilities from the given URL. If it succeeds, the method
isSuccess() replies true, otherwise false.- Since:
- 2745
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate HttpClientprivate static final Stringprivate final Componentprivate booleanprivate final StringFields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor -
Constructor Summary
ConstructorsConstructorDescriptionApiUrlTestTask(Component parent, String url) Constructs a newApiUrlTestTask. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected voidalertInvalidCapabilitiesUrl(String capabilitiesUrl) protected voidalertInvalidServerResult(int retCode) protected voidalertInvalidUrl(String url) protected voidcancel()User pressed cancel button.protected voidfinish()Finish up the data work.booleanDetermines if the test has been canceled.booleanDetermines if the test has succeeded.protected voidrealRun()Called in the worker thread to do the actual work.Methods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
-
Field Details
-
url
-
canceled
-
success
-
parent
-
connection
-
CONNECTION_FAILED_MSG
-
-
Constructor Details
-
ApiUrlTestTask
Constructs a newApiUrlTestTask.- Parameters:
parent- the parent component relative to which thePleaseWaitRunnable-Dialog is displayedurl- the url. Must not be null.- Throws:
IllegalArgumentException- if url is null.
-
-
Method Details
-
alertInvalidUrl
-
alertInvalidCapabilitiesUrl
-
alertConnectionFailed
-
alertInvalidServerResult
-
alertInvalidCapabilities
-
cancel
Description copied from class:PleaseWaitRunnableUser pressed cancel button.- Specified by:
cancelin classPleaseWaitRunnable
-
finish
Description copied from class:PleaseWaitRunnableFinish up the data work. Is guaranteed to be called if realRun is called. Finish is called in the gui thread just after the dialog disappeared.- Specified by:
finishin classPleaseWaitRunnable
-
realRun
Description copied from class:PleaseWaitRunnableCalled in the worker thread to do the actual work. When any of the exception is thrown, a message box will be displayed and closeDialog is called. finish() is called in any case.- Specified by:
realRunin classPleaseWaitRunnable- Throws:
SAXException- if a SAX error occursIOException- if an I/O error occursOsmTransferException- if a communication error with the OSM server occurs
-
isCanceled
Determines if the test has been canceled.- Returns:
trueif canceled,falseotherwise
-
isSuccess
Determines if the test has succeeded.- Returns:
trueif success,falseotherwise
-