This is an automated email from the ASF dual-hosted git repository.
wuzhiguo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/bigtop-manager.git
The following commit(s) were added to refs/heads/main by this push:
new 696c880 BIGTOP-4185: Optimize stack spi related classes (#39)
696c880 is described below
commit 696c8805334019d37d898430eb18cfe3e0ee02c2
Author: Zhiguo Wu <[email protected]>
AuthorDate: Tue Aug 13 10:26:02 2024 +0800
BIGTOP-4185: Optimize stack spi related classes (#39)
---
bigtop-manager-agent/pom.xml | 12 +++
.../executor/CacheFileUpdateCommandExecutor.java | 2 +-
.../server/command/task/CacheFileUpdateTask.java | 6 +-
bigtop-manager-spi/pom.xml | 61 ------------
.../bigtop-manager-stack-bigtop/pom.xml | 31 +++++--
.../manager/stack/bigtop/utils/HdfsUtil.java | 4 +-
.../stack/bigtop/v3_3_0/hdfs/DataNodeScript.java | 13 +--
.../stack/bigtop/v3_3_0/hdfs/HdfsClientScript.java | 10 +-
.../stack/bigtop/v3_3_0/hdfs/HdfsParams.java | 6 +-
.../stack/bigtop/v3_3_0/hdfs/HdfsSetup.java | 10 +-
.../stack/bigtop/v3_3_0/hdfs/NameNodeScript.java | 13 +--
.../stack/bigtop/v3_3_0/hdfs/SNameNodeScript.java | 13 +--
.../bigtop/v3_3_0/kafka/KafkaBrokerScript.java | 13 +--
.../stack/bigtop/v3_3_0/kafka/KafkaParams.java | 6 +-
.../stack/bigtop/v3_3_0/kafka/KafkaSetup.java | 8 +-
.../stack/bigtop/v3_3_0/tez/TezClientScript.java | 10 +-
.../manager/stack/bigtop/v3_3_0/tez/TezParams.java | 6 +-
.../manager/stack/bigtop/v3_3_0/tez/TezSetup.java | 6 +-
.../bigtop/v3_3_0/yarn/NodeManagerScript.java | 13 +--
.../bigtop/v3_3_0/yarn/ResourceManagerScript.java | 13 +--
.../stack/bigtop/v3_3_0/yarn/YarnClientScript.java | 10 +-
.../stack/bigtop/v3_3_0/yarn/YarnParams.java | 6 +-
.../stack/bigtop/v3_3_0/yarn/YarnSetup.java | 8 +-
.../v3_3_0/zookeeper/ZookeeperClientScript.java | 10 +-
.../bigtop/v3_3_0/zookeeper/ZookeeperParams.java | 6 +-
.../v3_3_0/zookeeper/ZookeeperServerScript.java | 13 +--
.../bigtop/v3_3_0/zookeeper/ZookeeperSetup.java | 8 +-
.../bigtop-manager-stack-common/pom.xml | 47 ----------
.../bigtop-manager-stack-core/pom.xml | 15 ++-
.../stack/core}/annotations/GlobalParams.java | 2 +-
.../manager/stack/core}/enums/ConfigType.java | 2 +-
.../stack/core}/exception/StackException.java | 2 +-
.../manager/stack/core/executor/StackExecutor.java | 22 ++---
.../manager/stack/core/hook/AbstractHook.java | 61 ------------
.../manager/stack/core/hook/InstallHook.java | 66 -------------
.../manager/stack/core/param}/BaseParams.java | 6 +-
.../bigtop/manager/stack/core/param}/Params.java | 2 +-
.../manager/stack/core/spi}/PrioritySPI.java | 2 +-
.../stack/core/spi}/PrioritySPIFactory.java | 2 +-
.../StopHook.java => spi/hook/AbstractHook.java} | 28 +++---
.../bigtop/manager/stack/core/spi/hook}/Hook.java | 9 +-
.../manager/stack/core/spi/hook/InstallHook.java | 102 +++++++++++++++++++++
.../stack/core/{ => spi}/hook/RestartHook.java | 8 +-
.../stack/core/{ => spi}/hook/StartHook.java | 8 +-
.../stack/core/{ => spi}/hook/StopHook.java | 8 +-
.../stack/core/spi}/repo/AptPackageManager.java | 16 ++--
.../stack/core/spi}/repo/DnfPackageManager.java | 17 ++--
.../stack/core/spi/repo}/PackageManager.java | 30 +++++-
.../stack/core/spi/repo}/PackageManagerType.java | 2 +-
.../stack/core/spi}/repo/YumPackageManager.java | 17 ++--
.../core/spi/script/AbstractClientScript.java | 12 +--
.../stack/core/spi/script/AbstractScript.java | 22 ++---
.../core/spi/script/AbstractServerScript.java | 11 +--
.../manager/stack/core/spi/script/Script.java | 86 +++++++++++++++++
.../manager/stack/core}/utils/LocalSettings.java | 2 +-
.../manager/stack/core}/utils/PackageUtils.java | 19 +++-
.../manager/stack/core}/utils/PropertiesUtils.java | 4 +-
.../bigtop/manager/stack/core}/utils/XmlUtils.java | 4 +-
.../stack/core}/utils/linux/LinuxAccountUtils.java | 48 +++++++++-
.../stack/core}/utils/linux/LinuxFileUtils.java | 8 +-
.../stack/core}/utils/linux/LinuxOSUtils.java | 2 +-
.../stack/core}/utils/template/BaseTemplate.java | 4 +-
.../stack/core}/utils/template/TemplateUtils.java | 4 +-
.../src/main/resources/templates/CONTENT.ftl | 0
.../src/main/resources/templates/ENV.ftl | 0
.../src/main/resources/templates/PROPERTIES.ftl | 0
.../src/main/resources/templates/XML.ftl | 0
.../bigtop-manager-stack-nop/pom.xml | 7 +-
.../stack/nop/v1_0_0/kafka/KafkaBrokerScript.java | 7 +-
.../stack/nop/v1_0_0/kafka/KafkaParams.java | 2 +-
.../v1_0_0/zookeeper/ZookeeperClientScript.java | 8 +-
.../nop/v1_0_0/zookeeper/ZookeeperParams.java | 2 +-
.../v1_0_0/zookeeper/ZookeeperServerScript.java | 7 +-
bigtop-manager-stack/pom.xml | 5 -
pom.xml | 13 ---
75 files changed, 555 insertions(+), 513 deletions(-)
diff --git a/bigtop-manager-agent/pom.xml b/bigtop-manager-agent/pom.xml
index a18da7b..6a6d703 100644
--- a/bigtop-manager-agent/pom.xml
+++ b/bigtop-manager-agent/pom.xml
@@ -47,15 +47,27 @@
<groupId>org.apache.bigtop</groupId>
<artifactId>bigtop-manager-common</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.bigtop</groupId>
<artifactId>bigtop-manager-grpc</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.bigtop</groupId>
<artifactId>bigtop-manager-stack-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.bigtop</groupId>
+ <artifactId>bigtop-manager-stack-bigtop</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.bigtop</groupId>
+ <artifactId>bigtop-manager-stack-nop</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
diff --git
a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/CacheFileUpdateCommandExecutor.java
b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/CacheFileUpdateCommandExecutor.java
index 13fbed7..11e3ae7 100644
---
a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/CacheFileUpdateCommandExecutor.java
+++
b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/CacheFileUpdateCommandExecutor.java
@@ -23,7 +23,7 @@ import
org.apache.bigtop.manager.common.constants.MessageConstants;
import
org.apache.bigtop.manager.common.message.entity.payload.CacheMessagePayload;
import org.apache.bigtop.manager.common.utils.JsonUtils;
import org.apache.bigtop.manager.grpc.generated.CommandType;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxFileUtils;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxFileUtils;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/task/CacheFileUpdateTask.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/task/CacheFileUpdateTask.java
index cde6536..3c1fabb 100644
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/task/CacheFileUpdateTask.java
+++
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/task/CacheFileUpdateTask.java
@@ -217,7 +217,6 @@ public class CacheFileUpdateTask extends AbstractTask {
ImmutablePair<StackDTO, List<ServiceDTO>> immutablePair =
StackUtils.getStackKeyMap().get(fullStackName);
StackDTO stackDTO = immutablePair.getLeft();
- List<ServiceDTO> serviceDTOList = immutablePair.getRight();
Map<String, Object> properties = taskContext.getProperties();
@@ -229,13 +228,10 @@ public class CacheFileUpdateTask extends AbstractTask {
clusterInfo.setUserGroup(stackDTO.getUserGroup());
clusterInfo.setRepoTemplate(stackDTO.getRepoTemplate());
clusterInfo.setRoot(stackDTO.getRoot());
+ clusterInfo.setPackages(List.of(stackDTO.getPackages().split(",")));
List<String> hostnames = (List<String>) properties.get("hostnames");
hostMap.put(Constants.ALL_HOST_KEY, new HashSet<>(hostnames));
-
- for (ServiceDTO serviceDTO : serviceDTOList) {
- userMap.put(serviceDTO.getServiceName(),
serviceDTO.getServiceUser());
- }
}
@Override
diff --git a/bigtop-manager-spi/pom.xml b/bigtop-manager-spi/pom.xml
deleted file mode 100644
index e48b38a..0000000
--- a/bigtop-manager-spi/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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
- ~
- ~ https://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.
--->
-<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>org.apache.bigtop</groupId>
- <artifactId>bigtop-manager</artifactId>
- <version>${revision}</version>
- </parent>
-
- <artifactId>bigtop-manager-spi</artifactId>
- <name>${project.artifactId}</name>
- <description>Bigtop Manager Spi</description>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.bigtop</groupId>
- <artifactId>bigtop-manager-bom</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.bigtop</groupId>
- <artifactId>bigtop-manager-common</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/pom.xml
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/pom.xml
index 2e2bbe6..873fb2e 100644
--- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/pom.xml
+++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/pom.xml
@@ -37,12 +37,7 @@
<dependencies>
<dependency>
<groupId>org.apache.bigtop</groupId>
- <artifactId>bigtop-manager-stack-common</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.google.auto.service</groupId>
- <artifactId>auto-service</artifactId>
+ <artifactId>bigtop-manager-stack-core</artifactId>
</dependency>
<dependency>
@@ -66,6 +61,14 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-reload4j</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper-jute</artifactId>
+ </exclusion>
</exclusions>
</dependency>
@@ -90,6 +93,14 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-reload4j</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper-jute</artifactId>
+ </exclusion>
</exclusions>
</dependency>
@@ -114,6 +125,14 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-reload4j</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper-jute</artifactId>
+ </exclusion>
</exclusions>
</dependency>
</dependencies>
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/utils/HdfsUtil.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/utils/HdfsUtil.java
index fe65590..74929f0 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/utils/HdfsUtil.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/utils/HdfsUtil.java
@@ -18,8 +18,8 @@
*/
package org.apache.bigtop.manager.stack.bigtop.utils;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
-import org.apache.bigtop.manager.stack.common.utils.LocalSettings;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
import org.apache.commons.collections.CollectionUtils;
import org.apache.hadoop.conf.Configuration;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/DataNodeScript.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/DataNodeScript.java
index 81a551c..2085834 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/DataNodeScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/DataNodeScript.java
@@ -19,11 +19,12 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
-import org.apache.bigtop.manager.stack.common.utils.PackageUtils;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractServerScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxOSUtils;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -32,7 +33,7 @@ import java.text.MessageFormat;
@Slf4j
@AutoService(Script.class)
-public class DataNodeScript implements Script {
+public class DataNodeScript extends AbstractServerScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsClientScript.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsClientScript.java
index 9208bff..02262e7 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsClientScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsClientScript.java
@@ -19,17 +19,17 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.ClientScript;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
-import org.apache.bigtop.manager.stack.common.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractClientScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@AutoService(Script.class)
-public class HdfsClientScript implements ClientScript {
+public class HdfsClientScript extends AbstractClientScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsParams.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsParams.java
index 24c8d61..aa45a5d 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsParams.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsParams.java
@@ -19,9 +19,9 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs;
import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload;
-import org.apache.bigtop.manager.stack.common.annotations.GlobalParams;
-import org.apache.bigtop.manager.stack.common.utils.BaseParams;
-import org.apache.bigtop.manager.stack.common.utils.LocalSettings;
+import org.apache.bigtop.manager.stack.core.annotations.GlobalParams;
+import org.apache.bigtop.manager.stack.core.param.BaseParams;
+import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
import org.apache.commons.lang3.StringUtils;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsSetup.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsSetup.java
index 3d37bdf..1cae445 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsSetup.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsSetup.java
@@ -20,12 +20,12 @@ package org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs;
import org.apache.bigtop.manager.common.constants.Constants;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
import org.apache.bigtop.manager.stack.bigtop.v3_3_0.kafka.KafkaParams;
-import org.apache.bigtop.manager.stack.common.enums.ConfigType;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxFileUtils;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils;
+import org.apache.bigtop.manager.stack.core.enums.ConfigType;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxFileUtils;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxOSUtils;
import org.apache.commons.lang3.StringUtils;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/NameNodeScript.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/NameNodeScript.java
index 42a74d0..5f30f29 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/NameNodeScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/NameNodeScript.java
@@ -19,11 +19,12 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
-import org.apache.bigtop.manager.stack.common.utils.PackageUtils;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractServerScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxOSUtils;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -32,7 +33,7 @@ import java.text.MessageFormat;
@Slf4j
@AutoService(Script.class)
-public class NameNodeScript implements Script {
+public class NameNodeScript extends AbstractServerScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/SNameNodeScript.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/SNameNodeScript.java
index bf72370..67eba56 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/SNameNodeScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/SNameNodeScript.java
@@ -19,11 +19,12 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
-import org.apache.bigtop.manager.stack.common.utils.PackageUtils;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractServerScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxOSUtils;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -32,7 +33,7 @@ import java.text.MessageFormat;
@Slf4j
@AutoService(Script.class)
-public class SNameNodeScript implements Script {
+public class SNameNodeScript extends AbstractServerScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaBrokerScript.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaBrokerScript.java
index c44c85c..97714ce 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaBrokerScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaBrokerScript.java
@@ -19,11 +19,12 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.kafka;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
-import org.apache.bigtop.manager.stack.common.utils.PackageUtils;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractServerScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxOSUtils;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -33,7 +34,7 @@ import java.text.MessageFormat;
@Slf4j
@AutoService(Script.class)
-public class KafkaBrokerScript implements Script {
+public class KafkaBrokerScript extends AbstractServerScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaParams.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaParams.java
index 9b6a2ec..c3c6411 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaParams.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaParams.java
@@ -19,9 +19,9 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.kafka;
import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload;
-import org.apache.bigtop.manager.stack.common.annotations.GlobalParams;
-import org.apache.bigtop.manager.stack.common.utils.BaseParams;
-import org.apache.bigtop.manager.stack.common.utils.LocalSettings;
+import org.apache.bigtop.manager.stack.core.annotations.GlobalParams;
+import org.apache.bigtop.manager.stack.core.param.BaseParams;
+import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
import lombok.Getter;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaSetup.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaSetup.java
index ca5c236..02bd702 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaSetup.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaSetup.java
@@ -19,10 +19,10 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.kafka;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.stack.common.enums.ConfigType;
-import org.apache.bigtop.manager.stack.common.utils.LocalSettings;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxFileUtils;
+import org.apache.bigtop.manager.stack.core.enums.ConfigType;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxFileUtils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezClientScript.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezClientScript.java
index 648680c..5db7b46 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezClientScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezClientScript.java
@@ -19,17 +19,17 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.tez;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.ClientScript;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
-import org.apache.bigtop.manager.stack.common.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractClientScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@AutoService(Script.class)
-public class TezClientScript implements ClientScript {
+public class TezClientScript extends AbstractClientScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezParams.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezParams.java
index f5df822..f74724d 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezParams.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezParams.java
@@ -19,9 +19,9 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.tez;
import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload;
-import org.apache.bigtop.manager.stack.common.annotations.GlobalParams;
-import org.apache.bigtop.manager.stack.common.utils.BaseParams;
-import org.apache.bigtop.manager.stack.common.utils.LocalSettings;
+import org.apache.bigtop.manager.stack.core.annotations.GlobalParams;
+import org.apache.bigtop.manager.stack.core.param.BaseParams;
+import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
import org.apache.commons.lang3.StringUtils;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezSetup.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezSetup.java
index 68cc1fa..5709ace 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezSetup.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezSetup.java
@@ -20,9 +20,9 @@ package org.apache.bigtop.manager.stack.bigtop.v3_3_0.tez;
import org.apache.bigtop.manager.common.constants.Constants;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.stack.common.enums.ConfigType;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxFileUtils;
+import org.apache.bigtop.manager.stack.core.enums.ConfigType;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxFileUtils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/NodeManagerScript.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/NodeManagerScript.java
index 3348c1b..8f89d71 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/NodeManagerScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/NodeManagerScript.java
@@ -19,11 +19,12 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.yarn;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
-import org.apache.bigtop.manager.stack.common.utils.PackageUtils;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractServerScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxOSUtils;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -32,7 +33,7 @@ import java.text.MessageFormat;
@Slf4j
@AutoService(Script.class)
-public class NodeManagerScript implements Script {
+public class NodeManagerScript extends AbstractServerScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/ResourceManagerScript.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/ResourceManagerScript.java
index 36930af..0db3b11 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/ResourceManagerScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/ResourceManagerScript.java
@@ -19,11 +19,12 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.yarn;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
-import org.apache.bigtop.manager.stack.common.utils.PackageUtils;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractServerScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxOSUtils;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -32,7 +33,7 @@ import java.text.MessageFormat;
@Slf4j
@AutoService(Script.class)
-public class ResourceManagerScript implements Script {
+public class ResourceManagerScript extends AbstractServerScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/YarnClientScript.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/YarnClientScript.java
index 31c3854..10e3d00 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/YarnClientScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/YarnClientScript.java
@@ -19,17 +19,17 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.yarn;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.ClientScript;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
-import org.apache.bigtop.manager.stack.common.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractClientScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@AutoService(Script.class)
-public class YarnClientScript implements ClientScript {
+public class YarnClientScript extends AbstractClientScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/YarnParams.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/YarnParams.java
index 7b3f215..e92dafa 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/YarnParams.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/YarnParams.java
@@ -19,9 +19,9 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.yarn;
import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload;
-import org.apache.bigtop.manager.stack.common.annotations.GlobalParams;
-import org.apache.bigtop.manager.stack.common.utils.BaseParams;
-import org.apache.bigtop.manager.stack.common.utils.LocalSettings;
+import org.apache.bigtop.manager.stack.core.annotations.GlobalParams;
+import org.apache.bigtop.manager.stack.core.param.BaseParams;
+import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/YarnSetup.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/YarnSetup.java
index 24e35b2..980b0b0 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/YarnSetup.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/yarn/YarnSetup.java
@@ -20,10 +20,10 @@ package org.apache.bigtop.manager.stack.bigtop.v3_3_0.yarn;
import org.apache.bigtop.manager.common.constants.Constants;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.stack.common.enums.ConfigType;
-import org.apache.bigtop.manager.stack.common.utils.BaseParams;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxFileUtils;
+import org.apache.bigtop.manager.stack.core.enums.ConfigType;
+import org.apache.bigtop.manager.stack.core.param.BaseParams;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxFileUtils;
import org.apache.commons.lang3.StringUtils;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperClientScript.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperClientScript.java
index 1001c13..067ef09 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperClientScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperClientScript.java
@@ -19,17 +19,17 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.zookeeper;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.ClientScript;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
-import org.apache.bigtop.manager.stack.common.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractClientScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@AutoService(Script.class)
-public class ZookeeperClientScript implements ClientScript {
+public class ZookeeperClientScript extends AbstractClientScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperParams.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperParams.java
index f5e2acc..f74faba 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperParams.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperParams.java
@@ -19,9 +19,9 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.zookeeper;
import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload;
-import org.apache.bigtop.manager.stack.common.annotations.GlobalParams;
-import org.apache.bigtop.manager.stack.common.utils.BaseParams;
-import org.apache.bigtop.manager.stack.common.utils.LocalSettings;
+import org.apache.bigtop.manager.stack.core.annotations.GlobalParams;
+import org.apache.bigtop.manager.stack.core.param.BaseParams;
+import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
import lombok.Getter;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperServerScript.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperServerScript.java
index b887b25..46a14ed 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperServerScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperServerScript.java
@@ -19,11 +19,12 @@
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.zookeeper;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
-import org.apache.bigtop.manager.stack.common.utils.PackageUtils;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractServerScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxOSUtils;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -33,7 +34,7 @@ import java.text.MessageFormat;
@Slf4j
@AutoService(Script.class)
-public class ZookeeperServerScript implements Script {
+public class ZookeeperServerScript extends AbstractServerScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperSetup.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperSetup.java
index 9d1346e..bb434ac 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperSetup.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperSetup.java
@@ -20,10 +20,10 @@ package
org.apache.bigtop.manager.stack.bigtop.v3_3_0.zookeeper;
import org.apache.bigtop.manager.common.shell.ShellResult;
import org.apache.bigtop.manager.common.utils.NetUtils;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.stack.common.enums.ConfigType;
-import org.apache.bigtop.manager.stack.common.utils.LocalSettings;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxFileUtils;
+import org.apache.bigtop.manager.stack.core.enums.ConfigType;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxFileUtils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/pom.xml
b/bigtop-manager-stack/bigtop-manager-stack-common/pom.xml
deleted file mode 100644
index 07b46b7..0000000
--- a/bigtop-manager-stack/bigtop-manager-stack-common/pom.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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
- ~
- ~ https://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.
--->
-<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>org.apache.bigtop</groupId>
- <artifactId>bigtop-manager-stack</artifactId>
- <version>${revision}</version>
- </parent>
-
- <artifactId>bigtop-manager-stack-common</artifactId>
- <name>${project.artifactId}</name>
- <description>Bigtop Manager Stack Common</description>
-
- <dependencies>
- <dependency>
- <groupId>com.google.auto.service</groupId>
- <artifactId>auto-service</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/bigtop-manager-stack/bigtop-manager-stack-core/pom.xml
b/bigtop-manager-stack/bigtop-manager-stack-core/pom.xml
index 7d0aa05..0423dce 100644
--- a/bigtop-manager-stack/bigtop-manager-stack-core/pom.xml
+++ b/bigtop-manager-stack/bigtop-manager-stack-core/pom.xml
@@ -32,17 +32,22 @@
<dependencies>
<dependency>
<groupId>org.apache.bigtop</groupId>
- <artifactId>bigtop-manager-stack-nop</artifactId>
+ <artifactId>bigtop-manager-common</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.bigtop</groupId>
- <artifactId>bigtop-manager-stack-bigtop</artifactId>
+ <groupId>com.google.auto.service</groupId>
+ <artifactId>auto-service</artifactId>
</dependency>
<dependency>
- <groupId>com.google.auto.service</groupId>
- <artifactId>auto-service</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
</dependency>
</dependencies>
</project>
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/annotations/GlobalParams.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/annotations/GlobalParams.java
similarity index 95%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/annotations/GlobalParams.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/annotations/GlobalParams.java
index 38a76ca..6c2b237 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/annotations/GlobalParams.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/annotations/GlobalParams.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.annotations;
+package org.apache.bigtop.manager.stack.core.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/ConfigType.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/enums/ConfigType.java
similarity index 94%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/ConfigType.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/enums/ConfigType.java
index 760a742..8708cc0 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/ConfigType.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/enums/ConfigType.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.enums;
+package org.apache.bigtop.manager.stack.core.enums;
public enum ConfigType {
PROPERTIES,
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/exception/StackException.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/exception/StackException.java
similarity index 95%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/exception/StackException.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/exception/StackException.java
index 863c1b8..2d64eb5 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/exception/StackException.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/exception/StackException.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.exception;
+package org.apache.bigtop.manager.stack.core.exception;
import java.text.MessageFormat;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/executor/StackExecutor.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/executor/StackExecutor.java
index 33d54b9..179bd65 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/executor/StackExecutor.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/executor/StackExecutor.java
@@ -23,11 +23,11 @@ import
org.apache.bigtop.manager.common.message.entity.payload.CommandPayload;
import org.apache.bigtop.manager.common.message.entity.pojo.CustomCommandInfo;
import org.apache.bigtop.manager.common.shell.ShellResult;
import org.apache.bigtop.manager.common.utils.CaseUtils;
-import org.apache.bigtop.manager.spi.plugin.PrioritySPIFactory;
-import org.apache.bigtop.manager.spi.stack.Hook;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.PrioritySPIFactory;
+import org.apache.bigtop.manager.stack.core.spi.hook.Hook;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
import lombok.extern.slf4j.Slf4j;
@@ -66,17 +66,17 @@ public class StackExecutor {
return script;
}
- private static void runBeforeHook(String command) {
+ private static void runBeforeHook(String command, Params params) {
Hook hook = HOOK_MAP.get(command.toLowerCase());
if (hook != null) {
- hook.before();
+ hook.before(params);
}
}
- private static void runAfterHook(String command) {
+ private static void runAfterHook(String command, Params params) {
Hook hook = HOOK_MAP.get(command.toLowerCase());
if (hook != null) {
- hook.after();
+ hook.after(params);
}
}
@@ -101,12 +101,12 @@ public class StackExecutor {
Params params = (Params)
paramsClass.getDeclaredConstructor(CommandPayload.class).newInstance(commandPayload);
- runBeforeHook(command);
+ runBeforeHook(command, params);
log.info("Executing {}::{}", script.getName(), method.getName());
ShellResult result = (ShellResult) method.invoke(script, params);
- runAfterHook(command);
+ runAfterHook(command, params);
return result;
} catch (Exception e) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/AbstractHook.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/AbstractHook.java
deleted file mode 100644
index be241eb..0000000
---
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/AbstractHook.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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
- *
- * https://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.bigtop.manager.stack.core.hook;
-
-import org.apache.bigtop.manager.spi.stack.Hook;
-import org.apache.bigtop.manager.stack.common.utils.LocalSettings;
-import org.apache.bigtop.manager.stack.common.utils.linux.LinuxAccountUtils;
-
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.Map;
-
-@Slf4j
-public abstract class AbstractHook implements Hook {
-
- @Override
- public void before() {
- addUserAndGroup();
-
- doBefore();
- }
-
- @Override
- public void after() {
- doAfter();
- }
-
- protected abstract void doBefore();
-
- protected abstract void doAfter();
-
- private void addUserAndGroup() {
- Map<String, String> users = LocalSettings.users();
- String group = LocalSettings.cluster().getUserGroup();
- LinuxAccountUtils.groupAdd(group);
-
- for (Map.Entry<String, String> user : users.entrySet()) {
- String service = user.getKey();
- String username = user.getValue();
-
- log.info("Adding user: {} to group: {}", username, group);
- LinuxAccountUtils.userAdd(username, group, null);
- }
- }
-}
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/InstallHook.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/InstallHook.java
deleted file mode 100644
index c6979b4..0000000
---
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/InstallHook.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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
- *
- * https://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.bigtop.manager.stack.core.hook;
-
-import org.apache.bigtop.manager.common.message.entity.pojo.RepoInfo;
-import org.apache.bigtop.manager.common.utils.os.OSDetection;
-import org.apache.bigtop.manager.spi.stack.Hook;
-import org.apache.bigtop.manager.stack.common.utils.LocalSettings;
-import org.apache.bigtop.manager.stack.common.utils.PackageUtils;
-import org.apache.bigtop.manager.stack.common.utils.template.BaseTemplate;
-
-import com.google.auto.service.AutoService;
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.List;
-
-/**
- * obtain agent execute command
- */
-@Slf4j
-@AutoService(Hook.class)
-public class InstallHook extends AbstractHook {
-
- public static final String NAME = "install";
-
- @Override
- public void doBefore() {
- List<RepoInfo> repos = LocalSettings.repos();
- String repoTemplate = LocalSettings.cluster().getRepoTemplate();
-
- for (RepoInfo repo : repos) {
- if (OSDetection.getOS().equals(repo.getOs())
- && OSDetection.getArch().equals(repo.getArch())) {
- BaseTemplate.writeCustomTemplate(
- "/etc/yum.repos.d/" + repo.getRepoId().replace(".",
"_") + ".repo", repo, repoTemplate);
- }
- }
-
- List<String> packages = LocalSettings.packages();
- PackageUtils.install(packages);
- }
-
- @Override
- public void doAfter() {}
-
- @Override
- public String getName() {
- return NAME;
- }
-}
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/BaseParams.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/param/BaseParams.java
similarity index 96%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/BaseParams.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/param/BaseParams.java
index 6d69cb7..49bd5ce 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/BaseParams.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/param/BaseParams.java
@@ -16,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.utils;
+package org.apache.bigtop.manager.stack.core.param;
import org.apache.bigtop.manager.common.enums.Command;
import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload;
import org.apache.bigtop.manager.common.message.entity.pojo.OSSpecificInfo;
import org.apache.bigtop.manager.common.utils.NetUtils;
import org.apache.bigtop.manager.common.utils.os.OSDetection;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.stack.common.annotations.GlobalParams;
+import org.apache.bigtop.manager.stack.core.annotations.GlobalParams;
+import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
import org.apache.commons.lang3.StringUtils;
diff --git
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Params.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/param/Params.java
similarity index 95%
rename from
bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Params.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/param/Params.java
index 301e86a..fdaf10f 100644
---
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Params.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/param/Params.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.spi.stack;
+package org.apache.bigtop.manager.stack.core.param;
import java.util.List;
diff --git
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPI.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/PrioritySPI.java
similarity index 96%
rename from
bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPI.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/PrioritySPI.java
index cda7a5a..2063274 100644
---
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPI.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/PrioritySPI.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.spi.plugin;
+package org.apache.bigtop.manager.stack.core.spi;
import org.springframework.lang.NonNull;
diff --git
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPIFactory.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/PrioritySPIFactory.java
similarity index 97%
rename from
bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPIFactory.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/PrioritySPIFactory.java
index 264ed8f..51fe2e4 100644
---
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPIFactory.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/PrioritySPIFactory.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.spi.plugin;
+package org.apache.bigtop.manager.stack.core.spi;
import lombok.extern.slf4j.Slf4j;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StopHook.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/AbstractHook.java
similarity index 67%
copy from
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StopHook.java
copy to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/AbstractHook.java
index e990ece..cb4fff1 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StopHook.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/AbstractHook.java
@@ -16,30 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.core.hook;
+package org.apache.bigtop.manager.stack.core.spi.hook;
-import org.apache.bigtop.manager.spi.stack.Hook;
+import org.apache.bigtop.manager.stack.core.param.Params;
-import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
-/**
- * obtain agent execute command
- */
@Slf4j
-@AutoService(Hook.class)
-public class StopHook extends AbstractHook {
-
- public static final String NAME = "stop";
-
- @Override
- public void doBefore() {}
+public abstract class AbstractHook implements Hook {
@Override
- public void doAfter() {}
+ public void before(Params params) {
+ doBefore(params);
+ }
@Override
- public String getName() {
- return NAME;
+ public void after(Params params) {
+ doAfter(params);
}
+
+ protected abstract void doBefore(Params params);
+
+ protected abstract void doAfter(Params params);
}
diff --git
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Hook.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/Hook.java
similarity index 78%
copy from
bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Hook.java
copy to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/Hook.java
index 1e10b24..b5ce693 100644
---
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Hook.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/Hook.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.spi.stack;
+package org.apache.bigtop.manager.stack.core.spi.hook;
-import org.apache.bigtop.manager.spi.plugin.PrioritySPI;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.PrioritySPI;
public interface Hook extends PrioritySPI {
- void before();
+ void before(Params params);
- void after();
+ void after(Params params);
}
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/InstallHook.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/InstallHook.java
new file mode 100644
index 0000000..c10279d
--- /dev/null
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/InstallHook.java
@@ -0,0 +1,102 @@
+/*
+ * 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
+ *
+ * https://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.bigtop.manager.stack.core.spi.hook;
+
+import org.apache.bigtop.manager.common.message.entity.pojo.RepoInfo;
+import org.apache.bigtop.manager.common.utils.os.OSDetection;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxAccountUtils;
+import org.apache.bigtop.manager.stack.core.utils.template.BaseTemplate;
+
+import org.springframework.util.CollectionUtils;
+
+import com.google.auto.service.AutoService;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * obtain agent execute command
+ */
+@Slf4j
+@AutoService(Hook.class)
+public class InstallHook extends AbstractHook {
+
+ public static final String NAME = "install";
+
+ @Override
+ public void doBefore(Params params) {
+ addUserAndGroup(params);
+
+ writeRepo(params);
+
+ installPackages(params);
+ }
+
+ @Override
+ public void doAfter(Params params) {}
+
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ private void addUserAndGroup(Params params) {
+ String user = params.user();
+ String group = params.group();
+
+ LinuxAccountUtils.groupAdd(group);
+ String primaryGroup = LinuxAccountUtils.getUserPrimaryGroup(user);
+ if (primaryGroup == null || !primaryGroup.equals(group)) {
+ log.info("Adding user: [{}] to group: [{}]", user, group);
+ LinuxAccountUtils.userAdd(user, group);
+ }
+ }
+
+ private void writeRepo(Params params) {
+ RepoInfo repo = LocalSettings.repos().stream()
+ .filter(r -> OSDetection.getOS().equals(r.getOs())
+ && OSDetection.getArch().equals(r.getArch()))
+ .findFirst()
+ .orElse(null);
+
+ if (repo != null) {
+ String filename = "/etc/yum.repos.d/" +
repo.getRepoId().replace(".", "_") + ".repo";
+ if (!new File(filename).exists()) {
+ log.info("Writing repo file: [{}]", filename);
+ String repoTemplate =
LocalSettings.cluster().getRepoTemplate();
+ BaseTemplate.writeCustomTemplate(filename, repo, repoTemplate);
+ }
+ }
+ }
+
+ private void installPackages(Params params) {
+ List<String> installedPackages = PackageUtils.listInstalledPackages();
+ List<String> needInstallPackages = LocalSettings.packages().stream()
+ .filter(pkg -> !installedPackages.contains(pkg))
+ .toList();
+
+ if (!CollectionUtils.isEmpty(needInstallPackages)) {
+ PackageUtils.install(needInstallPackages);
+ }
+ }
+}
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/RestartHook.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/RestartHook.java
similarity index 85%
rename from
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/RestartHook.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/RestartHook.java
index 5404c22..753bf0c 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/RestartHook.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/RestartHook.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.core.hook;
+package org.apache.bigtop.manager.stack.core.spi.hook;
-import org.apache.bigtop.manager.spi.stack.Hook;
+import org.apache.bigtop.manager.stack.core.param.Params;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -33,10 +33,10 @@ public class RestartHook extends AbstractHook {
public static final String NAME = "restart";
@Override
- public void doBefore() {}
+ public void doBefore(Params params) {}
@Override
- public void doAfter() {}
+ public void doAfter(Params params) {}
@Override
public String getName() {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StartHook.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/StartHook.java
similarity index 85%
rename from
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StartHook.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/StartHook.java
index 782ec00..292718a 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StartHook.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/StartHook.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.core.hook;
+package org.apache.bigtop.manager.stack.core.spi.hook;
-import org.apache.bigtop.manager.spi.stack.Hook;
+import org.apache.bigtop.manager.stack.core.param.Params;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -33,10 +33,10 @@ public class StartHook extends AbstractHook {
public static final String NAME = "start";
@Override
- public void doBefore() {}
+ public void doBefore(Params params) {}
@Override
- public void doAfter() {}
+ public void doAfter(Params params) {}
@Override
public String getName() {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StopHook.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/StopHook.java
similarity index 85%
rename from
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StopHook.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/StopHook.java
index e990ece..976daae 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StopHook.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/StopHook.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.core.hook;
+package org.apache.bigtop.manager.stack.core.spi.hook;
-import org.apache.bigtop.manager.spi.stack.Hook;
+import org.apache.bigtop.manager.stack.core.param.Params;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -33,10 +33,10 @@ public class StopHook extends AbstractHook {
public static final String NAME = "stop";
@Override
- public void doBefore() {}
+ public void doBefore(Params params) {}
@Override
- public void doAfter() {}
+ public void doAfter(Params params) {}
@Override
public String getName() {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/AptPackageManager.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/AptPackageManager.java
similarity index 86%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/AptPackageManager.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/AptPackageManager.java
index 86212d2..4c3ebc9 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/AptPackageManager.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/AptPackageManager.java
@@ -16,13 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.repo;
+package org.apache.bigtop.manager.stack.core.spi.repo;
import org.apache.bigtop.manager.common.shell.ShellExecutor;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.PackageManager;
-import org.apache.bigtop.manager.stack.common.enums.PackageManagerType;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -70,14 +68,20 @@ public class AptPackageManager implements PackageManager {
}
@Override
- public String listPackages() {
+ public List<String> listPackages() {
List<String> builderParameters = new ArrayList<>();
builderParameters.add(APT);
builderParameters.add("list");
+ builderParameters.add("--installed");
try {
ShellResult output = ShellExecutor.execCommand(builderParameters);
- return output.getOutput();
+ return output.getOutput()
+ .strip()
+ .lines()
+ .skip(1)
+ .map(line -> line.split("/")[0])
+ .toList();
} catch (IOException e) {
throw new StackException(e);
}
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/DnfPackageManager.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/DnfPackageManager.java
similarity index 84%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/DnfPackageManager.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/DnfPackageManager.java
index 628267f..cacae79 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/DnfPackageManager.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/DnfPackageManager.java
@@ -16,13 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.repo;
+package org.apache.bigtop.manager.stack.core.spi.repo;
import org.apache.bigtop.manager.common.shell.ShellExecutor;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.PackageManager;
-import org.apache.bigtop.manager.stack.common.enums.PackageManagerType;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -69,14 +67,21 @@ public class DnfPackageManager implements PackageManager {
}
@Override
- public String listPackages() {
+ public List<String> listPackages() {
List<String> builderParameters = new ArrayList<>();
builderParameters.add(DNF);
builderParameters.add("list");
+ builderParameters.add("installed");
try {
ShellResult output = ShellExecutor.execCommand(builderParameters);
- return output.getOutput();
+ return output.getOutput()
+ .strip()
+ .lines()
+ .skip(1)
+ .map(line -> line.split("\\s+")[0])
+ .map(line -> line.split("\\.")[0])
+ .toList();
} catch (IOException e) {
throw new StackException(e);
}
diff --git
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/PackageManager.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManager.java
similarity index 53%
rename from
bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/PackageManager.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManager.java
index 1f8add4..52478dc 100644
---
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/PackageManager.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManager.java
@@ -16,18 +16,42 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.spi.stack;
+package org.apache.bigtop.manager.stack.core.spi.repo;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.plugin.PrioritySPI;
+import org.apache.bigtop.manager.stack.core.spi.PrioritySPI;
import java.util.Collection;
+import java.util.List;
+/**
+ * Interface representing a package manager.
+ * Provides methods to install, uninstall, and list packages for different
type of operating systems.
+ * <br/>
+ * See {@link PackageManagerType} for all supported systems.
+ */
public interface PackageManager extends PrioritySPI {
+ /**
+ * Install packages.
+ *
+ * @param packages a collection of package names to be installed
+ * @return a ShellResult object containing the result of the installation
process
+ */
ShellResult installPackage(Collection<String> packages);
+ /**
+ * Uninstall packages.
+ *
+ * @param packages a collection of package names to be uninstalled
+ * @return a ShellResult object containing the result of the
uninstallation process
+ */
ShellResult uninstallPackage(Collection<String> packages);
- String listPackages();
+ /**
+ * List all packages.
+ *
+ * @return a string representation of the list of installed packages
+ */
+ List<String> listPackages();
}
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/PackageManagerType.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManagerType.java
similarity index 96%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/PackageManagerType.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManagerType.java
index 0263738..f42af79 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/PackageManagerType.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManagerType.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.enums;
+package org.apache.bigtop.manager.stack.core.spi.repo;
import org.apache.bigtop.manager.common.enums.OSType;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/YumPackageManager.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/YumPackageManager.java
similarity index 84%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/YumPackageManager.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/YumPackageManager.java
index 35a0a3e..24d3c25 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/YumPackageManager.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/YumPackageManager.java
@@ -16,13 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.repo;
+package org.apache.bigtop.manager.stack.core.spi.repo;
import org.apache.bigtop.manager.common.shell.ShellExecutor;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.PackageManager;
-import org.apache.bigtop.manager.stack.common.enums.PackageManagerType;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@@ -69,14 +67,21 @@ public class YumPackageManager implements PackageManager {
}
@Override
- public String listPackages() {
+ public List<String> listPackages() {
List<String> builderParameters = new ArrayList<>();
builderParameters.add(YUM);
builderParameters.add("list");
+ builderParameters.add("installed");
try {
ShellResult output = ShellExecutor.execCommand(builderParameters);
- return output.getOutput();
+ return output.getOutput()
+ .strip()
+ .lines()
+ .skip(1)
+ .map(line -> line.split("\\s+")[0])
+ .map(line -> line.split("\\.")[0])
+ .toList();
} catch (IOException e) {
throw new StackException(e);
}
diff --git
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/ClientScript.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/AbstractClientScript.java
similarity index 75%
rename from
bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/ClientScript.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/AbstractClientScript.java
index d1a6f29..0d01733 100644
---
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/ClientScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/AbstractClientScript.java
@@ -16,22 +16,22 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.spi.stack;
+package org.apache.bigtop.manager.stack.core.spi.script;
import org.apache.bigtop.manager.common.shell.ShellResult;
+import org.apache.bigtop.manager.stack.core.param.Params;
-public interface ClientScript extends Script {
+public abstract class AbstractClientScript extends AbstractScript {
- default ShellResult start(Params params) {
- configure(params);
+ public ShellResult start(Params params) {
return ShellResult.success();
}
- default ShellResult stop(Params params) {
+ public ShellResult stop(Params params) {
return ShellResult.success();
}
- default ShellResult status(Params params) {
+ public ShellResult status(Params params) {
return ShellResult.success();
}
}
diff --git
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Script.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/AbstractScript.java
similarity index 76%
rename from
bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Script.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/AbstractScript.java
index b661fe4..535d987 100644
---
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Script.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/AbstractScript.java
@@ -16,24 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.spi.stack;
+package org.apache.bigtop.manager.stack.core.spi.script;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.plugin.PrioritySPI;
+import org.apache.bigtop.manager.stack.core.param.Params;
import org.apache.commons.lang3.StringUtils;
-public interface Script extends PrioritySPI {
+import lombok.extern.slf4j.Slf4j;
- ShellResult install(Params params);
+@Slf4j
+public abstract class AbstractScript implements Script {
- ShellResult configure(Params params);
-
- ShellResult start(Params params);
-
- ShellResult stop(Params params);
-
- default ShellResult restart(Params params) {
+ public ShellResult restart(Params params) {
ShellResult shellResult = stop(params);
if (shellResult.getExitCode() != 0) {
return shellResult;
@@ -49,9 +44,8 @@ public interface Script extends PrioritySPI {
StringUtils.join(shellResult.getErrMsg(),
shellResult1.getErrMsg()));
}
- ShellResult status(Params params);
-
- default ShellResult check(Params params) {
+ @Override
+ public ShellResult check(Params params) {
return ShellResult.success();
}
}
diff --git
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Hook.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/AbstractServerScript.java
similarity index 81%
rename from
bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Hook.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/AbstractServerScript.java
index 1e10b24..9891e0c 100644
---
a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Hook.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/AbstractServerScript.java
@@ -16,13 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.spi.stack;
+package org.apache.bigtop.manager.stack.core.spi.script;
-import org.apache.bigtop.manager.spi.plugin.PrioritySPI;
-
-public interface Hook extends PrioritySPI {
-
- void before();
-
- void after();
-}
+public abstract class AbstractServerScript extends AbstractScript {}
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/Script.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/Script.java
new file mode 100644
index 0000000..aef31dc
--- /dev/null
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/Script.java
@@ -0,0 +1,86 @@
+/*
+ * 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
+ *
+ * https://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.bigtop.manager.stack.core.spi.script;
+
+import org.apache.bigtop.manager.common.shell.ShellResult;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.PrioritySPI;
+
+/**
+ * Interface representing a script for component support.
+ */
+public interface Script extends PrioritySPI {
+
+ /**
+ * Install the component.
+ *
+ * @param params the parameters required for installation
+ * @return a ShellResult object containing the result of the installation
process
+ */
+ ShellResult install(Params params);
+
+ /**
+ * Configure the component.
+ *
+ * @param params the parameters required for configuration
+ * @return a ShellResult object containing the result of the configuration
process
+ */
+ ShellResult configure(Params params);
+
+ /**
+ * Start the component.
+ *
+ * @param params the parameters required to start the component
+ * @return a ShellResult object containing the result of the start process
+ */
+ ShellResult start(Params params);
+
+ /**
+ * Stop the component.
+ *
+ * @param params the parameters required to stop the component
+ * @return a ShellResult object containing the result of the stop process
+ */
+ ShellResult stop(Params params);
+
+ /**
+ * Restart the component.
+ *
+ * @param params the parameters required to restart the component
+ * @return a ShellResult object containing the result of the restart
process
+ */
+ ShellResult restart(Params params);
+
+ /**
+ * Check the healthy status of the component.
+ *
+ * @param params the parameters required to check the status
+ * @return a ShellResult(0 for healthy, -1 for unhealthy) object
containing the result of the status check
+ */
+ ShellResult status(Params params);
+
+ /**
+ * Check component.
+ * Usually we will run smoke tests for component to see if it works as
expected.
+ *
+ * @param params the parameters required to check the component
+ * @return a ShellResult object indicating success
+ */
+ ShellResult check(Params params);
+}
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/LocalSettings.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/LocalSettings.java
similarity index 98%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/LocalSettings.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/LocalSettings.java
index e57eb3a..7de5c14 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/LocalSettings.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/LocalSettings.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.utils;
+package org.apache.bigtop.manager.stack.core.utils;
import org.apache.bigtop.manager.common.constants.CacheFiles;
import org.apache.bigtop.manager.common.constants.Constants;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PackageUtils.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/PackageUtils.java
similarity index 83%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PackageUtils.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/PackageUtils.java
index c168ad9..b6af23c 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PackageUtils.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/PackageUtils.java
@@ -16,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.utils;
+package org.apache.bigtop.manager.stack.core.utils;
import org.apache.bigtop.manager.common.enums.OSType;
import org.apache.bigtop.manager.common.shell.ShellResult;
import org.apache.bigtop.manager.common.utils.os.OSDetection;
-import org.apache.bigtop.manager.spi.plugin.PrioritySPIFactory;
-import org.apache.bigtop.manager.spi.stack.PackageManager;
-import org.apache.bigtop.manager.stack.common.enums.PackageManagerType;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.spi.PrioritySPIFactory;
+import org.apache.bigtop.manager.stack.core.spi.repo.PackageManager;
+import org.apache.bigtop.manager.stack.core.spi.repo.PackageManagerType;
import org.apache.commons.lang3.EnumUtils;
@@ -81,4 +81,13 @@ public class PackageUtils {
return getPackageManager().installPackage(packageList);
}
+
+ /**
+ * List installed packages
+ *
+ * @return list of installed packages
+ */
+ public static List<String> listInstalledPackages() {
+ return getPackageManager().listPackages();
+ }
}
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PropertiesUtils.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/PropertiesUtils.java
similarity index 96%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PropertiesUtils.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/PropertiesUtils.java
index 14348da..bbb860d 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PropertiesUtils.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/PropertiesUtils.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.utils;
+package org.apache.bigtop.manager.stack.core.utils;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
import lombok.extern.slf4j.Slf4j;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/XmlUtils.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/XmlUtils.java
similarity index 96%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/XmlUtils.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/XmlUtils.java
index e007bea..2fb0c12 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/XmlUtils.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/XmlUtils.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.utils;
+package org.apache.bigtop.manager.stack.core.utils;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxAccountUtils.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxAccountUtils.java
similarity index 84%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxAccountUtils.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxAccountUtils.java
index bd9db98..99de7d8 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxAccountUtils.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxAccountUtils.java
@@ -16,11 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.utils.linux;
+package org.apache.bigtop.manager.stack.core.utils.linux;
import org.apache.bigtop.manager.common.shell.ShellExecutor;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
+import org.apache.bigtop.manager.common.utils.FileUtils;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
import org.apache.commons.lang3.StringUtils;
@@ -28,11 +29,13 @@ import org.springframework.util.CollectionUtils;
import lombok.extern.slf4j.Slf4j;
+import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
+import java.util.stream.Stream;
@Slf4j
public class LinuxAccountUtils {
@@ -74,8 +77,8 @@ public class LinuxAccountUtils {
* Add user
* useradd [options] LOGIN
*/
- public static void userAdd(String user, String group, Collection<String>
groups) {
- userAdd(user, group, null, groups, null, null, null, false);
+ public static void userAdd(String user, String group) {
+ userAdd(user, group, null, null, null, null, null, false);
}
/**
@@ -274,4 +277,41 @@ public class LinuxAccountUtils {
throw new StackException(e);
}
}
+
+ /**
+ * Get user and it's primary group
+ *
+ * @param user username
+ * @return primary group, if user not exists, return null
+ */
+ public static String getUserPrimaryGroup(String user) {
+ if (!isUserExists(user)) {
+ return null;
+ }
+
+ // Search for user's primary group id
+ int groupId = 0;
+ Stream<String> lines = FileUtils.readFile2Str(new
File("/etc/passwd")).lines();
+ for (String line : lines.toList()) {
+ String[] split = line.split(":");
+ if (split[0].equals(user)) {
+ groupId = Integer.parseInt(split[3]);
+ }
+ }
+
+ if (groupId == 0) {
+ return null;
+ }
+
+ // Search for group name
+ lines = FileUtils.readFile2Str(new File("/etc/group")).lines();
+ for (String line : lines.toList()) {
+ String[] split = line.split(":");
+ if (Integer.parseInt(split[2]) == groupId) {
+ return split[0];
+ }
+ }
+
+ return null;
+ }
}
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxFileUtils.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxFileUtils.java
similarity index 97%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxFileUtils.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxFileUtils.java
index dff623c..fcf70b2 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxFileUtils.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxFileUtils.java
@@ -16,14 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.utils.linux;
+package org.apache.bigtop.manager.stack.core.utils.linux;
import org.apache.bigtop.manager.common.constants.Constants;
import org.apache.bigtop.manager.common.utils.JsonUtils;
import org.apache.bigtop.manager.common.utils.YamlUtils;
-import org.apache.bigtop.manager.stack.common.enums.ConfigType;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
-import org.apache.bigtop.manager.stack.common.utils.template.TemplateUtils;
+import org.apache.bigtop.manager.stack.core.enums.ConfigType;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.utils.template.TemplateUtils;
import org.apache.commons.lang3.StringUtils;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxOSUtils.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxOSUtils.java
similarity index 98%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxOSUtils.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxOSUtils.java
index 2b6800d..aa54d09 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxOSUtils.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxOSUtils.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.utils.linux;
+package org.apache.bigtop.manager.stack.core.utils.linux;
import org.apache.bigtop.manager.common.shell.ShellExecutor;
import org.apache.bigtop.manager.common.shell.ShellResult;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/BaseTemplate.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/template/BaseTemplate.java
similarity index 97%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/BaseTemplate.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/template/BaseTemplate.java
index c97c3c0..d60b990 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/BaseTemplate.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/template/BaseTemplate.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.utils.template;
+package org.apache.bigtop.manager.stack.core.utils.template;
-import org.apache.bigtop.manager.stack.common.exception.StackException;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
import freemarker.core.UndefinedOutputFormat;
import freemarker.template.Configuration;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/TemplateUtils.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/template/TemplateUtils.java
similarity index 94%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/TemplateUtils.java
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/template/TemplateUtils.java
index 7fb6779..e1c7c26 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/TemplateUtils.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/template/TemplateUtils.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.bigtop.manager.stack.common.utils.template;
+package org.apache.bigtop.manager.stack.core.utils.template;
-import org.apache.bigtop.manager.stack.common.enums.ConfigType;
+import org.apache.bigtop.manager.stack.core.enums.ConfigType;
import lombok.extern.slf4j.Slf4j;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/resources/templates/CONTENT.ftl
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/resources/templates/CONTENT.ftl
similarity index 100%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/resources/templates/CONTENT.ftl
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/resources/templates/CONTENT.ftl
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/resources/templates/ENV.ftl
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/resources/templates/ENV.ftl
similarity index 100%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/resources/templates/ENV.ftl
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/resources/templates/ENV.ftl
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/resources/templates/PROPERTIES.ftl
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/resources/templates/PROPERTIES.ftl
similarity index 100%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/resources/templates/PROPERTIES.ftl
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/resources/templates/PROPERTIES.ftl
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/resources/templates/XML.ftl
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/resources/templates/XML.ftl
similarity index 100%
rename from
bigtop-manager-stack/bigtop-manager-stack-common/src/main/resources/templates/XML.ftl
rename to
bigtop-manager-stack/bigtop-manager-stack-core/src/main/resources/templates/XML.ftl
diff --git a/bigtop-manager-stack/bigtop-manager-stack-nop/pom.xml
b/bigtop-manager-stack/bigtop-manager-stack-nop/pom.xml
index e4ede86..ad17fca 100644
--- a/bigtop-manager-stack/bigtop-manager-stack-nop/pom.xml
+++ b/bigtop-manager-stack/bigtop-manager-stack-nop/pom.xml
@@ -32,12 +32,7 @@
<dependencies>
<dependency>
<groupId>org.apache.bigtop</groupId>
- <artifactId>bigtop-manager-stack-common</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.google.auto.service</groupId>
- <artifactId>auto-service</artifactId>
+ <artifactId>bigtop-manager-stack-core</artifactId>
</dependency>
</dependencies>
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/kafka/KafkaBrokerScript.java
b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/kafka/KafkaBrokerScript.java
index dbb18eb..d13f756 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/kafka/KafkaBrokerScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/kafka/KafkaBrokerScript.java
@@ -19,15 +19,16 @@
package org.apache.bigtop.manager.stack.nop.v1_0_0.kafka;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractServerScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@AutoService(Script.class)
-public class KafkaBrokerScript implements Script {
+public class KafkaBrokerScript extends AbstractServerScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/kafka/KafkaParams.java
b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/kafka/KafkaParams.java
index 96fa9f3..b2494f6 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/kafka/KafkaParams.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/kafka/KafkaParams.java
@@ -19,7 +19,7 @@
package org.apache.bigtop.manager.stack.nop.v1_0_0.kafka;
import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload;
-import org.apache.bigtop.manager.stack.common.utils.BaseParams;
+import org.apache.bigtop.manager.stack.core.param.BaseParams;
import lombok.Getter;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperClientScript.java
b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperClientScript.java
index fced816..3244afc 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperClientScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperClientScript.java
@@ -19,16 +19,16 @@
package org.apache.bigtop.manager.stack.nop.v1_0_0.zookeeper;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.ClientScript;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractClientScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@AutoService(Script.class)
-public class ZookeeperClientScript implements ClientScript {
+public class ZookeeperClientScript extends AbstractClientScript {
@Override
public ShellResult install(Params params) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperParams.java
b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperParams.java
index 5d73a5e..7668768 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperParams.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperParams.java
@@ -19,7 +19,7 @@
package org.apache.bigtop.manager.stack.nop.v1_0_0.zookeeper;
import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload;
-import org.apache.bigtop.manager.stack.common.utils.BaseParams;
+import org.apache.bigtop.manager.stack.core.param.BaseParams;
import lombok.Getter;
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperServerScript.java
b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperServerScript.java
index 2487150..9da8e2c 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperServerScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperServerScript.java
@@ -19,15 +19,16 @@
package org.apache.bigtop.manager.stack.nop.v1_0_0.zookeeper;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.spi.stack.Params;
-import org.apache.bigtop.manager.spi.stack.Script;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractServerScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@AutoService(Script.class)
-public class ZookeeperServerScript implements Script {
+public class ZookeeperServerScript extends AbstractServerScript {
@Override
public ShellResult install(Params params) {
diff --git a/bigtop-manager-stack/pom.xml b/bigtop-manager-stack/pom.xml
index c9bf863..bc75923 100644
--- a/bigtop-manager-stack/pom.xml
+++ b/bigtop-manager-stack/pom.xml
@@ -34,7 +34,6 @@
<modules>
<module>bigtop-manager-stack-core</module>
- <module>bigtop-manager-stack-common</module>
<module>bigtop-manager-stack-bigtop</module>
<module>bigtop-manager-stack-nop</module>
</modules>
@@ -66,10 +65,6 @@
<groupId>org.apache.bigtop</groupId>
<artifactId>bigtop-manager-common</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.bigtop</groupId>
- <artifactId>bigtop-manager-spi</artifactId>
- </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
diff --git a/pom.xml b/pom.xml
index a894fd5..62b3b4a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,6 @@
<module>bigtop-manager-stack</module>
<module>bigtop-manager-ui</module>
<module>bigtop-manager-dao</module>
- <module>bigtop-manager-spi</module>
<module>bigtop-manager-grpc</module>
</modules>
@@ -94,18 +93,6 @@
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.bigtop</groupId>
- <artifactId>bigtop-manager-spi</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.bigtop</groupId>
- <artifactId>bigtop-manager-stack-common</artifactId>
- <version>${project.version}</version>
- </dependency>
-
<dependency>
<groupId>org.apache.bigtop</groupId>
<artifactId>bigtop-manager-stack-core</artifactId>