Skip to content
Permalink
Browse files
updating download page
  • Loading branch information
rmannibucau committed Jan 13, 2019
1 parent 757a5ce commit 13190598485bb3ffc121b42af7bd1829646123ba
Showing 2 changed files with 79 additions and 24 deletions.
@@ -36,7 +36,6 @@
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
@@ -55,6 +54,7 @@ public class Downloads {
private static final SAXParserFactory FACTORY = SAXParserFactory.newInstance();

// always available once the release passed compared to central
// note: if you have some stability issues (connection reset) then set that to MVN_BASE
private static final String ASF_BASE = "https://repository.apache.org/content/repositories/releases/";

// the entry point we want on the download page
@@ -74,14 +74,19 @@ private Downloads() {
public static void main(final String[] args) {
Locale.setDefault(Locale.ENGLISH);

System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "512");
System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "256");

final List<Download> downloads = Stream.of("org/apache/geronimo/config/geronimo-config-impl", "org/apache/geronimo/safeguard/safeguard-impl",
"org/apache/geronimo/geronimo-jwt-auth", "org/apache/geronimo/geronimo-opentracing",
"org/apache/geronimo/geronimo-health", "org/apache/geronimo/geronimo-metrics",
"org/apache/geronimo/geronimo-openapi-impl", "org/apache/geronimo/geronimo-microprofile-aggregator")
"org/apache/geronimo/geronimo-openapi-impl", "org/apache/geronimo/geronimo-microprofile-aggregator",
"org/apache/geronimo/utilda")
.flatMap(Downloads::toVersions)
.map(v -> v.base.endsWith("geronimo-microprofile-aggregator") ? v.extensions("pom") : v.extensions("jar"))
.flatMap(v -> v.base.endsWith("utilda") ?
Stream.of(v.classifiers("all").extensions("zip"), new Version(v.base, v.version).extensions("pom")) :
Stream.of(v))
.map(v -> v.base.endsWith("geronimo-microprofile-aggregator") ? v.extensions("pom") : v)
.map(v -> v.extensions.isEmpty() ? v.extensions("jar") : v)
.flatMap(Downloads::toDownloadable).map(Downloads::fillDownloadable).filter(Objects::nonNull)
.sorted(Downloads::versionComparator)
.map(Downloads::toCentral)
@@ -185,26 +190,37 @@ private static void printRow(final Download d) {
}

private static Download fillDownloadable(final Download download) {
try {
final URL url = new URL(download.url);
final HttpURLConnection connection = HttpURLConnection.class.cast(url.openConnection());
connection.setConnectTimeout((int) TimeUnit.SECONDS.toMillis(30));
final int responseCode = connection.getResponseCode();
if (responseCode != HttpURLConnection.HTTP_OK) {
if (HttpURLConnection.HTTP_NOT_FOUND != responseCode) {
System.err.println("Got " + responseCode + " for " + download.url);
final int maxRetries = 3;
for (int i = 0; i < maxRetries; i++) {
try {
final URL url = new URL(download.url);
final HttpURLConnection connection = HttpURLConnection.class.cast(url.openConnection());
connection.setConnectTimeout((int) TimeUnit.SECONDS.toMillis(30));
final int responseCode = connection.getResponseCode();
if (responseCode != HttpURLConnection.HTTP_OK) {
if (HttpURLConnection.HTTP_NOT_FOUND != responseCode) {
System.err.println("Got " + responseCode + " for " + download.url);
}
return null;
}
return null;
}

download.setDate(connection.getHeaderField("Last-Modified").replaceAll(" +", " "));
download.setSize(toMega(ofNullable(connection.getHeaderField("Content-Length")).map(Long::parseLong).orElse(0L),
ofNullable(connection.getHeaderField("Accept-Ranges")).orElse("bytes")));
download.setDate(connection.getHeaderField("Last-Modified").replaceAll(" +", " "));
download.setSize(toMega(ofNullable(connection.getHeaderField("Content-Length")).map(Long::parseLong).orElse(0L),
ofNullable(connection.getHeaderField("Accept-Ranges")).orElse("bytes")));

connection.getInputStream().close();
} catch (final IOException e) {
e.printStackTrace();
return null;
connection.getInputStream().close();
break;
} catch (final IOException e) {
if (i < maxRetries - 1) {
continue;
}
if (Boolean.getBoolean("debug")) {
e.printStackTrace();
} else {
System.err.println("[ERROR] @fillDownload: " + e.getMessage() + " for " + download);
}
return null;
}
}
return download;
}
@@ -244,6 +260,8 @@ private static Stream<Version> toVersions(final String baseUrl) {
} catch (final Exception e) {
if (Boolean.getBoolean("debug")) {
e.printStackTrace();
} else {
System.err.println("[ERROR] @toVersions: " + e.getMessage() + " for " + baseUrl);
}
return Stream.empty();
}
@@ -385,6 +403,21 @@ public long getSize() {
public void setSize(final long size) {
this.size = size;
}

@Override
public String toString() {
return "Download{" +
"name='" + name + '\'' +
", classifier='" + classifier + '\'' +
", version='" + version + '\'' +
", format='" + format + '\'' +
", url='" + url + '\'' +
", sha1='" + sha1 + '\'' +
", asc='" + asc + '\'' +
", date='" + date + '\'' +
", size=" + size +
'}';
}
}

private static class QuickMvnMetadataParser extends DefaultHandler {
@@ -9,12 +9,13 @@
[.table.table-bordered,options="header"]
|===
|Name|Version|Date|Size|Type|Links
|Geronimo Microprofile Aggregator|1.0.0|18 Dec 2018|7 kB |POM| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-microprofile-aggregator/1.0.0/geronimo-microprofile-aggregator-1.0.0.pom[icon:download[] POM] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-microprofile-aggregator/1.0.0/geronimo-microprofile-aggregator-1.0.0.pom.sha1[icon:download[] SHA1]
|Geronimo Utilda all|1.0.1|9 Jan 2019|10231 kB |ZIP| http://repo.maven.apache.org/maven2/org/apache/geronimo/utilda/1.0.1/utilda-1.0.1-all.zip[icon:download[] ZIP] http://repo.maven.apache.org/maven2/org/apache/geronimo/utilda/1.0.1/utilda-1.0.1-all.zip.sha1[icon:download[] SHA1]
|Geronimo Microprofile Aggregator|1.0.1|9 Jan 2019|7 kB |POM| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-microprofile-aggregator/1.0.1/geronimo-microprofile-aggregator-1.0.1.pom[icon:download[] POM] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-microprofile-aggregator/1.0.1/geronimo-microprofile-aggregator-1.0.1.pom.sha1[icon:download[] SHA1]
|Geronimo Config|1.2.1|17 Dec 2018|70 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/config/geronimo-config-impl/1.2.1/geronimo-config-impl-1.2.1.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/config/geronimo-config-impl/1.2.1/geronimo-config-impl-1.2.1.jar.sha1[icon:download[] SHA1]
|Geronimo Health|1.0.1|17 Dec 2018|13 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-health/1.0.1/geronimo-health-1.0.1.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-health/1.0.1/geronimo-health-1.0.1.jar.sha1[icon:download[] SHA1]
|Geronimo Jwt Auth|1.0.1|17 Dec 2018|67 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-jwt-auth/1.0.1/geronimo-jwt-auth-1.0.1.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-jwt-auth/1.0.1/geronimo-jwt-auth-1.0.1.jar.sha1[icon:download[] SHA1]
|Geronimo Metrics|1.0.2|2 Jan 2019|36 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-metrics/1.0.2/geronimo-metrics-1.0.2.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-metrics/1.0.2/geronimo-metrics-1.0.2.jar.sha1[icon:download[] SHA1]
|Geronimo Openapi|1.0.3|2 Jan 2019|169 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-openapi-impl/1.0.3/geronimo-openapi-impl-1.0.3.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-openapi-impl/1.0.3/geronimo-openapi-impl-1.0.3.jar.sha1[icon:download[] SHA1]
|Geronimo Openapi|1.0.4|9 Jan 2019|170 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-openapi-impl/1.0.4/geronimo-openapi-impl-1.0.4.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-openapi-impl/1.0.4/geronimo-openapi-impl-1.0.4.jar.sha1[icon:download[] SHA1]
|Geronimo Opentracing|1.0.1|17 Dec 2018|30 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-opentracing/1.0.1/geronimo-opentracing-1.0.1.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-opentracing/1.0.1/geronimo-opentracing-1.0.1.jar.sha1[icon:download[] SHA1]
|Geronimo Safeguard|1.2.0|17 Dec 2018|117 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/safeguard/safeguard-impl/1.2.0/safeguard-impl-1.2.0.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/safeguard/safeguard-impl/1.2.0/safeguard-impl-1.2.0.jar.sha1[icon:download[] SHA1]
|===
@@ -49,12 +50,22 @@
|Geronimo Health|1.0.0|16 Jul 2018|19 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-health/1.0.0/geronimo-health-1.0.0.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-health/1.0.0/geronimo-health-1.0.0.jar.sha1[icon:download[] SHA1]
|===

=== Geronimo Microprofile Aggregator


[.table.table-bordered,options="header"]
|===
|Name|Version|Date|Size|Type|Links
|Geronimo Microprofile Aggregator|1.0.0|18 Dec 2018|7 kB |POM| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-microprofile-aggregator/1.0.0/geronimo-microprofile-aggregator-1.0.0.pom[icon:download[] POM] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-microprofile-aggregator/1.0.0/geronimo-microprofile-aggregator-1.0.0.pom.sha1[icon:download[] SHA1]
|===

=== Geronimo Openapi


[.table.table-bordered,options="header"]
|===
|Name|Version|Date|Size|Type|Links
|Geronimo Openapi|1.0.3|2 Jan 2019|169 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-openapi-impl/1.0.3/geronimo-openapi-impl-1.0.3.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-openapi-impl/1.0.3/geronimo-openapi-impl-1.0.3.jar.sha1[icon:download[] SHA1]
|Geronimo Openapi|1.0.2|18 Dec 2018|169 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-openapi-impl/1.0.2/geronimo-openapi-impl-1.0.2.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-openapi-impl/1.0.2/geronimo-openapi-impl-1.0.2.jar.sha1[icon:download[] SHA1]
|Geronimo Openapi|1.0.1|1 Aug 2018|157 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-openapi-impl/1.0.1/geronimo-openapi-impl-1.0.1.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-openapi-impl/1.0.1/geronimo-openapi-impl-1.0.1.jar.sha1[icon:download[] SHA1]
|Geronimo Openapi|1.0.0|16 Jul 2018|157 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-openapi-impl/1.0.0/geronimo-openapi-impl-1.0.0.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-openapi-impl/1.0.0/geronimo-openapi-impl-1.0.0.jar.sha1[icon:download[] SHA1]
@@ -81,11 +92,22 @@
|Geronimo Config|1.0|10 Sep 2017|53 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/config/geronimo-config-impl/1.0/geronimo-config-impl-1.0.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/config/geronimo-config-impl/1.0/geronimo-config-impl-1.0.jar.sha1[icon:download[] SHA1]
|===

=== Geronimo Utilda


[.table.table-bordered,options="header"]
|===
|Name|Version|Date|Size|Type|Links
|Geronimo Utilda all|1.0.0|18 Dec 2018|11317 kB |ZIP| http://repo.maven.apache.org/maven2/org/apache/geronimo/utilda/1.0.0/utilda-1.0.0-all.zip[icon:download[] ZIP] http://repo.maven.apache.org/maven2/org/apache/geronimo/utilda/1.0.0/utilda-1.0.0-all.zip.sha1[icon:download[] SHA1]
|Geronimo Utilda|1.0.1|9 Jan 2019|2 kB |POM| http://repo.maven.apache.org/maven2/org/apache/geronimo/utilda/1.0.1/utilda-1.0.1.pom[icon:download[] POM] http://repo.maven.apache.org/maven2/org/apache/geronimo/utilda/1.0.1/utilda-1.0.1.pom.sha1[icon:download[] SHA1]
|Geronimo Utilda|1.0.0|18 Dec 2018|2 kB |POM| http://repo.maven.apache.org/maven2/org/apache/geronimo/utilda/1.0.0/utilda-1.0.0.pom[icon:download[] POM] http://repo.maven.apache.org/maven2/org/apache/geronimo/utilda/1.0.0/utilda-1.0.0.pom.sha1[icon:download[] SHA1]
|===

=== Geronimo Opentracing


[.table.table-bordered,options="header"]
|===
|Name|Version|Date|Size|Type|Links
|Geronimo Opentracing|1.0.0|24 Jul 2018|87 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-opentracing/1.0.0/geronimo-opentracing-1.0.0.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-opentracing/1.0.0/geronimo-opentracing-1.0.0.jar.sha1[icon:download[] SHA1]
|===
|===

0 comments on commit 1319059

Please sign in to comment.