Package com.ultikits.ultitools.utils
Class VersionLookup
java.lang.Object
com.ultikits.ultitools.utils.VersionLookup
The answer to one catalogue version lookup, as the start-up update check needs it: a version was
found, the catalogue confirmed it has nothing to offer, or the lookup failed (the catalogue could
not be reached, answered with an error status, or sent a body that could not be read).
The public lookups (VersionUtils.getUltiToolsNewestVersion(),
PluginInstallUtils.getPluginLatestVersion(String)) fold the last two into null and
keep doing so; this type exists so the update check can report "incomplete" instead of "up to
date" when a lookup failed (Phase 19, D19-032).
- Since:
- 6.3.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate static final VersionLookupprivate static final StringThe prefixSimpleHttpClientputs on the body it makes up when the request itself failed.private final VersionLookup.Outcome(package private) static final StringThe failure description for an answer longer than the client reads; the contract allows none.(package private) static final StringThe failure description for an answer whose status was fine but whose body could not be read.private final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateVersionLookup(VersionLookup.Outcome outcome, String version, String failure) -
Method Summary
Modifier and TypeMethodDescription(package private) static StringDescribes a non-2xx answer.static VersionLookupstatic VersionLookupbooleanisFailed()static VersionLookupnone()toString()
-
Field Details
-
UNREADABLE
The failure description for an answer whose status was fine but whose body could not be read.- See Also:
-
TOO_LARGE
The failure description for an answer longer than the client reads; the contract allows none.- See Also:
-
NOT_SENT_PREFIX
The prefixSimpleHttpClientputs on the body it makes up when the request itself failed.- See Also:
-
NONE_OFFERED
-
outcome
-
version
-
failure
-
-
Constructor Details
-
VersionLookup
-
-
Method Details
-
found
- Parameters:
version- the version the catalogue named- Returns:
- a
VersionLookup.Outcome.FOUNDlookup
-
none
- Returns:
- the
VersionLookup.Outcome.NONElookup
-
failed
- Parameters:
failure- a short description of why the lookup established nothing- Returns:
- a
VersionLookup.Outcome.FAILEDlookup
-
describe
Describes a non-2xx answer.SimpleHttpClientanswers an I/O failure (refused, timed out, unknown host) with status 500 and a body starting"Error: "; that case is described as not reached rather than as a server error.- Parameters:
status- the HTTP statusbody- the body, possiblynull- Returns:
- a short description for the FINE detail line
-
getOutcome
- Returns:
- what the lookup established
-
getVersion
- Returns:
- the version found, or
nullunless the outcome isVersionLookup.Outcome.FOUND
-
getFailure
- Returns:
- a short description of why the lookup failed (for example
HTTP 500), ornullunless the outcome isVersionLookup.Outcome.FAILED
-
isFailed
public boolean isFailed()- Returns:
truewhen the lookup established nothing
-
toString
-