Skip to content

Commit eb3e4a0

Browse files
authored
Merge pull request #8 from boschglobal/add-kuksa-val-v2-protocol
Add kuksa val v2 protocol
2 parents ca4cb83 + e4ea538 commit eb3e4a0

File tree

57 files changed

+2579
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2579
-164
lines changed

.github/workflows/daily_integration_main-master.yaml renamed to .github/workflows/daily_integration_main.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: SDK:main <-> Databroker:master
1+
name: SDK:main <-> Databroker:main
22

33
on:
44
schedule:
@@ -20,5 +20,5 @@ jobs:
2020
uses: ./.github/actions/run-tests
2121
with:
2222
upload-test-reports: true
23-
databroker-version: master
23+
databroker-version: main
2424
kotest-tag: "Integration"

README.md

+37-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
44
[![Gitter](https://img.shields.io/gitter/room/kuksa-val/community)](https://gitter.im/kuksa-val/community)
55

6-
[![SDK:main <-> Databroker:master](https://github.com/eclipse-kuksa/kuksa-java-sdk/actions/workflows/daily_integration_main-master.yaml/badge.svg)](https://github.com/eclipse-kuksa/kuksa-java-sdk/actions/workflows/daily_integration_main-master.yaml?query=branch%3Amain)
6+
[![SDK:main <-> Databroker:main](https://github.com/eclipse-kuksa/kuksa-java-sdk/actions/workflows/daily_integration_main.yaml/badge.svg)](https://github.com/eclipse-kuksa/kuksa-java-sdk/actions/workflows/daily_integration_main.yaml?query=branch%3Amain)
77

88
This is a Java SDK for the [KUKSA Vehicle Abstraction Layer](https://github.com/eclipse-kuksa/kuksa-databroker).
99

@@ -13,6 +13,41 @@ The KUKSA Java SDK allows you to interact with [VSS data](https://covesa.github.
1313
from the [KUKSA Databroker](https://github.com/eclipse-kuksa/kuksa-databroker/tree/main/)
1414
within a Java Application. The main functionality consists of fetching, updating and subscribing to VSS data.
1515

16+
Currently the following protocols are supported:
17+
- kuksa.val.v1
18+
- kuksa.val.v2
19+
20+
## kuksa.val.v1
21+
22+
You can interact with the Databroker using the kuksa.val.v1 interface by using the
23+
org.eclipse.kuksa.connectivity.databroker.v1.DataBrokerConnector class.
24+
25+
After successfully connecting the following methods are supported by org.eclipse.kuksa.connectivity.databroker.v1.DataBrokerConnection:
26+
- subscribe(SubscribeRequest, VssPathListener)
27+
- unsubscribe(SubscribeRequest, VssPathListener)
28+
- subscribe(VssNodeSubscribeRequest<T>, VssNodeListener<T>)
29+
- unsubscribe(VssNodeSubscribeRequest<T>, VssNodeListener<T>)
30+
- fetch(FetchRequest): GetResponse
31+
- fetch(VssNodeFetchRequest<T>): T
32+
- update(UpdateRequest): SetResponse
33+
- update(VssNodeUpdateRequest<T>): VssNodeUpdateResponse
34+
35+
## kuksa.val.v2
36+
37+
You can interact with the Databroker using the kuksa.val.v1 interface by using the
38+
org.eclipse.kuksa.connectivity.databroker.v2.DataBrokerConnectorV2 class.
39+
40+
After successfully connecting the following methods are supported by org.eclipse.kuksa.connectivity.databroker.v2.DataBrokerConnectionV2:
41+
- fetchValue(FetchValueRequestV2): GetValueResponse
42+
- fetchValues(FetchValuesRequestV2): GetValuesResponse
43+
- subscribeById(SubscribeByIdRequestV2): Flow<SubscribeByIdResponse>
44+
- subscribe(SubscribeRequestV2): Flow<SubscribeResponse>
45+
- actuate(ActuateRequestV2): ActuateResponse
46+
- batchActuate(BatchActuateRequestV2): BatchActuateResponse
47+
- listMetadata(ListMetadataRequestV2): ListMetadataResponse
48+
- publishValue(PublishValueRequestV2): PublishValueResponse
49+
- openProviderStream(StreamObserver<OpenProviderStreamResponse>): StreamObserver<OpenProviderStreamRequest>
50+
1651
## Integration
1752

1853
*app/build.gradle.kts*
@@ -23,8 +58,7 @@ implementation("org.eclipse.kuksa:kuksa-java-sdk:<VERSION>")
2358
The latest release version can be seen [here](https://github.com/eclipse-kuksa/kuksa-java-sdk/releases).
2459

2560

26-
See the [quickstart guide](https://github.com/eclipse-kuksa/kuksa-java-sdk/tree/main/docs/QUICKSTART.md) for
27-
additional integration options.
61+
See the [quickstart guide](https://github.com/eclipse-kuksa/kuksa-java-sdk/tree/main/docs/QUICKSTART.md) for additional integration options.
2862

2963
### Maven Central
3064

gradle/libs.versions.toml

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ kotlin = "1.9.22"
77
tomcatAnnotations = "6.0.53"
88
ktlint = "0.0" # Maintained inside ktlint.gradle.kts
99
grpc = "1.65.1"
10+
grpcKotlin = "1.4.1"
1011
protobufGradlePlugin = "0.9.4"
1112
protobuf = "3.25.3"
1213
kotest = "5.7.2"
@@ -20,6 +21,10 @@ docker-java-transport-httpclient5 = { module = "com.github.docker-java:docker-ja
2021
grpc-okhttp = { group = "io.grpc", name = "grpc-okhttp", version.ref = "grpc" }
2122
grpc-protobuf = { group = "io.grpc", name = "grpc-protobuf-lite", version.ref = "grpc" }
2223
grpc-stub = { group = "io.grpc", name = "grpc-stub", version.ref = "grpc" }
24+
grpc-kotlin-stub = { group = "io.grpc", name = "grpc-kotlin-stub", version.ref = "grpcKotlin" }
25+
protoc-gen-grpc-kotlin = { group = "io.grpc", name = "protoc-gen-grpc-kotlin", version.ref = "grpcKotlin" }
26+
protobuf-kotlin-lite = { group = "com.google.protobuf", name = "protobuf-kotlin-lite", version.ref = "protobuf" }
27+
2328
tomcat-annotations = { group = "org.apache.tomcat", name = "annotations-api", version.ref = "tomcatAnnotations" }
2429
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
2530
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" }

kuksa-java-sdk/build.gradle.kts

+23-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023 Contributors to the Eclipse Foundation
2+
* Copyright (c) 2023 - 2025 Contributors to the Eclipse Foundation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
1919

2020
@file:Suppress("UnstableApiUsage")
2121

22-
import com.google.protobuf.gradle.id
2322
import org.eclipse.kuksa.version.SemanticVersion
2423
import org.eclipse.kuksa.version.VERSION_FILE_DEFAULT_PATH_KEY
2524
import org.jetbrains.dokka.gradle.DokkaTask
@@ -95,11 +94,13 @@ dependencies {
9594

9695
// needs to be api as long as we expose ProtoBuf specific objects
9796
api(libs.grpc.protobuf)
97+
api(libs.protobuf.kotlin.lite)
9898

9999
implementation(kotlin("reflect"))
100100

101101
implementation(libs.grpc.okhttp)
102102
implementation(libs.grpc.stub)
103+
implementation(libs.grpc.kotlin.stub)
103104
implementation(libs.tomcat.annotations)
104105
implementation(libs.kotlinx.coroutines.core)
105106

@@ -116,20 +117,29 @@ protobuf {
116117
artifact = libs.protobuf.protoc.get().toString()
117118
}
118119
plugins {
119-
id("grpc") {
120+
create("grpc") {
120121
artifact = libs.grpc.protoc.java.gen.get().toString()
121122
}
122-
generateProtoTasks {
123-
all().forEach {
124-
it.builtins {
125-
named("java") {
126-
option("lite")
127-
}
123+
create("grpckt") {
124+
artifact = libs.protoc.gen.grpc.kotlin.get().toString() + ":jdk8@jar"
125+
}
126+
}
127+
generateProtoTasks {
128+
all().forEach {
129+
it.builtins {
130+
named("java") {
131+
option("lite")
132+
}
133+
create("kotlin") {
134+
option("lite")
135+
}
136+
}
137+
it.plugins {
138+
create("grpc") {
139+
option("lite")
128140
}
129-
it.plugins {
130-
create("grpc") {
131-
option("lite")
132-
}
141+
create("grpckt") {
142+
option("lite")
133143
}
134144
}
135145
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023 Contributors to the Eclipse Foundation
2+
* Copyright (c) 2023 - 2025 Contributors to the Eclipse Foundation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,9 +14,10 @@
1414
* limitations under the License.
1515
*
1616
* SPDX-License-Identifier: Apache-2.0
17+
*
1718
*/
1819

19-
package org.eclipse.kuksa.connectivity.databroker.listener
20+
package org.eclipse.kuksa.connectivity.databroker
2021

2122
import org.eclipse.kuksa.pattern.listener.Listener
2223

kuksa-java-sdk/src/main/kotlin/org/eclipse/kuksa/connectivity/databroker/DataBrokerConnection.kt renamed to kuksa-java-sdk/src/main/kotlin/org/eclipse/kuksa/connectivity/databroker/v1/DataBrokerConnection.kt

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023 Contributors to the Eclipse Foundation
2+
* Copyright (c) 2023 - 2025 Contributors to the Eclipse Foundation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,27 +14,29 @@
1414
* limitations under the License.
1515
*
1616
* SPDX-License-Identifier: Apache-2.0
17+
*
1718
*/
1819

19-
package org.eclipse.kuksa.connectivity.databroker
20+
package org.eclipse.kuksa.connectivity.databroker.v1
2021

2122
import io.grpc.ConnectivityState
2223
import io.grpc.ManagedChannel
2324
import kotlinx.coroutines.CoroutineDispatcher
2425
import kotlinx.coroutines.Dispatchers
2526
import kotlinx.coroutines.withContext
2627
import org.eclipse.kuksa.connectivity.authentication.JsonWebToken
27-
import org.eclipse.kuksa.connectivity.databroker.listener.DisconnectListener
28-
import org.eclipse.kuksa.connectivity.databroker.listener.VssNodeListener
29-
import org.eclipse.kuksa.connectivity.databroker.listener.VssPathListener
30-
import org.eclipse.kuksa.connectivity.databroker.request.FetchRequest
31-
import org.eclipse.kuksa.connectivity.databroker.request.SubscribeRequest
32-
import org.eclipse.kuksa.connectivity.databroker.request.UpdateRequest
33-
import org.eclipse.kuksa.connectivity.databroker.request.VssNodeFetchRequest
34-
import org.eclipse.kuksa.connectivity.databroker.request.VssNodeSubscribeRequest
35-
import org.eclipse.kuksa.connectivity.databroker.request.VssNodeUpdateRequest
36-
import org.eclipse.kuksa.connectivity.databroker.response.VssNodeUpdateResponse
37-
import org.eclipse.kuksa.connectivity.databroker.subscription.DataBrokerSubscriber
28+
import org.eclipse.kuksa.connectivity.databroker.DataBrokerException
29+
import org.eclipse.kuksa.connectivity.databroker.DisconnectListener
30+
import org.eclipse.kuksa.connectivity.databroker.v1.listener.VssNodeListener
31+
import org.eclipse.kuksa.connectivity.databroker.v1.listener.VssPathListener
32+
import org.eclipse.kuksa.connectivity.databroker.v1.request.FetchRequest
33+
import org.eclipse.kuksa.connectivity.databroker.v1.request.SubscribeRequest
34+
import org.eclipse.kuksa.connectivity.databroker.v1.request.UpdateRequest
35+
import org.eclipse.kuksa.connectivity.databroker.v1.request.VssNodeFetchRequest
36+
import org.eclipse.kuksa.connectivity.databroker.v1.request.VssNodeSubscribeRequest
37+
import org.eclipse.kuksa.connectivity.databroker.v1.request.VssNodeUpdateRequest
38+
import org.eclipse.kuksa.connectivity.databroker.v1.response.VssNodeUpdateResponse
39+
import org.eclipse.kuksa.connectivity.databroker.v1.subscription.DataBrokerSubscriber
3840
import org.eclipse.kuksa.extension.TAG
3941
import org.eclipse.kuksa.extension.datapoint
4042
import org.eclipse.kuksa.extension.vss.copy
@@ -59,7 +61,6 @@ class DataBrokerConnection internal constructor(
5961
private val dispatcher: CoroutineDispatcher = Dispatchers.Default,
6062
private val dataBrokerTransporter: DataBrokerTransporter = DataBrokerTransporter(
6163
managedChannel,
62-
dispatcher,
6364
),
6465
private val dataBrokerSubscriber: DataBrokerSubscriber = DataBrokerSubscriber(dataBrokerTransporter),
6566
) {

kuksa-java-sdk/src/main/kotlin/org/eclipse/kuksa/connectivity/databroker/DataBrokerConnector.kt renamed to kuksa-java-sdk/src/main/kotlin/org/eclipse/kuksa/connectivity/databroker/v1/DataBrokerConnector.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023 Contributors to the Eclipse Foundation
2+
* Copyright (c) 2023 - 2025 Contributors to the Eclipse Foundation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,9 +14,10 @@
1414
* limitations under the License.
1515
*
1616
* SPDX-License-Identifier: Apache-2.0
17+
*
1718
*/
1819

19-
package org.eclipse.kuksa.connectivity.databroker
20+
package org.eclipse.kuksa.connectivity.databroker.v1
2021

2122
import io.grpc.ConnectivityState
2223
import io.grpc.ManagedChannel
@@ -25,6 +26,7 @@ import kotlinx.coroutines.Dispatchers
2526
import kotlinx.coroutines.delay
2627
import kotlinx.coroutines.withContext
2728
import org.eclipse.kuksa.connectivity.authentication.JsonWebToken
29+
import org.eclipse.kuksa.connectivity.databroker.DataBrokerException
2830
import org.eclipse.kuksa.extension.TAG
2931
import org.eclipse.kuksa.model.TimeoutConfig
3032
import java.util.logging.Logger

0 commit comments

Comments
 (0)