Commit de38a77632a207938c407710fa6be5cf7bc03f53

Authored by Andrew Shvayka
1 parent eb6f0f39

Refactoring of main DeviceRpcService name

@@ -41,7 +41,7 @@ import org.thingsboard.server.extensions.api.exception.ToErrorResponseEntity; @@ -41,7 +41,7 @@ import org.thingsboard.server.extensions.api.exception.ToErrorResponseEntity;
41 import org.thingsboard.server.extensions.api.plugins.PluginConstants; 41 import org.thingsboard.server.extensions.api.plugins.PluginConstants;
42 import org.thingsboard.server.common.data.rpc.RpcRequest; 42 import org.thingsboard.server.common.data.rpc.RpcRequest;
43 import org.thingsboard.server.service.rpc.LocalRequestMetaData; 43 import org.thingsboard.server.service.rpc.LocalRequestMetaData;
44 -import org.thingsboard.server.service.rpc.RpcService; 44 +import org.thingsboard.server.service.rpc.DeviceRpcService;
45 import org.thingsboard.server.service.security.AccessValidator; 45 import org.thingsboard.server.service.security.AccessValidator;
46 import org.thingsboard.server.service.security.model.SecurityUser; 46 import org.thingsboard.server.service.security.model.SecurityUser;
47 47
@@ -66,7 +66,7 @@ public class RpcController extends BaseController { @@ -66,7 +66,7 @@ public class RpcController extends BaseController {
66 protected final ObjectMapper jsonMapper = new ObjectMapper(); 66 protected final ObjectMapper jsonMapper = new ObjectMapper();
67 67
68 @Autowired 68 @Autowired
69 - private RpcService rpcService; 69 + private DeviceRpcService deviceRpcService;
70 70
71 @Autowired 71 @Autowired
72 private AccessValidator accessValidator; 72 private AccessValidator accessValidator;
@@ -124,7 +124,7 @@ public class RpcController extends BaseController { @@ -124,7 +124,7 @@ public class RpcController extends BaseController {
124 timeout, 124 timeout,
125 body 125 body
126 ); 126 );
127 - rpcService.process(rpcRequest, new LocalRequestMetaData(rpcRequest, currentUser, response)); 127 + deviceRpcService.process(rpcRequest, new LocalRequestMetaData(rpcRequest, currentUser, response));
128 } 128 }
129 129
130 @Override 130 @Override
@@ -135,7 +135,7 @@ public class RpcController extends BaseController { @@ -135,7 +135,7 @@ public class RpcController extends BaseController {
135 } else { 135 } else {
136 entity = new ResponseEntity(HttpStatus.UNAUTHORIZED); 136 entity = new ResponseEntity(HttpStatus.UNAUTHORIZED);
137 } 137 }
138 - rpcService.logRpcCall(currentUser, deviceId, body, oneWay, Optional.empty(), e); 138 + deviceRpcService.logRpcCall(currentUser, deviceId, body, oneWay, Optional.empty(), e);
139 response.setResult(entity); 139 response.setResult(entity);
140 } 140 }
141 }); 141 });
application/src/main/java/org/thingsboard/server/service/rpc/DefaultDeviceRpcService.java renamed from application/src/main/java/org/thingsboard/server/service/rpc/DefaultRpcService.java
@@ -18,7 +18,6 @@ package org.thingsboard.server.service.rpc; @@ -18,7 +18,6 @@ package org.thingsboard.server.service.rpc;
18 import com.fasterxml.jackson.databind.ObjectMapper; 18 import com.fasterxml.jackson.databind.ObjectMapper;
19 import lombok.extern.slf4j.Slf4j; 19 import lombok.extern.slf4j.Slf4j;
20 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
21 -import org.springframework.http.HttpEntity;  
22 import org.springframework.http.HttpStatus; 21 import org.springframework.http.HttpStatus;
23 import org.springframework.http.ResponseEntity; 22 import org.springframework.http.ResponseEntity;
24 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
@@ -34,7 +33,6 @@ import org.thingsboard.server.common.msg.cluster.ServerAddress; @@ -34,7 +33,6 @@ import org.thingsboard.server.common.msg.cluster.ServerAddress;
34 import org.thingsboard.server.common.msg.rpc.ToDeviceRpcRequest; 33 import org.thingsboard.server.common.msg.rpc.ToDeviceRpcRequest;
35 import org.thingsboard.server.controller.BaseController; 34 import org.thingsboard.server.controller.BaseController;
36 import org.thingsboard.server.dao.audit.AuditLogService; 35 import org.thingsboard.server.dao.audit.AuditLogService;
37 -import org.thingsboard.server.extensions.api.plugins.PluginContext;  
38 import org.thingsboard.server.extensions.api.plugins.msg.FromDeviceRpcResponse; 36 import org.thingsboard.server.extensions.api.plugins.msg.FromDeviceRpcResponse;
39 import org.thingsboard.server.extensions.api.plugins.msg.RpcError; 37 import org.thingsboard.server.extensions.api.plugins.msg.RpcError;
40 import org.thingsboard.server.service.cluster.routing.ClusterRoutingService; 38 import org.thingsboard.server.service.cluster.routing.ClusterRoutingService;
@@ -58,7 +56,7 @@ import java.util.function.BiConsumer; @@ -58,7 +56,7 @@ import java.util.function.BiConsumer;
58 */ 56 */
59 @Service 57 @Service
60 @Slf4j 58 @Slf4j
61 -public class DefaultRpcService implements RpcService { 59 +public class DefaultDeviceRpcService implements DeviceRpcService {
62 60
63 private static final ObjectMapper jsonMapper = new ObjectMapper(); 61 private static final ObjectMapper jsonMapper = new ObjectMapper();
64 62
application/src/main/java/org/thingsboard/server/service/rpc/DeviceRpcService.java renamed from application/src/main/java/org/thingsboard/server/service/rpc/RpcService.java
@@ -27,7 +27,7 @@ import java.util.Optional; @@ -27,7 +27,7 @@ import java.util.Optional;
27 /** 27 /**
28 * Created by ashvayka on 16.04.18. 28 * Created by ashvayka on 16.04.18.
29 */ 29 */
30 -public interface RpcService { 30 +public interface DeviceRpcService {
31 31
32 void process(ToDeviceRpcRequest request, LocalRequestMetaData metaData); 32 void process(ToDeviceRpcRequest request, LocalRequestMetaData metaData);
33 33
1 /** 1 /**
2 * Copyright © 2016-2018 The Thingsboard Authors 2 * Copyright © 2016-2018 The Thingsboard Authors
3 - * <p> 3 + *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at 6 * You may obtain a copy of the License at
7 - * <p>  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - * <p> 7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
10 * Unless required by applicable law or agreed to in writing, software 10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, 11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.