Skip to content

Commit b5f8ebd

Browse files
committed
#1: Make 'jpx.jdbc' module compile.
1 parent 619af7b commit b5f8ebd

File tree

15 files changed

+217
-330
lines changed

15 files changed

+217
-330
lines changed

gradle/libs.versions.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
[plugins]
22

33
jmh = { id = "me.champeau.jmh", version = "0.7.2" }
4+
lombok = { id = "io.freefair.lombok", version = "8.4" }
45

56
[libraries]
67

78
assertj = "org.assertj:assertj-core:3.24.2"
89
commons-math = "org.apache.commons:commons-math3:3.6.1"
910
equalsverifier = "nl.jqno.equalsverifier:equalsverifier:3.15.3"
11+
facilejdbc = "io.jenetics:facilejdbc:2.0.0"
1012
guava = "com.google.guava:guava:32.1.3-jre"
13+
h2 = "com.h2database:h2:2.1.214"
14+
mariadb-java-client = "org.mariadb.jdbc:mariadb-java-client:3.3.0"
15+
mysql-connector-java = "mysql:mysql-connector-java:8.0.33"
16+
postgres = "org.postgresql:postgresql:42.6.0"
1117
prngine = "io.jenetics:prngine:2.0.0"
1218
rxjava = "io.reactivex.rxjava2:rxjava:2.2.21"
1319
testng = "org.testng:testng:7.8.0"

jpx.jdbc/build.gradle.kts

Lines changed: 14 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -24,102 +24,25 @@
2424
* @version 1.0
2525
*/
2626

27-
import io.franzbecker.gradle.lombok.task.DelombokTask
28-
2927
plugins {
30-
id "io.franzbecker.gradle-lombok" version "3.2.0"
28+
`java-library`
29+
idea
30+
`maven-publish`
31+
alias(libs.plugins.lombok)
3132
}
3233

33-
apply plugin: 'java-library'
34-
apply plugin: 'maven'
35-
apply plugin: 'signing'
36-
37-
compileTestJava.dependsOn tasks.getByPath(':jpx:compileTestJava')
34+
description = "JPX - Java GPX (GPS) Library"
3835

39-
description = 'JPX - Java GPX Library'
40-
41-
repositories {
42-
mavenCentral()
43-
jcenter()
44-
}
36+
extra["moduleName"] = "io.jenetics.jpx.jdbc"
4537

4638
dependencies {
47-
api project(':jpx')
48-
implementation 'io.jenetics:facilejdbc:0.3.0'
49-
50-
testImplementation project(':jpx').sourceSets.test.output
51-
testImplementation 'org.testng:testng:6.9.10'
52-
testImplementation 'com.h2database:h2:1.4.193'
53-
testImplementation 'mysql:mysql-connector-java:6.0.5'
54-
testImplementation 'org.mariadb.jdbc:mariadb-java-client:2.4.3'
55-
testImplementation 'org.postgresql:postgresql:42.2.7'
56-
}
57-
58-
task delombok(type: DelombokTask, dependsOn: compileJava) {
59-
ext.outputDir = file("$buildDir/delombok")
60-
outputs.dir(outputDir)
61-
sourceSets.main.java.srcDirs.each {
62-
inputs.dir(it)
63-
args(it, "-d", outputDir)
64-
}
65-
doFirst {
66-
outputDir.deleteDir()
67-
}
39+
api(project(":jpx"))
40+
api(libs.facilejdbc)
41+
42+
testImplementation(libs.assertj)
43+
testImplementation(libs.equalsverifier)
44+
testImplementation(libs.prngine)
45+
testImplementation(libs.testng)
46+
testImplementation(libs.h2)
6847
}
6948

70-
javadoc {
71-
dependsOn delombok
72-
73-
project.configure(options) {
74-
memberLevel = 'PROTECTED'
75-
version = true
76-
author = true
77-
docEncoding = 'UTF-8'
78-
charSet = 'UTF-8'
79-
linkSource = true
80-
links = [
81-
'https://docs.oracle.com/javase/8/docs/api',
82-
'https://jenetics.github.io/jpx/javadoc/jpx'
83-
]
84-
windowTitle = "JPX ${project.version}"
85-
docTitle = "<h1>JPX ${project.version}</h1>"
86-
bottom = "&copy; ${copyrightYear} Franz Wilhelmst&ouml;tter &nbsp;<i>(${dateformat.format(now)})</i>"
87-
options.tags = ["apiNote:a:API Note:",
88-
"implSpec:a:Implementation Requirements:",
89-
"implNote:a:Implementation Note:"]
90-
//exclude '**/internal/**'
91-
}
92-
93-
// Copy the doc-files.
94-
doLast {
95-
project.copy {
96-
from('src/main/java') {
97-
include 'org/**/doc-files/*.*'
98-
}
99-
includeEmptyDirs = false
100-
into destinationDir.path
101-
}
102-
}
103-
}
104-
105-
test {
106-
testLogging.showStandardStreams = true
107-
useTestNG {
108-
preserveOrder true
109-
parallel = 'tests' // 'methods'
110-
}
111-
}
112-
113-
jar {
114-
manifest {
115-
attributes(
116-
'Implementation-Title': 'JPX - Java GPX library',
117-
'Implementation-Version': "${project.name}-${project.version}",
118-
'Implementation-URL': 'https://jenetics.github.io/jpx',
119-
'Implementation-Vendor': 'jenetics',
120-
'ProjectName': project.name,
121-
'Version': project.version,
122-
'Maintainer': 'Franz Wilhelmstötter'
123-
)
124-
}
125-
}

jpx.jdbc/src/main/java/io/jenetics/jpx/jdbc/BoundsAccess.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
import java.sql.Connection;
2626
import java.sql.SQLException;
2727

28-
import io.jenetics.jpx.Bounds;
29-
3028
import io.jenetics.facilejdbc.Dctor;
3129
import io.jenetics.facilejdbc.Query;
3230
import io.jenetics.facilejdbc.RowParser;
3331

32+
import io.jenetics.jpx.Bounds;
33+
3434
/**
3535
* @author <a href="mailto:[email protected]">Franz Wilhelmstötter</a>
3636
* @version !__version__!
@@ -39,15 +39,17 @@
3939
public final class BoundsAccess {
4040
private BoundsAccess() {}
4141

42-
private static final Query SELECT = Query.of(
43-
"SELECT minlat, minlon, maxlat, maxlon " +
44-
"FROM bounds " +
45-
"WHERE id = :id"
42+
private static final Query SELECT = Query.of("""
43+
SELECT minlat, minlon, maxlat, maxlon
44+
FROM bounds
45+
WHERE id = :id
46+
"""
4647
);
4748

48-
private static final Query INSERT = Query.of(
49-
"INSERT INTO bounds(minlat, minlon, maxlat, maxlon) " +
50-
"VALUES(:minlat, :minlon, :maxlat, :maxlon)"
49+
private static final Query INSERT = Query.of("""
50+
INSERT INTO bounds(minlat, minlon, maxlat, maxlon)
51+
VALUES(:minlat, :minlon, :maxlat, :maxlon)
52+
"""
5153
);
5254

5355
private static final RowParser<Bounds> PARSER = (row, conn) -> Bounds.of(

jpx.jdbc/src/main/java/io/jenetics/jpx/jdbc/CopyrightAccess.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
import java.sql.SQLException;
2828
import java.time.Year;
2929

30-
import io.jenetics.jpx.Copyright;
31-
3230
import io.jenetics.facilejdbc.Dctor;
3331
import io.jenetics.facilejdbc.Query;
3432
import io.jenetics.facilejdbc.RowParser;
3533

34+
import io.jenetics.jpx.Copyright;
35+
3636
/**
3737
* @author <a href="mailto:[email protected]">Franz Wilhelmstötter</a>
3838
* @version !__version__!
@@ -41,15 +41,17 @@
4141
public final class CopyrightAccess {
4242
private CopyrightAccess() {}
4343

44-
private static final Query SELECT = Query.of(
45-
"SELECT id, author, year, license " +
46-
"FROM copyright " +
47-
"WHERE id = :id"
44+
private static final Query SELECT = Query.of("""
45+
SELECT id, author, year, license
46+
FROM copyright
47+
WHERE id = :id
48+
"""
4849
);
4950

50-
private static final Query INSERT = Query.of(
51-
"INSERT INTO copyright(author, year, license) " +
52-
"VALUES(:author, :year, :license)"
51+
private static final Query INSERT = Query.of("""
52+
INSERT INTO copyright(author, year, license)
53+
VALUES(:author, :year, :license)
54+
"""
5355
);
5456

5557
private static final RowParser<Copyright> PARSER = (row, conn) -> Copyright.of(

jpx.jdbc/src/main/java/io/jenetics/jpx/jdbc/GPXAccess.java

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
import java.sql.SQLException;
2626
import java.util.List;
2727

28+
import io.jenetics.facilejdbc.Batch;
29+
import io.jenetics.facilejdbc.Dctor;
30+
import io.jenetics.facilejdbc.Query;
31+
2832
import io.jenetics.jpx.GPX;
2933
import io.jenetics.jpx.Route;
3034
import io.jenetics.jpx.Track;
3135
import io.jenetics.jpx.WayPoint;
3236

33-
import io.jenetics.facilejdbc.Batch;
34-
import io.jenetics.facilejdbc.Dctor;
35-
import io.jenetics.facilejdbc.Query;
36-
3737
/**
3838
* @author <a href="mailto:[email protected]">Franz Wilhelmstötter</a>
3939
* @version !__version__!
@@ -42,17 +42,18 @@
4242
public final class GPXAccess {
4343
private GPXAccess() {}
4444

45-
private static final Query INSERT_QUERY = Query.of(
46-
"INSERT INTO gpx(version, creator, metadata_id) " +
47-
"VALUES(:version, :creator, :metadata_id);"
45+
private static final Query INSERT_QUERY = Query.of("""
46+
INSERT INTO gpx(version, creator, metadata_id)
47+
VALUES(:version, :creator, :metadata_id)
48+
"""
4849
);
4950

5051
private static final Dctor<GPX> DCTOR = Dctor.of(
5152
field("version", GPX::getVersion),
5253
field("creator", GPX::getCreator),
5354
field(
5455
"metadata_id",
55-
(g, c) -> MetadataAccess.insert(g.getMetadata().orElse(null), c)
56+
(gpx, conn) -> MetadataAccess.insert(gpx.getMetadata().orElse(null), conn)
5657
)
5758
);
5859

@@ -73,9 +74,10 @@ public static Long insert(final GPX gpx, final Connection conn)
7374
return id;
7475
}
7576

76-
private static final Query WAY_POINT_INSERT_QUERY = Query.of(
77-
"INSERT INTO gpx_way_point(gpx_id, way_point_id) " +
78-
"VALUES(:gpx_id, :way_point_id);"
77+
private static final Query WAY_POINT_INSERT_QUERY = Query.of("""
78+
INSERT INTO gpx_way_point(gpx_id, way_point_id)
79+
VALUES(:gpx_id, :way_point_id)
80+
"""
7981
);
8082

8183
private static void insertWayPoints(
@@ -96,9 +98,10 @@ private static void insertWayPoints(
9698
WAY_POINT_INSERT_QUERY.executeUpdate(batch, conn);
9799
}
98100

99-
private static final Query ROUTE_INSERT_QUERY = Query.of(
100-
"INSERT INTO gpx_route(gpx_id, route_id) " +
101-
"VALUES(:gpx_id, :route_id);"
101+
private static final Query ROUTE_INSERT_QUERY = Query.of("""
102+
INSERT INTO gpx_route(gpx_id, route_id)
103+
VALUES(:gpx_id, :route_id)
104+
"""
102105
);
103106

104107
private static void insertRoutes(
@@ -119,9 +122,10 @@ private static void insertRoutes(
119122
ROUTE_INSERT_QUERY.executeUpdate(batch, conn);
120123
}
121124

122-
private static final Query TRACK_INSERT_QUERY = Query.of(
123-
"INSERT INTO gpx_track(gpx_id, track_id) " +
124-
"VALUES(:gpx_id, :track_id);"
125+
private static final Query TRACK_INSERT_QUERY = Query.of("""
126+
INSERT INTO gpx_track(gpx_id, track_id)
127+
VALUES(:gpx_id, :track_id)
128+
"""
125129
);
126130

127131
private static void insertTracks(

jpx.jdbc/src/main/java/io/jenetics/jpx/jdbc/GpxTypeMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import java.time.Duration;
2525
import java.time.ZonedDateTime;
2626

27+
import io.jenetics.facilejdbc.spi.SqlTypeMapper;
28+
2729
import io.jenetics.jpx.DGPSStation;
2830
import io.jenetics.jpx.Degrees;
2931
import io.jenetics.jpx.Fix;
@@ -33,8 +35,6 @@
3335
import io.jenetics.jpx.Speed;
3436
import io.jenetics.jpx.UInt;
3537

36-
import io.jenetics.facilejdbc.spi.SqlTypeMapper;
37-
3838
/**
3939
* @author <a href="mailto:[email protected]">Franz Wilhelmstötter</a>
4040
* @version !__version__!

jpx.jdbc/src/main/java/io/jenetics/jpx/jdbc/LinkAccess.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
import java.sql.Connection;
2727
import java.sql.SQLException;
2828

29-
import io.jenetics.jpx.Link;
30-
3129
import io.jenetics.facilejdbc.Dctor;
3230
import io.jenetics.facilejdbc.Query;
3331
import io.jenetics.facilejdbc.RowParser;
3432

33+
import io.jenetics.jpx.Link;
34+
3535
/**
3636
* @author <a href="mailto:[email protected]">Franz Wilhelmstötter</a>
3737
* @version !__version__!
@@ -40,15 +40,17 @@
4040
public final class LinkAccess {
4141
private LinkAccess() {}
4242

43-
private static final Query SELECT = Query.of(
44-
"SELECT id, href, text, type " +
45-
"FROM link " +
46-
"WHERE id = :id;"
43+
private static final Query SELECT = Query.of("""
44+
SELECT id, href, text, type
45+
FROM link
46+
WHERE id = :id
47+
"""
4748
);
4849

49-
private static final Query INSERT = Query.of(
50-
"INSERT INTO link(href, text, type) " +
51-
"VALUES(:href, :text, :type);"
50+
private static final Query INSERT = Query.of("""
51+
INSERT INTO link(href, text, type)
52+
VALUES(:href, :text, :type)
53+
"""
5254
);
5355

5456
private static final RowParser<Link> PARSER = (row, conn) -> Link.of(

0 commit comments

Comments
 (0)