Skip to content

Commit e64b030

Browse files
committed
#1633 remove all deprecated
1 parent 80d9a8b commit e64b030

32 files changed

Lines changed: 112 additions & 590 deletions

docs/rpc/service.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,24 @@ exchange in [XLON, XAMS, NYSE]
1616
You may have noticed when you type in the filter in the grid you get a typeahead hint for the available values. If I had
1717
typed "exchange in [" the UI offers up to 10 values based on the contents of the tables.
1818

19-
These suggestions are implemented as an RPC service within the type ahead module:
19+
These suggestions are implemented as an RPC service ViewportTypeAheadRpcHandler within the DefaultRpcHandler:
2020

2121
```scala
22-
23-
object TypeAheadModule extends DefaultModule {
24-
25-
final val NAME = "TYPEAHEAD"
26-
27-
def apply()(implicit clock: Clock, lifecycle: LifecycleContainer): ViewServerModule = {
28-
ModuleFactory.withNamespace(NAME)
29-
.addRpcHandler(server => new GenericTypeAheadRpcHandler(server.tableContainer))
30-
.asModule()
31-
}
32-
}
22+
class DefaultRpcHandler(implicit tableContainer: TableContainer) extends RpcHandler with StrictLogging {
23+
...
24+
private val viewportTypeAheadRpcHandler = new ViewportTypeAheadRpcHandler(tableContainer)
25+
viewportTypeAheadRpcHandler.register(this)
3326
```
3427

35-
You can see we've defined an RpcHandler called GenericTypeAheadRpcHandler, which implements the interface:
28+
You can see we've defined an RpcHandler called ViewportTypeAheadRpcHandler:
3629

3730
```scala
38-
trait TypeAheadRpcHandler{
39-
def getUniqueFieldValues(tableMap: Map[String, String], column: String, ctx: RequestContext): Array[String]
40-
def getUniqueFieldValuesStartingWith(tableMap: Map[String, String], column: String, starts: String, ctx: RequestContext): Array[String]
31+
class ViewportTypeAheadRpcHandler(tableContainer: TableContainer) {
32+
...
33+
def processGetUniqueFieldValuesRequest(params: RpcParams): RpcFunctionResult = {
34+
...
35+
def processGetUniqueFieldValuesStartWithRequest(params: RpcParams): RpcFunctionResult = {
36+
...
4137
}
4238
```
4339

example/apache-ignite/src/main/scala/org/finos/vuu/example/ignite/IgniteVuuMain.scala

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@ import org.finos.toolbox.lifecycle.LifecycleContainer
77
import org.finos.toolbox.time.{Clock, DefaultClock}
88
import org.finos.vuu.core._
99
import org.finos.vuu.core.module.TableDefContainer
10-
import org.finos.vuu.core.module.authn.AuthNModule
11-
import org.finos.vuu.core.module.auths.PermissionModule
1210
import org.finos.vuu.core.module.metrics.MetricsModule
13-
import org.finos.vuu.core.module.price.PriceModule
14-
import org.finos.vuu.core.module.simul.SimulationModule
15-
import org.finos.vuu.core.module.typeahead.TypeAheadModule
16-
import org.finos.vuu.core.module.vui.VuiStateModule
1711
import org.finos.vuu.example.ignite.loader.IgniteOrderGenerator
1812
import org.finos.vuu.example.ignite.module.IgniteOrderDataModule
1913
import org.finos.vuu.net.auth.AlwaysHappyAuthenticator
2014
import org.finos.vuu.net.http.{AbsolutePathWebRoot, VuuHttp2ServerOptions}
2115
import org.finos.vuu.net.{AlwaysHappyLoginValidator, Authenticator, LoggedInTokenValidator}
22-
import org.finos.vuu.order.oms.OmsApi
2316
import org.finos.vuu.plugin.virtualized.VirtualizedTablePlugin
2417
import org.finos.vuu.state.MemoryBackedVuiStateStore
2518

@@ -78,8 +71,7 @@ object IgniteVuuMain extends App with StrictLogging {
7871
VuuThreadingOptions()
7972
.withViewPortThreads(4)
8073
.withTreeThreads(4)
81-
).withModule(TypeAheadModule())
82-
.withModule(MetricsModule())
74+
).withModule(MetricsModule())
8375
.withModule(IgniteOrderDataModule(igniteOrderStore))
8476
.withPlugin(VirtualizedTablePlugin)
8577

example/basket/src/test/scala/org/finos/vuu/core/module/basket/BasketConstituentMutateTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class BasketConstituentMutateTest extends VuuServerTestCase {
4949
val basketTradingConstituentJoinService = vpBasketTradingConsJoin.getStructure.viewPortDef.service
5050
val selection = vpBasketTradingConsJoin.getSelection
5151
val vpSelection = ViewPortSelection(selection, vpBasketTradingConsJoin)
52-
basketTradingConstituentJoinService.processRpcRequest("setSell", new RpcParams(null, Map("selection" -> vpSelection), None, None, vuuServer.requestContext))
52+
basketTradingConstituentJoinService.processRpcRequest("setSell", new RpcParams(Map("selection" -> vpSelection), None, None, vuuServer.requestContext))
5353
vuuServer.runOnce()
5454

5555
Then("get all the updates that have occurred for all view ports from the outbound queue")

example/basket/src/test/scala/org/finos/vuu/core/module/basket/BasketCreateTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class BasketCreateTest extends VuuServerTestCase {
7070

7171
val basketService = viewportBasket.getStructure.viewPortDef.service
7272

73-
val rpcResult = basketService.processRpcRequest("createBasket", new RpcParams(null, Map("sourceBasketId" -> basketId, "basketTradeName" -> "TestBasket"), None, None, vuuServer.requestContext))
73+
val rpcResult = basketService.processRpcRequest("createBasket", new RpcParams(Map("sourceBasketId" -> basketId, "basketTradeName" -> "TestBasket"), None, None, vuuServer.requestContext))
7474
vuuServer.runOnce()
7575
assert(rpcResult.isInstanceOf[RpcFunctionSuccess])
7676
val basketTradeInstanceId = rpcResult.asInstanceOf[RpcFunctionSuccess].optionalResult.get.asInstanceOf[String]

example/basket/src/test/scala/org/finos/vuu/core/module/basket/BasketMutateOffMarketTest.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class BasketMutateOffMarketTest extends VuuServerTestCase {
6969

7070
Then("Get the Basket RPC Service and call create basket")
7171
val basketService = vpBasket.getStructure.viewPortDef.service
72-
val rpcResult = basketService.processRpcRequest("createBasket", new RpcParams(null, Map("sourceBasketId" -> ".FTSE", "basketTradeName" -> "MyCustomBasket"), None, None, vuuServer.requestContext))
72+
val rpcResult = basketService.processRpcRequest("createBasket", new RpcParams(Map("sourceBasketId" -> ".FTSE", "basketTradeName" -> "MyCustomBasket"), None, None, vuuServer.requestContext))
7373
assert(rpcResult.isInstanceOf[RpcFunctionSuccess])
7474
val basketTradeInstanceId = rpcResult.asInstanceOf[RpcFunctionSuccess].optionalResult.get.asInstanceOf[String]
7575

@@ -210,7 +210,7 @@ class BasketMutateOffMarketTest extends VuuServerTestCase {
210210
vuuServer.runOnce()
211211

212212
When("we edit the side of the parent basket to same side as current value")
213-
basketTradingConstituentJoinService.processRpcRequest("addConstituent", new RpcParams(null, Map("ric" -> "0001.HK"), None, None, vuuServer.requestContext))
213+
basketTradingConstituentJoinService.processRpcRequest("addConstituent", new RpcParams(Map("ric" -> "0001.HK"), None, None, vuuServer.requestContext))
214214
vuuServer.runOnce()
215215

216216
Then("get all the updates that have occurred for all view ports from the outbound queue")
@@ -243,7 +243,7 @@ class BasketMutateOffMarketTest extends VuuServerTestCase {
243243

244244
val vpBasket = vuuServer.createViewPort(BasketModule.NAME, BasketModule.BasketTable)
245245
val basketService = vpBasket.getStructure.viewPortDef.service
246-
val rpcResult = basketService.processRpcRequest("createBasket", new RpcParams(null, Map("sourceBasketId" -> basketId, "basketTradeName" -> basketTradeName), None, None, vuuServer.requestContext))
246+
val rpcResult = basketService.processRpcRequest("createBasket", new RpcParams(Map("sourceBasketId" -> basketId, "basketTradeName" -> basketTradeName), None, None, vuuServer.requestContext))
247247
assert(rpcResult.isInstanceOf[RpcFunctionSuccess])
248248
rpcResult.asInstanceOf[RpcFunctionSuccess].optionalResult.get.asInstanceOf[String]
249249
}

example/basket/src/test/scala/org/finos/vuu/core/module/basket/BasketSendToMarketTest.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class BasketSendToMarketTest extends VuuServerTestCase {
5050
Then("Get the Basket RPC Service and call create basket")
5151
val basketService = vpBasket.getStructure.viewPortDef.service
5252

53-
val rpcResult = basketService.processRpcRequest("createBasket", new RpcParams(null, Map("sourceBasketId" -> ".FTSE", "basketTradeName" -> "TestBasket"), None, None, vuuServer.requestContext))
53+
val rpcResult = basketService.processRpcRequest("createBasket", new RpcParams(Map("sourceBasketId" -> ".FTSE", "basketTradeName" -> "TestBasket"), None, None, vuuServer.requestContext))
5454
assert(rpcResult.isInstanceOf[RpcFunctionSuccess])
5555
val basketTradeInstanceId = rpcResult.asInstanceOf[RpcFunctionSuccess].optionalResult.get.asInstanceOf[String]
5656

@@ -71,7 +71,7 @@ class BasketSendToMarketTest extends VuuServerTestCase {
7171

7272
val tradingService = vpBasketTrading.getStructure.viewPortDef.service
7373
And("send the basket to market")
74-
tradingService.processRpcRequest("sendToMarket", new RpcParams(null, Map("basketInstanceId"-> basketTradeInstanceId), None, None, vuuServer.requestContext))
74+
tradingService.processRpcRequest("sendToMarket", new RpcParams(Map("basketInstanceId"-> basketTradeInstanceId), None, None, vuuServer.requestContext))
7575

7676
vuuServer.runOnce()
7777

@@ -84,7 +84,7 @@ class BasketSendToMarketTest extends VuuServerTestCase {
8484
}
8585

8686
Then("Take the basket off the market")
87-
tradingService.processRpcRequest("takeOffMarket", new RpcParams(null, Map("basketInstanceId"-> basketTradeInstanceId), None, None, vuuServer.requestContext))
87+
tradingService.processRpcRequest("takeOffMarket", new RpcParams(Map("basketInstanceId"-> basketTradeInstanceId), None, None, vuuServer.requestContext))
8888

8989
vuuServer.runOnce()
9090

example/main-java/src/main/java/org/finos/vuu/VuuExampleMain.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.finos.vuu.core.module.metrics.MetricsModule;
1313
import org.finos.vuu.core.module.price.PriceModule;
1414
import org.finos.vuu.core.module.simul.SimulationModule;
15-
import org.finos.vuu.core.module.typeahead.TypeAheadModule;
1615
import org.finos.vuu.core.module.vui.VuiStateModule;
1716
import org.finos.vuu.module.JavaExampleModule;
1817
import org.finos.vuu.net.AlwaysHappyLoginValidator;
@@ -78,7 +77,6 @@ public static void main( String[] args )
7877
.withModule(SimulationModule.apply(clock, lifecycle, tableDefContainer))
7978
.withModule(MetricsModule.apply(clock, lifecycle, metrics, tableDefContainer))
8079
.withModule(VuiStateModule.apply(store, clock, lifecycle, tableDefContainer))
81-
.withModule(TypeAheadModule.apply(clock, lifecycle, tableDefContainer))
8280
.withModule(AuthNModule.apply(authenticator, loginTokenValidator, clock, lifecycle, tableDefContainer))
8381
//the modules above are scala, the modules below are java...
8482
.withModule(new JavaExampleModule().create(tableDefContainer, clock)) ;

vuu-java/src/test/java/org/finos/vuu/net/rpc/RpcMethodHandlerTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
import test.helper.ViewPortTestUtils;
1919

2020
import java.util.Collections;
21-
22-
import static test.helper.ViewPortTestUtils.createRandomViewServerMessage;
21+
import java.util.Map;
2322

2423
public class RpcMethodHandlerTest {
2524

@@ -34,12 +33,12 @@ public void should_register_java_function_as_rpc_in_default_handler() {
3433
final DefaultRpcHandler defaultRpcHandler = new DefaultRpcHandler(tableContainer);
3534
defaultRpcHandler.registerRpc("helloWorld", rpcService::rpcFunction);
3635

37-
RpcCall call = new RpcCall("service", "helloWorld", new Object[]{}, ScalaCollectionConverter.toScala(Collections.emptyMap()));
38-
Option<ViewServerMessage> response = defaultRpcHandler.processRpcCall(createRandomViewServerMessage(new LoginRequest("token", "user")), call, ViewPortTestUtils.requestContext());
36+
RpcFunctionResult response = defaultRpcHandler.processRpcRequest("helloWorld", new RpcParams(ScalaCollectionConverter.toScala(Collections.emptyMap()), Option.empty(), Option.empty(), ViewPortTestUtils.requestContext()));
3937

40-
Assertions.assertThat(response.get().body())
41-
.isExactlyInstanceOf(RpcResponse.class)
42-
.isEqualTo(new RpcResponse("helloWorld", "It Works", null));
38+
Assertions.assertThat(response)
39+
.isExactlyInstanceOf(RpcFunctionSuccess.class);
40+
Assertions.assertThat(((RpcFunctionSuccess) response).optionalResult().get())
41+
.isEqualTo("It Works");
4342
}
4443

4544
static class TestRpcService {

vuu/src/main/scala/org/finos/vuu/core/CoreServerApiHandler.scala

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@ class CoreServerApiHandler(val viewPortContainer: ViewPortContainer,
1515
val tableContainer: TableContainer,
1616
val providers: ProviderContainer)(implicit timeProvider: Clock) extends ServerApi with StrictLogging {
1717

18-
@deprecated("ViewPortRpcCall is replaced by RpcRequest")
19-
override def process(msg: ViewPortRpcCall)(ctx: RequestContext): Option[ViewServerMessage] = {
20-
Try(viewPortContainer.callRpcService(msg.vpId, msg.rpcName, msg.params, msg.namedParams, ctx.session)(ctx)) match {
21-
case Success(action) =>
22-
logger.debug("Processed VP RPC call " + msg)
23-
vsMsg(ViewPortRpcResponse(msg.vpId, msg.rpcName, action))(ctx)
24-
case Failure(e) =>
25-
logger.warn("Failed to process VP RPC call", e)
26-
vsMsg(ViewPortMenuRpcReject(msg.vpId, msg.rpcName, e.getMessage))(ctx)
27-
}
28-
}
29-
3018
override def process(msg: ViewPortMenuCellRpcCall)(ctx: RequestContext): Option[ViewServerMessage] = {
3119
Try(viewPortContainer.callRpcCell(msg.vpId, msg.rpcName, ctx.session, msg.rowKey, msg.field, msg.value)) match {
3220
case Success(action) =>

vuu/src/main/scala/org/finos/vuu/core/VuuServer.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,11 @@ class VuuServer(config: VuuServerConfig)(implicit lifecycle: LifecycleContainer,
145145
val vs = this
146146

147147
val realized = new RealizedViewServerModule {
148-
@deprecated("RpcCall is replaced by RpcRequest")
149-
override def rpcHandlers: List[RpcHandler] = module.rpcHandlersUnrealized.map(_.apply(vs))
150148
override def restServices: List[RestService] = module.restServicesUnrealized.map(_.apply(vs))
151149
override def name: String = module.name
152150
override def tableDefContainer: TableDefContainer = module.tableDefContainer
153151
override def tableDefs: List[TableDef] = module.tableDefs
154152
override def serializationMixin: AnyRef = module.serializationMixin
155-
@deprecated("RpcCall is replaced by RpcRequest")
156-
override def rpcHandlersUnrealized: List[IVuuServer => RpcHandler] = module.rpcHandlersUnrealized
157153
override def restServicesUnrealized: List[IVuuServer => RestService] = module.restServicesUnrealized
158154
override def getProviderForTable(table: DataTable, viewserver: IVuuServer)(implicit time: Clock, life: LifecycleContainer): Provider = {
159155
module.getProviderForTable(table, viewserver)(time, life)

0 commit comments

Comments
 (0)