diff --git a/.classpath b/.classpath deleted file mode 100644 index fae1a2b..0000000 --- a/.classpath +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.settings/.gitignore b/.settings/.gitignore new file mode 100644 index 0000000..3b1537c --- /dev/null +++ b/.settings/.gitignore @@ -0,0 +1 @@ +/org.eclipse.jdt.core.prefs diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 714351a..0000000 --- a/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e51a61..195f775 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm # Changelog for org.gcube.data.transfer.sis-geotk-plugin +## [v1.2.0] 2020-09-07 +Upgrade to apache-sis 1.0 + ## [v1.1.3] 2020-09-07 ### Fixes diff --git a/pom.xml b/pom.xml index a67de5f..6fc8b0c 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,5 @@ - 4.0.0 @@ -8,14 +9,15 @@ org.gcube.data.transfer sis-geotk-plugin - 1.1.3 + 1.2.0 Sis/GeoToolkit plugin Apache Sis/Geotk plugin for data-transfer-service - 0.7 + 1.0 ${sis.version} https://code-repo.d4science.org/gCubeSystem + 5.3.3 @@ -30,14 +32,22 @@ org.gcube.distribution gcube-smartgears-bom - 2.0.0 + 2.1.0 pom import org.gcube.distribution gcube-bom - 2.0.0 + 2.0.1 + pom + import + + + + org.apache.sis + storage + 1.0 pom import @@ -48,7 +58,7 @@ org.gcube.data.transfer data-transfer-plugin-framework - [1.0.2,2.0.0-SNAPSHOT) + [1.0.2,2.0.0) @@ -69,7 +79,7 @@ org.gcube.spatial.data sdi-library - [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + [1.0.0,2.0.0) @@ -96,6 +106,43 @@ sis-netcdf ${sis.utils.modules} + + org.apache.sis.storage + sis-earth-observation + ${sis.utils.modules} + + + org.apache.sis.storage + sis-geotiff + ${sis.utils.modules} + + + + + + + com.esri.geometry + esri-geometry-api + + + + + edu.ucar + cdm + + + + + + + org.apache.sis.non-free + sis-embedded-data + ${sis.version} + runtime + + + + @@ -107,7 +154,6 @@ junit junit - 4.12 test @@ -117,11 +163,29 @@ test + + org.opengis + geoapi-conformance + test + + + + + + unidata-all + Unidata All + + https://nexus.d4science.org/nexus/content/repositories/unidata/ + + + + + - + org.apache.maven.plugins maven-assembly-plugin diff --git a/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java b/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java index 7f2980e..547b275 100644 --- a/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java +++ b/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java @@ -2,12 +2,11 @@ package org.gcube.data.transfer.plugins.sis; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.net.MalformedURLException; +import java.net.URL; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.security.MessageDigest; @@ -15,54 +14,117 @@ import java.security.NoSuchAlgorithmException; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.UnsupportedStorageException; -import org.gcube.data.transfer.model.TransferTicket.Status; import org.gcube.data.transfer.plugins.thredds.sis.SisPlugin; public class TestGetMetadata { public static void main(String[] args) throws UnsupportedStorageException, DataStoreException, IOException, NoSuchAlgorithmException { + String[] toCheckFiles=new String[] { + + + // ********** HDF - NETCDF 4 + "/Users/FabioISTI/Downloads/NASA_Precipitations_1950_2100_rcp45.nc", + + "https://thredds.d4science.org/thredds/fileServer/public/netcdf/ClimateChange/NASA_Precipitations_1950_2100_rcp45.nc", + "https://thredds.d4science.org/thredds/fileServer/public/netcdf/ClimateChange/NASA_Precipitations_1950_2100_rcp85.nc", + "https://thredds.d4science.org/thredds/fileServer/public/netcdf/ClimateChange/NASA_Surface_Air_Temperature_1950_2100_rcp45.nc", + "https://thredds.d4science.org/thredds/fileServer/public/netcdf/ClimateChange/NASA_Surface_Air_Temperature_1950_2100_rcp85.nc", + "https://thredds.d4science.org/thredds/fileServer/public/netcdf/ClimateChange/hcaf_v6_1950_2100.nc", + + + // *********** NETCDF 3 + + "/Users/FabioISTI/Downloads/Aaptos_aaptos.nc" + }; - File temp=File.createTempFile("temp", ".temp"); - File original=new File("/home/fabio/Downloads/oscar_vel2011_180.nc"); - File copied=File.createTempFile("copied", ".nc"); - transferStream(new FileInputStream(original),new FileOutputStream(temp)); - System.out.println("copied. Moving.."); + for(String f:toCheckFiles) { + System.out.println("checking "+f); + try{ + check(false,f); + }catch(UnsupportedStorageException e) { + System.err.println(e.getMessage()); +// System.out.println("Trying opening "+f+" manually"); +// open(f); + } + } + System.out.println("Done"); + } + + +// private static void open(String path) throws IOException, UnsupportedStorageException, DataStoreException { +// System.out.println("Opening "+path); +// NetcdfFile f=NetcdfFiles.open(path); +// System.out.println(f.getFileTypeDescription()+"\t"+f.getFileTypeId()); +// +// +// NetcdfDataset ncDs=NetcdfDatasets.openDataset(path); +//// NcMLReaderNew. +//// +// System.out.println(ncDs.getFileTypeDescription()+"\t"+ncDs.getFileTypeId()); +// +//// NetcdfDatasets.openFile(path,null); +// +// +// } + + + private static void check(boolean checkCopy,String src) throws UnsupportedStorageException, DataStoreException, IOException, NoSuchAlgorithmException { + + File original=new File(src); - System.out.println("Checksum original : "+getChecksum(original)); - System.out.println("Checksum temp : "+getChecksum(temp)); + File dataset=original; + if(checkCopy) { + File temp=File.createTempFile("temp", ".temp"); + File copied=File.createTempFile("copied", ".nc"); + transferStream(new FileInputStream(original),new FileOutputStream(temp)); + System.out.println("copied. Moving.."); + + System.out.println("Checksum original : "+getChecksum(original)); + System.out.println("Checksum temp : "+getChecksum(temp)); + + + + Files.move(temp.toPath(), copied.toPath(),StandardCopyOption.ATOMIC_MOVE,StandardCopyOption.REPLACE_EXISTING); + if(copied.length()