Skip to content

Commit f371dbf

Browse files
committed
refactor: LiveViewSubscription -> LiveView
fixes: sourceplusplus/sourceplusplus#606
1 parent b937a19 commit f371dbf

File tree

13 files changed

+39
-44
lines changed

13 files changed

+39
-44
lines changed

src/main/kotlin/spp/protocol/SourceServices.kt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
*/
1717
package spp.protocol
1818

19-
import spp.protocol.SourceServices.Utilize.LIVE_INSTRUMENT
20-
import spp.protocol.SourceServices.Utilize.LIVE_VIEW
21-
2219
/**
2320
* todo: description.
2421
*
@@ -27,13 +24,11 @@ import spp.protocol.SourceServices.Utilize.LIVE_VIEW
2724
*/
2825
object SourceServices {
2926

30-
object Utilize {
31-
const val LIVE_MANAGEMENT_SERVICE = "spp.service.live-management-service"
32-
const val LIVE_INSTRUMENT = "spp.service.live-instrument"
33-
const val LIVE_VIEW = "spp.service.live-view"
34-
}
27+
const val LIVE_MANAGEMENT_SERVICE = "spp.service.live-management-service"
28+
const val LIVE_INSTRUMENT = "spp.service.live-instrument"
29+
const val LIVE_VIEW = "spp.service.live-view"
3530

36-
object Provide {
31+
object Subscribe {
3732
const val LIVE_INSTRUMENT_SUBSCRIBER = "$LIVE_INSTRUMENT.subscriber"
3833
const val LIVE_VIEW_SUBSCRIBER = "$LIVE_VIEW.subscriber"
3934

src/main/kotlin/spp/protocol/service/LiveInstrumentService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import io.vertx.codegen.annotations.VertxGen
2222
import io.vertx.core.Future
2323
import io.vertx.core.Vertx
2424
import io.vertx.core.eventbus.DeliveryOptions
25-
import spp.protocol.SourceServices
25+
import spp.protocol.SourceServices.LIVE_INSTRUMENT
2626
import spp.protocol.instrument.*
2727

2828
/**
@@ -42,7 +42,7 @@ interface LiveInstrumentService {
4242
val deliveryOptions = DeliveryOptions().apply {
4343
authToken?.let { addHeader("auth-token", it) }
4444
}
45-
return LiveInstrumentServiceVertxEBProxy(vertx, SourceServices.Utilize.LIVE_INSTRUMENT, deliveryOptions)
45+
return LiveInstrumentServiceVertxEBProxy(vertx, LIVE_INSTRUMENT, deliveryOptions)
4646
}
4747
}
4848

src/main/kotlin/spp/protocol/service/LiveManagementService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import io.vertx.core.Future
2323
import io.vertx.core.Vertx
2424
import io.vertx.core.eventbus.DeliveryOptions
2525
import io.vertx.core.json.JsonObject
26-
import spp.protocol.SourceServices.Utilize.LIVE_MANAGEMENT_SERVICE
26+
import spp.protocol.SourceServices.LIVE_MANAGEMENT_SERVICE
2727
import spp.protocol.platform.auth.ClientAccess
2828
import spp.protocol.platform.auth.RolePermission
2929
import spp.protocol.platform.developer.SelfInfo

src/main/kotlin/spp/protocol/service/LiveViewService.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import io.vertx.core.Future
2323
import io.vertx.core.Vertx
2424
import io.vertx.core.eventbus.DeliveryOptions
2525
import io.vertx.core.json.JsonObject
26-
import spp.protocol.SourceServices
27-
import spp.protocol.view.LiveViewSubscription
26+
import spp.protocol.SourceServices.LIVE_VIEW
27+
import spp.protocol.view.LiveView
2828

2929
/**
3030
* Back-end service for managing [LiveView]s.
@@ -43,15 +43,15 @@ interface LiveViewService {
4343
val deliveryOptions = DeliveryOptions().apply {
4444
authToken?.let { addHeader("auth-token", it) }
4545
}
46-
return LiveViewServiceVertxEBProxy(vertx, SourceServices.Utilize.LIVE_VIEW, deliveryOptions)
46+
return LiveViewServiceVertxEBProxy(vertx, LIVE_VIEW, deliveryOptions)
4747
}
4848
}
4949

50-
fun addLiveViewSubscription(subscription: LiveViewSubscription): Future<LiveViewSubscription>
51-
fun updateLiveViewSubscription(id: String, subscription: LiveViewSubscription): Future<LiveViewSubscription>
52-
fun removeLiveViewSubscription(id: String): Future<LiveViewSubscription>
53-
fun getLiveViewSubscription(id: String): Future<LiveViewSubscription>
54-
fun getLiveViewSubscriptions(): Future<List<LiveViewSubscription>>
55-
fun clearLiveViewSubscriptions(): Future<List<LiveViewSubscription>>
56-
fun getLiveViewSubscriptionStats(): Future<JsonObject>
50+
fun addLiveView(subscription: LiveView): Future<LiveView>
51+
fun updateLiveView(id: String, subscription: LiveView): Future<LiveView>
52+
fun removeLiveView(id: String): Future<LiveView>
53+
fun getLiveView(id: String): Future<LiveView>
54+
fun getLiveViews(): Future<List<LiveView>>
55+
fun clearLiveViews(): Future<List<LiveView>>
56+
fun getLiveViewStats(): Future<JsonObject>
5757
}

src/main/kotlin/spp/protocol/service/listen/LiveInstrumentListenerImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import io.vertx.core.Vertx
2121
import io.vertx.core.eventbus.MessageConsumer
2222
import io.vertx.core.json.JsonArray
2323
import io.vertx.core.json.JsonObject
24-
import spp.protocol.SourceServices.Provide.toLiveInstrumentSubscriberAddress
24+
import spp.protocol.SourceServices.Subscribe.toLiveInstrumentSubscriberAddress
2525
import spp.protocol.instrument.*
2626
import spp.protocol.instrument.event.*
2727

src/main/kotlin/spp/protocol/view/LiveViewSubscription.kt renamed to src/main/kotlin/spp/protocol/view/LiveView.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import spp.protocol.instrument.LiveSourceLocation
2929
* @author [Brandon Fergerson](mailto:bfergerson@apache.org)
3030
*/
3131
@DataObject
32-
data class LiveViewSubscription(
32+
data class LiveView(
3333
val subscriptionId: String? = null, //todo: actual bottom
3434
val entityIds: MutableSet<String>,
3535
val artifactQualifiedName: ArtifactQualifiedName? = null, //todo: remove, use artifactLocation
@@ -57,7 +57,7 @@ data class LiveViewSubscription(
5757
override fun equals(other: Any?): Boolean {
5858
if (this === other) return true
5959
if (javaClass != other?.javaClass) return false
60-
other as LiveViewSubscription
60+
other as LiveView
6161
if (subscriptionId != other.subscriptionId) return false
6262
return true
6363
}

src/main/resources/graphql/schema.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2165,7 +2165,7 @@
21652165
},
21662166
{
21672167
"kind": "OBJECT",
2168-
"name": "LiveViewSubscription",
2168+
"name": "LiveView",
21692169
"description": null,
21702170
"fields": [
21712171
{
@@ -2244,7 +2244,7 @@
22442244
},
22452245
{
22462246
"kind": "INPUT_OBJECT",
2247-
"name": "LiveViewSubscriptionInput",
2247+
"name": "LiveViewInput",
22482248
"description": null,
22492249
"fields": null,
22502250
"inputFields": [
@@ -3505,7 +3505,7 @@
35053505
"deprecationReason": null
35063506
},
35073507
{
3508-
"name": "addLiveViewSubscription",
3508+
"name": "addLiveView",
35093509
"description": null,
35103510
"args": [
35113511
{
@@ -3516,7 +3516,7 @@
35163516
"name": null,
35173517
"ofType": {
35183518
"kind": "INPUT_OBJECT",
3519-
"name": "LiveViewSubscriptionInput",
3519+
"name": "LiveViewInput",
35203520
"ofType": null
35213521
}
35223522
},
@@ -3528,15 +3528,15 @@
35283528
"name": null,
35293529
"ofType": {
35303530
"kind": "OBJECT",
3531-
"name": "LiveViewSubscription",
3531+
"name": "LiveView",
35323532
"ofType": null
35333533
}
35343534
},
35353535
"isDeprecated": false,
35363536
"deprecationReason": null
35373537
},
35383538
{
3539-
"name": "clearLiveViewSubscriptions",
3539+
"name": "clearLiveViews",
35403540
"description": null,
35413541
"args": [],
35423542
"type": {
@@ -4232,7 +4232,7 @@
42324232
"deprecationReason": null
42334233
},
42344234
{
4235-
"name": "getLiveViewSubscriptions",
4235+
"name": "getLiveViews",
42364236
"description": null,
42374237
"args": [],
42384238
"type": {
@@ -4246,7 +4246,7 @@
42464246
"name": null,
42474247
"ofType": {
42484248
"kind": "OBJECT",
4249-
"name": "LiveViewSubscription",
4249+
"name": "LiveView",
42504250
"ofType": null
42514251
}
42524252
}

src/main/resources/graphql/view/add-live-view-subscription.graphql renamed to src/main/resources/graphql/view/add-live-view.graphql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
mutation addLiveViewSubscription($input: LiveViewSubscriptionInput!) {
2-
addLiveViewSubscription(input: $input) {
1+
mutation addLiveView($input: LiveViewInput!) {
2+
addLiveView(input: $input) {
33
subscriptionId
44
entityIds
55
artifactQualifiedName {

src/main/resources/graphql/view/clear-live-view-subscriptions.graphql

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mutation clearLiveViews {
2+
clearLiveViews
3+
}

0 commit comments

Comments
 (0)