diff --git a/bigtop-manager-agent/pom.xml b/bigtop-manager-agent/pom.xml index a18da7bc2..6a6d70352 100644 --- a/bigtop-manager-agent/pom.xml +++ b/bigtop-manager-agent/pom.xml @@ -47,15 +47,27 @@ org.apache.bigtop bigtop-manager-common + org.apache.bigtop bigtop-manager-grpc + org.apache.bigtop bigtop-manager-stack-core + + org.apache.bigtop + bigtop-manager-stack-bigtop + + + + org.apache.bigtop + bigtop-manager-stack-nop + + org.springframework.boot spring-boot-starter-web 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 13fbed71d..11e3ae7c5 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.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 cde6536a0..3c1fabbbe 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 @@ private void genEmptyCaches() { ImmutablePair> immutablePair = StackUtils.getStackKeyMap().get(fullStackName); StackDTO stackDTO = immutablePair.getLeft(); - List serviceDTOList = immutablePair.getRight(); Map properties = taskContext.getProperties(); @@ -229,13 +228,10 @@ private void genEmptyCaches() { clusterInfo.setUserGroup(stackDTO.getUserGroup()); clusterInfo.setRepoTemplate(stackDTO.getRepoTemplate()); clusterInfo.setRoot(stackDTO.getRoot()); + clusterInfo.setPackages(List.of(stackDTO.getPackages().split(","))); List hostnames = (List) 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 e48b38a4a..000000000 --- a/bigtop-manager-spi/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - 4.0.0 - - org.apache.bigtop - bigtop-manager - ${revision} - - - bigtop-manager-spi - ${project.artifactId} - Bigtop Manager Spi - - - - - org.apache.bigtop - bigtop-manager-bom - ${project.version} - pom - import - - - - - - - org.apache.bigtop - bigtop-manager-common - - - - org.slf4j - slf4j-api - compile - - - org.projectlombok - lombok - - - - diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/pom.xml b/bigtop-manager-stack/bigtop-manager-stack-bigtop/pom.xml index 2e2bbe6b6..873fb2e7b 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 @@ org.apache.bigtop - bigtop-manager-stack-common - - - - com.google.auto.service - auto-service + bigtop-manager-stack-core @@ -66,6 +61,14 @@ org.slf4j slf4j-reload4j + + org.apache.zookeeper + zookeeper + + + org.apache.zookeeper + zookeeper-jute + @@ -90,6 +93,14 @@ org.slf4j slf4j-reload4j + + org.apache.zookeeper + zookeeper + + + org.apache.zookeeper + zookeeper-jute + @@ -114,6 +125,14 @@ org.slf4j slf4j-reload4j + + org.apache.zookeeper + zookeeper + + + org.apache.zookeeper + zookeeper-jute + 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 fe65590f6..74929f0ff 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 81a551c0b..2085834c5 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 @@ @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 9208bff15..02262e7c8 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 24c8d617c..aa45a5d2e 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 3d37bdf5c..1cae4457e 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 @@ 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 42a74d033..5f30f29fa 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 @@ @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 bf7237015..67eba56f3 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 @@ @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 c44c85c6a..97714ce5a 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 @@ @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 9b6a2ec24..c3c6411b9 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 ca5c2369f..02bd702f3 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 648680cfd..5db7b4675 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 f5df822e9..f74724d5b 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 68cc1faf5..5709ace32 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 @@ 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 3348c1b4a..8f89d7119 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 @@ @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 36930af2f..0db3b1189 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 @@ @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 31c38542f..10e3d006b 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 7b3f215a0..e92dafab1 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 24e35b2db..980b0b010 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 @@ 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 1001c13e0..067ef09d2 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 f5e2acc66..f74faba74 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 b887b25d2..46a14edd8 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 @@ @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 9d1346e7e..bb434acbc 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 @@ 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 07b46b749..000000000 --- a/bigtop-manager-stack/bigtop-manager-stack-common/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - 4.0.0 - - org.apache.bigtop - bigtop-manager-stack - ${revision} - - - bigtop-manager-stack-common - ${project.artifactId} - Bigtop Manager Stack Common - - - - com.google.auto.service - auto-service - - - com.fasterxml.jackson.core - jackson-databind - - - commons-io - commons-io - - - - diff --git a/bigtop-manager-stack/bigtop-manager-stack-core/pom.xml b/bigtop-manager-stack/bigtop-manager-stack-core/pom.xml index 7d0aa0576..0423dce5a 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 @@ org.apache.bigtop - bigtop-manager-stack-nop + bigtop-manager-common - org.apache.bigtop - bigtop-manager-stack-bigtop + com.google.auto.service + auto-service - com.google.auto.service - auto-service + com.fasterxml.jackson.core + jackson-databind + + + + commons-io + commons-io 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 38a76cab3..6c2b237ef 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 760a7421e..8708cc02e 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 863c1b80b..2d64eb58e 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 33d54b9d4..179bd6550 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.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 @@ private static Script getCustomScript(String customCommand, List users = LocalSettings.users(); - String group = LocalSettings.cluster().getUserGroup(); - LinuxAccountUtils.groupAdd(group); - - for (Map.Entry 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 c6979b49b..000000000 --- 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 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 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 6d69cb712..49bd5ce94 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 301e86a0d..fdaf10fd0 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 cda7a5af1..206327435 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 264ed8fab..51fe2e449 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/spi/hook/AbstractHook.java b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/AbstractHook.java new file mode 100644 index 000000000..cb4fff1d3 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/hook/AbstractHook.java @@ -0,0 +1,41 @@ +/* + * 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.stack.core.param.Params; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public abstract class AbstractHook implements Hook { + + @Override + public void before(Params params) { + doBefore(params); + } + + @Override + 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% 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/hook/Hook.java index 1e10b24b0..b5ce693bc 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 000000000..c10279deb --- /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 installedPackages = PackageUtils.listInstalledPackages(); + List 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 5404c22f5..753bf0cc5 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 782ec00b7..292718ad2 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 e990ece71..976daaecd 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 86212d27e..4c3ebc910 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 ShellResult uninstallPackage(Collection packages) { } @Override - public String listPackages() { + public List listPackages() { List 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 628267f1b..cacae795a 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 ShellResult uninstallPackage(Collection packages) { } @Override - public String listPackages() { + public List listPackages() { List 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-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManager.java b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManager.java new file mode 100644 index 000000000..52478dc13 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManager.java @@ -0,0 +1,57 @@ +/* + * 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.repo; + +import org.apache.bigtop.manager.common.shell.ShellResult; +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. + *
+ * 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 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 packages); + + /** + * List all packages. + * + * @return a string representation of the list of installed packages + */ + List 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 0263738a5..f42af79b8 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 35a0a3ec0..24d3c2532 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 ShellResult uninstallPackage(Collection packages) { } @Override - public String listPackages() { + public List listPackages() { List 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 d1a6f29d4..0d0173372 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 b661fe458..535d98726 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 @@ default ShellResult restart(Params params) { 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/PackageManager.java b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/script/AbstractServerScript.java similarity index 66% 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/script/AbstractServerScript.java index 1f8add49e..9891e0c38 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/script/AbstractServerScript.java @@ -16,18 +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.common.shell.ShellResult; -import org.apache.bigtop.manager.spi.plugin.PrioritySPI; - -import java.util.Collection; - -public interface PackageManager extends PrioritySPI { - - ShellResult installPackage(Collection packages); - - ShellResult uninstallPackage(Collection packages); - - String listPackages(); -} +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 000000000..aef31dccc --- /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 e57eb3aec..7de5c1468 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 c168ad9fb..b6af23c98 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 static ShellResult install(Collection packageList) { return getPackageManager().installPackage(packageList); } + + /** + * List installed packages + * + * @return list of installed packages + */ + public static List 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 14348da06..bbb860de6 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 e007beafb..2fb0c1290 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 bd9db98e6..99de7d82f 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 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 static void userDel(String user) { * Add user * useradd [options] LOGIN */ - public static void userAdd(String user, String group, Collection 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 static boolean isUserExists(String user) { 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 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 dff623c72..fcf70b229 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 2b6800d96..aa54d0969 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 c97c3c0aa..d60b990fb 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 7fb67794d..e1c7c26d3 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 e4ede8643..ad17fca95 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 @@ org.apache.bigtop - bigtop-manager-stack-common - - - - com.google.auto.service - auto-service + bigtop-manager-stack-core 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 dbb18eb5e..d13f75693 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 96fa9f39c..b2494f61b 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 fced816ef..3244afc61 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 5d73a5e4e..766876885 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 24871503c..9da8e2ceb 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 c9bf86373..bc759239d 100644 --- a/bigtop-manager-stack/pom.xml +++ b/bigtop-manager-stack/pom.xml @@ -34,7 +34,6 @@ bigtop-manager-stack-core - bigtop-manager-stack-common bigtop-manager-stack-bigtop bigtop-manager-stack-nop @@ -66,10 +65,6 @@ org.apache.bigtop bigtop-manager-common - - org.apache.bigtop - bigtop-manager-spi - org.projectlombok diff --git a/pom.xml b/pom.xml index a894fd5e6..62b3b4a5d 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,6 @@ bigtop-manager-stack bigtop-manager-ui bigtop-manager-dao - bigtop-manager-spi bigtop-manager-grpc @@ -94,18 +93,6 @@ ${project.version} - - org.apache.bigtop - bigtop-manager-spi - ${project.version} - - - - org.apache.bigtop - bigtop-manager-stack-common - ${project.version} - - org.apache.bigtop bigtop-manager-stack-core