Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgresql protocol adapter Alpha #726

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
22d7b66
Submitting alpha version of the PostgreSQL protocol adapter.
anthonyolazabal Oct 31, 2024
5895c0f
Update to 2024.8 SDK
anthonyolazabal Dec 22, 2024
bd67864
Minor updates and test bypass (for alpha)
anthonyolazabal Dec 23, 2024
4a400d4
include adapter in the edge platform
DC2-DanielKrueger Jan 7, 2025
b8c9a69
include adapter in the edge platform
DC2-DanielKrueger Jan 7, 2025
ada46e5
cleanup
DC2-DanielKrueger Jan 7, 2025
5f2ede4
cleanup
DC2-DanielKrueger Jan 7, 2025
d87e27f
add timeout for connection attempts
DC2-DanielKrueger Jan 8, 2025
814eecd
restructuring
DC2-DanielKrueger Jan 8, 2025
c0136d2
cleanup
DC2-DanielKrueger Jan 8, 2025
baaf114
fix repository resolution
DC2-DanielKrueger Jan 8, 2025
a175e2f
cleanup and adding of IT
DC2-DanielKrueger Jan 8, 2025
a4134e2
use hikari connection pool and prepared statement
DC2-DanielKrueger Jan 9, 2025
f0786b7
restructure
DC2-DanielKrueger Jan 9, 2025
1e6b366
fix prepared statements
DC2-DanielKrueger Jan 9, 2025
1c45ff1
improve handling of native types
DC2-DanielKrueger Jan 10, 2025
7909b65
fix missing method
DC2-DanielKrueger Feb 6, 2025
af192d5
Submitting alpha version of the PostgreSQL protocol adapter.
anthonyolazabal Oct 31, 2024
501222a
Update to 2024.8 SDK
anthonyolazabal Dec 22, 2024
3325c48
Minor updates and test bypass (for alpha)
anthonyolazabal Dec 23, 2024
6b97c12
include adapter in the edge platform
DC2-DanielKrueger Jan 7, 2025
779a101
include adapter in the edge platform
DC2-DanielKrueger Jan 7, 2025
baa37e9
cleanup
DC2-DanielKrueger Jan 7, 2025
0938a9c
cleanup
DC2-DanielKrueger Jan 7, 2025
b44417d
add timeout for connection attempts
DC2-DanielKrueger Jan 8, 2025
d695bd0
restructuring
DC2-DanielKrueger Jan 8, 2025
bde910c
cleanup
DC2-DanielKrueger Jan 8, 2025
1da80ff
fix repository resolution
DC2-DanielKrueger Jan 8, 2025
1899d6f
cleanup and adding of IT
DC2-DanielKrueger Jan 8, 2025
99af28e
use hikari connection pool and prepared statement
DC2-DanielKrueger Jan 9, 2025
2d04b9b
restructure
DC2-DanielKrueger Jan 9, 2025
87924cf
fix prepared statements
DC2-DanielKrueger Jan 9, 2025
ca7c894
improve handling of native types
DC2-DanielKrueger Jan 10, 2025
f6865fe
fix missing method
DC2-DanielKrueger Feb 6, 2025
b35651b
Merge remote-tracking branch 'origin/postgresql-protocol-adapter' int…
anthonyolazabal Feb 14, 2025
cf931c6
Refactoring to add support for MySQL and MSSQL along with PostgreSQL
anthonyolazabal Feb 18, 2025
11cec6c
fix publickeyretrieval issue on mysql connection
anthonyolazabal Feb 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ dependencies {
edgeModule("com.hivemq:hivemq-edge-module-plc4x")
edgeModule("com.hivemq:hivemq-edge-module-opcua")
edgeModule("com.hivemq:hivemq-edge-module-modbus")
edgeModule("com.hivemq:hivemq-edge-module-postgresql")
}

val hivemqEdgeZip by tasks.registering(Zip::class) {
Expand All @@ -109,7 +110,8 @@ val edgeProjectsToUpdate = setOf(
"hivemq-edge-module-http",
"hivemq-edge-module-modbus",
"hivemq-edge-module-opcua",
"hivemq-edge-module-plc4x"
"hivemq-edge-module-plc4x",
"hivemq-edge-module-postgresql"
)

tasks.register("updateDependantVersions") {
Expand Down
8 changes: 8 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dropwizard-metrics = "4.2.30"
equalsVerifier = "3.18.2"
future-converter = "1.2.0"
guava = "32.1.3-jre"
hikari = "6.2.1"
hivemq-edge-adapterSdk = "2024.5"
hivemq-edge-extensionSdk = "2024.5"
hivemq-extensionSdk = "4.30.0"
Expand All @@ -39,6 +40,9 @@ mqtt-sn-codec = "838f51d691"
netty = "4.1.117.Final"
org_json = "20250107"
pmd = "6.55.0"
postgresql = "42.7.3"
mysql= "8.0.33"
mssql="12.8.1.jre11"
shrinkwrap = "1.2.6"
slf4j = "2.0.16"
spotBugs = "4.8.5"
Expand Down Expand Up @@ -75,6 +79,7 @@ jersey-hk2 = { module = "org.glassfish.jersey.inject:jersey-hk2", version.ref =
jersey-media-json-jackson = { module = "org.glassfish.jersey.media:jersey-media-json-jackson", version.ref = "jersey" }
jersey-media-multipart = { module = "org.glassfish.jersey.media:jersey-media-multipart", version.ref = "jersey" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
hikari = { module = "com.zaxxer:HikariCP", version.ref = "hikari" }
hivemq-edge-adapterSdk = { module = "com.hivemq:hivemq-edge-adapter-sdk", version.ref = "hivemq-edge-adapterSdk" }
hivemq-edge-extensionSdk = { module = "com.hivemq:hivemq-edge-extension-sdk", version.ref = "hivemq-edge-extensionSdk" }
hivemq-extensionSdk = { module = "com.hivemq:hivemq-extension-sdk", version.ref = "hivemq-extensionSdk" }
Expand Down Expand Up @@ -111,6 +116,9 @@ netty-codec-http = { module = "io.netty:netty-codec-http", version.ref = "netty"
netty-commons = { module = "io.netty:netty-common", version.ref = "netty" }
netty-handler = { module = "io.netty:netty-handler", version.ref = "netty" }
netty-transport = { module = "io.netty:netty-transport", version.ref = "netty" }
postgresql= { module = "org.postgresql:postgresql", version.ref = "postgresql" }
mysql= { module = "mysql:mysql-connector-java", version.ref = "mysql" }
mssql= { module = "com.microsoft.sqlserver:mssql-jdbc", version.ref = "mssql" }
org_json = { module = "org.json:json", version.ref = "org_json" }
plc4j-api = { module = "org.apache.plc4x:plc4j-api", version.ref = "apache-plc4x" }
plc4j-s7 = { module = "org.apache.plc4x:plc4j-driver-s7", version.ref = "apache-plc4x" }
Expand Down
3 changes: 3 additions & 0 deletions modules/hivemq-edge-module-databases/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions modules/hivemq-edge-module-databases/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions modules/hivemq-edge-module-databases/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions modules/hivemq-edge-module-databases/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions modules/hivemq-edge-module-databases/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions modules/hivemq-edge-module-databases/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions modules/hivemq-edge-module-databases/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions modules/hivemq-edge-module-databases/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions modules/hivemq-edge-module-databases/HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2023-present HiveMQ GmbH

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
216 changes: 216 additions & 0 deletions modules/hivemq-edge-module-databases/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
import nl.javadude.gradle.plugins.license.DownloadLicensesExtension.license
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent.*

plugins {
java
alias(libs.plugins.defaults)
alias(libs.plugins.shadow)
alias(libs.plugins.license)
id("com.hivemq.edge-version-updater")
id("com.hivemq.third-party-license-generator")
}


group = "com.hivemq"

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
exclusiveContent {
forRepository {
maven {
url = uri("https://jitpack.io")
}
}
filter {
includeGroup("com.github.simon622.mqtt-sn")
includeGroup("com.github.simon622")
}
}
}


dependencies {
implementation(libs.hikari)
compileOnly(libs.hivemq.edge.adapterSdk)
compileOnly(libs.apache.commonsIO)
compileOnly(libs.jackson.databind)
compileOnly(libs.slf4j.api)
implementation(libs.postgresql)
implementation(libs.mysql)
implementation(libs.mssql)
}

dependencies {
testImplementation("com.hivemq:hivemq-edge")
testImplementation(libs.jackson.databind)
testImplementation(libs.hivemq.edge.adapterSdk)
testImplementation(libs.apache.commonsIO)
testImplementation(libs.mockito.junitJupiter)
testImplementation(libs.junit.jupiter)
testImplementation(libs.milo.server)
testImplementation(libs.assertj)
testImplementation(libs.awaitility)
}

tasks.test {
useJUnitPlatform()
testLogging {
events = setOf(STARTED, PASSED, FAILED, SKIPPED, STANDARD_ERROR)
exceptionFormat = TestExceptionFormat.FULL
}
}

tasks.register<Copy>("copyAllDependencies") {
shouldRunAfter("assemble")
from(configurations.runtimeClasspath)
into("${buildDir}/deps/libs")
}

tasks.named("assemble") { finalizedBy("copyAllDependencies") }

/* ******************** artifacts ******************** */

val releaseBinary: Configuration by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named("binary"))
attribute(Usage.USAGE_ATTRIBUTE, objects.named("release"))
}
}

val thirdPartyLicenses: Configuration by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named("third-party-licenses"))
}
}

artifacts {
add(releaseBinary.name, tasks.shadowJar)
add(thirdPartyLicenses.name, tasks.updateThirdPartyLicenses.flatMap { it.outputDirectory })
}
/* ******************** compliance ******************** */

license {
header = file("HEADER")
mapping("java", "SLASHSTAR_STYLE")
}

downloadLicenses {
aliases = mapOf(
license("Apache License, Version 2.0", "https://opensource.org/licenses/Apache-2.0") to listOf(
"Apache 2",
"Apache 2.0",
"Apache-2.0",
"Apache License 2.0",
"Apache License, 2.0",
"Apache License v2.0",
"Apache License, Version 2",
"Apache License Version 2.0",
"Apache License, Version 2.0",
"Apache License, version 2.0",
"The Apache License, Version 2.0",
"Apache Software License - Version 2.0",
"Apache Software License, version 2.0",
"The Apache Software License, Version 2.0"
),
license("MIT License", "https://opensource.org/licenses/MIT") to listOf(
"MIT License",
"MIT license",
"The MIT License",
"The MIT License (MIT)"
),
license("CDDL, Version 1.0", "https://opensource.org/licenses/CDDL-1.0") to listOf(
"CDDL, Version 1.0",
"Common Development and Distribution License 1.0",
"COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0",
license("CDDL", "https://glassfish.dev.java.net/public/CDDLv1.0.html")
),
license("CDDL, Version 1.1", "https://oss.oracle.com/licenses/CDDL+GPL-1.1") to listOf(
"CDDL 1.1",
"CDDL, Version 1.1",
"Common Development And Distribution License 1.1",
"CDDL+GPL License",
"CDDL + GPLv2 with classpath exception",
"Dual license consisting of the CDDL v1.1 and GPL v2",
"CDDL or GPLv2 with exceptions",
"CDDL/GPLv2+CE"
),
license("LGPL, Version 2.0", "https://opensource.org/licenses/LGPL-2.0") to listOf(
"LGPL, Version 2.0",
"GNU General Public License, version 2"
),
license("LGPL, Version 2.1", "https://opensource.org/licenses/LGPL-2.1") to listOf(
"LGPL, Version 2.1",
"LGPL, version 2.1",
"GNU Lesser General Public License version 2.1 (LGPLv2.1)",
license("GNU Lesser General Public License", "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html")
),
license("LGPL, Version 3.0", "https://opensource.org/licenses/LGPL-3.0") to listOf(
"LGPL, Version 3.0",
"Lesser General Public License, version 3 or greater"
),
license("EPL, Version 1.0", "https://opensource.org/licenses/EPL-1.0") to listOf(
"EPL, Version 1.0",
"Eclipse Public License - v 1.0",
"Eclipse Public License - Version 1.0",
license("Eclipse Public License", "http://www.eclipse.org/legal/epl-v10.html")
),
license("EPL, Version 2.0", "https://opensource.org/licenses/EPL-2.0") to listOf(
"EPL 2.0",
"EPL, Version 2.0"
),
license("EDL, Version 1.0", "https://www.eclipse.org/org/documents/edl-v10.php") to listOf(
"EDL 1.0",
"EDL, Version 1.0",
"Eclipse Distribution License - v 1.0"
),
license("BSD 3-Clause License", "https://opensource.org/licenses/BSD-3-Clause") to listOf(
"BSD 3-clause",
"BSD-3-Clause",
"BSD 3-Clause License",
"3-Clause BSD License",
"New BSD License",
license("BSD", "http://asm.ow2.org/license.html"),
license("BSD", "http://asm.objectweb.org/license.html"),
license("BSD", "LICENSE.txt")
),
license("Bouncy Castle License", "https://www.bouncycastle.org/licence.html") to listOf(
"Bouncy Castle Licence"
),
license("W3C License", "https://opensource.org/licenses/W3C") to listOf(
"W3C License",
"W3C Software Copyright Notice and License",
"The W3C Software License"
),
license("CC0", "https://creativecommons.org/publicdomain/zero/1.0/") to listOf(
"CC0",
"Public Domain"
)
)

dependencyConfiguration = "runtimeClasspath"
}

tasks.updateThirdPartyLicenses {
dependsOn(tasks.downloadLicenses)
projectName.set(project.name)
group = "license"
dependencyLicense.set(tasks.downloadLicenses.get().xmlDestination.resolve("dependency-license.xml"))
outputDirectory.set(layout.buildDirectory.dir("distribution/third-party-licenses"))
}

val javaComponent = components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements.get()) {
skip()
}
1 change: 1 addition & 0 deletions modules/hivemq-edge-module-databases/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=2025.1-SNAPSHOT
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Wed Apr 24 08:26:06 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading