[OSPP] Mapper-framework-Java design and implementation#5900
Conversation
d712614 to
72c0f35
Compare
|
/assign @kevin-wangzefeng |
wbc6080
left a comment
There was a problem hiding this comment.
/kind feature
/remove-kind design
Please describe in detail what this PR is used for in the description of the PR.
|
As other language mapper-frameworks are in demand in actual business, we implement a java version mapper-framework and realize a modbus protocol based mapper as an example. The developers could use the template to customize their own protocol, which could translate information between device and kubeEdge into the format understood by each other. |
wbc6080
left a comment
There was a problem hiding this comment.
In the go version of mapper-framework, we provide Makefile. Users can execute make generate to generate a custom mapper project, but similar files are not found in the java version. So how to generate a user-defined mapper here?
| # 默认忽略的文件 | ||
| /shelf/ | ||
| /workspace.xml | ||
| # 基于编辑器的 HTTP 客户端请求 | ||
| /httpRequests/ | ||
| # Datasource local storage ignored files | ||
| /dataSources/ | ||
| /dataSources.local.xml |
| Point point = Point.measurement(influxdb2DataConfig.getMeasurement()) | ||
| .addTags(influxdb2DataConfig.getTag()) | ||
| .addField(influxdb2DataConfig.getFieldKey(), data.getValue()) | ||
| .time(Instant.now(), WritePrecision.NS); // 使用纳秒精度 |
| pstmt.setString(1, dateTime); // 设置日期时间参数 | ||
| pstmt.setString(2, data.getValue()); // 设置字段值参数 | ||
| pstmt.executeUpdate(); // 执行插入 |
There was a problem hiding this comment.
ditto. Please replace all Chinese comments in the code with English
wbc6080
left a comment
There was a problem hiding this comment.
Please make the check pipeline pass. You can run make verify and then run git status. There will be some new changes and you can push them again.
|
|
As a java project, it makes sense that it wouldn't be able to get past the go pipeline check. |
| import driver.CustomizedClient; | ||
| import grpc.GrpcClient; | ||
| import lombok.Getter; | ||
| import lombok.Setter; |
There was a problem hiding this comment.
Whether lombok compilation needs to rely on plug-in configuration ? It is recommended to explain it in the readme document.
There was a problem hiding this comment.
In this project maven is used to manage dependencies, and the pom.xml already contains this dependency
There was a problem hiding this comment.
If I compile your project with Idea, don't I need to install the Lombok plugin in Idea?
There was a problem hiding this comment.
You don't need to install the Lombok plugin in Idea.
| private TDEngineClientConfig tdClientConfig; | ||
| public Connection initDbClient(){ | ||
| Connection dbClient = null; | ||
| String userName = System.getenv("USERNAME"); |
There was a problem hiding this comment.
USERNAME and PASSWORD are suggested to be made constants
There was a problem hiding this comment.
Do you mean to set default values for USERNAME and PASSWORD?
Since USERNAME and PASSWORD are more private information, we want users to enter this information themselves and add it to the local environment.
There was a problem hiding this comment.
Defined as a constant, and here we reference this constant, not a magic string
| client.publish(this.mqttpConfig.topic, message); | ||
|
|
||
| client.disconnect(250); | ||
| System.out.println("############### Message published. ###############"); |
There was a problem hiding this comment.
Do not use System. out. println for logging, as it is usually used for temporary debugging
There was a problem hiding this comment.
OK, I will correct it.
| // | ||
| // File socketFile = new File(socketPath); | ||
| // if (socketFile.exists()) { | ||
| // if (socketFile.isDirectory()) { |
There was a problem hiding this comment.
Annotate the code, add comments to explain why, or simply delete them and explain in the readme document
There was a problem hiding this comment.
OK, I will correct it.
434dd21 to
ce716b5
Compare
| @@ -0,0 +1,53 @@ | |||
| ##!/usr/bin/env bash | |||
There was a problem hiding this comment.
If this shell is not needed, you can remove this file.
wbc6080
left a comment
There was a problem hiding this comment.
Do not modify these irrelevant files. @ryWangkkk

f916f2c to
8839729
Compare
|
@JiaweiGithub: adding LGTM is restricted to approvers and reviewers in OWNERS files. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
8839729 to
7394e7e
Compare
7394e7e to
376531d
Compare
| // handle /api/v1/ping request | ||
| @Override | ||
| public void handle(HttpExchange exchange) throws IOException { | ||
| // 创建响应对象 |
There was a problem hiding this comment.
Do not use Chinese comments
| private String nameSpace = ""; | ||
|
|
||
| @JsonProperty("description") | ||
| private String description = "";//这个属性暂时没用到 |
Signed-off-by: ryWangkkk <ryWang@zju.edu.cn> Java Version mapper framework Signed-off-by: ryWangkkk <ryWang@zju.edu.cn> Java Version mapper framework Signed-off-by: ryWangkkk <ryWang@zju.edu.cn> Java Version mapper framework Signed-off-by: ryWangkkk <ryWang@zju.edu.cn>
e34cd98 to
8af74fe
Compare
wbc6080
left a comment
There was a problem hiding this comment.
Looks good for the first version.
Mappers with other languages are best developed in independent repo, so we firstly merge into the feature development branch and then @ryWangkkk need to migrate to the new repo.
/lgtm
cc @JiaweiGithub @WillardHu @fisherxu
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fisherxu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |

What type of PR is this?
/kind feature
What this PR does / why we need it:
As other language mapper-frameworks are in demand in actual business, we implement a java version mapper-framework and realize a modbus protocol based mapper as an example. The developers could use the template to customize their own protocol, which could translate information between device and kubeEdge into the format understood by each other.
Which issue(s) this PR fixes:
Fixes #5594
Special notes for your reviewer:
Does this PR introduce a user-facing change?: