Skip to content

Commit

Permalink
GEOMESA-3397 Upgrade to GeoTools 32.0 and GeoServer 2.26.0 (#3187)
Browse files Browse the repository at this point in the history
  • Loading branch information
elahrvivaz authored Oct 8, 2024
1 parent e966d4d commit 7f062f8
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 71 deletions.
128 changes: 64 additions & 64 deletions build/cqs.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -97,45 +97,45 @@ io.prometheus:simpleclient_tracer_common 0.16.0 compile
io.prometheus:simpleclient_tracer_otel 0.16.0 compile
io.prometheus:simpleclient_tracer_otel_agent 0.16.0 compile
io.sgr:s2-geometry-library-java 1.0.1 compile
it.geosolutions.jaiext.affine:jt-affine 1.1.24 compile
it.geosolutions.jaiext.algebra:jt-algebra 1.1.24 compile
it.geosolutions.jaiext.bandcombine:jt-bandcombine 1.1.24 compile
it.geosolutions.jaiext.bandmerge:jt-bandmerge 1.1.24 compile
it.geosolutions.jaiext.bandselect:jt-bandselect 1.1.24 compile
it.geosolutions.jaiext.binarize:jt-binarize 1.1.24 compile
it.geosolutions.jaiext.border:jt-border 1.1.24 compile
it.geosolutions.jaiext.buffer:jt-buffer 1.1.24 compile
it.geosolutions.jaiext.classifier:jt-classifier 1.1.24 compile
it.geosolutions.jaiext.colorconvert:jt-colorconvert 1.1.24 compile
it.geosolutions.jaiext.colorindexer:jt-colorindexer 1.1.24 compile
it.geosolutions.jaiext.crop:jt-crop 1.1.24 compile
it.geosolutions.jaiext.errordiffusion:jt-errordiffusion 1.1.24 compile
it.geosolutions.jaiext.format:jt-format 1.1.24 compile
it.geosolutions.jaiext.imagefunction:jt-imagefunction 1.1.24 compile
it.geosolutions.jaiext.iterators:jt-iterators 1.1.24 compile
it.geosolutions.jaiext.lookup:jt-lookup 1.1.24 compile
it.geosolutions.jaiext.mosaic:jt-mosaic 1.1.24 compile
it.geosolutions.jaiext.nullop:jt-nullop 1.1.24 compile
it.geosolutions.jaiext.orderdither:jt-orderdither 1.1.24 compile
it.geosolutions.jaiext.piecewise:jt-piecewise 1.1.24 compile
it.geosolutions.jaiext.rescale:jt-rescale 1.1.24 compile
it.geosolutions.jaiext.rlookup:jt-rlookup 1.1.24 compile
it.geosolutions.jaiext.scale2:jt-scale2 1.1.24 compile
it.geosolutions.jaiext.scale:jt-scale 1.1.24 compile
it.geosolutions.jaiext.shadedrelief:jt-shadedrelief 1.1.24 compile
it.geosolutions.jaiext.stats:jt-stats 1.1.24 compile
it.geosolutions.jaiext.translate:jt-translate 1.1.24 compile
it.geosolutions.jaiext.utilities:jt-utilities 1.1.24 compile
it.geosolutions.jaiext.vectorbin:jt-vectorbin 1.1.24 compile
it.geosolutions.jaiext.warp:jt-warp 1.1.24 compile
it.geosolutions.jaiext.zonal:jt-zonal 1.1.24 compile
it.geosolutions.jaiext.affine:jt-affine 1.1.27 compile
it.geosolutions.jaiext.algebra:jt-algebra 1.1.27 compile
it.geosolutions.jaiext.bandcombine:jt-bandcombine 1.1.27 compile
it.geosolutions.jaiext.bandmerge:jt-bandmerge 1.1.27 compile
it.geosolutions.jaiext.bandselect:jt-bandselect 1.1.27 compile
it.geosolutions.jaiext.binarize:jt-binarize 1.1.27 compile
it.geosolutions.jaiext.border:jt-border 1.1.27 compile
it.geosolutions.jaiext.buffer:jt-buffer 1.1.27 compile
it.geosolutions.jaiext.classifier:jt-classifier 1.1.27 compile
it.geosolutions.jaiext.colorconvert:jt-colorconvert 1.1.27 compile
it.geosolutions.jaiext.colorindexer:jt-colorindexer 1.1.27 compile
it.geosolutions.jaiext.crop:jt-crop 1.1.27 compile
it.geosolutions.jaiext.errordiffusion:jt-errordiffusion 1.1.27 compile
it.geosolutions.jaiext.format:jt-format 1.1.27 compile
it.geosolutions.jaiext.imagefunction:jt-imagefunction 1.1.27 compile
it.geosolutions.jaiext.iterators:jt-iterators 1.1.27 compile
it.geosolutions.jaiext.lookup:jt-lookup 1.1.27 compile
it.geosolutions.jaiext.mosaic:jt-mosaic 1.1.27 compile
it.geosolutions.jaiext.nullop:jt-nullop 1.1.27 compile
it.geosolutions.jaiext.orderdither:jt-orderdither 1.1.27 compile
it.geosolutions.jaiext.piecewise:jt-piecewise 1.1.27 compile
it.geosolutions.jaiext.rescale:jt-rescale 1.1.27 compile
it.geosolutions.jaiext.rlookup:jt-rlookup 1.1.27 compile
it.geosolutions.jaiext.scale2:jt-scale2 1.1.27 compile
it.geosolutions.jaiext.scale:jt-scale 1.1.27 compile
it.geosolutions.jaiext.shadedrelief:jt-shadedrelief 1.1.27 compile
it.geosolutions.jaiext.stats:jt-stats 1.1.27 compile
it.geosolutions.jaiext.translate:jt-translate 1.1.27 compile
it.geosolutions.jaiext.utilities:jt-utilities 1.1.27 compile
it.geosolutions.jaiext.vectorbin:jt-vectorbin 1.1.27 compile
it.geosolutions.jaiext.warp:jt-warp 1.1.27 compile
it.geosolutions.jaiext.zonal:jt-zonal 1.1.27 compile
it.geosolutions.jgridshift:jgridshift-core 1.3 compile
jakarta.annotation:jakarta.annotation-api 1.3.5 compile
jakarta.inject:jakarta.inject-api 2.0.0 compile
jakarta.inject:jakarta.inject-api 2.0.1 compile
jakarta.transaction:jakarta.transaction-api 1.3.3 compile
javax.annotation:javax.annotation-api 1.2 compile
javax.measure:unit-api 2.1.2 compile
javax.measure:unit-api 2.2 compile
joda-time:joda-time 2.12.6 compile
net.java.dev.jna:jna 5.14.0 compile
net.java.dev.jna:jna-platform 5.14.0 compile
Expand Down Expand Up @@ -219,34 +219,34 @@ org.ejml:ejml-core 0.41 compile
org.ejml:ejml-ddense 0.41 compile
org.ejml:ejml-fsparse 0.41 compile
org.ejml:ejml-simple 0.41 compile
org.geotools.jdbc:gt-jdbc-postgis 30.4 compile
org.geotools.ogc:net.opengis.fes 30.4 compile
org.geotools.ogc:net.opengis.ows 30.4 compile
org.geotools.ogc:net.opengis.wfs 30.4 compile
org.geotools.ogc:org.w3.xlink 30.4 compile
org.geotools.xsd:gt-xsd-core 30.4 compile
org.geotools.xsd:gt-xsd-fes 30.4 compile
org.geotools.xsd:gt-xsd-filter 30.4 compile
org.geotools.xsd:gt-xsd-gml2 30.4 compile
org.geotools.xsd:gt-xsd-gml3 30.4 compile
org.geotools.xsd:gt-xsd-ows 30.4 compile
org.geotools.xsd:gt-xsd-wfs 30.4 compile
org.geotools:gt-api 30.4 compile
org.geotools:gt-coverage 30.4 compile
org.geotools:gt-cql 30.4 compile
org.geotools:gt-epsg-wkt 30.4 compile
org.geotools:gt-grid 30.4 compile
org.geotools:gt-http 30.4 compile
org.geotools:gt-jdbc 30.4 compile
org.geotools:gt-main 30.4 compile
org.geotools:gt-metadata 30.4 compile
org.geotools:gt-process 30.4 compile
org.geotools:gt-process-feature 30.4 compile
org.geotools:gt-referencing 30.4 compile
org.geotools:gt-render 30.4 compile
org.geotools:gt-shapefile 30.4 compile
org.geotools:gt-transform 30.4 compile
org.geotools:gt-xml 30.4 compile
org.geotools.jdbc:gt-jdbc-postgis 32.0 compile
org.geotools.ogc:net.opengis.fes 32.0 compile
org.geotools.ogc:net.opengis.ows 32.0 compile
org.geotools.ogc:net.opengis.wfs 32.0 compile
org.geotools.ogc:org.w3.xlink 32.0 compile
org.geotools.xsd:gt-xsd-core 32.0 compile
org.geotools.xsd:gt-xsd-fes 32.0 compile
org.geotools.xsd:gt-xsd-filter 32.0 compile
org.geotools.xsd:gt-xsd-gml2 32.0 compile
org.geotools.xsd:gt-xsd-gml3 32.0 compile
org.geotools.xsd:gt-xsd-ows 32.0 compile
org.geotools.xsd:gt-xsd-wfs 32.0 compile
org.geotools:gt-api 32.0 compile
org.geotools:gt-coverage 32.0 compile
org.geotools:gt-cql 32.0 compile
org.geotools:gt-epsg-wkt 32.0 compile
org.geotools:gt-grid 32.0 compile
org.geotools:gt-http 32.0 compile
org.geotools:gt-jdbc 32.0 compile
org.geotools:gt-main 32.0 compile
org.geotools:gt-metadata 32.0 compile
org.geotools:gt-process 32.0 compile
org.geotools:gt-process-feature 32.0 compile
org.geotools:gt-referencing 32.0 compile
org.geotools:gt-render 32.0 compile
org.geotools:gt-shapefile 32.0 compile
org.geotools:gt-transform 32.0 compile
org.geotools:gt-xml 32.0 compile
org.huldra.math:bigint 0.7.1 compile
org.jetbrains:annotations 17.0.0 compile
org.jruby.jcodings:jcodings 1.0.55 compile
Expand All @@ -255,8 +255,8 @@ org.json4s:json4s-ast_2.12 3.6.12 compile
org.json4s:json4s-core_2.12 3.6.12 compile
org.json4s:json4s-native_2.12 3.6.12 compile
org.json4s:json4s-scalap_2.12 3.6.12 compile
org.locationtech.jts.io:jts-io-common 1.19.0 compile
org.locationtech.jts:jts-core 1.19.0 compile
org.locationtech.jts.io:jts-io-common 1.20.0 compile
org.locationtech.jts:jts-core 1.20.0 compile
org.locationtech.spatial4j:spatial4j 0.8 compile
org.mozilla:rhino 1.7.14 compile
org.mozilla:rhino-engine 1.7.14 compile
Expand Down Expand Up @@ -342,7 +342,7 @@ org.apache.sedona:sedona-common 1.5.0 test
org.cassandraunit:cassandra-unit 3.7.1.0 test
org.codehaus.groovy:groovy-jsr223 3.0.20 test
org.geomesa.testcontainers:testcontainers-accumulo 1.4.1 test
org.geotools:gt-epsg-hsql 30.4 test
org.geotools:gt-epsg-hsql 32.0 test
org.jruby:jruby 9.4.5.0 test
org.mockito:mockito-core 2.28.2 test
org.mortbay.jetty:jetty 6.1.26 test
Expand Down
2 changes: 2 additions & 0 deletions docs/user/geoserver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ although this may occasionally cause errors as GeoServer does not follow semanti
+-------------------+-------------------+
| GeoMesa Version | GeoServer Version |
+===================+===================+
| 5.1.0 | 2.26.0 |
+-------------------+-------------------+
| 5.0.0 | 2.24.2 |
+-------------------+-------------------+
| 4.0.0 | 2.22.2 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.geotools.api.filter.Filter
import org.geotools.data.postgis.PostGISPSDialect
import org.geotools.jdbc.JDBCDataStore

import java.lang.invoke.{MethodHandle, MethodHandles, MethodType}
import java.sql.{Connection, DatabaseMetaData, PreparedStatement, Types}
import java.util.Locale
import java.util.concurrent.TimeUnit
Expand All @@ -39,7 +40,55 @@ class PartitionedPostgisPsDialect(store: JDBCDataStore, delegate: PartitionedPos
}
})

override def setValue(value: Any, binding: Class[_], ps: PreparedStatement, column: Int, cx: Connection): Unit = {
// reference to super.setValue, for back-compatibility with gt 30
private lazy val superSetValue: MethodHandle = {
val methodType =
MethodType.methodType(classOf[Unit], classOf[Object], classOf[Class[_]], classOf[PreparedStatement], classOf[Int], classOf[Connection])
MethodHandles.lookup.findSpecial(classOf[PostGISPSDialect], "setValue", methodType, classOf[PartitionedPostgisPsDialect])
}

override def setValue(
value: AnyRef,
binding: Class[_],
att: AttributeDescriptor,
ps: PreparedStatement,
column: Int,
cx: Connection): Unit = {
// json columns are string type in geotools, but we have to use setObject or else we get a binding error
if (binding == classOf[String] && jsonColumns.get(new PreparedStatementKey(ps, column))) {
ps.setObject(column, value, Types.OTHER)
} else if (binding == classOf[java.util.List[_]]) {
// handle bug in jdbc store not calling setArrayValue in update statements
value match {
case null =>
ps.setNull(column, Types.ARRAY)

case list: java.util.Collection[_] =>
if (list.isEmpty) {
ps.setNull(column, Types.ARRAY)
} else {
setArray(list.toArray(), ps, column, cx)
}

case array: Array[_] =>
if (array.isEmpty) {
ps.setNull(column, Types.ARRAY)
} else {
setArray(array, ps, column, cx)
}

case _ =>
// this will almost certainly fail...
super.setValue(value, binding, att, ps, column, cx)
}
} else {
super.setValue(value, binding, att, ps, column, cx)
}
}

// for back-compatibility with gt 30
// noinspection ScalaUnusedSymbol
def setValue(value: AnyRef, binding: Class[_], ps: PreparedStatement, column: Int, cx: Connection): Unit = {
// json columns are string type in geotools, but we have to use setObject or else we get a binding error
if (binding == classOf[String] && jsonColumns.get(new PreparedStatementKey(ps, column))) {
ps.setObject(column, value, Types.OTHER)
Expand All @@ -65,10 +114,10 @@ class PartitionedPostgisPsDialect(store: JDBCDataStore, delegate: PartitionedPos

case _ =>
// this will almost certainly fail...
super.setValue(value, binding, ps, column, cx)
superSetValue.invoke(this, value, binding, ps, column, cx)
}
} else {
super.setValue(value, binding, ps, column, cx)
superSetValue.invoke(this, value, binding, ps, column, cx)
}
}

Expand Down Expand Up @@ -116,7 +165,7 @@ class PartitionedPostgisPsDialect(store: JDBCDataStore, delegate: PartitionedPos
object PartitionedPostgisPsDialect {

// uses eq on the prepared statement to ensure that we compute json fields exactly once per prepared statement/col
class PreparedStatementKey(val ps: PreparedStatement, val column: Int) {
private class PreparedStatementKey(val ps: PreparedStatement, val column: Int) {

override def equals(other: Any): Boolean = {
other match {
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
<scala.parsers.version>2.3.0</scala.parsers.version>

<!-- geotools -->
<gt.version>30.4</gt.version> <!-- make sure this tracks with gs, jts, spatial4j and ejml -->
<geoserver.version>2.24.4</geoserver.version>
<jts.version>1.19.0</jts.version> <!-- needs to track with gt/gs version -->
<gt.version>32.0</gt.version> <!-- make sure this tracks with gs, jts, spatial4j and ejml -->
<geoserver.version>2.26.0</geoserver.version>
<jts.version>1.20.0</jts.version> <!-- needs to track with gt/gs version -->
<spatial4j.version>0.8</spatial4j.version> <!-- needs to track with jts version -->
<ejml.version>0.41</ejml.version> <!-- needs to track with gt/gs version -->

Expand Down

0 comments on commit 7f062f8

Please sign in to comment.