This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new fd95e72ba5 [INLONG-9833][Agent] Add module state to distinguish
whether the module has been downloaded or installed (#9834)
fd95e72ba5 is described below
commit fd95e72ba5b805a803f32aace9d865196893d5f1
Author: justinwwhuang <[email protected]>
AuthorDate: Mon Mar 18 12:39:08 2024 +0800
[INLONG-9833][Agent] Add module state to distinguish whether the module has
been downloaded or installed (#9834)
---
.../common/pojo/agent/installer/ModuleConfig.java | 6 +++
.../pojo/agent/installer/ModuleStateEnum.java | 51 ++++++++++++++++++++++
2 files changed, 57 insertions(+)
diff --git
a/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ModuleConfig.java
b/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ModuleConfig.java
index 2388cb3825..7e44498bbe 100644
---
a/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ModuleConfig.java
+++
b/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ModuleConfig.java
@@ -58,5 +58,11 @@ public class ModuleConfig {
* The command to uninstall the module
*/
private String uninstallCommand;
+
private PackageConfig packageConfig;
+
+ /**
+ * The state of the module
+ */
+ private ModuleStateEnum state;
}
\ No newline at end of file
diff --git
a/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ModuleStateEnum.java
b/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ModuleStateEnum.java
new file mode 100644
index 0000000000..7f33ea7b53
--- /dev/null
+++
b/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ModuleStateEnum.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.common.pojo.agent.installer;
+
+/**
+ * Enum of module state.
+ */
+public enum ModuleStateEnum {
+
+ NEW(0),
+ DOWNLOADED(1),
+ INSTALLED(2);
+
+ private final int state;
+
+ ModuleStateEnum(int state) {
+ this.state = state;
+ }
+
+ public static ModuleStateEnum getTaskState(int state) {
+ switch (state) {
+ case 0:
+ return NEW;
+ case 1:
+ return DOWNLOADED;
+ case 2:
+ return INSTALLED;
+ default:
+ throw new RuntimeException("Unsupported module state " +
state);
+ }
+ }
+
+ public int getType() {
+ return state;
+ }
+}