Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
charphi committed Sep 13, 2021
2 parents a66d1eb + 7025b80 commit 2518f11
Show file tree
Hide file tree
Showing 146 changed files with 4,462 additions and 1,887 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/java8-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ jobs:
SIGN_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
SIGN_KEY_PASS: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Dryrun release assets with Maven
run: mvn -B -ntp install -DskipTests=true -P full-release -Djreleaser.dryrun=true
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

release-job:
needs: build-and-test-job
if: startsWith(github.repository, 'nbbrd/') && startsWith(github.ref, 'refs/tags/v')
Expand Down Expand Up @@ -116,18 +124,10 @@ jobs:
SIGN_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
SIGN_KEY_PASS: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Build assets with Maven
run: mvn -B -ntp install -DskipTests=true -P base-deploy
env:
SIGN_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
SIGN_KEY_PASS: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Create dummy file if no assets
run: test -d "binaries" || (mkdir binaries && echo "no assets" > binaries/no_assets.txt)

- name: Create draft release and upload assets
uses: xresloader/upload-to-github-release@v1
- name: Release assets with Maven
run: mvn -B -ntp install -DskipTests=true -P full-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: 'binaries/*'
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
86 changes: 86 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [3.0.0-beta.3] - 2021-09-13

This is the third beta release of **sdmx-dl**.
sdmx-dl follows [semantic versioning](http://semver.org/).

_Note that sdmx-dl is still in heavy development and might change a lot between versions so you shouldn't use it in production._

This release adds new sources and improves feedback on request parameters such as Key and Flow.
The CLI binary is now available in some popular package managers.
Finally, sdmx-dl advertises itself on web queries with the user-agent `sdmx-dl/3.0.0-beta.3`.

### Added
- Add support of multiple media-types in HTTP request header (RI)
- Add support of media-type charset in HTTP response header (RI)
- Add response event `#onSuccess(MediaType)` (RI)
- Add default user-agent `sdmx-dl/version` (RI) [#117](https://github.com/nbbrd/sdmx-dl/issues/117)
- Add source from Bundesbank [#104](https://github.com/nbbrd/sdmx-dl/issues/104)
- Add source from Economic and Social Commission for Asia and the Pacific [#99](https://github.com/nbbrd/sdmx-dl/issues/99)
- Add source from National Statistical Institute of Cambodia [#98](https://github.com/nbbrd/sdmx-dl/issues/98)
- Add source from SDMX Global Registry [#97](https://github.com/nbbrd/sdmx-dl/issues/97)
- Add source from Pacific Data Hub [#96](https://github.com/nbbrd/sdmx-dl/issues/96)
- Add source from UK Data Service [#93](https://github.com/nbbrd/sdmx-dl/issues/93)
- Add distribution to Scoop (Windows) [#83](https://github.com/nbbrd/sdmx-dl/issues/83)
- Add distribution to Homebrew (macOS & Linux) [#84](https://github.com/nbbrd/sdmx-dl/issues/84)

### Changed
- Enforce https on ABS source [#108](https://github.com/nbbrd/sdmx-dl/issues/108)
- Improve CLI version option [#79](https://github.com/nbbrd/sdmx-dl/issues/79)
- Refactor SdmxWebAuthenticator as an SPI
- Improve feedback on missing data flow [#123](https://github.com/nbbrd/sdmx-dl/issues/123)

### Fixed
- Fix parsing of blank labels
- Update ILO source with new endpoint [#107](https://github.com/nbbrd/sdmx-dl/issues/107)
- Fix key parsing when time dimension is not last in data structure [#110](https://github.com/nbbrd/sdmx-dl/issues/110)
- Fix key validity check on input [#118](https://github.com/nbbrd/sdmx-dl/issues/118)
- Fix parsing of media types in SDMX21 driver

## [3.0.0-beta.2] - 2021-05-03

This is the second beta release of **sdmx-dl**.
sdmx-dl follows [semantic versioning](http://semver.org/).

_Note that sdmx-dl is still in heavy development and might change a lot between versions so you shouldn't use it in production._

This release adds new sources, the support of attributes and modify the CLI commands.
These command modifications are quite extended and concern [command names, overall structure and output](https://github.com/nbbrd/sdmx-dl/wiki/cli-usage).

### Added
- Add FileDriver to allow demo data
- Add initial support of native image
- Add file reading feedback
- Improve file performance in worst-case scenarios
- Add source from Bank for International Settlements (BIS)
- Add source from Norges Bank (NB)
- Add web service endpoint monitoring
- Add reading of attributes
- Add library deployment to Maven Central
- Add GPG signature of binaries
- Add [basic documentation](https://github.com/nbbrd/sdmx-dl/wiki/)

### Changed
- Modify CLI [command name, structure and output](https://github.com/nbbrd/sdmx-dl/wiki/cli-usage)

## [3.0.0-beta.1] - 2020-09-25

This is the first beta release of **sdmx-dl**.
sdmx-dl follows [semantic versioning](http://semver.org/).

_Note that sdmx-dl is still in heavy development and might change a lot between versions so you shouldn't use it in production._

### Added
- Initial release

[Unreleased]: https://github.com/nbbrd/sdmx-dl/compare/v3.0.0-beta.3...HEAD
[3.0.0-beta.3]: https://github.com/nbbrd/sdmx-dl/compare/v3.0.0-beta.2...v3.0.0-beta.3
[3.0.0-beta.2]: https://github.com/nbbrd/sdmx-dl/compare/v3.0.0-beta.1...v3.0.0-beta.2
[3.0.0-beta.1]: https://github.com/nbbrd/sdmx-dl/releases/tag/v3.0.0-beta.1
21 changes: 11 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@

<groupId>com.github.nbbrd.sdmx-dl</groupId>
<artifactId>sdmx-dl-parent</artifactId>
<version>3.0.0-beta.2</version>
<version>3.0.0-beta.3</version>
<packaging>pom</packaging>

<name>sdmx-dl</name>
<description>Download data from remote SDMX servers</description>
<url>https://github.com/nbbrd/sdmx-dl</url>
<inceptionYear>2020</inceptionYear>

<licenses>
<license>
Expand All @@ -35,7 +36,8 @@
</scm>

<properties>
<java-io-util.version>0.0.12</java-io-util.version>
<java-io-util.version>0.0.14</java-io-util.version>
<slf4j.version>1.7.32</slf4j.version>
</properties>

<dependencyManagement>
Expand All @@ -44,7 +46,7 @@
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>3.12.0</version>
<version>3.18.0</version>
</dependency>

<!-- test libraries -->
Expand All @@ -56,7 +58,7 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.19.0</version>
<version>3.20.2</version>
</dependency>

<!-- dependencies -->
Expand Down Expand Up @@ -92,7 +94,6 @@
<module>sdmx-dl-provider-ri</module>
<module>sdmx-dl-provider-connectors</module>
<module>sdmx-dl-kryo</module>
<module>sdmx-dl-sys</module>
<module>sdmx-dl-testing</module>
</modules>

Expand Down Expand Up @@ -149,7 +150,7 @@
</activation>
<properties>
<lombok.version>1.18.20</lombok.version>
<java-service.version>1.3.2</java-service.version>
<java-service.version>1.4.0</java-service.version>
<java-design.version>1.1.3</java-design.version>
<picocli.version>4.6.1</picocli.version>
</properties>
Expand Down Expand Up @@ -313,7 +314,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>org.kordamp.maven</groupId>
Expand Down Expand Up @@ -363,7 +364,7 @@
<plugin>
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<configuration>
<javaVersion>1.8</javaVersion>
</configuration>
Expand Down Expand Up @@ -395,7 +396,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<version>0.8.7</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -460,7 +461,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-empty-javadocs</id>
Expand Down
2 changes: 1 addition & 1 deletion sdmx-dl-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.nbbrd.sdmx-dl</groupId>
<artifactId>sdmx-dl-parent</artifactId>
<version>3.0.0-beta.2</version>
<version>3.0.0-beta.3</version>
</parent>

<artifactId>sdmx-dl-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void onFileSourceEvent(@NonNull SdmxFileSource source, @NonNull String me
onFile.accept(source, message);
}

@SuppressWarnings("EmptyMethod")
private static void doNothing(Object source, Object message) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
/**
* @author Philippe Charles
*/
@SuppressWarnings("ConstantConditions")
@lombok.extern.java.Log
@lombok.AllArgsConstructor(access = AccessLevel.PACKAGE)
final class FailsafeSdmxWebConnection implements SdmxWebConnection {
Expand Down
4 changes: 2 additions & 2 deletions sdmx-dl-api/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sdmxdl.web.spi.SdmxWebMonitoring;

module sdmxdl.api {

Expand All @@ -18,8 +17,9 @@
exports sdmxdl.web;
exports sdmxdl.web.spi;

uses SdmxWebMonitoring;
uses sdmxdl.ext.spi.SdmxDialect;
uses sdmxdl.file.spi.SdmxFileReader;
uses sdmxdl.web.spi.SdmxWebAuthenticator;
uses sdmxdl.web.spi.SdmxWebDriver;
uses sdmxdl.web.spi.SdmxWebMonitoring;
}
23 changes: 23 additions & 0 deletions sdmx-dl-api/src/main/java/sdmxdl/About.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package sdmxdl;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public final class About {

public static final String NAME = "sdmx-dl";

public static final String VERSION = loadVersion();

private static String loadVersion() {
Properties properties = new Properties();
try (InputStream stream = About.class.getResourceAsStream("/META-INF/maven/com.github.nbbrd.sdmx-dl/sdmx-dl-api/pom.properties")) {
if (stream != null) {
properties.load(stream);
}
} catch (IOException ex) {
}
return properties.getProperty("version", "unknown");
}
}
2 changes: 1 addition & 1 deletion sdmx-dl-api/src/main/java/sdmxdl/Frequency.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public boolean hasTime() {
public static Frequency getHighest(Collection<Series> data) {
return data.stream()
.map(Series::getFreq)
.min(Comparator.reverseOrder())
.max(Comparator.naturalOrder())
.orElse(Frequency.UNDEFINED);
}
}
52 changes: 42 additions & 10 deletions sdmx-dl-api/src/main/java/sdmxdl/Key.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;

/**
* Parameter that defines the dimension values of the data to be returned.
Expand Down Expand Up @@ -109,6 +107,36 @@ public boolean supersedes(@NonNull Key that) {
return !equals(that) && contains(that);
}

@Nullable
public String validateOn(@NonNull DataStructure dsd) {
if (this == ALL) {
return null;
}

if (dsd.getDimensions().size() != size()) {
return "Expected " + dsd.getDimensions().size() + " dimensions instead of " + size();
}

Dimension[] dimensions = dsd
.getDimensions()
.stream()
.sorted(Comparator.comparingInt(Dimension::getPosition))
.toArray(Dimension[]::new);

for (int i = 0; i < dimensions.length; i++) {
Dimension dimension = dimensions[i];
if (dimension.isCoded()) {
for (String code : Chars.splitToArray(get(i), OR_CHAR)) {
if (!isWildcardCode(code) && !dimension.getCodes().containsKey(code)) {
return "Unknown code '" + code + "' for dimension '" + dimension.getId() + "'";
}
}
}
}

return null;
}

@Override
public String toString() {
return formatToString(items);
Expand Down Expand Up @@ -169,16 +197,20 @@ public static Key of(@NonNull String... input) {

@NonNull
public static Builder builder(@NonNull DataStructure dfs) {
Map<String, Integer> index = new HashMap<>();
dfs.getDimensions().forEach(o -> index.put(o.getId(), o.getPosition() - 1));
return new Builder(index);
return builder(dfs
.getDimensions()
.stream()
.sorted(Comparator.comparingInt(Dimension::getPosition))
.map(Dimension::getId)
.collect(Collectors.toList())
);
}

@NonNull
public static Builder builder(@NonNull String... dimensions) {
public static Builder builder(@NonNull List<String> dimensionNames) {
Map<String, Integer> index = new HashMap<>();
for (int i = 0; i < dimensions.length; i++) {
index.put(dimensions[i], i);
for (int i = 0; i < dimensionNames.size(); i++) {
index.put(dimensionNames.get(i), i);
}
return new Builder(index);
}
Expand Down
Loading

0 comments on commit 2518f11

Please sign in to comment.