Skip to content
Permalink
Browse files
updating download generation (name normalisation and grabbind from as…
…f release repo + new releases)
  • Loading branch information
rmannibucau committed Jan 6, 2019
1 parent 3b0518e commit 3ad0e9671de30a67f43d5fa785fd54bf70ef7419
Showing 2 changed files with 49 additions and 14 deletions.
@@ -30,6 +30,7 @@
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Locale;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
@@ -47,6 +48,10 @@ public class Downloads {

private static final SAXParserFactory FACTORY = SAXParserFactory.newInstance();

// always available once the release passed compared to central
private static final String ASF_BASE = "https://repository.apache.org/content/repositories/releases/";

// the entry point we want on the download page
private static final String MVN_BASE = "http://repo.maven.apache.org/maven2/";

private static final long KILO_RATION = 1024;
@@ -61,6 +66,7 @@ private Downloads() {
}

public static void main(final String[] args) {
Locale.setDefault(Locale.ENGLISH);

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

@@ -95,11 +101,39 @@ public static void main(final String[] args) {
}

return o1.url.compareTo(o2.url);
}).forEach(Downloads::printRow);
}).map(Downloads::toCentral).forEach(Downloads::printRow);
}

private static Download toCentral(final Download download) {
final Download dl = new Download(
normalizeName(download.name),
download.classifier,
download.version,
download.format,
download.url.replace(ASF_BASE, MVN_BASE),
download.sha1.replace(ASF_BASE, MVN_BASE),
download.asc.replace(ASF_BASE, MVN_BASE));
dl.date = download.date;
dl.size = download.size;
return dl;
}

private static String normalizeName(final String name) {
String out = name;
if (out.startsWith("Apache ")) {
out = out.substring("Apache ".length());
}
if (!out.startsWith("Geronimo")) {
out = "Geronimo " + out;
}
if (out.endsWith(" Impl")) {
out = out.substring(0, out.length() - " Impl".length());
}
return out;
}

private static void printRow(final Download d) {
System.out.println("|" + d.name.replace("Apache ", "") + (d.classifier.isEmpty() ? "" : (" " + d.classifier)) + "|"
System.out.println("|" + d.name + (d.classifier.isEmpty() ? "" : (" " + d.classifier)) + "|"
+ d.version + "|"
+ new SimpleDateFormat("d MMM yyyy")
.format(Date.from(LocalDateTime.parse(d.date, RFC_1123_DATE_TIME).toInstant(ZoneOffset.UTC)))
@@ -153,13 +187,13 @@ private static Stream<Download> toDownloadable(final Version version) {
private static Download toDownload(final String artifactId, final String classifier, final String version,
final String format, final String url) {
return new Download(
WordUtils.capitalize(artifactId.replace('-', ' ')).replace("Openejb", "OpenEJB").replace("Tomee", "TomEE"),
WordUtils.capitalize(artifactId.replace('-', ' ')),
classifier, version, format, url, url + ".sha1", url + ".asc");
}

private static Stream<Version> toVersions(final String baseUrl) {
final QuickMvnMetadataParser handler = new QuickMvnMetadataParser();
final String base = MVN_BASE + baseUrl;
final String base = ASF_BASE + baseUrl;
try (final InputStream stream = new URL(base + "/maven-metadata.xml").openStream()) {
final SAXParser parser = FACTORY.newSAXParser();
parser.parse(stream, handler);
@@ -7,23 +7,24 @@

|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 Config Impl|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 Config Impl|1.2|10 Jun 2018|70 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/config/geronimo-config-impl/1.2/geronimo-config-impl-1.2.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/config/geronimo-config-impl/1.2/geronimo-config-impl-1.2.jar.sha1[icon:download[] SHA1]
|Geronimo Config Impl|1.1|2 Jan 2018|59 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/config/geronimo-config-impl/1.1/geronimo-config-impl-1.1.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/config/geronimo-config-impl/1.1/geronimo-config-impl-1.1.jar.sha1[icon:download[] SHA1]
|Geronimo Config Impl|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 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 Config|1.2|10 Jun 2018|70 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/config/geronimo-config-impl/1.2/geronimo-config-impl-1.2.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/config/geronimo-config-impl/1.2/geronimo-config-impl-1.2.jar.sha1[icon:download[] SHA1]
|Geronimo Config|1.1|2 Jan 2018|59 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/config/geronimo-config-impl/1.1/geronimo-config-impl-1.1.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/config/geronimo-config-impl/1.1/geronimo-config-impl-1.1.jar.sha1[icon:download[] SHA1]
|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 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 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 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 Jwt Auth|1.0.0|13 Jun 2018|67 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-jwt-auth/1.0.0/geronimo-jwt-auth-1.0.0.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-jwt-auth/1.0.0/geronimo-jwt-auth-1.0.0.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 Metrics|1.0.1|17 Dec 2018|36 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-metrics/1.0.1/geronimo-metrics-1.0.1.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-metrics/1.0.1/geronimo-metrics-1.0.1.jar.sha1[icon:download[] SHA1]
|Geronimo Metrics|1.0.0|15 Jun 2018|73 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-metrics/1.0.0/geronimo-metrics-1.0.0.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/geronimo-metrics/1.0.0/geronimo-metrics-1.0.0.jar.sha1[icon:download[] SHA1]
|Geronimo Openapi Impl|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 Impl|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 Impl|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]
|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]
|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 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]
|Safeguard Impl|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]
|Safeguard Impl|1.0|6 Jan 2018|64 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/safeguard/safeguard-impl/1.0/safeguard-impl-1.0.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/safeguard/safeguard-impl/1.0/safeguard-impl-1.0.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]
|Geronimo Safeguard|1.0|6 Jan 2018|64 kB |JAR| http://repo.maven.apache.org/maven2/org/apache/geronimo/safeguard/safeguard-impl/1.0/safeguard-impl-1.0.jar[icon:download[] JAR] http://repo.maven.apache.org/maven2/org/apache/geronimo/safeguard/safeguard-impl/1.0/safeguard-impl-1.0.jar.sha1[icon:download[] SHA1]

|===

0 comments on commit 3ad0e96

Please sign in to comment.