Skip to content

Commit

Permalink
Merge pull request #5 from nlsfi/2.25.0
Browse files Browse the repository at this point in the history
2.25.0
  • Loading branch information
nls-jajuko authored Apr 11, 2024
2 parents 32665cb + 1cad33d commit 3b32318
Show file tree
Hide file tree
Showing 28 changed files with 2,304 additions and 2,303 deletions.
291 changes: 169 additions & 122 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,130 +1,177 @@
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.geoserver.extension</groupId>
<artifactId>gs-ogcfeat-datastore</artifactId>
<version>2.23.2</version>
<name>OGCFeat Datastore Module</name>
<description>A Geoserver datastore for reading GeoJSON based formats from a
OGCFeat service</description>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<gs.version>2.23.2</gs.version>
<gt.version>29.2</gt.version>
<junit.version>4.13.1</junit.version>
<easymock.version>5.2.0</easymock.version>
</properties>
<dependencyManagement>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.geoserver.extension</groupId>
<artifactId>gs-ogcfeat-datastore</artifactId>
<version>2.25.0</version>
<name>OGCFeat Datastore Module</name>
<description>A Geoserver datastore for reading GeoJSON based formats from a
OGCFeat service</description>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<gs.version>2.25.0</gs.version>
<gt.version>31.0</gt.version>
<junit.version>4.13.1</junit.version>
<easymock.version>5.2.0</easymock.version>
<cyclonedx.version>2.7.11</cyclonedx.version>
</properties>
<dependencyManagement>

</dependencyManagement>
<!-- For GeoTools -->
<repositories>
<repository>
<id>osgeo</id>
<name>OSGeo repository</name>
<url>https://repo.osgeo.org/repository/release/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-main</artifactId>
<version>${gt.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-http</artifactId>
<version>${gt.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-http-commons</artifactId>
<version>${gt.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geojson-core</artifactId>
<version>${gt.version}</version>
</dependency>
</dependencyManagement>
<!-- For GeoTools -->
<repositories>
<repository>
<id>osgeo</id>
<name>OSGeo repository</name>
<url>https://repo.osgeo.org/repository/release/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-main</artifactId>
<version>${gt.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-http</artifactId>
<version>${gt.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-http-commons</artifactId>
<version>${gt.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geojson-core</artifactId>
<version>${gt.version}</version>
</dependency>

<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>${gt.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>${gt.version}</version>
</dependency>

<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
<version>2.2.16</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
<version>2.2.16</version>
</dependency>


<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-sample-data</artifactId>
<version>${gt.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geoserver</groupId>
<artifactId>gs-platform</artifactId>
<version>${gs.version}</version>
</dependency>
<dependency>
<groupId>org.geoserver</groupId>
<artifactId>gs-main</artifactId>
<version>${gs.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-property</artifactId>
<version>${gt.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-sample-data</artifactId>
<version>${gt.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geoserver</groupId>
<artifactId>gs-platform</artifactId>
<version>${gs.version}</version>
</dependency>
<dependency>
<groupId>org.geoserver</groupId>
<artifactId>gs-main</artifactId>
<version>${gs.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-property</artifactId>
<version>${gt.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
<version>${easymock.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/libs
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>dependency-track</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
<version>${cyclonedx.version}</version>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
<executions>
<execution>
<id>cyclonedx-aggregate</id>
<phase>verify</phase>
<goals>
<goal>makeBom</goal>
</goals>
</execution>
</executions>
<configuration>
<includeCompileScope>true</includeCompileScope>
<includeProvidedScope>true</includeProvidedScope>
<includeRuntimeScope>true</includeRuntimeScope>
<includeSystemScope>true</includeSystemScope>
<includeTestScope>false</includeTestScope>
</configuration>
</plugin>
</plugins>


</build>
</profile>
</profiles>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
<version>${easymock.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/libs
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,33 @@
import org.geotools.util.logging.Logging;

/**
* A date parser that tries different formats for single dates, but not as loose as {@link
* org.geotools.util.DateTimeParser} (and does not support periods and list of times either). For
* reading GeoJSON, especially when guessing if a field is a date, we want some flexibility, without
* mis-guessing a date field.
* A date parser that tries different formats for single dates, but not as loose
* as {@link org.geotools.util.DateTimeParser} (and does not support periods and
* list of times either). For reading GeoJSON, especially when guessing if a
* field is a date, we want some flexibility, without mis-guessing a date field.
*/
class DateParser {

static final Logger LOGGER = Logging.getLogger(DateParser.class);

private static final String FULL_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSSX";
static final List<FastDateFormat> DEFAULT_FAST_DATE_FORMATS =
Arrays.asList(
FastDateFormat.getInstance(FULL_PATTERN, DEFAULT_TIME_ZONE),
FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS", DEFAULT_TIME_ZONE),
FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ssX", DEFAULT_TIME_ZONE),
FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss", DEFAULT_TIME_ZONE),
FastDateFormat.getInstance("yyyy-MM-ddX", DEFAULT_TIME_ZONE),
FastDateFormat.getInstance("yyyy-MM-dd", DEFAULT_TIME_ZONE));
static final List<FastDateFormat> DEFAULT_FAST_DATE_FORMATS = Arrays.asList(
FastDateFormat.getInstance(FULL_PATTERN, DEFAULT_TIME_ZONE),
FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS", DEFAULT_TIME_ZONE),
FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ssX", DEFAULT_TIME_ZONE),
FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss", DEFAULT_TIME_ZONE),
FastDateFormat.getInstance("yyyy-MM-ddX", DEFAULT_TIME_ZONE),
FastDateFormat.getInstance("yyyy-MM-dd", DEFAULT_TIME_ZONE));

List<FastDateFormat> formats = DEFAULT_FAST_DATE_FORMATS;

/**
* Sets the Timezone used to format the date fields. <code>null</code> is a valid value, the JVM
* local timezone will be used in that case.
* Sets the Timezone used to format the date fields. <code>null</code> is a
* valid value, the JVM local timezone will be used in that case.
*/
public void setTimeZone(TimeZone tz) {
this.formats =
formats.stream()
.map(f -> FastDateFormat.getInstance(f.getPattern(), tz))
.collect(Collectors.toList());
this.formats = formats.stream().map(f -> FastDateFormat.getInstance(f.getPattern(), tz))
.collect(Collectors.toList());
}

/** Returns the timezone used to format dates. Defaults to GMT. */
Expand All @@ -79,10 +76,8 @@ public TimeZone getTimeZone() {
public void setDatePattern(String... pattern) {
if (pattern == null || pattern.length == 0)
throw new IllegalArgumentException("Date patterns must be non null, and non empty");
this.formats =
Arrays.stream(pattern)
.map(p -> FastDateFormat.getInstance(p, getTimeZone()))
.collect(Collectors.toList());
this.formats = Arrays.stream(pattern).map(p -> FastDateFormat.getInstance(p, getTimeZone()))
.collect(Collectors.toList());
}

/** Returns the date formatter pattern. Defaults to DEFAULT_DATE_FORMAT */
Expand All @@ -91,8 +86,8 @@ public String[] getDatePatterns() {
}

/**
* Tries out the various date patterns and returns the result, or returns null if none could
* parse the date
* Tries out the various date patterns and returns the result, or returns null
* if none could parse the date
*/
public Date parse(String text) {
// is it a date with nanosecond precision? FastDateFormat cannot handle it
Expand Down Expand Up @@ -120,10 +115,7 @@ public Date parse(String text) {
return result;
} catch (NumberFormatException e) {
if (LOGGER.isLoggable(Level.FINEST))
LOGGER.log(
Level.FINEST,
"Failed to parse " + text + " using " + format.getPattern(),
e);
LOGGER.log(Level.FINEST, "Failed to parse " + text + " using " + format.getPattern(), e);
}
}
return null;
Expand Down
Loading

0 comments on commit 3b32318

Please sign in to comment.