Skip to content

Commit

Permalink
Back to Java 8 for releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
herrtunante committed Jun 22, 2023
1 parent 3e28a3e commit 271f55a
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 8 deletions.
3 changes: 1 addition & 2 deletions collect-earth/collect-earth-app/pom.xml
Expand Up @@ -11,7 +11,7 @@
<packaging>jar</packaging>

<properties>
<jetty.version>11.0.15</jetty.version>
<jetty.version>9.4.44.v20210927</jetty.version>
<selenium.version>4.9.1</selenium.version>
<classpath.prefix>earth-libs</classpath.prefix>
<log4j.version>2.20.0</log4j.version>
Expand Down Expand Up @@ -57,7 +57,6 @@
<artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
</dependency>

<dependency>
<groupId>org.openforis.collect</groupId>
<artifactId>collect-rdb</artifactId>
Expand Down
Expand Up @@ -10,8 +10,6 @@
import java.util.Observable;
import java.util.Observer;

import javax.servlet.ServletContext;

import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
Expand Down Expand Up @@ -76,7 +74,7 @@ public String toString() {
public WebApplicationContext getContext() {
WebApplicationContext webApplicationContext = null;
try {
webApplicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext((ServletContext) getRoot().getServletContext());
webApplicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(getRoot().getServletContext());
} catch (Exception e) {
logger.error("Error getting web application context", e); //$NON-NLS-1$
}
Expand Down Expand Up @@ -218,7 +216,7 @@ public void startServer(Observer observeInitialization) throws Exception {

connector.setPort(getPort());

//connector.setStopTimeout(1000); Change to setIdleTimeout ??
connector.setStopTimeout(1000);

server.setConnectors(new Connector[] { connector });

Expand Down
2 changes: 1 addition & 1 deletion collect-earth/collect-earth-grid/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.openforis.collect.earth</groupId>
<artifactId>collect-earth</artifactId>
<version>1.16.1-SNAPSHOT</version>
<version>1.16.3-SNAPSHOT</version>
</parent>

<artifactId>collect-earth-grid</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion collect-earth/collect-earth-installer/pom.xml
Expand Up @@ -16,7 +16,7 @@
<installer-build-path>${project.build.directory}/installer</installer-build-path>
<installbuilder-file-name>CollectEarthWithSaiku.xml</installbuilder-file-name>
<installbuilder-file-name-updater>CollectEarthUpdater.xml</installbuilder-file-name-updater>
<jre.version>20.0.1+9</jre.version>
<jre.version>1.8.0_232</jre.version>
<!-- installer file names -->
<windows-installer-file-name>CollectEarth-${project.version}-windows-installer.exe</windows-installer-file-name>
<linux-x64-installer-file-name>CollectEarth-${project.version}-linux-x64-installer.run</linux-x64-installer-file-name>
Expand Down
@@ -0,0 +1,60 @@
package org.openforis.collect.earth.sampler.adhoc;

import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.List;

import org.openforis.collect.earth.core.utils.CsvReaderUtils;
import org.openforis.collect.earth.sampler.utils.CoordinateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.opencsv.CSVReader;
import com.opencsv.CSVWriter;

public class UruguayDisplacedPoints {


public static void main(String[] args) {

Logger logger = LoggerFactory.getLogger( UruguayDisplacedPoints.class );
File fileToDivide = new File("C:/temp/urugua2.csv");
if( !fileToDivide.exists() ){
throw new IllegalArgumentException("The file selected does not exist");
}

try (
FileWriter fw = new FileWriter( new File("C:/temp/modified2.csv") );
CSVWriter writer = new CSVWriter( fw );
CSVReader reader = CsvReaderUtils.getCsvReader(fileToDivide.getPath(), false, true );
){

List<String[]> modified = new ArrayList<>();

// read first line
String[] csvRow;

// First divide the lines into the files by column ( or a single file if the user chose not to divide using a column)
while ((csvRow = reader.readNext()) != null ) {

Double yCoordinate = Double.parseDouble( csvRow[1] );
Double xCoordinate = Double.parseDouble( csvRow[2] );

double[] pointWithOffset = CoordinateUtils.getPointWithOffset( new double[]{ yCoordinate, xCoordinate }, 1500, 1500);

csvRow[1] = Double.toString( pointWithOffset[0] );
csvRow[2] = Double.toString( pointWithOffset[1] );

modified.add( csvRow );
}

for (String[] row : modified) {
writer.writeNext(row);
}

} catch (Exception e) {
logger.error("Error processing CSV file", e);
}
}
}

0 comments on commit 271f55a

Please sign in to comment.