Skip to content

Commit

Permalink
Revert "Merge pull request #268 from spyrkob/mvn_verify"
Browse files Browse the repository at this point in the history
This reverts commit 52c9d15, reversing
changes made to 63a1a95.
  • Loading branch information
jmesnil committed Jan 6, 2025
1 parent 52c9d15 commit 1efd15f
Show file tree
Hide file tree
Showing 31 changed files with 76 additions and 2,281 deletions.
53 changes: 5 additions & 48 deletions core/src/main/java/org/wildfly/channel/Channel.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ public class Channel {
private BlocklistCoordinate blocklistCoordinate;
private ChannelManifestCoordinate manifestCoordinate;
private NoStreamStrategy noStreamStrategy = NoStreamStrategy.NONE;
private Boolean gpgCheck;
private List<String> gpgUrls;

// no-arg constructor for maven plugins
public Channel() {
Expand All @@ -58,7 +56,7 @@ public Channel() {
/**
* Representation of a Channel resource using the current schema version.
*
* @see #Channel(String, String, String, Vendor, List, ChannelManifestCoordinate, BlocklistCoordinate, NoStreamStrategy, Boolean, String)
* @see #Channel(String, String, String, Vendor, List, ChannelManifestCoordinate, BlocklistCoordinate, NoStreamStrategy)
*/
public Channel(String name,
String description,
Expand All @@ -74,8 +72,7 @@ public Channel(String name,
repositories,
manifestCoordinate,
blocklistCoordinate,
noStreamStrategy,
null, null);
noStreamStrategy);
}

@JsonCreator
Expand All @@ -87,9 +84,7 @@ public Channel(@JsonProperty(value = "schemaVersion", required = true) String sc
@JsonInclude(NON_EMPTY) List<Repository> repositories,
@JsonProperty(value = "manifest") ChannelManifestCoordinate manifestCoordinate,
@JsonProperty(value = "blocklist") @JsonInclude(NON_EMPTY) BlocklistCoordinate blocklistCoordinate,
@JsonProperty(value = "resolve-if-no-stream") NoStreamStrategy noStreamStrategy,
@JsonProperty(value = "gpg-check") Boolean gpgCheck,
@JsonProperty(value = "gpg-urls") List<String> gpgUrls) {
@JsonProperty(value = "resolve-if-no-stream") NoStreamStrategy noStreamStrategy) {
this.schemaVersion = schemaVersion;
this.name = name;
this.description = description;
Expand All @@ -98,8 +93,6 @@ public Channel(@JsonProperty(value = "schemaVersion", required = true) String sc
this.blocklistCoordinate = blocklistCoordinate;
this.manifestCoordinate = manifestCoordinate;
this.noStreamStrategy = (noStreamStrategy != null) ? noStreamStrategy: NoStreamStrategy.NONE;
this.gpgCheck = gpgCheck;
this.gpgUrls = (gpgUrls != null) ? gpgUrls : emptyList();
}

public String getSchemaVersion() {
Expand Down Expand Up @@ -144,25 +137,6 @@ public NoStreamStrategy getNoStreamStrategy() {
return noStreamStrategy;
}

// using a private method to return a Boolean for serializing
// this way channels without gpg-check field can be read/written without modifications
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("gpg-check")
private Boolean _isGpgCheck() {
return gpgCheck;
}

@JsonIgnore
public boolean isGpgCheck() {
return gpgCheck!=null?gpgCheck:false;
}

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("gpg-urls")
public List<String> getGpgUrls() {
return gpgUrls;
}

/**
* Strategies for resolving artifact versions if it is not listed in streams.
* <ul>
Expand Down Expand Up @@ -223,26 +197,22 @@ public static class Builder {
private NoStreamStrategy strategy;
private String description;
private Vendor vendor;
private Boolean gpgCheck;
private List<String> gpgUrls;

public Builder() {
}

public Builder(Channel from) {
this.name = from.getName();
this.repositories = from.getRepositories() == null ? null : new ArrayList<>(from.getRepositories());
this.repositories = new ArrayList<>(from.getRepositories());
this.manifestCoordinate = from.getManifestCoordinate();
this.blocklistCoordinate = from.getBlocklistCoordinate();
this.strategy = from.getNoStreamStrategy();
this.description = from.getDescription();
this.vendor = from.getVendor();
this.gpgCheck = from._isGpgCheck();
this.gpgUrls = from.getGpgUrls() == null ? null : new ArrayList<>(from.getGpgUrls());
}

public Channel build() {
return new Channel(ChannelMapper.CURRENT_SCHEMA_VERSION, name, description, vendor, repositories, manifestCoordinate, blocklistCoordinate, strategy, gpgCheck, gpgUrls);
return new Channel(name, description, vendor, repositories, manifestCoordinate, blocklistCoordinate, strategy);
}

public Builder setName(String name) {
Expand Down Expand Up @@ -308,18 +278,5 @@ public Builder setResolveStrategy(NoStreamStrategy strategy) {
this.strategy = strategy;
return this;
}

public Builder setGpgCheck(boolean gpgCheck) {
this.gpgCheck = gpgCheck;
return this;
}

public Builder addGpgUrl(String gpgUrl) {
if (this.gpgUrls == null) {
this.gpgUrls = new ArrayList<>();
}
this.gpgUrls.add(gpgUrl);
return this;
}
}
}
15 changes: 4 additions & 11 deletions core/src/main/java/org/wildfly/channel/ChannelImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void init(MavenVersionsResolver.Factory factory, List<ChannelImpl> channels) {
return;
}

resolver = factory.create(channelDefinition);
resolver = factory.create(channelDefinition.getRepositories());

final Channel.Builder resolvedChannelBuilder = new Channel.Builder(channelDefinition);
if (channelDefinition.getManifestCoordinate() != null) {
Expand Down Expand Up @@ -149,16 +149,9 @@ private ChannelImpl createNewChannelFromMaven(MavenVersionsResolver.Factory fact
version = latest.orElseThrow(() -> new RuntimeException(String.format("Can not determine the latest version for Maven artifact %s:%s:%s:%s",
groupId, artifactId, ChannelManifest.EXTENSION, ChannelManifest.CLASSIFIER)));
}
final Channel requiredChannelDefinition = new Channel.Builder(channelDefinition)
.setName(null)
.setDescription(null)
.setVendor(null)
.setManifestCoordinate(groupId, artifactId, version)
.setResolveStrategy(Channel.NoStreamStrategy.NONE)
.build();

final ChannelImpl requiredChannel = new ChannelImpl(requiredChannelDefinition);

final ChannelImpl requiredChannel = new ChannelImpl(new Channel(null, null, null, channelDefinition.getRepositories(),
new ChannelManifestCoordinate(groupId, artifactId, version), null,
Channel.NoStreamStrategy.NONE));
try {
requiredChannel.init(factory, channels);
} catch (UnresolvedMavenArtifactException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,20 @@ public ChannelManifestCoordinate(URL url) {
super(url);
}

public ChannelManifestCoordinate(URL url, URL signatureUrl) {
super(url, signatureUrl);
}

public ChannelManifestCoordinate() {
super(ChannelManifest.CLASSIFIER, ChannelManifest.EXTENSION);
}

public static ChannelManifestCoordinate create(String url,
MavenCoordinate gav) throws MalformedURLException {
return create(url, null, gav);
}

@JsonCreator
public static ChannelManifestCoordinate create(@JsonProperty(value = "url") String url,
@JsonProperty(value = "signature-url") String signatureUrl,
@JsonProperty(value = "maven") MavenCoordinate gav) throws MalformedURLException {
public static ChannelManifestCoordinate create(@JsonProperty(value = "url") String url, @JsonProperty(value = "maven") MavenCoordinate gav) throws MalformedURLException {
if (gav != null) {
if (gav.getVersion() == null || gav.getVersion().isEmpty()) {
return new ChannelManifestCoordinate(gav.getGroupId(), gav.getArtifactId());
} else {
return new ChannelManifestCoordinate(gav.getGroupId(), gav.getArtifactId(), gav.getVersion());
}
} else {
return new ChannelManifestCoordinate(new URL(url), signatureUrl == null ? null : new URL(signatureUrl));
return new ChannelManifestCoordinate(new URL(url));
}
}

Expand All @@ -92,10 +81,4 @@ private boolean isEmpty(String text) {
public URL getUrl() {
return super.getUrl();
}

@JsonProperty(value = "signature-url")
@JsonInclude(NON_NULL)
public URL getSignatureUrl() {
return super.getSignatureUrl();
}
}
5 changes: 1 addition & 4 deletions core/src/main/java/org/wildfly/channel/ChannelMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@ public class ChannelMapper {

public static final String SCHEMA_VERSION_1_0_0 = "1.0.0";
public static final String SCHEMA_VERSION_2_0_0 = "2.0.0";
public static final String SCHEMA_VERSION_2_1_0 = "2.1.0";
public static final String CURRENT_SCHEMA_VERSION = SCHEMA_VERSION_2_1_0;
public static final String CURRENT_SCHEMA_VERSION = SCHEMA_VERSION_2_0_0;

private static final String SCHEMA_1_0_0_FILE = "org/wildfly/channel/v1.0.0/schema.json";
private static final String SCHEMA_2_0_0_FILE = "org/wildfly/channel/v2.0.0/schema.json";
private static final String SCHEMA_2_1_0_FILE = "org/wildfly/channel/v2.1.0/schema.json";
private static final YAMLFactory YAML_FACTORY = new YAMLFactory()
.configure(YAMLGenerator.Feature.INDENT_ARRAYS_WITH_INDICATOR, true);
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(YAML_FACTORY)
Expand All @@ -73,7 +71,6 @@ public class ChannelMapper {
}
SCHEMAS.put(SCHEMA_VERSION_1_0_0, SCHEMA_FACTORY.getSchema(ChannelMapper.class.getClassLoader().getResourceAsStream(SCHEMA_1_0_0_FILE)));
SCHEMAS.put(SCHEMA_VERSION_2_0_0, SCHEMA_FACTORY.getSchema(ChannelMapper.class.getClassLoader().getResourceAsStream(SCHEMA_2_0_0_FILE)));
SCHEMAS.put(SCHEMA_VERSION_2_1_0, SCHEMA_FACTORY.getSchema(ChannelMapper.class.getClassLoader().getResourceAsStream(SCHEMA_2_1_0_FILE)));
}

private static JsonSchema getSchema(JsonNode node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class ChannelMetadataCoordinate {
private String extension;

private URL url;
protected URL signatureUrl;

protected ChannelMetadataCoordinate() {
}
Expand All @@ -58,12 +57,6 @@ public ChannelMetadataCoordinate(URL url) {
requireNonNull(url);
}

public ChannelMetadataCoordinate(URL url, URL signatureUrl) {
this(null, null, null, null, null, url);
requireNonNull(url);
this.signatureUrl = signatureUrl;
}

private ChannelMetadataCoordinate(String groupId, String artifactId, String version, String classifier, String extension, URL url) {
this.groupId = groupId;
this.artifactId = artifactId;
Expand Down Expand Up @@ -101,10 +94,6 @@ public String getExtension() {
return extension;
}

public URL getSignatureUrl() {
return signatureUrl;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Loading

0 comments on commit 1efd15f

Please sign in to comment.