diff --git a/iot-common-core/pom.xml b/iot-common-core/pom.xml index 3a2e36e..53b0a94 100755 --- a/iot-common-core/pom.xml +++ b/iot-common-core/pom.xml @@ -6,7 +6,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 iot-common-core diff --git a/iot-common-doc/pom.xml b/iot-common-doc/pom.xml index 18c14ca..f74ef7f 100755 --- a/iot-common-doc/pom.xml +++ b/iot-common-doc/pom.xml @@ -5,7 +5,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-common-excel/pom.xml b/iot-common-excel/pom.xml index ede96fc..762c5e6 100755 --- a/iot-common-excel/pom.xml +++ b/iot-common-excel/pom.xml @@ -5,7 +5,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-common-log/pom.xml b/iot-common-log/pom.xml index 75538e4..f6aa5e6 100755 --- a/iot-common-log/pom.xml +++ b/iot-common-log/pom.xml @@ -5,7 +5,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-common-oss/pom.xml b/iot-common-oss/pom.xml index b089b53..17a81f5 100755 --- a/iot-common-oss/pom.xml +++ b/iot-common-oss/pom.xml @@ -5,7 +5,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-common-oss/src/main/java/cc/iotkit/common/oss/properties/OssProperties.java b/iot-common-oss/src/main/java/cc/iotkit/common/oss/properties/OssProperties.java index ab372c9..66c97ed 100755 --- a/iot-common-oss/src/main/java/cc/iotkit/common/oss/properties/OssProperties.java +++ b/iot-common-oss/src/main/java/cc/iotkit/common/oss/properties/OssProperties.java @@ -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 { /** diff --git a/iot-common-redis/pom.xml b/iot-common-redis/pom.xml index 093db94..b253693 100755 --- a/iot-common-redis/pom.xml +++ b/iot-common-redis/pom.xml @@ -5,7 +5,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-common-satoken/pom.xml b/iot-common-satoken/pom.xml index bc6dcf3..920bbdb 100755 --- a/iot-common-satoken/pom.xml +++ b/iot-common-satoken/pom.xml @@ -5,7 +5,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-common-tenant/pom.xml b/iot-common-tenant/pom.xml index 6bfda65..89839a2 100755 --- a/iot-common-tenant/pom.xml +++ b/iot-common-tenant/pom.xml @@ -5,7 +5,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-common-thing/pom.xml b/iot-common-thing/pom.xml index 003916a..6e33abf 100755 --- a/iot-common-thing/pom.xml +++ b/iot-common-thing/pom.xml @@ -5,7 +5,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-common-web/pom.xml b/iot-common-web/pom.xml index 8ce49b0..fb9c790 100755 --- a/iot-common-web/pom.xml +++ b/iot-common-web/pom.xml @@ -5,7 +5,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-common-websocket/pom.xml b/iot-common-websocket/pom.xml index afb83c7..ddddaae 100755 --- a/iot-common-websocket/pom.xml +++ b/iot-common-websocket/pom.xml @@ -5,7 +5,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-message-bus/iot-message-core/pom.xml b/iot-message-bus/iot-message-core/pom.xml index 19f53cd..2c2074a 100755 --- a/iot-message-bus/iot-message-core/pom.xml +++ b/iot-message-bus/iot-message-core/pom.xml @@ -5,7 +5,7 @@ iot-message-bus cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-message-bus/iot-message-event-bus/pom.xml b/iot-message-bus/iot-message-event-bus/pom.xml index bb80bd9..7d09ac1 100755 --- a/iot-message-bus/iot-message-event-bus/pom.xml +++ b/iot-message-bus/iot-message-event-bus/pom.xml @@ -5,7 +5,7 @@ iot-message-bus cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-message-bus/iot-message-rocketmq/pom.xml b/iot-message-bus/iot-message-rocketmq/pom.xml index 3db7f54..ca4ca38 100755 --- a/iot-message-bus/iot-message-rocketmq/pom.xml +++ b/iot-message-bus/iot-message-rocketmq/pom.xml @@ -5,7 +5,7 @@ iot-message-bus cc.iotkit - 1.0.2 + 1.0.3 4.0.0 diff --git a/iot-message-bus/pom.xml b/iot-message-bus/pom.xml index a478c3e..f0cc817 100755 --- a/iot-message-bus/pom.xml +++ b/iot-message-bus/pom.xml @@ -5,7 +5,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 4.0.0 pom diff --git a/iot-oss-local/pom.xml b/iot-oss-local/pom.xml new file mode 100644 index 0000000..3f6ecbd --- /dev/null +++ b/iot-oss-local/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + + cc.iotkit + iot-iita-core + 1.0.3 + + + iot-oss-local + + + 11 + 11 + UTF-8 + + + + + + cc.iotkit + iot-common-core + + + + cc.iotkit + iot-common-redis + + + + cc.iotkit + iot-common-oss + + + + io.vertx + vertx-core + + + + io.vertx + vertx-web + ${vertx.version} + + + + org.springframework.boot + spring-boot-starter + + + + + \ No newline at end of file diff --git a/iot-oss-local/src/main/java/cc/iotkit/oss/HttpVerticle.java b/iot-oss-local/src/main/java/cc/iotkit/oss/HttpVerticle.java new file mode 100644 index 0000000..ac489b3 --- /dev/null +++ b/iot-oss-local/src/main/java/cc/iotkit/oss/HttpVerticle.java @@ -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 { + 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()); + } + +} diff --git a/iot-oss-local/src/main/java/cc/iotkit/oss/OssServer.java b/iot-oss-local/src/main/java/cc/iotkit/oss/OssServer.java new file mode 100644 index 0000000..1102ac9 --- /dev/null +++ b/iot-oss-local/src/main/java/cc/iotkit/oss/OssServer.java @@ -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 future = vertx.deployVerticle(httpVerticle); + future.onSuccess((s -> { + log.info("http plugin startup success"); + })); + future.onFailure((e) -> { + log.error("http plugin startup failed", e); + }); + } + +} diff --git a/iot-oss-local/src/main/java/cc/iotkit/oss/Test.java b/iot-oss-local/src/main/java/cc/iotkit/oss/Test.java new file mode 100644 index 0000000..574a1a4 --- /dev/null +++ b/iot-oss-local/src/main/java/cc/iotkit/oss/Test.java @@ -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); +// } +} diff --git a/iot-plugin-core/pom.xml b/iot-plugin-core/pom.xml index 0070567..b3c4f7c 100644 --- a/iot-plugin-core/pom.xml +++ b/iot-plugin-core/pom.xml @@ -6,7 +6,7 @@ cc.iotkit iot-iita-core - 1.0.2 + 1.0.3 iot-plugin-core diff --git a/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/ActionType.java b/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/ActionType.java index 011aa00..e1ba6e8 100755 --- a/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/ActionType.java +++ b/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/ActionType.java @@ -14,6 +14,8 @@ public enum ActionType { //注册 REGISTER("register"), + //子注册 + SUB_REGISTER("sub_register"), //设备拓扑更新 TOPOLOGY("topology"), //在离线状态变更 diff --git a/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/SubDeviceRegister.java b/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/SubDeviceRegister.java new file mode 100644 index 0000000..b3cb193 --- /dev/null +++ b/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/SubDeviceRegister.java @@ -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 subs; + + @Override + public ActionType getType() { + return ActionType.SUB_REGISTER; + } +} diff --git a/iot-script-engine/pom.xml b/iot-script-engine/pom.xml index 019d7c6..f909f27 100755 --- a/iot-script-engine/pom.xml +++ b/iot-script-engine/pom.xml @@ -6,7 +6,7 @@ iot-iita-core cc.iotkit - 1.0.2 + 1.0.3 iot-script-engine diff --git a/iot-spring-brick/pom.xml b/iot-spring-brick/pom.xml index 010e06d..cc2fe4d 100644 --- a/iot-spring-brick/pom.xml +++ b/iot-spring-brick/pom.xml @@ -6,7 +6,7 @@ cc.iotkit iot-iita-core - 1.0.2 + 1.0.3 com.gitee.starblues diff --git a/iot-spring-brick/spring-brick/src/main/java/com/gitee/starblues/integration/ExtendPointConfiguration.java b/iot-spring-brick/spring-brick/src/main/java/com/gitee/starblues/integration/ExtendPointConfiguration.java index ec930b6..d483f0b 100755 --- a/iot-spring-brick/spring-brick/src/main/java/com/gitee/starblues/integration/ExtendPointConfiguration.java +++ b/iot-spring-brick/spring-brick/src/main/java/com/gitee/starblues/integration/ExtendPointConfiguration.java @@ -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 diff --git a/pom.xml b/pom.xml index 441d491..0357c40 100755 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cc.iotkit iot-iita-core - 1.0.2 + 1.0.3 pom @@ -25,6 +25,7 @@ iot-common-thing iot-plugin-core iot-spring-brick + iot-oss-local @@ -45,6 +46,12 @@ + + org.springframework.boot + spring-boot-starter + ${spring-boot.version} + + org.springframework.boot spring-boot-starter-web @@ -321,6 +328,12 @@ ${project.version} + + cc.iotkit + iot-common-oss + ${project.version} + +