Skip to content

Commit

Permalink
Merge branch 'release-2.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
charphi committed Apr 16, 2018
2 parents f1e9529 + 868e52f commit 6a495a5
Show file tree
Hide file tree
Showing 209 changed files with 10,590 additions and 3,889 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
/jwsacruncher/target/
/spreadsheet/*/target/
/demetra-tck/target/
/demetra-workspace/target/
/demetra-workspace/target/
/jdr/target
/jdr/nbproject/
2 changes: 1 addition & 1 deletion settings.xml → .travis.settings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>joinup-snapshots</id>
<id>oss-jfrog-artifactory</id>
<username>${env.CI_DEPLOY_USERNAME}</username>
<password>${env.CI_DEPLOY_PASSWORD}</password>
</server>
Expand Down
31 changes: 17 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
language: java
jdk:
- oraclejdk8
sudo: required

# Use latest JDK
addons:
apt:
packages:
- oracle-java8-installer

cache:
directories:
- $HOME/.m2

deploy:
provider: script
script: mvn deploy -Dmaven.test.skip -s settings.xml
skip_cleanup: true
on:
branch: develop
jdk: oraclejdk8
condition: $TRAVIS_PULL_REQUEST = "false"
# SNAPSHOTS from develop & jdk8
- provider: script
script: mvn deploy -Dmaven.test.skip -s .travis.settings.xml -P deploy-snapshots
skip_cleanup: true
on:
branch: develop
jdk: oraclejdk8
condition: $TRAVIS_PULL_REQUEST = "false"

# RELEASES from master & jdk8
- provider: script
script: mvn deploy -Dmaven.test.skip -s .travis.settings.xml -P deploy-releases
skip_cleanup: true
on:
branch: master
jdk: oraclejdk8
condition: $TRAVIS_PULL_REQUEST = "false"
2 changes: 1 addition & 1 deletion commonprovider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.europa.ec.joinup.sat</groupId>
<artifactId>demetra-parent</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
</parent>

<artifactId>demetra-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package ec.tss.tsproviders.common.xml;

import com.google.common.base.Throwables;
import com.google.common.io.Files;
import ec.tss.ITsProvider;
import ec.tss.TsAsyncMode;
Expand All @@ -30,16 +29,13 @@
import ec.tss.tsproviders.utils.OptionalTsData;
import ec.tss.tsproviders.utils.Params;
import ec.tss.tsproviders.utils.Parsers;
import ioutil.Jaxb;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import org.openide.util.lookup.ServiceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -52,15 +48,6 @@ public class XmlProvider extends AbstractFileLoader<wsTsWorkspace, XmlBean> {
static final IParam<DataSet, Integer> Y_COLLECTIONINDEX = Params.onInteger(-1, "collectionIndex");
static final IParam<DataSet, Integer> Z_SERIESINDEX = Params.onInteger(-1, "seriesIndex");
private static final Logger LOGGER = LoggerFactory.getLogger(XmlProvider.class);
final static JAXBContext CONTEXT;

static {
try {
CONTEXT = JAXBContext.newInstance(wsTsWorkspace.class);
} catch (JAXBException ex) {
throw Throwables.propagate(ex);
}
}

protected final Parsers.Parser<DataSource> legacyDataSourceParser;
protected final Parsers.Parser<DataSet> legacyDataSetParser;
Expand Down Expand Up @@ -97,12 +84,7 @@ public DataSource toDataSource(TsMoniker moniker) throws IllegalArgumentExceptio
protected wsTsWorkspace loadFromBean(XmlBean bean) throws IOException {
File file = getRealFile(bean.getFile());
String content = Files.toString(file, bean.getCharset()).replace("eu/tstoolkit:", "ec/tstoolkit.");
try {
Unmarshaller unmarshaller = CONTEXT.createUnmarshaller();
return (wsTsWorkspace) unmarshaller.unmarshal(new StringReader(content));
} catch (JAXBException ex) {
throw new IOException("Cannot parse xml content from file '" + file.getPath() + "'", ex);
}
return Jaxb.Parser.of(wsTsWorkspace.class).parseChars(content);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion demetra-tck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.europa.ec.joinup.sat</groupId>
<artifactId>demetra-parent</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
</parent>

<artifactId>demetra-tck</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion demetra-workspace/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.europa.ec.joinup.sat</groupId>
<artifactId>demetra-parent</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
</parent>

<artifactId>demetra-workspace</artifactId>
Expand Down
29 changes: 20 additions & 9 deletions demetra-workspace/src/main/java/internal/io/JaxbUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
*/
package internal.io;

import ioutil.IO;
import ioutil.Jaxb;
import ioutil.Xml;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -42,18 +44,27 @@ public class JaxbUtil {

@Nonnull
public Object unmarshal(@Nonnull Path file, @Nonnull JAXBContext context) throws JAXBException, IOException {
return unmarshal(file, context.createUnmarshaller());
try {
return Jaxb.Parser.of(context).parsePath(file);
} catch (Xml.WrappedException ex) {
Throwable cause = ex.getCause();
if (cause instanceof JAXBException) {
throw (JAXBException) cause;
}
throw ex;
}
}

@Nonnull
public Object unmarshal(@Nonnull Path file, @Nonnull Unmarshaller unmarshaller) throws JAXBException, IOException {
Optional<File> localFile = PathUtil.toLocalFile(file);
if (localFile.isPresent()) {
return unmarshaller.unmarshal(localFile.get());
} else {
try (Reader reader = Files.newBufferedReader(file)) {
return unmarshaller.unmarshal(reader);
try {
return Jaxb.Parser.builder().factory(() -> unmarshaller).build().parsePath(file);
} catch (Xml.WrappedException ex) {
Throwable cause = ex.getCause();
if (cause instanceof JAXBException) {
throw (JAXBException) cause;
}
throw ex;
}
}

Expand All @@ -64,7 +75,7 @@ public void marshal(@Nonnull Path file, @Nonnull JAXBContext context, @Nonnull O
}

public void marshal(@Nonnull Path file, @Nonnull Marshaller marshaller, @Nonnull Object jaxbElement) throws JAXBException, IOException {
Optional<File> localFile = PathUtil.toLocalFile(file);
Optional<File> localFile = IO.getFile(file);
if (localFile.isPresent()) {
marshaller.marshal(jaxbElement, localFile.get());
} else {
Expand Down
11 changes: 0 additions & 11 deletions demetra-workspace/src/main/java/internal/io/PathUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package internal.io;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
Expand All @@ -27,7 +26,6 @@
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Optional;
import java.util.function.Function;
import javax.annotation.Nonnull;

Expand All @@ -39,15 +37,6 @@
@lombok.experimental.UtilityClass
public class PathUtil {

@Nonnull
public Optional<File> toLocalFile(@Nonnull Path file) {
try {
return Optional.of(file.toFile());
} catch (UnsupportedOperationException ex) {
return Optional.empty();
}
}

@Nonnull
public Path get(URL url) {
try {
Expand Down
2 changes: 1 addition & 1 deletion jbench/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>eu.europa.ec.joinup.sat</groupId>
<artifactId>demetra-parent</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
</parent>

<artifactId>jbench</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jdbcprovider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.europa.ec.joinup.sat</groupId>
<artifactId>demetra-parent</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
</parent>

<artifactId>demetra-jdbc</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,9 @@
* Defines a function that creates a new object from the current ResultSet.
*
* @author Philippe Charles
* @param <T>
*/
public abstract class ResultSetFunc<T> implements DbUtil.Func<ResultSet, T, SQLException> {

@Nonnull
public static ResultSetFunc<String> onNull() {
return NullResultSetFunc.INSTANCE;
}

@Nonnull
public static ResultSetFunc<String> onGetString(final int columnIndex) {
return new ResultSetFunc<String>() {
Expand Down Expand Up @@ -105,16 +99,6 @@ public static ResultSetFunc<Number> onNumber(@Nonnull ResultSetMetaData metaData
return result != null ? result : compose(columnIndex, numberParser);
}

private static final class NullResultSetFunc extends ResultSetFunc<String> {

static final ResultSetFunc<String> INSTANCE = new NullResultSetFunc();

@Override
public String apply(ResultSet input) throws SQLException {
return null;
}
}

@Nullable
private static ResultSetFunc<java.util.Date> dateBySqlType(int columnType, final int columnIndex) {
switch (columnType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import ec.tss.tsproviders.jdbc.dsm.identification.aes.AESContentManager;
import ec.tss.tsproviders.jdbc.dsm.identification.aes.KeyGen;
import ec.tstoolkit.utilities.*;
import ioutil.Jaxb;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -35,7 +36,6 @@
import java.util.Set;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
Expand Down Expand Up @@ -86,9 +86,7 @@ public void load(final File path2file) {
}

try {
JAXBContext context = JAXBContext.newInstance(XmlDataSources.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
XmlDataSources root = (XmlDataSources) unmarshaller.unmarshal(path2file);
XmlDataSources root = Jaxb.Parser.of(XmlDataSources.class).parseFile(path2file);
for (XmlDataSource xmlProvider : root.dataSources) {
IManagedDataSource mds = new DefaultManagedDataSource(xmlProvider.provider, null);
mds.setName(xmlProvider.dbName);
Expand Down
56 changes: 56 additions & 0 deletions jdr/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.europa.ec.joinup.sat</groupId>
<artifactId>demetra-parent</artifactId>
<version>2.2.1</version>
</parent>

<artifactId>jdr</artifactId>
<name>JD for R</name>

<dependencies>
<!-- compile and runtime -->
<dependency>
<groupId>eu.europa.ec.joinup.sat</groupId>
<artifactId>demetra-tstoolkit</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<!-- test only -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>dependency</classpathPrefix>
<mainClass>ec.jbench.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit 6a495a5

Please sign in to comment.