Refactoring of main DeviceRpcService name

This commit is contained in:
Andrew Shvayka 2018-04-16 20:16:21 +03:00
parent eb6f0f394e
commit de38a77632
4 changed files with 10 additions and 12 deletions

View File

@ -41,7 +41,7 @@ import org.thingsboard.server.extensions.api.exception.ToErrorResponseEntity;
import org.thingsboard.server.extensions.api.plugins.PluginConstants; import org.thingsboard.server.extensions.api.plugins.PluginConstants;
import org.thingsboard.server.common.data.rpc.RpcRequest; import org.thingsboard.server.common.data.rpc.RpcRequest;
import org.thingsboard.server.service.rpc.LocalRequestMetaData; import org.thingsboard.server.service.rpc.LocalRequestMetaData;
import org.thingsboard.server.service.rpc.RpcService; import org.thingsboard.server.service.rpc.DeviceRpcService;
import org.thingsboard.server.service.security.AccessValidator; import org.thingsboard.server.service.security.AccessValidator;
import org.thingsboard.server.service.security.model.SecurityUser; import org.thingsboard.server.service.security.model.SecurityUser;
@ -66,7 +66,7 @@ public class RpcController extends BaseController {
protected final ObjectMapper jsonMapper = new ObjectMapper(); protected final ObjectMapper jsonMapper = new ObjectMapper();
@Autowired @Autowired
private RpcService rpcService; private DeviceRpcService deviceRpcService;
@Autowired @Autowired
private AccessValidator accessValidator; private AccessValidator accessValidator;
@ -124,7 +124,7 @@ public class RpcController extends BaseController {
timeout, timeout,
body body
); );
rpcService.process(rpcRequest, new LocalRequestMetaData(rpcRequest, currentUser, response)); deviceRpcService.process(rpcRequest, new LocalRequestMetaData(rpcRequest, currentUser, response));
} }
@Override @Override
@ -135,7 +135,7 @@ public class RpcController extends BaseController {
} else { } else {
entity = new ResponseEntity(HttpStatus.UNAUTHORIZED); entity = new ResponseEntity(HttpStatus.UNAUTHORIZED);
} }
rpcService.logRpcCall(currentUser, deviceId, body, oneWay, Optional.empty(), e); deviceRpcService.logRpcCall(currentUser, deviceId, body, oneWay, Optional.empty(), e);
response.setResult(entity); response.setResult(entity);
} }
}); });

View File

@ -18,7 +18,6 @@ package org.thingsboard.server.service.rpc;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -34,7 +33,6 @@ import org.thingsboard.server.common.msg.cluster.ServerAddress;
import org.thingsboard.server.common.msg.rpc.ToDeviceRpcRequest; import org.thingsboard.server.common.msg.rpc.ToDeviceRpcRequest;
import org.thingsboard.server.controller.BaseController; import org.thingsboard.server.controller.BaseController;
import org.thingsboard.server.dao.audit.AuditLogService; import org.thingsboard.server.dao.audit.AuditLogService;
import org.thingsboard.server.extensions.api.plugins.PluginContext;
import org.thingsboard.server.extensions.api.plugins.msg.FromDeviceRpcResponse; import org.thingsboard.server.extensions.api.plugins.msg.FromDeviceRpcResponse;
import org.thingsboard.server.extensions.api.plugins.msg.RpcError; import org.thingsboard.server.extensions.api.plugins.msg.RpcError;
import org.thingsboard.server.service.cluster.routing.ClusterRoutingService; import org.thingsboard.server.service.cluster.routing.ClusterRoutingService;
@ -58,7 +56,7 @@ import java.util.function.BiConsumer;
*/ */
@Service @Service
@Slf4j @Slf4j
public class DefaultRpcService implements RpcService { public class DefaultDeviceRpcService implements DeviceRpcService {
private static final ObjectMapper jsonMapper = new ObjectMapper(); private static final ObjectMapper jsonMapper = new ObjectMapper();

View File

@ -27,7 +27,7 @@ import java.util.Optional;
/** /**
* Created by ashvayka on 16.04.18. * Created by ashvayka on 16.04.18.
*/ */
public interface RpcService { public interface DeviceRpcService {
void process(ToDeviceRpcRequest request, LocalRequestMetaData metaData); void process(ToDeviceRpcRequest request, LocalRequestMetaData metaData);

View File

@ -1,12 +1,12 @@
/** /**
* Copyright © 2016-2018 The Thingsboard Authors * Copyright © 2016-2018 The Thingsboard Authors
* <p> *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* <p> *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* <p> *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.