Skip to content

Commit 4ec55f0

Browse files
committed
live service provider
1 parent 5e5ded9 commit 4ec55f0

File tree

5 files changed

+55
-6
lines changed

5 files changed

+55
-6
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package spp.protocol.developer
2+
3+
import kotlinx.serialization.Serializable
4+
import spp.protocol.auth.AccessPermission
5+
import spp.protocol.auth.DeveloperRole
6+
import spp.protocol.auth.RolePermission
7+
8+
@Serializable
9+
data class SelfInfo(
10+
val developer: Developer,
11+
val roles: List<DeveloperRole>,
12+
val permissions: List<RolePermission>,
13+
val access: List<AccessPermission>
14+
)

src/jvmMain/kotlin/spp/protocol/ProtocolMarshaller.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import kotlinx.datetime.Instant
1616
import spp.protocol.artifact.ArtifactQualifiedName
1717
import spp.protocol.artifact.log.LogCountSummary
1818
import spp.protocol.artifact.trace.TraceResult
19+
import spp.protocol.developer.SelfInfo
1920
import spp.protocol.instrument.LiveInstrument
2021
import spp.protocol.instrument.LiveInstrumentBatch
2122
import spp.protocol.instrument.LiveInstrumentType
@@ -178,6 +179,16 @@ object ProtocolMarshaller {
178179
return value.mapTo(LiveViewSubscription::class.java)
179180
}
180181

182+
@JvmStatic
183+
fun serializeSelfInfo(value: SelfInfo): JsonObject {
184+
return JsonObject(Json.encode(value))
185+
}
186+
187+
@JvmStatic
188+
fun deserializeSelfInfo(value: JsonObject): SelfInfo {
189+
return value.mapTo(SelfInfo::class.java)
190+
}
191+
181192
@JvmStatic
182193
fun deserializeLiveInstrumentBatch(value: JsonObject): LiveInstrumentBatch {
183194
val rawInstruments = value.getJsonArray("instruments")

src/jvmMain/kotlin/spp/protocol/SourceMarkerServices.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package spp.protocol
22

33
import spp.protocol.SourceMarkerServices.Utilize.LIVE_INSTRUMENT
44
import spp.protocol.SourceMarkerServices.Utilize.LIVE_VIEW
5+
import spp.protocol.service.LiveService
56
import spp.protocol.service.live.LiveInstrumentService
67
import spp.protocol.service.live.LiveViewService
78
import spp.protocol.service.logging.LogCountIndicatorService
@@ -16,21 +17,23 @@ import spp.protocol.service.tracing.LocalTracingService
1617
object SourceMarkerServices {
1718

1819
object Instance {
20+
var liveService: LiveService? = null
1921
var liveInstrument: LiveInstrumentService? = null
2022
var liveView: LiveViewService? = null
2123
var localTracing: LocalTracingService? = null
2224
var logCountIndicator: LogCountIndicatorService? = null
2325
}
2426

2527
object Status {
26-
const val MARKER_CONNECTED = "sm.status.marker-connected"
28+
const val MARKER_CONNECTED = "spp.status.marker-connected"
2729
}
2830

2931
object Utilize {
30-
const val LIVE_VIEW = "sm.service.live-view"
31-
const val LIVE_INSTRUMENT = "sm.service.live-instrument"
32-
const val LOCAL_TRACING = "sm.service.local-tracing"
33-
const val LOG_COUNT_INDICATOR = "sm.service.log-count-indicator"
32+
const val LIVE_SERVICE = "spp.service.live-service"
33+
const val LIVE_INSTRUMENT = "spp.service.live-instrument"
34+
const val LIVE_VIEW = "spp.service.live-view"
35+
const val LOCAL_TRACING = "spp.service.local-tracing"
36+
const val LOG_COUNT_INDICATOR = "spp.service.log-count-indicator"
3437
}
3538

3639
object Provide {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package spp.protocol.service
2+
3+
import io.vertx.codegen.annotations.ProxyGen
4+
import io.vertx.codegen.annotations.VertxGen
5+
import io.vertx.core.AsyncResult
6+
import io.vertx.core.Handler
7+
import spp.protocol.developer.SelfInfo
8+
9+
/**
10+
* todo: description.
11+
*
12+
* @author [Brandon Fergerson](mailto:bfergerson@apache.org)
13+
*/
14+
@ProxyGen
15+
@VertxGen
16+
interface LiveService {
17+
18+
fun getSelf(handler: Handler<AsyncResult<SelfInfo>>)
19+
}

src/jvmMain/resources/META-INF/vertx/json-mappers.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ spp.protocol.instrument.meter.LiveMeter.deserializer=spp.protocol.ProtocolMarsha
1919
spp.protocol.instrument.LiveInstrumentBatch.serializer=spp.protocol.ProtocolMarshaller#serializeLiveInstrumentBatch
2020
spp.protocol.instrument.LiveInstrumentBatch.deserializer=spp.protocol.ProtocolMarshaller#deserializeLiveInstrumentBatch
2121
spp.protocol.view.LiveViewSubscription.serializer=spp.protocol.ProtocolMarshaller#serializeLiveViewSubscription
22-
spp.protocol.view.LiveViewSubscription.deserializer=spp.protocol.ProtocolMarshaller#deserializeLiveViewSubscription
22+
spp.protocol.view.LiveViewSubscription.deserializer=spp.protocol.ProtocolMarshaller#deserializeLiveViewSubscription
23+
spp.protocol.developer.SelfInfo.serializer=spp.protocol.ProtocolMarshaller#serializeSelfInfo
24+
spp.protocol.developer.SelfInfo.deserializer=spp.protocol.ProtocolMarshaller#deserializeSelfInfo

0 commit comments

Comments
 (0)