Showing
73 changed files
with
287 additions
and
180 deletions
@@ -69,8 +69,8 @@ | @@ -69,8 +69,8 @@ | ||
69 | <!--<artifactId>coap</artifactId>--> | 69 | <!--<artifactId>coap</artifactId>--> |
70 | <!--</dependency>--> | 70 | <!--</dependency>--> |
71 | <dependency> | 71 | <dependency> |
72 | - <groupId>org.thingsboard.transport</groupId> | ||
73 | - <artifactId>mqtt-common</artifactId> | 72 | + <groupId>org.thingsboard.common.transport</groupId> |
73 | + <artifactId>mqtt</artifactId> | ||
74 | </dependency> | 74 | </dependency> |
75 | <dependency> | 75 | <dependency> |
76 | <groupId>org.thingsboard</groupId> | 76 | <groupId>org.thingsboard</groupId> |
@@ -64,7 +64,6 @@ import org.thingsboard.server.service.encoding.DataDecodingEncodingService; | @@ -64,7 +64,6 @@ import org.thingsboard.server.service.encoding.DataDecodingEncodingService; | ||
64 | import org.thingsboard.server.service.executors.DbCallbackExecutorService; | 64 | import org.thingsboard.server.service.executors.DbCallbackExecutorService; |
65 | import org.thingsboard.server.service.executors.ExternalCallExecutorService; | 65 | import org.thingsboard.server.service.executors.ExternalCallExecutorService; |
66 | import org.thingsboard.server.service.mail.MailExecutorService; | 66 | import org.thingsboard.server.service.mail.MailExecutorService; |
67 | -import org.thingsboard.server.service.queue.MsgQueueService; | ||
68 | import org.thingsboard.server.service.rpc.DeviceRpcService; | 67 | import org.thingsboard.server.service.rpc.DeviceRpcService; |
69 | import org.thingsboard.server.service.script.JsExecutorService; | 68 | import org.thingsboard.server.service.script.JsExecutorService; |
70 | import org.thingsboard.server.service.script.JsInvokeService; | 69 | import org.thingsboard.server.service.script.JsInvokeService; |
@@ -417,7 +417,7 @@ js: | @@ -417,7 +417,7 @@ js: | ||
417 | max_errors: "${REMOTE_JS_SANDBOX_MAX_ERRORS:3}" | 417 | max_errors: "${REMOTE_JS_SANDBOX_MAX_ERRORS:3}" |
418 | 418 | ||
419 | transport: | 419 | transport: |
420 | - type: "${TRANSPORT_TYPE:remote}" # local or remote | 420 | + type: "${TRANSPORT_TYPE:local}" # local or remote |
421 | remote: | 421 | remote: |
422 | transport_api: | 422 | transport_api: |
423 | requests_topic: "${TB_TRANSPORT_API_REQUEST_TOPIC:tb.transport.api.requests}" | 423 | requests_topic: "${TB_TRANSPORT_API_REQUEST_TOPIC:tb.transport.api.requests}" |
@@ -434,11 +434,12 @@ transport: | @@ -434,11 +434,12 @@ transport: | ||
434 | topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}" | 434 | topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}" |
435 | # Local HTTP transport parameters | 435 | # Local HTTP transport parameters |
436 | http: | 436 | http: |
437 | + enabled: "${MQTT_ENABLED:true}" | ||
437 | request_timeout: "${HTTP_REQUEST_TIMEOUT:60000}" | 438 | request_timeout: "${HTTP_REQUEST_TIMEOUT:60000}" |
438 | # Local MQTT transport parameters | 439 | # Local MQTT transport parameters |
439 | mqtt: | 440 | mqtt: |
440 | # Enable/disable mqtt transport protocol. | 441 | # Enable/disable mqtt transport protocol. |
441 | - enabled: "${MQTT_ENABLED:false}" | 442 | + enabled: "${MQTT_ENABLED:true}" |
442 | bind_address: "${MQTT_BIND_ADDRESS:0.0.0.0}" | 443 | bind_address: "${MQTT_BIND_ADDRESS:0.0.0.0}" |
443 | bind_port: "${MQTT_BIND_PORT:1883}" | 444 | bind_port: "${MQTT_BIND_PORT:1883}" |
444 | adaptor: "${MQTT_ADAPTOR_NAME:JsonMqttAdaptor}" | 445 | adaptor: "${MQTT_ADAPTOR_NAME:JsonMqttAdaptor}" |
@@ -465,7 +466,7 @@ transport: | @@ -465,7 +466,7 @@ transport: | ||
465 | # Local CoAP transport parameters | 466 | # Local CoAP transport parameters |
466 | coap: | 467 | coap: |
467 | # Enable/disable coap transport protocol. | 468 | # Enable/disable coap transport protocol. |
468 | - enabled: "${COAP_ENABLED:false}" | 469 | + enabled: "${COAP_ENABLED:true}" |
469 | bind_address: "${COAP_BIND_ADDRESS:0.0.0.0}" | 470 | bind_address: "${COAP_BIND_ADDRESS:0.0.0.0}" |
470 | bind_port: "${COAP_BIND_PORT:5683}" | 471 | bind_port: "${COAP_BIND_PORT:5683}" |
471 | adaptor: "${COAP_ADAPTOR_NAME:JsonCoapAdaptor}" | 472 | adaptor: "${COAP_ADAPTOR_NAME:JsonCoapAdaptor}" |
@@ -41,6 +41,10 @@ | @@ -41,6 +41,10 @@ | ||
41 | <artifactId>data</artifactId> | 41 | <artifactId>data</artifactId> |
42 | </dependency> | 42 | </dependency> |
43 | <dependency> | 43 | <dependency> |
44 | + <groupId>org.bouncycastle</groupId> | ||
45 | + <artifactId>bcprov-jdk15on</artifactId> | ||
46 | + </dependency> | ||
47 | + <dependency> | ||
44 | <groupId>org.slf4j</groupId> | 48 | <groupId>org.slf4j</groupId> |
45 | <artifactId>slf4j-api</artifactId> | 49 | <artifactId>slf4j-api</artifactId> |
46 | </dependency> | 50 | </dependency> |
common/message/src/main/java/org/thingsboard/server/common/msg/EncryptionUtil.java
renamed from
dao/src/main/java/org/thingsboard/server/dao/EncryptionUtil.java
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.thingsboard.server.dao; | 16 | +package org.thingsboard.server.common.msg; |
17 | 17 | ||
18 | import lombok.extern.slf4j.Slf4j; | 18 | import lombok.extern.slf4j.Slf4j; |
19 | import org.bouncycastle.crypto.digests.SHA3Digest; | 19 | import org.bouncycastle.crypto.digests.SHA3Digest; |
@@ -23,7 +23,6 @@ | @@ -23,7 +23,6 @@ | ||
23 | <version>2.2.0-SNAPSHOT</version> | 23 | <version>2.2.0-SNAPSHOT</version> |
24 | <artifactId>thingsboard</artifactId> | 24 | <artifactId>thingsboard</artifactId> |
25 | </parent> | 25 | </parent> |
26 | - <groupId>org.thingsboard</groupId> | ||
27 | <artifactId>common</artifactId> | 26 | <artifactId>common</artifactId> |
28 | <packaging>pom</packaging> | 27 | <packaging>pom</packaging> |
29 | 28 |
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | 16 | ||
17 | --> | 17 | --> |
18 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 18 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
19 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | 19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
20 | <modelVersion>4.0.0</modelVersion> | 20 | <modelVersion>4.0.0</modelVersion> |
21 | <parent> | 21 | <parent> |
22 | <groupId>org.thingsboard</groupId> | 22 | <groupId>org.thingsboard</groupId> |
@@ -65,6 +65,10 @@ | @@ -65,6 +65,10 @@ | ||
65 | <artifactId>gson</artifactId> | 65 | <artifactId>gson</artifactId> |
66 | </dependency> | 66 | </dependency> |
67 | <dependency> | 67 | <dependency> |
68 | + <groupId>org.apache.commons</groupId> | ||
69 | + <artifactId>commons-lang3</artifactId> | ||
70 | + </dependency> | ||
71 | + <dependency> | ||
68 | <groupId>org.slf4j</groupId> | 72 | <groupId>org.slf4j</groupId> |
69 | <artifactId>slf4j-api</artifactId> | 73 | <artifactId>slf4j-api</artifactId> |
70 | </dependency> | 74 | </dependency> |
1 | +/** | ||
2 | + * Copyright © 2016-2018 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (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 | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.kafka; | ||
17 | + | ||
18 | +import lombok.Getter; | ||
19 | +import lombok.extern.slf4j.Slf4j; | ||
20 | +import org.springframework.beans.factory.annotation.Value; | ||
21 | +import org.springframework.stereotype.Component; | ||
22 | +import org.springframework.util.StringUtils; | ||
23 | + | ||
24 | +import javax.annotation.PostConstruct; | ||
25 | +import java.net.InetAddress; | ||
26 | +import java.net.UnknownHostException; | ||
27 | + | ||
28 | +/** | ||
29 | + * Created by ashvayka on 12.10.18. | ||
30 | + */ | ||
31 | +@Slf4j | ||
32 | +@Component | ||
33 | +public class TbNodeIdProvider { | ||
34 | + | ||
35 | + @Getter | ||
36 | + @Value("${cluster.node_id:#{null}}") | ||
37 | + private String nodeId; | ||
38 | + | ||
39 | + @PostConstruct | ||
40 | + public void init() { | ||
41 | + if (StringUtils.isEmpty(nodeId)) { | ||
42 | + try { | ||
43 | + nodeId = InetAddress.getLocalHost().getHostName(); | ||
44 | + } catch (UnknownHostException e) { | ||
45 | + nodeId = org.apache.commons.lang3.RandomStringUtils.randomAlphabetic(10); | ||
46 | + } | ||
47 | + } | ||
48 | + log.info("Current NodeId: {}", nodeId); | ||
49 | + } | ||
50 | + | ||
51 | +} |
common/transport/mqtt/pom.xml
renamed from
transport/mqtt-common/pom.xml
@@ -19,12 +19,12 @@ | @@ -19,12 +19,12 @@ | ||
19 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | 19 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
20 | <modelVersion>4.0.0</modelVersion> | 20 | <modelVersion>4.0.0</modelVersion> |
21 | <parent> | 21 | <parent> |
22 | - <groupId>org.thingsboard</groupId> | 22 | + <groupId>org.thingsboard.common</groupId> |
23 | <version>2.2.0-SNAPSHOT</version> | 23 | <version>2.2.0-SNAPSHOT</version> |
24 | <artifactId>transport</artifactId> | 24 | <artifactId>transport</artifactId> |
25 | </parent> | 25 | </parent> |
26 | - <groupId>org.thingsboard.transport</groupId> | ||
27 | - <artifactId>mqtt-common</artifactId> | 26 | + <groupId>org.thingsboard.common.transport</groupId> |
27 | + <artifactId>mqtt</artifactId> | ||
28 | <packaging>jar</packaging> | 28 | <packaging>jar</packaging> |
29 | 29 | ||
30 | <name>Thingsboard MQTT Transport Common</name> | 30 | <name>Thingsboard MQTT Transport Common</name> |
@@ -32,13 +32,13 @@ | @@ -32,13 +32,13 @@ | ||
32 | 32 | ||
33 | <properties> | 33 | <properties> |
34 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 34 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
35 | - <main.dir>${basedir}/../..</main.dir> | 35 | + <main.dir>${basedir}/../../..</main.dir> |
36 | </properties> | 36 | </properties> |
37 | 37 | ||
38 | <dependencies> | 38 | <dependencies> |
39 | <dependency> | 39 | <dependency> |
40 | - <groupId>org.thingsboard.common</groupId> | ||
41 | - <artifactId>transport</artifactId> | 40 | + <groupId>org.thingsboard.common.transport</groupId> |
41 | + <artifactId>transport-api</artifactId> | ||
42 | </dependency> | 42 | </dependency> |
43 | <dependency> | 43 | <dependency> |
44 | <groupId>io.netty</groupId> | 44 | <groupId>io.netty</groupId> |
@@ -46,6 +46,10 @@ | @@ -46,6 +46,10 @@ | ||
46 | </dependency> | 46 | </dependency> |
47 | <dependency> | 47 | <dependency> |
48 | <groupId>org.springframework</groupId> | 48 | <groupId>org.springframework</groupId> |
49 | + <artifactId>spring-context-support</artifactId> | ||
50 | + </dependency> | ||
51 | + <dependency> | ||
52 | + <groupId>org.springframework</groupId> | ||
49 | <artifactId>spring-context</artifactId> | 53 | <artifactId>spring-context</artifactId> |
50 | </dependency> | 54 | </dependency> |
51 | <dependency> | 55 | <dependency> |
@@ -69,6 +73,12 @@ | @@ -69,6 +73,12 @@ | ||
69 | <artifactId>guava</artifactId> | 73 | <artifactId>guava</artifactId> |
70 | </dependency> | 74 | </dependency> |
71 | <dependency> | 75 | <dependency> |
76 | + <groupId>com.google.code.findbugs</groupId> | ||
77 | + <artifactId>jsr305</artifactId> | ||
78 | + <version>3.0.1</version> | ||
79 | + <optional>true</optional> | ||
80 | + </dependency> | ||
81 | + <dependency> | ||
72 | <groupId>org.springframework.boot</groupId> | 82 | <groupId>org.springframework.boot</groupId> |
73 | <artifactId>spring-boot-starter-test</artifactId> | 83 | <artifactId>spring-boot-starter-test</artifactId> |
74 | <scope>test</scope> | 84 | <scope>test</scope> |
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttSslHandlerProvider.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/MqttSslHandlerProvider.java
@@ -23,12 +23,19 @@ import org.springframework.beans.factory.annotation.Value; | @@ -23,12 +23,19 @@ import org.springframework.beans.factory.annotation.Value; | ||
23 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | 23 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
24 | import org.springframework.stereotype.Component; | 24 | import org.springframework.stereotype.Component; |
25 | import org.springframework.util.StringUtils; | 25 | import org.springframework.util.StringUtils; |
26 | -import org.thingsboard.server.common.data.security.DeviceCredentials; | ||
27 | -import org.thingsboard.server.dao.EncryptionUtil; | ||
28 | -import org.thingsboard.server.dao.device.DeviceCredentialsService; | 26 | +import org.thingsboard.server.common.msg.EncryptionUtil; |
27 | +import org.thingsboard.server.common.transport.TransportService; | ||
28 | +import org.thingsboard.server.common.transport.TransportServiceCallback; | ||
29 | +import org.thingsboard.server.gen.transport.TransportProtos; | ||
29 | import org.thingsboard.server.transport.mqtt.util.SslUtil; | 30 | import org.thingsboard.server.transport.mqtt.util.SslUtil; |
30 | 31 | ||
31 | -import javax.net.ssl.*; | 32 | +import javax.net.ssl.KeyManager; |
33 | +import javax.net.ssl.KeyManagerFactory; | ||
34 | +import javax.net.ssl.SSLContext; | ||
35 | +import javax.net.ssl.SSLEngine; | ||
36 | +import javax.net.ssl.TrustManager; | ||
37 | +import javax.net.ssl.TrustManagerFactory; | ||
38 | +import javax.net.ssl.X509TrustManager; | ||
32 | import java.io.File; | 39 | import java.io.File; |
33 | import java.io.FileInputStream; | 40 | import java.io.FileInputStream; |
34 | import java.io.IOException; | 41 | import java.io.IOException; |
@@ -37,6 +44,8 @@ import java.net.URL; | @@ -37,6 +44,8 @@ import java.net.URL; | ||
37 | import java.security.KeyStore; | 44 | import java.security.KeyStore; |
38 | import java.security.cert.CertificateException; | 45 | import java.security.cert.CertificateException; |
39 | import java.security.cert.X509Certificate; | 46 | import java.security.cert.X509Certificate; |
47 | +import java.util.concurrent.CountDownLatch; | ||
48 | +import java.util.concurrent.TimeUnit; | ||
40 | 49 | ||
41 | /** | 50 | /** |
42 | * Created by valerii.sosliuk on 11/6/16. | 51 | * Created by valerii.sosliuk on 11/6/16. |
@@ -58,7 +67,7 @@ public class MqttSslHandlerProvider { | @@ -58,7 +67,7 @@ public class MqttSslHandlerProvider { | ||
58 | private String keyStoreType; | 67 | private String keyStoreType; |
59 | 68 | ||
60 | @Autowired | 69 | @Autowired |
61 | - private DeviceCredentialsService deviceCredentialsService; | 70 | + private TransportService transportService; |
62 | 71 | ||
63 | public SslHandler getSslHandler() { | 72 | public SslHandler getSslHandler() { |
64 | try { | 73 | try { |
@@ -111,17 +120,17 @@ public class MqttSslHandlerProvider { | @@ -111,17 +120,17 @@ public class MqttSslHandlerProvider { | ||
111 | break; | 120 | break; |
112 | } | 121 | } |
113 | } | 122 | } |
114 | - return new ThingsboardMqttX509TrustManager(x509Tm, deviceCredentialsService); | 123 | + return new ThingsboardMqttX509TrustManager(x509Tm, transportService); |
115 | } | 124 | } |
116 | 125 | ||
117 | static class ThingsboardMqttX509TrustManager implements X509TrustManager { | 126 | static class ThingsboardMqttX509TrustManager implements X509TrustManager { |
118 | 127 | ||
119 | private final X509TrustManager trustManager; | 128 | private final X509TrustManager trustManager; |
120 | - private DeviceCredentialsService deviceCredentialsService; | 129 | + private TransportService transportService; |
121 | 130 | ||
122 | - ThingsboardMqttX509TrustManager(X509TrustManager trustManager, DeviceCredentialsService deviceCredentialsService) { | 131 | + ThingsboardMqttX509TrustManager(X509TrustManager trustManager, TransportService transportService) { |
123 | this.trustManager = trustManager; | 132 | this.trustManager = trustManager; |
124 | - this.deviceCredentialsService = deviceCredentialsService; | 133 | + this.transportService = transportService; |
125 | } | 134 | } |
126 | 135 | ||
127 | @Override | 136 | @Override |
@@ -138,20 +147,39 @@ public class MqttSslHandlerProvider { | @@ -138,20 +147,39 @@ public class MqttSslHandlerProvider { | ||
138 | @Override | 147 | @Override |
139 | public void checkClientTrusted(X509Certificate[] chain, | 148 | public void checkClientTrusted(X509Certificate[] chain, |
140 | String authType) throws CertificateException { | 149 | String authType) throws CertificateException { |
141 | - DeviceCredentials deviceCredentials = null; | 150 | + String credentialsBody = null; |
142 | for (X509Certificate cert : chain) { | 151 | for (X509Certificate cert : chain) { |
143 | try { | 152 | try { |
144 | String strCert = SslUtil.getX509CertificateString(cert); | 153 | String strCert = SslUtil.getX509CertificateString(cert); |
145 | String sha3Hash = EncryptionUtil.getSha3Hash(strCert); | 154 | String sha3Hash = EncryptionUtil.getSha3Hash(strCert); |
146 | - deviceCredentials = deviceCredentialsService.findDeviceCredentialsByCredentialsId(sha3Hash); | ||
147 | - if (deviceCredentials != null && strCert.equals(deviceCredentials.getCredentialsValue())) { | 155 | + final String[] credentialsBodyHolder = new String[1]; |
156 | + CountDownLatch latch = new CountDownLatch(1); | ||
157 | + transportService.process(TransportProtos.ValidateDeviceX509CertRequestMsg.newBuilder().setHash(sha3Hash).build(), | ||
158 | + new TransportServiceCallback<TransportProtos.ValidateDeviceCredentialsResponseMsg>() { | ||
159 | + @Override | ||
160 | + public void onSuccess(TransportProtos.ValidateDeviceCredentialsResponseMsg msg) { | ||
161 | + if (!StringUtils.isEmpty(msg.getCredentialsBody())) { | ||
162 | + credentialsBodyHolder[0] = msg.getCredentialsBody(); | ||
163 | + } | ||
164 | + latch.countDown(); | ||
165 | + } | ||
166 | + | ||
167 | + @Override | ||
168 | + public void onError(Throwable e) { | ||
169 | + log.error(e.getMessage(), e); | ||
170 | + latch.countDown(); | ||
171 | + } | ||
172 | + }); | ||
173 | + latch.await(10, TimeUnit.SECONDS); | ||
174 | + if (strCert.equals(credentialsBodyHolder[0])) { | ||
175 | + credentialsBody = credentialsBodyHolder[0]; | ||
148 | break; | 176 | break; |
149 | } | 177 | } |
150 | - } catch (IOException e) { | 178 | + } catch (InterruptedException | IOException e) { |
151 | log.error(e.getMessage(), e); | 179 | log.error(e.getMessage(), e); |
152 | } | 180 | } |
153 | } | 181 | } |
154 | - if (deviceCredentials == null) { | 182 | + if (credentialsBody == null) { |
155 | throw new CertificateException("Invalid Device Certificate"); | 183 | throw new CertificateException("Invalid Device Certificate"); |
156 | } | 184 | } |
157 | } | 185 | } |
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTopics.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/MqttTopics.java
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportContext.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportContext.java
@@ -20,21 +20,17 @@ import io.netty.handler.ssl.SslHandler; | @@ -20,21 +20,17 @@ import io.netty.handler.ssl.SslHandler; | ||
20 | import lombok.Data; | 20 | import lombok.Data; |
21 | import lombok.Getter; | 21 | import lombok.Getter; |
22 | import lombok.extern.slf4j.Slf4j; | 22 | import lombok.extern.slf4j.Slf4j; |
23 | -import org.apache.commons.lang3.RandomStringUtils; | ||
24 | import org.springframework.beans.factory.annotation.Autowired; | 23 | import org.springframework.beans.factory.annotation.Autowired; |
25 | import org.springframework.beans.factory.annotation.Value; | 24 | import org.springframework.beans.factory.annotation.Value; |
26 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | 25 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
27 | -import org.springframework.context.annotation.Lazy; | ||
28 | import org.springframework.stereotype.Component; | 26 | import org.springframework.stereotype.Component; |
29 | -import org.springframework.util.StringUtils; | ||
30 | import org.thingsboard.server.common.transport.TransportService; | 27 | import org.thingsboard.server.common.transport.TransportService; |
31 | import org.thingsboard.server.common.transport.quota.host.HostRequestsQuotaService; | 28 | import org.thingsboard.server.common.transport.quota.host.HostRequestsQuotaService; |
29 | +import org.thingsboard.server.kafka.TbNodeIdProvider; | ||
32 | import org.thingsboard.server.transport.mqtt.adaptors.MqttTransportAdaptor; | 30 | import org.thingsboard.server.transport.mqtt.adaptors.MqttTransportAdaptor; |
33 | 31 | ||
34 | import javax.annotation.PostConstruct; | 32 | import javax.annotation.PostConstruct; |
35 | import javax.annotation.PreDestroy; | 33 | import javax.annotation.PreDestroy; |
36 | -import java.net.InetAddress; | ||
37 | -import java.net.UnknownHostException; | ||
38 | import java.util.concurrent.ExecutorService; | 34 | import java.util.concurrent.ExecutorService; |
39 | import java.util.concurrent.Executors; | 35 | import java.util.concurrent.Executors; |
40 | 36 | ||
@@ -61,11 +57,12 @@ public class MqttTransportContext { | @@ -61,11 +57,12 @@ public class MqttTransportContext { | ||
61 | @Autowired | 57 | @Autowired |
62 | private MqttTransportAdaptor adaptor; | 58 | private MqttTransportAdaptor adaptor; |
63 | 59 | ||
60 | + @Autowired | ||
61 | + private TbNodeIdProvider nodeIdProvider; | ||
62 | + | ||
64 | @Value("${transport.mqtt.netty.max_payload_size}") | 63 | @Value("${transport.mqtt.netty.max_payload_size}") |
65 | private Integer maxPayloadSize; | 64 | private Integer maxPayloadSize; |
66 | 65 | ||
67 | - @Value("${cluster.node_id:#{null}}") | ||
68 | - private String nodeId; | ||
69 | 66 | ||
70 | private SslHandler sslHandler; | 67 | private SslHandler sslHandler; |
71 | 68 | ||
@@ -74,14 +71,6 @@ public class MqttTransportContext { | @@ -74,14 +71,6 @@ public class MqttTransportContext { | ||
74 | 71 | ||
75 | @PostConstruct | 72 | @PostConstruct |
76 | public void init() { | 73 | public void init() { |
77 | - if (StringUtils.isEmpty(nodeId)) { | ||
78 | - try { | ||
79 | - nodeId = InetAddress.getLocalHost().getHostName(); | ||
80 | - } catch (UnknownHostException e) { | ||
81 | - nodeId = RandomStringUtils.randomAlphabetic(10); | ||
82 | - } | ||
83 | - } | ||
84 | - log.info("Current NodeId: {}", nodeId); | ||
85 | executor = Executors.newCachedThreadPool(); | 74 | executor = Executors.newCachedThreadPool(); |
86 | } | 75 | } |
87 | 76 | ||
@@ -92,4 +81,7 @@ public class MqttTransportContext { | @@ -92,4 +81,7 @@ public class MqttTransportContext { | ||
92 | } | 81 | } |
93 | } | 82 | } |
94 | 83 | ||
84 | + public String getNodeId() { | ||
85 | + return nodeIdProvider.getNodeId(); | ||
86 | + } | ||
95 | } | 87 | } |
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java
@@ -43,7 +43,7 @@ import org.thingsboard.server.common.transport.TransportService; | @@ -43,7 +43,7 @@ import org.thingsboard.server.common.transport.TransportService; | ||
43 | import org.thingsboard.server.common.transport.TransportServiceCallback; | 43 | import org.thingsboard.server.common.transport.TransportServiceCallback; |
44 | import org.thingsboard.server.common.transport.adaptor.AdaptorException; | 44 | import org.thingsboard.server.common.transport.adaptor.AdaptorException; |
45 | import org.thingsboard.server.common.transport.quota.QuotaService; | 45 | import org.thingsboard.server.common.transport.quota.QuotaService; |
46 | -import org.thingsboard.server.dao.EncryptionUtil; | 46 | +import org.thingsboard.server.common.msg.EncryptionUtil; |
47 | import org.thingsboard.server.gen.transport.TransportProtos; | 47 | import org.thingsboard.server.gen.transport.TransportProtos; |
48 | import org.thingsboard.server.gen.transport.TransportProtos.DeviceInfoProto; | 48 | import org.thingsboard.server.gen.transport.TransportProtos.DeviceInfoProto; |
49 | import org.thingsboard.server.gen.transport.TransportProtos.SessionEvent; | 49 | import org.thingsboard.server.gen.transport.TransportProtos.SessionEvent; |
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportServerInitializer.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportServerInitializer.java
@@ -21,13 +21,6 @@ import io.netty.channel.socket.SocketChannel; | @@ -21,13 +21,6 @@ import io.netty.channel.socket.SocketChannel; | ||
21 | import io.netty.handler.codec.mqtt.MqttDecoder; | 21 | import io.netty.handler.codec.mqtt.MqttDecoder; |
22 | import io.netty.handler.codec.mqtt.MqttEncoder; | 22 | import io.netty.handler.codec.mqtt.MqttEncoder; |
23 | import io.netty.handler.ssl.SslHandler; | 23 | import io.netty.handler.ssl.SslHandler; |
24 | -import org.thingsboard.server.common.transport.SessionMsgProcessor; | ||
25 | -import org.thingsboard.server.common.transport.TransportService; | ||
26 | -import org.thingsboard.server.common.transport.auth.DeviceAuthService; | ||
27 | -import org.thingsboard.server.common.transport.quota.QuotaService; | ||
28 | -import org.thingsboard.server.dao.device.DeviceService; | ||
29 | -import org.thingsboard.server.dao.relation.RelationService; | ||
30 | -import org.thingsboard.server.transport.mqtt.adaptors.MqttTransportAdaptor; | ||
31 | 24 | ||
32 | /** | 25 | /** |
33 | * @author Andrew Shvayka | 26 | * @author Andrew Shvayka |
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportService.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportService.java
@@ -23,19 +23,9 @@ import io.netty.channel.socket.nio.NioServerSocketChannel; | @@ -23,19 +23,9 @@ import io.netty.channel.socket.nio.NioServerSocketChannel; | ||
23 | import io.netty.util.ResourceLeakDetector; | 23 | import io.netty.util.ResourceLeakDetector; |
24 | import lombok.extern.slf4j.Slf4j; | 24 | import lombok.extern.slf4j.Slf4j; |
25 | import org.springframework.beans.factory.annotation.Autowired; | 25 | import org.springframework.beans.factory.annotation.Autowired; |
26 | -import org.springframework.beans.factory.annotation.Qualifier; | ||
27 | import org.springframework.beans.factory.annotation.Value; | 26 | import org.springframework.beans.factory.annotation.Value; |
28 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | 27 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
29 | -import org.springframework.context.ApplicationContext; | ||
30 | -import org.springframework.context.annotation.Lazy; | ||
31 | import org.springframework.stereotype.Service; | 28 | import org.springframework.stereotype.Service; |
32 | -import org.thingsboard.server.common.transport.SessionMsgProcessor; | ||
33 | -import org.thingsboard.server.common.transport.TransportService; | ||
34 | -import org.thingsboard.server.common.transport.auth.DeviceAuthService; | ||
35 | -import org.thingsboard.server.common.transport.quota.host.HostRequestsQuotaService; | ||
36 | -import org.thingsboard.server.dao.device.DeviceService; | ||
37 | -import org.thingsboard.server.dao.relation.RelationService; | ||
38 | -import org.thingsboard.server.transport.mqtt.adaptors.MqttTransportAdaptor; | ||
39 | 29 | ||
40 | import javax.annotation.PostConstruct; | 30 | import javax.annotation.PostConstruct; |
41 | import javax.annotation.PreDestroy; | 31 | import javax.annotation.PreDestroy; |
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/adaptors/JsonMqttAdaptor.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/adaptors/JsonMqttAdaptor.java
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/adaptors/MqttTransportAdaptor.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/adaptors/MqttTransportAdaptor.java
@@ -18,7 +18,6 @@ package org.thingsboard.server.transport.mqtt.adaptors; | @@ -18,7 +18,6 @@ package org.thingsboard.server.transport.mqtt.adaptors; | ||
18 | import io.netty.handler.codec.mqtt.MqttMessage; | 18 | import io.netty.handler.codec.mqtt.MqttMessage; |
19 | import io.netty.handler.codec.mqtt.MqttPublishMessage; | 19 | import io.netty.handler.codec.mqtt.MqttPublishMessage; |
20 | import org.thingsboard.server.common.transport.adaptor.AdaptorException; | 20 | import org.thingsboard.server.common.transport.adaptor.AdaptorException; |
21 | -import org.thingsboard.server.gen.transport.TransportProtos; | ||
22 | import org.thingsboard.server.gen.transport.TransportProtos.AttributeUpdateNotificationMsg; | 21 | import org.thingsboard.server.gen.transport.TransportProtos.AttributeUpdateNotificationMsg; |
23 | import org.thingsboard.server.gen.transport.TransportProtos.GetAttributeRequestMsg; | 22 | import org.thingsboard.server.gen.transport.TransportProtos.GetAttributeRequestMsg; |
24 | import org.thingsboard.server.gen.transport.TransportProtos.GetAttributeResponseMsg; | 23 | import org.thingsboard.server.gen.transport.TransportProtos.GetAttributeResponseMsg; |
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/DeviceSessionCtx.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/session/DeviceSessionCtx.java
@@ -16,11 +16,8 @@ | @@ -16,11 +16,8 @@ | ||
16 | package org.thingsboard.server.transport.mqtt.session; | 16 | package org.thingsboard.server.transport.mqtt.session; |
17 | 17 | ||
18 | import io.netty.channel.ChannelHandlerContext; | 18 | import io.netty.channel.ChannelHandlerContext; |
19 | -import io.netty.handler.codec.mqtt.MqttMessage; | ||
20 | import lombok.Getter; | 19 | import lombok.Getter; |
21 | import lombok.extern.slf4j.Slf4j; | 20 | import lombok.extern.slf4j.Slf4j; |
22 | -import org.thingsboard.server.common.msg.session.ex.SessionException; | ||
23 | -import org.thingsboard.server.common.transport.adaptor.AdaptorException; | ||
24 | 21 | ||
25 | import java.util.UUID; | 22 | import java.util.UUID; |
26 | import java.util.concurrent.ConcurrentMap; | 23 | import java.util.concurrent.ConcurrentMap; |
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/GatewayDeviceSessionCtx.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/session/GatewayDeviceSessionCtx.java
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/GatewaySessionHandler.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/session/GatewaySessionHandler.java
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/MqttDeviceAwareSessionContext.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/session/MqttDeviceAwareSessionContext.java
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/MqttTopicMatcher.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/session/MqttTopicMatcher.java
common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/util/SslUtil.java
renamed from
transport/mqtt-common/src/main/java/org/thingsboard/server/transport/mqtt/util/SslUtil.java
@@ -17,7 +17,7 @@ package org.thingsboard.server.transport.mqtt.util; | @@ -17,7 +17,7 @@ package org.thingsboard.server.transport.mqtt.util; | ||
17 | 17 | ||
18 | import lombok.extern.slf4j.Slf4j; | 18 | import lombok.extern.slf4j.Slf4j; |
19 | import org.springframework.util.Base64Utils; | 19 | import org.springframework.util.Base64Utils; |
20 | -import org.thingsboard.server.dao.EncryptionUtil; | 20 | +import org.thingsboard.server.common.msg.EncryptionUtil; |
21 | 21 | ||
22 | import java.io.IOException; | 22 | import java.io.IOException; |
23 | import java.security.cert.CertificateEncodingException; | 23 | import java.security.cert.CertificateEncodingException; |
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | 16 | ||
17 | --> | 17 | --> |
18 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 18 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
19 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | 19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
20 | <modelVersion>4.0.0</modelVersion> | 20 | <modelVersion>4.0.0</modelVersion> |
21 | <parent> | 21 | <parent> |
22 | <groupId>org.thingsboard</groupId> | 22 | <groupId>org.thingsboard</groupId> |
@@ -25,85 +25,20 @@ | @@ -25,85 +25,20 @@ | ||
25 | </parent> | 25 | </parent> |
26 | <groupId>org.thingsboard.common</groupId> | 26 | <groupId>org.thingsboard.common</groupId> |
27 | <artifactId>transport</artifactId> | 27 | <artifactId>transport</artifactId> |
28 | - <packaging>jar</packaging> | 28 | + <packaging>pom</packaging> |
29 | 29 | ||
30 | - <name>Thingsboard Server Common Transport components</name> | 30 | + <name>Thingsboard Server Commons</name> |
31 | <url>https://thingsboard.io</url> | 31 | <url>https://thingsboard.io</url> |
32 | 32 | ||
33 | <properties> | 33 | <properties> |
34 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 34 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
35 | <main.dir>${basedir}/../..</main.dir> | 35 | <main.dir>${basedir}/../..</main.dir> |
36 | </properties> | 36 | </properties> |
37 | - | ||
38 | - <dependencies> | ||
39 | - <dependency> | ||
40 | - <groupId>org.thingsboard.common</groupId> | ||
41 | - <artifactId>data</artifactId> | ||
42 | - </dependency> | ||
43 | - <dependency> | ||
44 | - <groupId>org.thingsboard.common</groupId> | ||
45 | - <artifactId>message</artifactId> | ||
46 | - </dependency> | ||
47 | - <dependency> | ||
48 | - <groupId>com.google.code.gson</groupId> | ||
49 | - <artifactId>gson</artifactId> | ||
50 | - </dependency> | ||
51 | - <dependency> | ||
52 | - <groupId>org.slf4j</groupId> | ||
53 | - <artifactId>slf4j-api</artifactId> | ||
54 | - </dependency> | ||
55 | - <dependency> | ||
56 | - <groupId>org.slf4j</groupId> | ||
57 | - <artifactId>log4j-over-slf4j</artifactId> | ||
58 | - </dependency> | ||
59 | - <dependency> | ||
60 | - <groupId>ch.qos.logback</groupId> | ||
61 | - <artifactId>logback-core</artifactId> | ||
62 | - </dependency> | ||
63 | - <dependency> | ||
64 | - <groupId>ch.qos.logback</groupId> | ||
65 | - <artifactId>logback-classic</artifactId> | ||
66 | - </dependency> | ||
67 | - <dependency> | ||
68 | - <groupId>junit</groupId> | ||
69 | - <artifactId>junit</artifactId> | ||
70 | - <scope>test</scope> | ||
71 | - </dependency> | ||
72 | - <dependency> | ||
73 | - <groupId>org.mockito</groupId> | ||
74 | - <artifactId>mockito-all</artifactId> | ||
75 | - <scope>test</scope> | ||
76 | - </dependency> | ||
77 | - <dependency> | ||
78 | - <groupId>org.springframework</groupId> | ||
79 | - <artifactId>spring-context</artifactId> | ||
80 | - </dependency> | ||
81 | - <dependency> | ||
82 | - <groupId>org.springframework.boot</groupId> | ||
83 | - <artifactId>spring-boot-starter-web</artifactId> | ||
84 | - <scope>provided</scope> | ||
85 | - </dependency> | ||
86 | - <dependency> | ||
87 | - <groupId>com.google.guava</groupId> | ||
88 | - <artifactId>guava</artifactId> | ||
89 | - </dependency> | ||
90 | - <dependency> | ||
91 | - <groupId>org.apache.commons</groupId> | ||
92 | - <artifactId>commons-lang3</artifactId> | ||
93 | - </dependency> | ||
94 | - <dependency> | ||
95 | - <groupId>com.google.protobuf</groupId> | ||
96 | - <artifactId>protobuf-java</artifactId> | ||
97 | - </dependency> | ||
98 | - </dependencies> | ||
99 | - | ||
100 | - <build> | ||
101 | - <plugins> | ||
102 | - <plugin> | ||
103 | - <groupId>org.xolstice.maven.plugins</groupId> | ||
104 | - <artifactId>protobuf-maven-plugin</artifactId> | ||
105 | - </plugin> | ||
106 | - </plugins> | ||
107 | - </build> | 37 | + <modules> |
38 | + <module>transport-api</module> | ||
39 | + <module>mqtt</module> | ||
40 | + <!--module>http</module--> | ||
41 | + <!--module>coap</module--> | ||
42 | + </modules> | ||
108 | 43 | ||
109 | </project> | 44 | </project> |
common/transport/transport-api/pom.xml
0 → 100644
1 | +<!-- | ||
2 | + | ||
3 | + Copyright © 2016-2018 The Thingsboard Authors | ||
4 | + | ||
5 | + Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + you may not use this file except in compliance with the License. | ||
7 | + You may obtain a copy of the License at | ||
8 | + | ||
9 | + http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + | ||
11 | + Unless required by applicable law or agreed to in writing, software | ||
12 | + distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + See the License for the specific language governing permissions and | ||
15 | + limitations under the License. | ||
16 | + | ||
17 | +--> | ||
18 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
20 | + <modelVersion>4.0.0</modelVersion> | ||
21 | + <parent> | ||
22 | + <groupId>org.thingsboard.common</groupId> | ||
23 | + <version>2.2.0-SNAPSHOT</version> | ||
24 | + <artifactId>transport</artifactId> | ||
25 | + </parent> | ||
26 | + <groupId>org.thingsboard.common.transport</groupId> | ||
27 | + <artifactId>transport-api</artifactId> | ||
28 | + <packaging>jar</packaging> | ||
29 | + | ||
30 | + <name>Thingsboard Server Common Transport components</name> | ||
31 | + <url>https://thingsboard.io</url> | ||
32 | + | ||
33 | + <properties> | ||
34 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
35 | + <main.dir>${basedir}/../../..</main.dir> | ||
36 | + </properties> | ||
37 | + | ||
38 | + <dependencies> | ||
39 | + <dependency> | ||
40 | + <groupId>org.thingsboard.common</groupId> | ||
41 | + <artifactId>data</artifactId> | ||
42 | + </dependency> | ||
43 | + <dependency> | ||
44 | + <groupId>org.thingsboard.common</groupId> | ||
45 | + <artifactId>message</artifactId> | ||
46 | + </dependency> | ||
47 | + <dependency> | ||
48 | + <groupId>org.thingsboard.common</groupId> | ||
49 | + <artifactId>queue</artifactId> | ||
50 | + </dependency> | ||
51 | + <dependency> | ||
52 | + <groupId>com.google.code.gson</groupId> | ||
53 | + <artifactId>gson</artifactId> | ||
54 | + </dependency> | ||
55 | + <dependency> | ||
56 | + <groupId>org.slf4j</groupId> | ||
57 | + <artifactId>slf4j-api</artifactId> | ||
58 | + </dependency> | ||
59 | + <dependency> | ||
60 | + <groupId>org.slf4j</groupId> | ||
61 | + <artifactId>log4j-over-slf4j</artifactId> | ||
62 | + </dependency> | ||
63 | + <dependency> | ||
64 | + <groupId>ch.qos.logback</groupId> | ||
65 | + <artifactId>logback-core</artifactId> | ||
66 | + </dependency> | ||
67 | + <dependency> | ||
68 | + <groupId>ch.qos.logback</groupId> | ||
69 | + <artifactId>logback-classic</artifactId> | ||
70 | + </dependency> | ||
71 | + <dependency> | ||
72 | + <groupId>junit</groupId> | ||
73 | + <artifactId>junit</artifactId> | ||
74 | + <scope>test</scope> | ||
75 | + </dependency> | ||
76 | + <dependency> | ||
77 | + <groupId>org.mockito</groupId> | ||
78 | + <artifactId>mockito-all</artifactId> | ||
79 | + <scope>test</scope> | ||
80 | + </dependency> | ||
81 | + <dependency> | ||
82 | + <groupId>org.springframework</groupId> | ||
83 | + <artifactId>spring-context</artifactId> | ||
84 | + </dependency> | ||
85 | + <dependency> | ||
86 | + <groupId>org.springframework.boot</groupId> | ||
87 | + <artifactId>spring-boot-starter-web</artifactId> | ||
88 | + <scope>provided</scope> | ||
89 | + </dependency> | ||
90 | + <dependency> | ||
91 | + <groupId>com.google.guava</groupId> | ||
92 | + <artifactId>guava</artifactId> | ||
93 | + </dependency> | ||
94 | + <dependency> | ||
95 | + <groupId>org.apache.commons</groupId> | ||
96 | + <artifactId>commons-lang3</artifactId> | ||
97 | + </dependency> | ||
98 | + <dependency> | ||
99 | + <groupId>com.google.protobuf</groupId> | ||
100 | + <artifactId>protobuf-java</artifactId> | ||
101 | + </dependency> | ||
102 | + </dependencies> | ||
103 | + | ||
104 | + <build> | ||
105 | + <plugins> | ||
106 | + <plugin> | ||
107 | + <groupId>org.xolstice.maven.plugins</groupId> | ||
108 | + <artifactId>protobuf-maven-plugin</artifactId> | ||
109 | + </plugin> | ||
110 | + </plugins> | ||
111 | + </build> | ||
112 | + | ||
113 | +</project> |
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/SessionMsgListener.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/SessionMsgListener.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/SessionMsgProcessor.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/SessionMsgProcessor.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportAdaptor.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/TransportAdaptor.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/TransportService.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportServiceCallback.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/TransportServiceCallback.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/adaptor/AdaptorException.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/adaptor/AdaptorException.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/adaptor/JsonConverter.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/adaptor/JsonConverter.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/auth/DeviceAuthResult.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/auth/DeviceAuthResult.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/auth/DeviceAuthService.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/auth/DeviceAuthService.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/AbstractQuotaService.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/AbstractQuotaService.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/Clock.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/Clock.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/QuotaService.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/QuotaService.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/RequestLimitPolicy.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/RequestLimitPolicy.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/host/HostIntervalRegistryCleaner.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/host/HostIntervalRegistryCleaner.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/host/HostIntervalRegistryLogger.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/host/HostIntervalRegistryLogger.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/host/HostRequestIntervalRegistry.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/host/HostRequestIntervalRegistry.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/host/HostRequestLimitPolicy.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/host/HostRequestLimitPolicy.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/host/HostRequestsQuotaService.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/host/HostRequestsQuotaService.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/inmemory/IntervalCount.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/inmemory/IntervalCount.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/inmemory/IntervalRegistryCleaner.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/inmemory/IntervalRegistryCleaner.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/inmemory/IntervalRegistryLogger.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/inmemory/IntervalRegistryLogger.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/inmemory/KeyBasedIntervalRegistry.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/inmemory/KeyBasedIntervalRegistry.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/tenant/TenantIntervalRegistryCleaner.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/tenant/TenantIntervalRegistryCleaner.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/tenant/TenantIntervalRegistryLogger.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/tenant/TenantIntervalRegistryLogger.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/tenant/TenantMsgsIntervalRegistry.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/tenant/TenantMsgsIntervalRegistry.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/tenant/TenantQuotaService.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/tenant/TenantQuotaService.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/quota/tenant/TenantRequestLimitPolicy.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/quota/tenant/TenantRequestLimitPolicy.java
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/RemoteTransportService.java
renamed from
transport/mqtt-transport/src/main/java/org/thingsboard/server/mqtt/service/MqttTransportService.java
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.thingsboard.server.mqtt.service; | 16 | +package org.thingsboard.server.common.transport.service; |
17 | 17 | ||
18 | import lombok.extern.slf4j.Slf4j; | 18 | import lombok.extern.slf4j.Slf4j; |
19 | import org.apache.kafka.clients.consumer.ConsumerRecords; | 19 | import org.apache.kafka.clients.consumer.ConsumerRecords; |
@@ -21,6 +21,7 @@ import org.apache.kafka.clients.producer.Callback; | @@ -21,6 +21,7 @@ import org.apache.kafka.clients.producer.Callback; | ||
21 | import org.apache.kafka.clients.producer.RecordMetadata; | 21 | import org.apache.kafka.clients.producer.RecordMetadata; |
22 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
23 | import org.springframework.beans.factory.annotation.Value; | 23 | import org.springframework.beans.factory.annotation.Value; |
24 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
24 | import org.springframework.stereotype.Service; | 25 | import org.springframework.stereotype.Service; |
25 | import org.thingsboard.server.common.transport.SessionMsgListener; | 26 | import org.thingsboard.server.common.transport.SessionMsgListener; |
26 | import org.thingsboard.server.common.transport.TransportService; | 27 | import org.thingsboard.server.common.transport.TransportService; |
@@ -44,7 +45,7 @@ import org.thingsboard.server.kafka.TBKafkaConsumerTemplate; | @@ -44,7 +45,7 @@ import org.thingsboard.server.kafka.TBKafkaConsumerTemplate; | ||
44 | import org.thingsboard.server.kafka.TBKafkaProducerTemplate; | 45 | import org.thingsboard.server.kafka.TBKafkaProducerTemplate; |
45 | import org.thingsboard.server.kafka.TbKafkaRequestTemplate; | 46 | import org.thingsboard.server.kafka.TbKafkaRequestTemplate; |
46 | import org.thingsboard.server.kafka.TbKafkaSettings; | 47 | import org.thingsboard.server.kafka.TbKafkaSettings; |
47 | -import org.thingsboard.server.transport.mqtt.MqttTransportContext; | 48 | +import org.thingsboard.server.kafka.TbNodeIdProvider; |
48 | 49 | ||
49 | import javax.annotation.PostConstruct; | 50 | import javax.annotation.PostConstruct; |
50 | import javax.annotation.PreDestroy; | 51 | import javax.annotation.PreDestroy; |
@@ -58,9 +59,10 @@ import java.util.concurrent.Executors; | @@ -58,9 +59,10 @@ import java.util.concurrent.Executors; | ||
58 | /** | 59 | /** |
59 | * Created by ashvayka on 05.10.18. | 60 | * Created by ashvayka on 05.10.18. |
60 | */ | 61 | */ |
62 | +@ConditionalOnProperty(prefix = "transport", value = "type", havingValue = "remote", matchIfMissing = true) | ||
61 | @Service | 63 | @Service |
62 | @Slf4j | 64 | @Slf4j |
63 | -public class MqttTransportService implements TransportService { | 65 | +public class RemoteTransportService implements TransportService { |
64 | 66 | ||
65 | @Value("${kafka.rule_engine.topic}") | 67 | @Value("${kafka.rule_engine.topic}") |
66 | private String ruleEngineTopic; | 68 | private String ruleEngineTopic; |
@@ -89,7 +91,7 @@ public class MqttTransportService implements TransportService { | @@ -89,7 +91,7 @@ public class MqttTransportService implements TransportService { | ||
89 | private TbKafkaSettings kafkaSettings; | 91 | private TbKafkaSettings kafkaSettings; |
90 | //We use this to get the node id. We should replace this with a component that provides the node id. | 92 | //We use this to get the node id. We should replace this with a component that provides the node id. |
91 | @Autowired | 93 | @Autowired |
92 | - private MqttTransportContext transportContext; | 94 | + private TbNodeIdProvider nodeIdProvider; |
93 | 95 | ||
94 | private ExecutorService transportCallbackExecutor; | 96 | private ExecutorService transportCallbackExecutor; |
95 | 97 | ||
@@ -112,8 +114,8 @@ public class MqttTransportService implements TransportService { | @@ -112,8 +114,8 @@ public class MqttTransportService implements TransportService { | ||
112 | 114 | ||
113 | TBKafkaConsumerTemplate.TBKafkaConsumerTemplateBuilder<TransportApiResponseMsg> responseBuilder = TBKafkaConsumerTemplate.builder(); | 115 | TBKafkaConsumerTemplate.TBKafkaConsumerTemplateBuilder<TransportApiResponseMsg> responseBuilder = TBKafkaConsumerTemplate.builder(); |
114 | responseBuilder.settings(kafkaSettings); | 116 | responseBuilder.settings(kafkaSettings); |
115 | - responseBuilder.topic(transportApiResponsesTopic + "." + transportContext.getNodeId()); | ||
116 | - responseBuilder.clientId("transport-api-client-" + transportContext.getNodeId()); | 117 | + responseBuilder.topic(transportApiResponsesTopic + "." + nodeIdProvider.getNodeId()); |
118 | + responseBuilder.clientId("transport-api-client-" + nodeIdProvider.getNodeId()); | ||
117 | responseBuilder.groupId("transport-api-client"); | 119 | responseBuilder.groupId("transport-api-client"); |
118 | responseBuilder.autoCommit(true); | 120 | responseBuilder.autoCommit(true); |
119 | responseBuilder.autoCommitIntervalMs(autoCommitInterval); | 121 | responseBuilder.autoCommitIntervalMs(autoCommitInterval); |
@@ -138,8 +140,8 @@ public class MqttTransportService implements TransportService { | @@ -138,8 +140,8 @@ public class MqttTransportService implements TransportService { | ||
138 | 140 | ||
139 | TBKafkaConsumerTemplate.TBKafkaConsumerTemplateBuilder<ToTransportMsg> mainConsumerBuilder = TBKafkaConsumerTemplate.builder(); | 141 | TBKafkaConsumerTemplate.TBKafkaConsumerTemplateBuilder<ToTransportMsg> mainConsumerBuilder = TBKafkaConsumerTemplate.builder(); |
140 | mainConsumerBuilder.settings(kafkaSettings); | 142 | mainConsumerBuilder.settings(kafkaSettings); |
141 | - mainConsumerBuilder.topic(notificationsTopic + "." + transportContext.getNodeId()); | ||
142 | - mainConsumerBuilder.clientId("transport-" + transportContext.getNodeId()); | 143 | + mainConsumerBuilder.topic(notificationsTopic + "." + nodeIdProvider.getNodeId()); |
144 | + mainConsumerBuilder.clientId("transport-" + nodeIdProvider.getNodeId()); | ||
143 | mainConsumerBuilder.groupId("transport"); | 145 | mainConsumerBuilder.groupId("transport"); |
144 | mainConsumerBuilder.autoCommit(true); | 146 | mainConsumerBuilder.autoCommit(true); |
145 | mainConsumerBuilder.autoCommitIntervalMs(notificationsAutoCommitInterval); | 147 | mainConsumerBuilder.autoCommitIntervalMs(notificationsAutoCommitInterval); |
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/ToRuleEngineMsgEncoder.java
renamed from
transport/mqtt-transport/src/main/java/org/thingsboard/server/mqtt/service/ToRuleEngineMsgEncoder.java
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.thingsboard.server.mqtt.service; | 16 | +package org.thingsboard.server.common.transport.service; |
17 | 17 | ||
18 | import org.thingsboard.server.gen.transport.TransportProtos.ToRuleEngineMsg; | 18 | import org.thingsboard.server.gen.transport.TransportProtos.ToRuleEngineMsg; |
19 | import org.thingsboard.server.kafka.TbKafkaEncoder; | 19 | import org.thingsboard.server.kafka.TbKafkaEncoder; |
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/ToTransportMsgResponseDecoder.java
renamed from
transport/mqtt-transport/src/main/java/org/thingsboard/server/mqtt/service/ToTransportMsgResponseDecoder.java
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.thingsboard.server.mqtt.service; | 16 | +package org.thingsboard.server.common.transport.service; |
17 | 17 | ||
18 | import org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg; | 18 | import org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg; |
19 | import org.thingsboard.server.kafka.TbKafkaDecoder; | 19 | import org.thingsboard.server.kafka.TbKafkaDecoder; |
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/TransportApiRequestEncoder.java
renamed from
transport/mqtt-transport/src/main/java/org/thingsboard/server/mqtt/service/TransportApiRequestEncoder.java
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.thingsboard.server.mqtt.service; | 16 | +package org.thingsboard.server.common.transport.service; |
17 | 17 | ||
18 | import org.thingsboard.server.gen.transport.TransportProtos.TransportApiRequestMsg; | 18 | import org.thingsboard.server.gen.transport.TransportProtos.TransportApiRequestMsg; |
19 | import org.thingsboard.server.kafka.TbKafkaEncoder; | 19 | import org.thingsboard.server.kafka.TbKafkaEncoder; |
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/TransportApiResponseDecoder.java
renamed from
transport/mqtt-transport/src/main/java/org/thingsboard/server/mqtt/service/TransportApiResponseDecoder.java
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.thingsboard.server.mqtt.service; | 16 | +package org.thingsboard.server.common.transport.service; |
17 | 17 | ||
18 | import org.thingsboard.server.gen.transport.TransportProtos.TransportApiResponseMsg; | 18 | import org.thingsboard.server.gen.transport.TransportProtos.TransportApiResponseMsg; |
19 | import org.thingsboard.server.kafka.TbKafkaDecoder; | 19 | import org.thingsboard.server.kafka.TbKafkaDecoder; |
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/session/DeviceAwareSessionContext.java
renamed from
common/transport/src/main/java/org/thingsboard/server/common/transport/session/DeviceAwareSessionContext.java
common/transport/transport-api/src/main/proto/transport.proto
renamed from
common/transport/src/main/proto/transport.proto
@@ -123,6 +123,7 @@ message ValidateDeviceX509CertRequestMsg { | @@ -123,6 +123,7 @@ message ValidateDeviceX509CertRequestMsg { | ||
123 | 123 | ||
124 | message ValidateDeviceCredentialsResponseMsg { | 124 | message ValidateDeviceCredentialsResponseMsg { |
125 | DeviceInfoProto deviceInfo = 1; | 125 | DeviceInfoProto deviceInfo = 1; |
126 | + string credentialsBody = 2; | ||
126 | } | 127 | } |
127 | 128 | ||
128 | message GetOrCreateDeviceFromGatewayRequestMsg { | 129 | message GetOrCreateDeviceFromGatewayRequestMsg { |
common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/quota/ClockTest.java
renamed from
common/transport/src/test/java/org/thingsboard/server/common/transport/quota/ClockTest.java
common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/quota/HostRequestLimitPolicyTest.java
renamed from
common/transport/src/test/java/org/thingsboard/server/common/transport/quota/HostRequestLimitPolicyTest.java
common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/quota/HostRequestsQuotaServiceTest.java
renamed from
common/transport/src/test/java/org/thingsboard/server/common/transport/quota/HostRequestsQuotaServiceTest.java
common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/quota/inmemory/HostRequestIntervalRegistryTest.java
renamed from
common/transport/src/test/java/org/thingsboard/server/common/transport/quota/inmemory/HostRequestIntervalRegistryTest.java
common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/quota/inmemory/IntervalCountTest.java
renamed from
common/transport/src/test/java/org/thingsboard/server/common/transport/quota/inmemory/IntervalCountTest.java
common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/quota/inmemory/IntervalRegistryLoggerTest.java
renamed from
common/transport/src/test/java/org/thingsboard/server/common/transport/quota/inmemory/IntervalRegistryLoggerTest.java
@@ -26,7 +26,7 @@ import org.thingsboard.server.common.data.Device; | @@ -26,7 +26,7 @@ import org.thingsboard.server.common.data.Device; | ||
26 | import org.thingsboard.server.common.data.id.DeviceId; | 26 | import org.thingsboard.server.common.data.id.DeviceId; |
27 | import org.thingsboard.server.common.data.security.DeviceCredentials; | 27 | import org.thingsboard.server.common.data.security.DeviceCredentials; |
28 | import org.thingsboard.server.common.data.security.DeviceCredentialsType; | 28 | import org.thingsboard.server.common.data.security.DeviceCredentialsType; |
29 | -import org.thingsboard.server.dao.EncryptionUtil; | 29 | +import org.thingsboard.server.common.msg.EncryptionUtil; |
30 | import org.thingsboard.server.dao.exception.DataValidationException; | 30 | import org.thingsboard.server.dao.exception.DataValidationException; |
31 | import org.thingsboard.server.dao.service.DataValidator; | 31 | import org.thingsboard.server.dao.service.DataValidator; |
32 | 32 |
@@ -355,18 +355,23 @@ | @@ -355,18 +355,23 @@ | ||
355 | <version>${project.version}</version> | 355 | <version>${project.version}</version> |
356 | </dependency> | 356 | </dependency> |
357 | <dependency> | 357 | <dependency> |
358 | - <groupId>org.thingsboard.transport</groupId> | ||
359 | - <artifactId>http</artifactId> | 358 | + <groupId>org.thingsboard.common.transport</groupId> |
359 | + <artifactId>transport-api</artifactId> | ||
360 | + <version>${project.version}</version> | ||
361 | + </dependency> | ||
362 | + <dependency> | ||
363 | + <groupId>org.thingsboard.common.transport</groupId> | ||
364 | + <artifactId>mqtt</artifactId> | ||
360 | <version>${project.version}</version> | 365 | <version>${project.version}</version> |
361 | </dependency> | 366 | </dependency> |
362 | <dependency> | 367 | <dependency> |
363 | <groupId>org.thingsboard.transport</groupId> | 368 | <groupId>org.thingsboard.transport</groupId> |
364 | - <artifactId>coap</artifactId> | 369 | + <artifactId>http</artifactId> |
365 | <version>${project.version}</version> | 370 | <version>${project.version}</version> |
366 | </dependency> | 371 | </dependency> |
367 | <dependency> | 372 | <dependency> |
368 | <groupId>org.thingsboard.transport</groupId> | 373 | <groupId>org.thingsboard.transport</groupId> |
369 | - <artifactId>mqtt-common</artifactId> | 374 | + <artifactId>coap</artifactId> |
370 | <version>${project.version}</version> | 375 | <version>${project.version}</version> |
371 | </dependency> | 376 | </dependency> |
372 | <dependency> | 377 | <dependency> |
@@ -72,6 +72,10 @@ | @@ -72,6 +72,10 @@ | ||
72 | <artifactId>guava</artifactId> | 72 | <artifactId>guava</artifactId> |
73 | </dependency> | 73 | </dependency> |
74 | <dependency> | 74 | <dependency> |
75 | + <groupId>com.google.code.gson</groupId> | ||
76 | + <artifactId>gson</artifactId> | ||
77 | + </dependency> | ||
78 | + <dependency> | ||
75 | <groupId>org.springframework</groupId> | 79 | <groupId>org.springframework</groupId> |
76 | <artifactId>spring-web</artifactId> | 80 | <artifactId>spring-web</artifactId> |
77 | <scope>provided</scope> | 81 | <scope>provided</scope> |
@@ -25,7 +25,6 @@ import org.thingsboard.rule.engine.api.TbContext; | @@ -25,7 +25,6 @@ import org.thingsboard.rule.engine.api.TbContext; | ||
25 | import org.thingsboard.rule.engine.api.TbNode; | 25 | import org.thingsboard.rule.engine.api.TbNode; |
26 | import org.thingsboard.rule.engine.api.TbNodeConfiguration; | 26 | import org.thingsboard.rule.engine.api.TbNodeConfiguration; |
27 | import org.thingsboard.rule.engine.api.TbNodeException; | 27 | import org.thingsboard.rule.engine.api.TbNodeException; |
28 | -import org.thingsboard.rule.engine.api.TbRelationTypes; | ||
29 | import org.thingsboard.rule.engine.api.util.DonAsynchron; | 28 | import org.thingsboard.rule.engine.api.util.DonAsynchron; |
30 | import org.thingsboard.rule.engine.api.util.TbNodeUtils; | 29 | import org.thingsboard.rule.engine.api.util.TbNodeUtils; |
31 | import org.thingsboard.server.common.data.DataConstants; | 30 | import org.thingsboard.server.common.data.DataConstants; |
@@ -23,7 +23,6 @@ import org.springframework.http.HttpStatus; | @@ -23,7 +23,6 @@ import org.springframework.http.HttpStatus; | ||
23 | import org.springframework.http.ResponseEntity; | 23 | import org.springframework.http.ResponseEntity; |
24 | import org.springframework.web.bind.annotation.*; | 24 | import org.springframework.web.bind.annotation.*; |
25 | import org.springframework.web.context.request.async.DeferredResult; | 25 | import org.springframework.web.context.request.async.DeferredResult; |
26 | -import org.thingsboard.server.common.msg.core.*; | ||
27 | import org.thingsboard.server.common.transport.SessionMsgProcessor; | 26 | import org.thingsboard.server.common.transport.SessionMsgProcessor; |
28 | import org.thingsboard.server.common.transport.auth.DeviceAuthService; | 27 | import org.thingsboard.server.common.transport.auth.DeviceAuthService; |
29 | import org.thingsboard.server.common.transport.quota.host.HostRequestsQuotaService; | 28 | import org.thingsboard.server.common.transport.quota.host.HostRequestsQuotaService; |
@@ -15,22 +15,10 @@ | @@ -15,22 +15,10 @@ | ||
15 | */ | 15 | */ |
16 | package org.thingsboard.server.transport.http.session; | 16 | package org.thingsboard.server.transport.http.session; |
17 | 17 | ||
18 | -import com.google.gson.JsonObject; | ||
19 | import lombok.extern.slf4j.Slf4j; | 18 | import lombok.extern.slf4j.Slf4j; |
20 | -import org.springframework.http.HttpStatus; | ||
21 | -import org.springframework.http.ResponseEntity; | ||
22 | -import org.springframework.web.context.request.async.DeferredResult; | ||
23 | -import org.thingsboard.server.common.msg.core.*; | ||
24 | -import org.thingsboard.server.common.msg.session.*; | ||
25 | -import org.thingsboard.server.common.msg.session.ex.SessionException; | ||
26 | -import org.thingsboard.server.common.transport.SessionMsgProcessor; | ||
27 | -import org.thingsboard.server.common.transport.adaptor.JsonConverter; | ||
28 | -import org.thingsboard.server.common.transport.auth.DeviceAuthService; | ||
29 | import org.thingsboard.server.common.transport.session.DeviceAwareSessionContext; | 19 | import org.thingsboard.server.common.transport.session.DeviceAwareSessionContext; |
30 | 20 | ||
31 | -import java.util.Optional; | ||
32 | import java.util.UUID; | 21 | import java.util.UUID; |
33 | -import java.util.function.Consumer; | ||
34 | 22 | ||
35 | /** | 23 | /** |
36 | * @author Andrew Shvayka | 24 | * @author Andrew Shvayka |
@@ -37,12 +37,8 @@ | @@ -37,12 +37,8 @@ | ||
37 | 37 | ||
38 | <dependencies> | 38 | <dependencies> |
39 | <dependency> | 39 | <dependency> |
40 | - <groupId>org.thingsboard.common</groupId> | ||
41 | - <artifactId>transport</artifactId> | ||
42 | - </dependency> | ||
43 | - <dependency> | ||
44 | - <groupId>org.thingsboard.transport</groupId> | ||
45 | - <artifactId>mqtt-common</artifactId> | 40 | + <groupId>org.thingsboard.common.transport</groupId> |
41 | + <artifactId>mqtt</artifactId> | ||
46 | </dependency> | 42 | </dependency> |
47 | <dependency> | 43 | <dependency> |
48 | <groupId>org.thingsboard.common</groupId> | 44 | <groupId>org.thingsboard.common</groupId> |
@@ -23,7 +23,6 @@ | @@ -23,7 +23,6 @@ | ||
23 | <version>2.2.0-SNAPSHOT</version> | 23 | <version>2.2.0-SNAPSHOT</version> |
24 | <artifactId>thingsboard</artifactId> | 24 | <artifactId>thingsboard</artifactId> |
25 | </parent> | 25 | </parent> |
26 | - <groupId>org.thingsboard</groupId> | ||
27 | <artifactId>transport</artifactId> | 26 | <artifactId>transport</artifactId> |
28 | <packaging>pom</packaging> | 27 | <packaging>pom</packaging> |
29 | 28 | ||
@@ -37,7 +36,6 @@ | @@ -37,7 +36,6 @@ | ||
37 | <modules> | 36 | <modules> |
38 | <module>http</module> | 37 | <module>http</module> |
39 | <!--<module>coap</module>--> | 38 | <!--<module>coap</module>--> |
40 | - <module>mqtt-common</module> | ||
41 | <module>mqtt-transport</module> | 39 | <module>mqtt-transport</module> |
42 | </modules> | 40 | </modules> |
43 | 41 |