Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jcheck: allow configurable census URL #785

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -240,6 +240,16 @@ public static int run(Repository repo, String[] args) throws IOException {
}

var endpoint = getOption("census", arguments);
if (endpoint == null) {
try {
var conf = JCheckConfiguration.from(repo, repo.head());
if (conf.isPresent()) {
endpoint = conf.get().census().url().toString();
}
} catch (IOException e) {
// pass
}
}
if (endpoint == null) {
endpoint = "https://openjdk.java.net/census.xml";
}
@@ -23,17 +23,20 @@
package org.openjdk.skara.jcheck;

import org.openjdk.skara.ini.Section;
import java.net.URI;

public class CensusConfiguration {
private static final CensusConfiguration DEFAULT =
new CensusConfiguration(0, "localhost");
new CensusConfiguration(0, "localhost", URI.create("https://openjdk.java.net/census.xml"));

private final int version;
private final String domain;
private final URI url;

CensusConfiguration(int version, String domain) {
CensusConfiguration(int version, String domain, URI url) {
this.version = version;
this.domain = domain;
this.url = url;
}

public int version() {
@@ -44,6 +47,10 @@ public String domain() {
return domain;
}

public URI url() {
return url;
}

static String name() {
return "census";
}
@@ -55,6 +62,7 @@ static CensusConfiguration parse(Section s) {

var version = s.get("version", DEFAULT.version());
var domain = s.get("domain", DEFAULT.domain());
return new CensusConfiguration(version, domain);
var url = s.get("url", DEFAULT.url().toString());
return new CensusConfiguration(version, domain, URI.create(url));
}
}