@Override public final Version getHighestAvailableVersion() throws RetryAfterException, IOException { SortedSet<Version> available = getAvailableVersions(); return getHighestVersion(available); }
private URLConnection getConnection(URL url) throws IOException { return getConnectionHandler().getConnection(url); }
protected DownloadHandle getDownloadHandle(URL packageURL) { return getDownloadHandler().getHandle(packageURL); }
protected String getIdentification() { return getIdentificationHandler().getAgentId(); }
protected URL getServerURL() throws RetryAfterException { // FIXME not sure if this is the proper place URL serverURL = getDiscoveryHandler().getServerUrl(); if (serverURL == null) { throw new RetryAfterException(10); } return serverURL; }
protected SortedSet<Version> getAvailableVersions(URL endpoint) throws RetryAfterException, IOException { SortedSet<Version> versions = new TreeSet<>(); URLConnection connection = null; BufferedReader reader = null; try { connection = getConnection(endpoint); checkConnectionResponse(connection); reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String versionString; while ((versionString = reader.readLine()) != null) { try { Version version = Version.parseVersion(versionString); versions.add(version); } catch (IllegalArgumentException e) { throw new IOException(e); } } return versions; } finally { closeSilently(reader); close(connection); } }
protected InputStream getInputStream(URL packageURL) throws RetryAfterException, IOException { return new ContentRangeInputStream(getConnectionHandler(), packageURL); }