feat:增加子设备注册
parent
71e74d447e
commit
b83f314c9d
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>iot-common-core</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package cc.iotkit.common.oss.properties;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* OSS对象存储 配置属性
|
||||
|
@ -8,6 +11,9 @@ import lombok.Data;
|
|||
* @author Lion Li
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class OssProperties {
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-message-bus</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-message-bus</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-message-bus</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>pom</packaging>
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>iot-oss-local</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-common-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-common-oss</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-web</artifactId>
|
||||
<version>${vertx.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: xw2sy@163.com
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
package cc.iotkit.oss;
|
||||
|
||||
import io.vertx.core.AbstractVerticle;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.http.HttpServer;
|
||||
import io.vertx.core.http.HttpServerRequest;
|
||||
import io.vertx.core.http.HttpServerResponse;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.ext.web.Router;
|
||||
import io.vertx.ext.web.RoutingContext;
|
||||
import io.vertx.ext.web.handler.BodyHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class HttpVerticle extends AbstractVerticle implements Handler<RoutingContext> {
|
||||
private HttpServer httpServer;
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
Executors.newSingleThreadScheduledExecutor().schedule(this::initHttpServer, 3, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private void initHttpServer() {
|
||||
httpServer = vertx.createHttpServer();
|
||||
Router router = Router.router(vertx);
|
||||
router.route().handler(BodyHandler.create()).handler(this);
|
||||
httpServer.requestHandler(router).listen(1121, ar -> {
|
||||
if (ar.succeeded()) {
|
||||
log.info("http server is listening on port " + ar.result().actualPort());
|
||||
} else {
|
||||
log.error("Error on starting the server", ar.cause());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(RoutingContext ctx) {
|
||||
HttpServerResponse response = ctx.response();
|
||||
response.putHeader("content-type", "application/json");
|
||||
response.setStatusCode(200);
|
||||
|
||||
try {
|
||||
HttpServerRequest request = ctx.request();
|
||||
String path = request.path();
|
||||
log.info("path:{}", path);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("消息处理失败", e);
|
||||
response.setStatusCode(500);
|
||||
end(response);
|
||||
}
|
||||
}
|
||||
|
||||
private void end(HttpServerResponse response) {
|
||||
response.end(new JsonObject()
|
||||
.put("code", response.getStatusCode() == 200 ? 0 : response.getStatusCode())
|
||||
.toString());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package cc.iotkit.oss;
|
||||
|
||||
import cc.iotkit.common.oss.constant.OssConstant;
|
||||
import cc.iotkit.common.oss.properties.OssProperties;
|
||||
import cc.iotkit.common.redis.utils.RedisUtils;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.Vertx;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class OssServer {
|
||||
|
||||
private final int port = RandomUtil.randomInt(1660, 1880);
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
RedisUtils.setCacheObject(OssConstant.DEFAULT_CONFIG_KEY, OssProperties.builder()
|
||||
.endpoint(String.format("http://127.0.0.1:%d", port))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
Vertx vertx = Vertx.vertx();
|
||||
|
||||
HttpVerticle httpVerticle=new HttpVerticle();
|
||||
Future<String> future = vertx.deployVerticle(httpVerticle);
|
||||
future.onSuccess((s -> {
|
||||
log.info("http plugin startup success");
|
||||
}));
|
||||
future.onFailure((e) -> {
|
||||
log.error("http plugin startup failed", e);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package cc.iotkit.oss;
|
||||
|
||||
import cc.iotkit.common.oss.core.OssClient;
|
||||
import cc.iotkit.common.oss.factory.OssFactory;
|
||||
|
||||
public class Test {
|
||||
// public static void main(String[] args) {
|
||||
// OssClient ossClient = new OssClient("", properties);
|
||||
// }
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>iot-plugin-core</artifactId>
|
||||
|
|
|
@ -14,6 +14,8 @@ public enum ActionType {
|
|||
|
||||
//注册
|
||||
REGISTER("register"),
|
||||
//子注册
|
||||
SUB_REGISTER("sub_register"),
|
||||
//设备拓扑更新
|
||||
TOPOLOGY("topology"),
|
||||
//在离线状态变更
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package cc.iotkit.plugin.core.thing.actions.up;
|
||||
|
||||
|
||||
import cc.iotkit.plugin.core.thing.actions.AbstractAction;
|
||||
import cc.iotkit.plugin.core.thing.actions.ActionType;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 子设备注册动作
|
||||
*
|
||||
* @author sjg
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
@ToString(callSuper = true)
|
||||
public class SubDeviceRegister extends AbstractAction {
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
private String model;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* 子设备注册
|
||||
*/
|
||||
private List<DeviceRegister> subs;
|
||||
|
||||
@Override
|
||||
public ActionType getType() {
|
||||
return ActionType.SUB_REGISTER;
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>iot-script-engine</artifactId>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.gitee.starblues</groupId>
|
||||
|
|
|
@ -17,13 +17,11 @@
|
|||
package com.gitee.starblues.integration;
|
||||
|
||||
import com.gitee.starblues.core.DefaultRealizeProvider;
|
||||
import com.gitee.starblues.core.RealizeProvider;;
|
||||
import com.gitee.starblues.core.classloader.CacheMainResourceMatcher;
|
||||
import com.gitee.starblues.core.RealizeProvider;
|
||||
import com.gitee.starblues.core.classloader.DefaultMainResourceMatcher;
|
||||
import com.gitee.starblues.core.classloader.MainResourceMatcher;
|
||||
import com.gitee.starblues.core.descriptor.decrypt.DefaultPluginDescriptorDecrypt;
|
||||
import com.gitee.starblues.core.descriptor.decrypt.PluginDescriptorDecrypt;
|
||||
import com.gitee.starblues.core.launcher.plugin.BasicMainResourcePatternDefiner;
|
||||
import com.gitee.starblues.core.launcher.plugin.DefaultMainResourcePatternDefiner;
|
||||
import com.gitee.starblues.integration.operator.DefaultPluginOperator;
|
||||
import com.gitee.starblues.integration.operator.PluginOperator;
|
||||
|
@ -31,11 +29,12 @@ import com.gitee.starblues.integration.operator.PluginOperatorWrapper;
|
|||
import com.gitee.starblues.integration.user.DefaultPluginUser;
|
||||
import com.gitee.starblues.integration.user.PluginUser;
|
||||
import com.gitee.starblues.spring.extract.ExtractFactory;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.*;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* 系统Bean配置
|
||||
* @author starBlues
|
||||
|
|
15
pom.xml
15
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-iita-core</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
|
@ -25,6 +25,7 @@
|
|||
<module>iot-common-thing</module>
|
||||
<module>iot-plugin-core</module>
|
||||
<module>iot-spring-brick</module>
|
||||
<module>iot-oss-local</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
@ -45,6 +46,12 @@
|
|||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
|
@ -321,6 +328,12 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-common-oss</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</dependencyManagement>
|
||||
|
|
Loading…
Reference in New Issue