This is an automated email from the ASF dual-hosted git repository.
wuzhiguo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/bigtop-manager.git
The following commit(s) were added to refs/heads/main by this push:
new eca8265e BIGTOP-4290: Remove os and script specific from Service
metainfo (#113)
eca8265e is described below
commit eca8265e7a0eb76256a7b1bede408b67a4d1f1a9
Author: Zhiguo Wu <[email protected]>
AuthorDate: Mon Dec 2 11:29:35 2024 +0800
BIGTOP-4290: Remove os and script specific from Service metainfo (#113)
---
.../executor/CacheFileUpdateCommandExecutor.java | 2 -
.../service/ComponentStatusServiceGrpcImpl.java | 7 ++--
.../common/constants/ComponentCategories.java | 4 +-
.../bigtop/manager/common/enums/OSArchType.java | 2 -
.../entity/payload/CacheMessagePayload.java | 2 -
.../message/entity/payload/CommandPayload.java | 6 ---
.../common/message/entity/pojo/ComponentInfo.java | 4 --
.../message/entity/pojo/CustomCommandInfo.java | 33 ---------------
.../message/entity/pojo/PackageSpecificInfo.java | 2 -
.../common/message/entity/pojo/ScriptInfo.java | 35 ----------------
.../manager/common/utils/os/OSDetection.java | 23 +---------
.../apache/bigtop/manager/dao/po/ComponentPO.java | 3 ++
.../resources/mapper/mysql/ComponentMapper.xml | 4 +-
.../mapper/postgresql/ComponentMapper.xml | 4 +-
.../main/resources/proto/component_status.proto | 13 +++---
.../server/command/job/AbstractServiceJob.java | 9 +---
.../command/stage/AbstractComponentStage.java | 2 -
.../server/command/task/AbstractComponentTask.java | 35 ----------------
.../server/command/task/CacheFileUpdateTask.java | 2 -
.../manager/server/model/dto/ComponentDTO.java | 4 +-
.../manager/server/model/dto/CustomCommandDTO.java | 29 -------------
.../server/model/dto/PackageSpecificDTO.java | 2 -
.../bigtop/manager/server/model/dto/ScriptDTO.java | 31 --------------
.../server/service/impl/HostServiceImpl.java | 18 ++++++++
.../manager/server/stack/model/ComponentModel.java | 5 +--
.../server/stack/model/CustomCommandModel.java | 35 ----------------
.../server/stack/model/PackageSpecificModel.java | 4 --
.../manager/server/stack/model/ScriptModel.java | 38 -----------------
.../manager/server/timer/ComponentStatusTimer.java | 28 ++++++++-----
.../bigtop/3.3.0/services/flink/metainfo.xml | 17 +-------
.../stacks/bigtop/3.3.0/services/hdfs/metainfo.xml | 49 +++-------------------
.../bigtop/3.3.0/services/kafka/metainfo.xml | 22 +---------
.../bigtop/3.3.0/services/mapred/metainfo.xml | 17 +-------
.../stacks/bigtop/3.3.0/services/solr/metainfo.xml | 12 +-----
.../stacks/bigtop/3.3.0/services/tez/metainfo.xml | 10 -----
.../stacks/bigtop/3.3.0/services/yarn/metainfo.xml | 42 +------------------
.../bigtop/3.3.0/services/zookeeper/metainfo.xml | 16 +------
.../infra/1.0.0/services/prometheus/metainfo.xml | 17 +-------
.../manager/stack/bigtop/param/BigtopParams.java | 19 ---------
.../v3_3_0/flink/FlinkHistoryServerScript.java | 8 ++--
.../stack/bigtop/v3_3_0/flink/FlinkParams.java | 7 +---
.../stack/bigtop/v3_3_0/hdfs/HdfsParams.java | 9 +---
.../bigtop/v3_3_0/mapred/Mapreduce2Params.java | 13 ++----
.../manager/stack/bigtop/v3_3_0/tez/TezParams.java | 11 ++---
.../stack/bigtop/v3_3_0/yarn/YarnParams.java | 13 ++----
.../manager/stack/core/executor/StackExecutor.java | 41 +++++++-----------
46 files changed, 103 insertions(+), 606 deletions(-)
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 28fd8ae5..74b014cf 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
@@ -40,7 +40,6 @@ import static
org.apache.bigtop.manager.common.constants.CacheFiles.COMPONENTS_I
import static
org.apache.bigtop.manager.common.constants.CacheFiles.CONFIGURATIONS_INFO;
import static org.apache.bigtop.manager.common.constants.CacheFiles.HOSTS_INFO;
import static org.apache.bigtop.manager.common.constants.CacheFiles.REPOS_INFO;
-import static
org.apache.bigtop.manager.common.constants.CacheFiles.SETTINGS_INFO;
import static org.apache.bigtop.manager.common.constants.CacheFiles.USERS_INFO;
@Slf4j
@@ -71,7 +70,6 @@ public class CacheFileUpdateCommandExecutor extends
AbstractCommandExecutor {
}
}
- JsonUtils.writeToFile(cacheDir + SETTINGS_INFO,
cacheMessagePayload.getSettings());
JsonUtils.writeToFile(cacheDir + CONFIGURATIONS_INFO,
cacheMessagePayload.getConfigurations());
JsonUtils.writeToFile(cacheDir + HOSTS_INFO,
cacheMessagePayload.getClusterHostInfo());
JsonUtils.writeToFile(cacheDir + USERS_INFO,
cacheMessagePayload.getUserInfo());
diff --git
a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/service/ComponentStatusServiceGrpcImpl.java
b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/service/ComponentStatusServiceGrpcImpl.java
index 75e6e6e7..7413b354 100644
---
a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/service/ComponentStatusServiceGrpcImpl.java
+++
b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/service/ComponentStatusServiceGrpcImpl.java
@@ -20,9 +20,7 @@ package org.apache.bigtop.manager.agent.service;
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.ScriptInfo;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.bigtop.manager.common.utils.JsonUtils;
import org.apache.bigtop.manager.grpc.generated.ComponentStatusReply;
import org.apache.bigtop.manager.grpc.generated.ComponentStatusRequest;
import org.apache.bigtop.manager.grpc.generated.ComponentStatusServiceGrpc;
@@ -44,12 +42,13 @@ public class ComponentStatusServiceGrpcImpl extends
ComponentStatusServiceGrpc.C
try {
CommandPayload commandPayload = new CommandPayload();
commandPayload.setCommand(Command.STATUS);
+ commandPayload.setStackName(request.getStackName());
+ commandPayload.setStackVersion(request.getStackVersion());
commandPayload.setServiceName(request.getServiceName());
commandPayload.setServiceUser(request.getServiceUser());
commandPayload.setComponentName(request.getComponentName());
-
commandPayload.setCommandScript(JsonUtils.readFromString(request.getCommandScript(),
ScriptInfo.class));
- ShellResult shellResult = StackExecutor.execute(commandPayload);
+ ShellResult shellResult = StackExecutor.execute(commandPayload);
ComponentStatusReply reply = ComponentStatusReply.newBuilder()
.setStatus(shellResult.getExitCode())
.build();
diff --git
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/constants/ComponentCategories.java
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/constants/ComponentCategories.java
index a0a6bfef..5bb0d4a1 100644
---
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/constants/ComponentCategories.java
+++
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/constants/ComponentCategories.java
@@ -20,9 +20,7 @@ package org.apache.bigtop.manager.common.constants;
public class ComponentCategories {
- public static final String MASTER = "master";
-
- public static final String SLAVE = "slave";
+ public static final String SERVER = "server";
public static final String CLIENT = "client";
}
diff --git
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSArchType.java
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSArchType.java
index 382de48b..2516d550 100644
---
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSArchType.java
+++
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSArchType.java
@@ -25,7 +25,5 @@ public enum OSArchType {
X86_64,
AARCH64,
-
- PPC64LE,
;
}
diff --git
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CacheMessagePayload.java
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CacheMessagePayload.java
index aff34fab..9d289bc2 100644
---
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CacheMessagePayload.java
+++
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CacheMessagePayload.java
@@ -37,8 +37,6 @@ import java.util.Set;
@NoArgsConstructor
public class CacheMessagePayload extends BasePayload {
- private Map<String, Object> settings;
-
private ClusterInfo clusterInfo;
private Map<String, String> userInfo;
diff --git
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CommandPayload.java
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CommandPayload.java
index 2ec55ff4..6f9402ae 100644
---
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CommandPayload.java
+++
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CommandPayload.java
@@ -19,9 +19,7 @@
package org.apache.bigtop.manager.common.message.entity.payload;
import org.apache.bigtop.manager.common.enums.Command;
-import org.apache.bigtop.manager.common.message.entity.pojo.CustomCommandInfo;
import
org.apache.bigtop.manager.common.message.entity.pojo.PackageSpecificInfo;
-import org.apache.bigtop.manager.common.message.entity.pojo.ScriptInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -42,10 +40,6 @@ public class CommandPayload extends BasePayload {
private String customCommand;
- private List<CustomCommandInfo> customCommands;
-
- private ScriptInfo commandScript;
-
private String serviceUser;
private String stackName;
diff --git
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ComponentInfo.java
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ComponentInfo.java
index b573228d..4026fedb 100644
---
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ComponentInfo.java
+++
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ComponentInfo.java
@@ -27,10 +27,6 @@ public class ComponentInfo {
private String displayName;
- private String commandScript;
-
- private String customCommands;
-
private String category;
private String serviceName;
diff --git
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/CustomCommandInfo.java
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/CustomCommandInfo.java
deleted file mode 100644
index 5e83dee2..00000000
---
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/CustomCommandInfo.java
+++ /dev/null
@@ -1,33 +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.common.message.entity.pojo;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-public class CustomCommandInfo {
-
- private String name;
-
- private ScriptInfo commandScript;
-}
diff --git
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/PackageSpecificInfo.java
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/PackageSpecificInfo.java
index 13be0345..0cf4dfa8 100644
---
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/PackageSpecificInfo.java
+++
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/PackageSpecificInfo.java
@@ -25,8 +25,6 @@ import java.util.List;
@Data
public class PackageSpecificInfo {
- private List<String> os;
-
private List<String> arch;
private List<PackageInfo> packages;
diff --git
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ScriptInfo.java
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ScriptInfo.java
deleted file mode 100644
index 229acb6b..00000000
---
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ScriptInfo.java
+++ /dev/null
@@ -1,35 +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.common.message.entity.pojo;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-public class ScriptInfo {
-
- private String scriptType;
-
- private String scriptId;
-
- private Long timeout;
-}
diff --git
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/os/OSDetection.java
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/os/OSDetection.java
index e5b50bd1..593e5b3a 100644
---
a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/os/OSDetection.java
+++
b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/os/OSDetection.java
@@ -18,12 +18,9 @@
*/
package org.apache.bigtop.manager.common.utils.os;
-import org.apache.bigtop.manager.common.enums.OSArchType;
-import org.apache.bigtop.manager.common.enums.OSType;
import org.apache.bigtop.manager.common.shell.ShellExecutor;
import org.apache.bigtop.manager.common.shell.ShellResult;
-import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.SystemUtils;
import lombok.extern.slf4j.Slf4j;
@@ -55,9 +52,7 @@ public class OSDetection {
public static String getOS() {
if (SystemUtils.IS_OS_LINUX) {
- String os = getOSType() + getOSVersion().toLowerCase();
- ifSupportedOS(os);
- return os;
+ return getOSType() + getOSVersion().toLowerCase();
} else {
return System.getProperty("os.name");
}
@@ -151,25 +146,9 @@ public class OSDetection {
ShellResult shellResult =
ShellExecutor.execCommand(builderParameters);
String output = shellResult.getOutput().replace("\n", "");
log.debug("getArch: {}", output);
-
- ifSupportedArch(output);
return output;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
-
- private static void ifSupportedOS(String os) {
- if (!EnumUtils.isValidEnumIgnoreCase(OSType.class, os)) {
- throw new RuntimeException("Unsupported OS: [" + os + "]");
- }
- log.debug("OS [{}] is Supported", os);
- }
-
- private static void ifSupportedArch(String arch) {
- if (!EnumUtils.isValidEnumIgnoreCase(OSArchType.class, arch)) {
- throw new RuntimeException("Unsupported Arch: [" + arch + "]");
- }
- log.debug("Arch [{}] is Supported", arch);
- }
}
diff --git
a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/po/ComponentPO.java
b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/po/ComponentPO.java
index c1171076..cbc98275 100644
---
a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/po/ComponentPO.java
+++
b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/po/ComponentPO.java
@@ -57,6 +57,9 @@ public class ComponentPO extends BasePO implements
Serializable {
@Transient
private String serviceName;
+ @Transient
+ private String serviceUser;
+
@Transient
private String serviceDisplayName;
diff --git
a/bigtop-manager-dao/src/main/resources/mapper/mysql/ComponentMapper.xml
b/bigtop-manager-dao/src/main/resources/mapper/mysql/ComponentMapper.xml
index ace3d4c4..964295af 100644
--- a/bigtop-manager-dao/src/main/resources/mapper/mysql/ComponentMapper.xml
+++ b/bigtop-manager-dao/src/main/resources/mapper/mysql/ComponentMapper.xml
@@ -41,7 +41,7 @@
select
<include refid="baseColumnsV2">
<property name="alias" value="comp"/>
- </include>, s.name as service_name, s.display_name as
service_display_name, s.stack, h.hostname
+ </include>, s.name as service_name, s.user as service_user,
s.display_name as service_display_name, s.stack, h.hostname
from
component comp
left join service s on comp.service_id = s.id
@@ -75,7 +75,7 @@
select
<include refid="baseColumnsV2">
<property name="alias" value="comp"/>
- </include>, s.name as service_name, s.display_name as
service_display_name, s.stack, h.hostname
+ </include>, s.name as service_name, s.user as service_user,
s.display_name as service_display_name, s.stack, h.hostname
from
component comp
left join service s on comp.service_id = s.id
diff --git
a/bigtop-manager-dao/src/main/resources/mapper/postgresql/ComponentMapper.xml
b/bigtop-manager-dao/src/main/resources/mapper/postgresql/ComponentMapper.xml
index ace3d4c4..964295af 100644
---
a/bigtop-manager-dao/src/main/resources/mapper/postgresql/ComponentMapper.xml
+++
b/bigtop-manager-dao/src/main/resources/mapper/postgresql/ComponentMapper.xml
@@ -41,7 +41,7 @@
select
<include refid="baseColumnsV2">
<property name="alias" value="comp"/>
- </include>, s.name as service_name, s.display_name as
service_display_name, s.stack, h.hostname
+ </include>, s.name as service_name, s.user as service_user,
s.display_name as service_display_name, s.stack, h.hostname
from
component comp
left join service s on comp.service_id = s.id
@@ -75,7 +75,7 @@
select
<include refid="baseColumnsV2">
<property name="alias" value="comp"/>
- </include>, s.name as service_name, s.display_name as
service_display_name, s.stack, h.hostname
+ </include>, s.name as service_name, s.user as service_user,
s.display_name as service_display_name, s.stack, h.hostname
from
component comp
left join service s on comp.service_id = s.id
diff --git
a/bigtop-manager-grpc/src/main/resources/proto/component_status.proto
b/bigtop-manager-grpc/src/main/resources/proto/component_status.proto
index 7431b63f..8be8b48d 100644
--- a/bigtop-manager-grpc/src/main/resources/proto/component_status.proto
+++ b/bigtop-manager-grpc/src/main/resources/proto/component_status.proto
@@ -27,14 +27,11 @@ service ComponentStatusService {
}
message ComponentStatusRequest {
- string service_name = 1;
- string service_user = 2;
- string component_name = 3;
- string command_script = 4;
- // TODO Unnecessary, should be removed in the future
- string root = 5;
- string stack_name = 6;
- string stack_version = 7;
+ string stack_name = 1;
+ string stack_version = 2;
+ string service_name = 3;
+ string service_user = 4;
+ string component_name = 5;
}
message ComponentStatusReply {
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/AbstractServiceJob.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/AbstractServiceJob.java
index 6b73c848..a5765570 100644
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/AbstractServiceJob.java
+++
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/AbstractServiceJob.java
@@ -123,14 +123,9 @@ public abstract class AbstractServiceJob extends
AbstractJob {
return
StackUtils.getServiceDTOByComponentName(componentName).getName();
}
- protected Boolean isMasterComponent(String componentName) {
+ protected Boolean isServerComponent(String componentName) {
ComponentDTO componentDTO = StackUtils.getComponentDTO(componentName);
- return
componentDTO.getCategory().equalsIgnoreCase(ComponentCategories.MASTER);
- }
-
- protected Boolean isSlaveComponent(String componentName) {
- ComponentDTO componentDTO = StackUtils.getComponentDTO(componentName);
- return
componentDTO.getCategory().equalsIgnoreCase(ComponentCategories.SLAVE);
+ return
componentDTO.getCategory().equalsIgnoreCase(ComponentCategories.SERVER);
}
protected Boolean isClientComponent(String componentName) {
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/AbstractComponentStage.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/AbstractComponentStage.java
index 9eca5cb8..04f2d6cb 100644
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/AbstractComponentStage.java
+++
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/AbstractComponentStage.java
@@ -77,9 +77,7 @@ public abstract class AbstractComponentStage extends
AbstractStage {
taskContext.setRootDir(clusterPO.getRootDir());
Map<String, Object> properties = new HashMap<>();
- properties.put("customCommands", componentDTO.getCustomCommands());
properties.put("packageSpecifics", serviceDTO.getPackageSpecifics());
- properties.put("commandScript", componentDTO.getCommandScript());
taskContext.setProperties(properties);
return taskContext;
}
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/task/AbstractComponentTask.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/task/AbstractComponentTask.java
index ea58327c..4071ae66 100644
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/task/AbstractComponentTask.java
+++
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/task/AbstractComponentTask.java
@@ -19,19 +19,15 @@
package org.apache.bigtop.manager.server.command.task;
import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload;
-import org.apache.bigtop.manager.common.message.entity.pojo.CustomCommandInfo;
import org.apache.bigtop.manager.common.message.entity.pojo.PackageInfo;
import
org.apache.bigtop.manager.common.message.entity.pojo.PackageSpecificInfo;
-import org.apache.bigtop.manager.common.message.entity.pojo.ScriptInfo;
import org.apache.bigtop.manager.common.utils.JsonUtils;
import org.apache.bigtop.manager.dao.repository.ComponentDao;
import org.apache.bigtop.manager.grpc.generated.CommandRequest;
import org.apache.bigtop.manager.grpc.generated.CommandType;
import org.apache.bigtop.manager.server.holder.SpringContextHolder;
-import org.apache.bigtop.manager.server.model.dto.CustomCommandDTO;
import org.apache.bigtop.manager.server.model.dto.PackageDTO;
import org.apache.bigtop.manager.server.model.dto.PackageSpecificDTO;
-import org.apache.bigtop.manager.server.model.dto.ScriptDTO;
import org.apache.bigtop.manager.server.model.dto.StackDTO;
import org.apache.bigtop.manager.server.utils.StackUtils;
@@ -69,11 +65,8 @@ public abstract class AbstractComponentTask extends
AbstractTask {
Map<String, Object> properties = taskContext.getProperties();
- commandPayload.setCustomCommands(
- convertCustomCommandInfo((List<CustomCommandDTO>)
properties.get("customCommands")));
commandPayload.setPackageSpecifics(
convertPackageSpecificInfo((List<PackageSpecificDTO>)
properties.get("packageSpecifics")));
- commandPayload.setCommandScript(convertScriptInfo((ScriptDTO)
properties.get("commandScript")));
CommandRequest.Builder builder = CommandRequest.newBuilder();
builder.setType(CommandType.COMPONENT);
@@ -82,18 +75,6 @@ public abstract class AbstractComponentTask extends
AbstractTask {
return builder.build();
}
- private ScriptInfo convertScriptInfo(ScriptDTO scriptDTO) {
- if (scriptDTO == null) {
- return null;
- }
-
- ScriptInfo scriptInfo = new ScriptInfo();
- scriptInfo.setScriptId(scriptDTO.getScriptId());
- scriptInfo.setScriptType(scriptDTO.getScriptType());
- scriptInfo.setTimeout(scriptDTO.getTimeout());
- return scriptInfo;
- }
-
private List<PackageSpecificInfo>
convertPackageSpecificInfo(List<PackageSpecificDTO> packageSpecificDTOList) {
if (packageSpecificDTOList == null) {
return new ArrayList<>();
@@ -116,20 +97,4 @@ public abstract class AbstractComponentTask extends
AbstractTask {
return packageSpecificInfos;
}
-
- private List<CustomCommandInfo>
convertCustomCommandInfo(List<CustomCommandDTO> customCommandDTOs) {
- if (customCommandDTOs == null) {
- return new ArrayList<>();
- }
-
- List<CustomCommandInfo> customCommandInfos = new ArrayList<>();
- for (CustomCommandDTO customCommandDTO : customCommandDTOs) {
- CustomCommandInfo customCommandInfo = new CustomCommandInfo();
- customCommandInfo.setName(customCommandDTO.getName());
-
customCommandInfo.setCommandScript(convertScriptInfo(customCommandDTO.getCommandScript()));
- customCommandInfos.add(customCommandInfo);
- }
-
- return customCommandInfos;
- }
}
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 6a41a73f..ab26d21a 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
@@ -67,7 +67,6 @@ public class CacheFileUpdateTask extends AbstractTask {
private Map<String, Set<String>> hostMap;
private List<RepoInfo> repoList;
private Map<String, String> userMap;
- private Map<String, Object> settingsMap;
public CacheFileUpdateTask(TaskContext taskContext) {
super(taskContext);
@@ -208,7 +207,6 @@ public class CacheFileUpdateTask extends AbstractTask {
messagePayload.setConfigurations(serviceConfigMap);
messagePayload.setClusterHostInfo(hostMap);
messagePayload.setRepoInfo(repoList);
- messagePayload.setSettings(settingsMap);
messagePayload.setUserInfo(userMap);
messagePayload.setComponentInfo(componentInfoMap);
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ComponentDTO.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ComponentDTO.java
index 9319a22a..114d5c6f 100644
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ComponentDTO.java
+++
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ComponentDTO.java
@@ -33,9 +33,7 @@ public class ComponentDTO {
private String cardinality;
- private ScriptDTO commandScript;
-
- private List<CustomCommandDTO> customCommands;
+ private List<String> customCommands;
private QuickLinkDTO quickLink;
}
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/CustomCommandDTO.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/CustomCommandDTO.java
deleted file mode 100644
index e5fea6d3..00000000
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/CustomCommandDTO.java
+++ /dev/null
@@ -1,29 +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.server.model.dto;
-
-import lombok.Data;
-
-@Data
-public class CustomCommandDTO {
-
- private String name;
-
- private ScriptDTO commandScript;
-}
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/PackageSpecificDTO.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/PackageSpecificDTO.java
index 23c81a4c..742de7ab 100644
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/PackageSpecificDTO.java
+++
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/PackageSpecificDTO.java
@@ -25,8 +25,6 @@ import java.util.List;
@Data
public class PackageSpecificDTO {
- private List<String> os;
-
private List<String> arch;
private List<PackageDTO> packages;
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ScriptDTO.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ScriptDTO.java
deleted file mode 100644
index 3702a5f1..00000000
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ScriptDTO.java
+++ /dev/null
@@ -1,31 +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.server.model.dto;
-
-import lombok.Data;
-
-@Data
-public class ScriptDTO {
-
- private String scriptType;
-
- private String scriptId;
-
- private Long timeout;
-}
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/HostServiceImpl.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/HostServiceImpl.java
index bf8cdb06..319b5894 100644
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/HostServiceImpl.java
+++
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/HostServiceImpl.java
@@ -197,6 +197,24 @@ public class HostServiceImpl implements HostService {
throw new
ApiException(ApiExceptionEnum.HOST_UNABLE_TO_EXEC_COMMAND,
hostDTO.getHostname());
}
+ // Update agent conf
+ // Current only grpc port needs to be updated if it's not default
port
+ if (hostDTO.getGrpcPort() != 8835) {
+ command = "sed -i 's/port: 8835/port: " +
hostDTO.getGrpcPort() + "/' " + path
+ + "/bigtop-manager-agent/conf/application.yml";
+ result = execCommandOnRemoteHost(hostDTO,
hostDTO.getHostname(), command);
+ if (result.getExitCode() != MessageConstants.SUCCESS_CODE) {
+ hostPO.setErrInfo(result.getErrMsg());
+ hostDao.updateById(hostPO);
+
+ log.error(
+ "Unable to update agent config, hostname: {}, msg:
{}",
+ hostDTO.getHostname(),
+ result.getErrMsg());
+ throw new
ApiException(ApiExceptionEnum.HOST_UNABLE_TO_EXEC_COMMAND,
hostDTO.getHostname());
+ }
+ }
+
// Run agent in background
command = "nohup " + path + "/bigtop-manager-agent/bin/start.sh >
/dev/null 2>&1 &";
result = execCommandOnRemoteHost(hostDTO, hostDTO.getHostname(),
command);
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/ComponentModel.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/ComponentModel.java
index 21c8dd79..1c3bdb4b 100644
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/ComponentModel.java
+++
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/ComponentModel.java
@@ -40,12 +40,9 @@ public class ComponentModel {
private String cardinality;
- @XmlElement(name = "command-script")
- private ScriptModel commandScript;
-
@XmlElementWrapper(name = "custom-commands")
@XmlElements(@XmlElement(name = "custom-command"))
- private List<CustomCommandModel> customCommands;
+ private List<String> customCommands;
@XmlElement(name = "quick-link")
private QuickLinkModel quickLink;
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/CustomCommandModel.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/CustomCommandModel.java
deleted file mode 100644
index 1517c95a..00000000
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/CustomCommandModel.java
+++ /dev/null
@@ -1,35 +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.server.stack.model;
-
-import lombok.Data;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlElement;
-
-@Data
-@XmlAccessorType(XmlAccessType.FIELD)
-public class CustomCommandModel {
-
- private String name;
-
- @XmlElement(name = "command-script")
- private ScriptModel commandScript;
-}
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/PackageSpecificModel.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/PackageSpecificModel.java
index a600b763..4d4c38b4 100644
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/PackageSpecificModel.java
+++
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/PackageSpecificModel.java
@@ -31,10 +31,6 @@ import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
public class PackageSpecificModel {
- @XmlElementWrapper(name = "operating-systems")
- @XmlElements(@XmlElement(name = "os"))
- private List<String> os;
-
@XmlElementWrapper(name = "architectures")
@XmlElements(@XmlElement(name = "arch"))
private List<String> arch;
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/ScriptModel.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/ScriptModel.java
deleted file mode 100644
index 6b71ac25..00000000
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/model/ScriptModel.java
+++ /dev/null
@@ -1,38 +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.server.stack.model;
-
-import lombok.Data;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlElement;
-
-@Data
-@XmlAccessorType(XmlAccessType.FIELD)
-public class ScriptModel {
-
- @XmlElement(name = "script-id")
- private String scriptId;
-
- @XmlElement(name = "script-type")
- private String scriptType;
-
- private Long timeout;
-}
diff --git
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/timer/ComponentStatusTimer.java
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/timer/ComponentStatusTimer.java
index 43f47da9..a4edcac6 100644
---
a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/timer/ComponentStatusTimer.java
+++
b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/timer/ComponentStatusTimer.java
@@ -18,6 +18,7 @@
*/
package org.apache.bigtop.manager.server.timer;
+import org.apache.bigtop.manager.common.utils.CaseUtils;
import org.apache.bigtop.manager.dao.po.ComponentPO;
import org.apache.bigtop.manager.dao.po.HostPO;
import org.apache.bigtop.manager.dao.repository.ComponentDao;
@@ -28,32 +29,39 @@ import
org.apache.bigtop.manager.grpc.generated.ComponentStatusServiceGrpc;
import org.apache.bigtop.manager.server.enums.HealthyStatusEnum;
import org.apache.bigtop.manager.server.grpc.GrpcClient;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
import lombok.extern.slf4j.Slf4j;
+import jakarta.annotation.Resource;
import java.util.List;
+import java.util.concurrent.TimeUnit;
@Slf4j
-// @Component
+@Component
public class ComponentStatusTimer {
- // @Resource
+ @Resource
private ComponentDao componentDao;
- // @Resource
+ @Resource
private HostDao hostDao;
- // @Async
- // @Scheduled(fixedDelay = 30, timeUnit = TimeUnit.SECONDS)
+ @Async
+ @Scheduled(fixedDelay = 30, timeUnit = TimeUnit.SECONDS)
public void execute() {
List<ComponentPO> componentPOList = componentDao.findAll();
for (ComponentPO componentPO : componentPOList) {
+ componentPO = componentDao.findDetailsById(componentPO.getId());
HostPO hostPO = hostDao.findById(componentPO.getHostId());
- // TODO need to build the correct request
ComponentStatusRequest request =
ComponentStatusRequest.newBuilder()
- //
.setServiceName(hostComponentPO.getServiceName())
- //
.setServiceUser(hostComponentPO.getServiceUser())
- //
.setComponentName(hostComponentPO.getComponentName())
- //
.setCommandScript(hostComponentPO.getCommandScript())
+
.setStackName(CaseUtils.toLowerCase(componentPO.getStack().split("-")[0]))
+ .setStackVersion(componentPO.getStack().split("-")[1])
+ .setServiceName(componentPO.getServiceName())
+ .setServiceUser(componentPO.getServiceUser())
+ .setComponentName(componentPO.getName())
.build();
ComponentStatusServiceGrpc.ComponentStatusServiceBlockingStub
blockingStub = GrpcClient.getBlockingStub(
hostPO.getHostname(),
diff --git
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/flink/metainfo.xml
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/flink/metainfo.xml
index ba3ef91f..dd989a05 100644
---
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/flink/metainfo.xml
+++
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/flink/metainfo.xml
@@ -30,13 +30,8 @@
<component>
<name>flink_history_server</name>
<display-name>Flink History Server</display-name>
- <category>master</category>
+ <category>server</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.flink.FlinkHistoryServerScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
<quick-link>
<display-name>Flink HistoryServer UI</display-name>
<http-port-property>historyserver.web.port</http-port-property>
@@ -50,21 +45,11 @@
<display-name>Flink Client</display-name>
<category>client</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.flink.FlinkClientScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
</component>
</components>
<package-specifics>
<package-specific>
- <operating-systems>
- <os>centos7</os>
- <os>rocky8</os>
- <os>openeuler22</os>
- </operating-systems>
<architectures>
<arch>x86_64</arch>
</architectures>
diff --git
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/hdfs/metainfo.xml
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/hdfs/metainfo.xml
index 830a9a52..2d8215b0 100644
---
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/hdfs/metainfo.xml
+++
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/hdfs/metainfo.xml
@@ -30,30 +30,11 @@
<component>
<name>namenode</name>
<display-name>NameNode</display-name>
- <category>master</category>
+ <category>server</category>
<cardinality>1-2</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs.NameNodeScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
<custom-commands>
- <custom-command>
- <name>rebalance_hdfs</name>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs.NameNodeScript</script-id>
- <script-type>java</script-type>
- <timeout>600</timeout>
- </command-script>
- </custom-command>
- <custom-command>
- <name>print_topology</name>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs.NameNodeScript</script-id>
- <script-type>java</script-type>
- <timeout>600</timeout>
- </command-script>
- </custom-command>
+ <custom-command>rebalance_hdfs</custom-command>
+ <custom-command>print_topology</custom-command>
</custom-commands>
<quick-link>
<display-name>NameNode UI</display-name>
@@ -66,45 +47,25 @@
<component>
<name>datanode</name>
<display-name>DataNode</display-name>
- <category>slave</category>
+ <category>server</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs.DataNodeScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
</component>
<component>
<name>secondary_namenode</name>
<display-name>SNameNode</display-name>
- <category>master</category>
+ <category>server</category>
<cardinality>1</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs.SNameNodeScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
</component>
<component>
<name>hdfs_client</name>
<display-name>HDFS Client</display-name>
<category>client</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs.HdfsClientScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
</component>
</components>
<package-specifics>
<package-specific>
- <operating-systems>
- <os>centos7</os>
- <os>rocky8</os>
- <os>openeuler22</os>
- </operating-systems>
<architectures>
<arch>x86_64</arch>
</architectures>
diff --git
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/kafka/metainfo.xml
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/kafka/metainfo.xml
index 4722ea7a..2c113d53 100644
---
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/kafka/metainfo.xml
+++
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/kafka/metainfo.xml
@@ -34,33 +34,13 @@
<component>
<name>kafka_broker</name>
<display-name>Kafka Broker</display-name>
- <category>master</category>
+ <category>server</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.kafka.KafkaBrokerScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
- <custom-commands>
- <custom-command>
- <name>test</name>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.kafka.KafkaBrokerScript</script-id>
- <script-type>java</script-type>
- <timeout>600</timeout>
- </command-script>
- </custom-command>
- </custom-commands>
</component>
</components>
<package-specifics>
<package-specific>
- <operating-systems>
- <os>centos7</os>
- <os>rocky8</os>
- <os>openeuler22</os>
- </operating-systems>
<architectures>
<arch>x86_64</arch>
</architectures>
diff --git
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/mapred/metainfo.xml
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/mapred/metainfo.xml
index c920e2c6..698fdcd7 100644
---
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/mapred/metainfo.xml
+++
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/mapred/metainfo.xml
@@ -30,13 +30,8 @@
<component>
<name>history_server</name>
<display-name>History Server</display-name>
- <category>master</category>
+ <category>server</category>
<cardinality>1</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.mapred.HistoryServerScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
<quick-link>
<display-name>JobHistory UI</display-name>
<http-port-property>mapreduce.jobhistory.webapp.address</http-port-property>
@@ -50,21 +45,11 @@
<display-name>MapReduce2 Client</display-name>
<category>client</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.mapred.MapredClientScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
</component>
</components>
<package-specifics>
<package-specific>
- <operating-systems>
- <os>centos7</os>
- <os>rocky8</os>
- <os>openeuler22</os>
- </operating-systems>
<architectures>
<arch>x86_64</arch>
</architectures>
diff --git
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/metainfo.xml
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/metainfo.xml
index 506669c0..95ee24a0 100644
---
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/metainfo.xml
+++
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/metainfo.xml
@@ -31,13 +31,8 @@
<component>
<name>solr_instance</name>
<display-name>Solr Instance</display-name>
- <category>master</category>
+ <category>server</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.solr.SolrServerScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
<quick-link>
<display-name>Solr UI</display-name>
<http-port-property>solr_port</http-port-property>
@@ -50,11 +45,6 @@
<package-specifics>
<package-specific>
- <operating-systems>
- <os>centos7</os>
- <os>rocky8</os>
- <os>openeuler22</os>
- </operating-systems>
<architectures>
<arch>x86_64</arch>
</architectures>
diff --git
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/tez/metainfo.xml
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/tez/metainfo.xml
index 7ce3bbd8..3ca39261 100644
---
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/tez/metainfo.xml
+++
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/tez/metainfo.xml
@@ -32,21 +32,11 @@
<display-name>Tez Client</display-name>
<category>client</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.tez.TezClientScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
</component>
</components>
<package-specifics>
<package-specific>
- <operating-systems>
- <os>centos7</os>
- <os>rocky8</os>
- <os>openeuler22</os>
- </operating-systems>
<architectures>
<arch>x86_64</arch>
</architectures>
diff --git
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/yarn/metainfo.xml
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/yarn/metainfo.xml
index f725d49c..ffc8eb33 100644
---
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/yarn/metainfo.xml
+++
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/yarn/metainfo.xml
@@ -30,31 +30,8 @@
<component>
<name>resourcemanager</name>
<display-name>ResourceManager</display-name>
- <category>master</category>
+ <category>server</category>
<cardinality>1-2</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.yarn.ResourceManagerScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
- <custom-commands>
- <custom-command>
- <name>decommission</name>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.yarn.ResourceManagerScript</script-id>
- <script-type>java</script-type>
- <timeout>600</timeout>
- </command-script>
- </custom-command>
- <custom-command>
- <name>refreshqueues</name>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.yarn.ResourceManagerScript</script-id>
- <script-type>java</script-type>
- <timeout>600</timeout>
- </command-script>
- </custom-command>
- </custom-commands>
<quick-link>
<display-name>ResourceManager UI</display-name>
<http-port-property>yarn.resourcemanager.webapp.address</http-port-property>
@@ -66,34 +43,19 @@
<component>
<name>nodemanager</name>
<display-name>NodeManager</display-name>
- <category>slave</category>
+ <category>server</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.yarn.NodeManagerScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
</component>
<component>
<name>yarn_client</name>
<display-name>YARN Client</display-name>
<category>client</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.yarn.YarnClientScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
</component>
</components>
<package-specifics>
<package-specific>
- <operating-systems>
- <os>centos7</os>
- <os>rocky8</os>
- <os>openeuler22</os>
- </operating-systems>
<architectures>
<arch>x86_64</arch>
</architectures>
diff --git
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/zookeeper/metainfo.xml
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/zookeeper/metainfo.xml
index 52115a5e..795bdb41 100644
---
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/zookeeper/metainfo.xml
+++
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/zookeeper/metainfo.xml
@@ -33,13 +33,8 @@
<component>
<name>zookeeper_server</name>
<display-name>ZooKeeper Server</display-name>
- <category>master</category>
+ <category>server</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.zookeeper.ZookeeperServerScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
</component>
<component>
@@ -47,20 +42,11 @@
<display-name>ZooKeeper Client</display-name>
<category>client</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.zookeeper.ZookeeperClientScript</script-id>
- <script-type>java</script-type>
- </command-script>
</component>
</components>
<package-specifics>
<package-specific>
- <operating-systems>
- <os>centos7</os>
- <os>rocky8</os>
- <os>openeuler22</os>
- </operating-systems>
<architectures>
<arch>x86_64</arch>
</architectures>
diff --git
a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/prometheus/metainfo.xml
b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/prometheus/metainfo.xml
index 30289202..b0e7b606 100644
---
a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/prometheus/metainfo.xml
+++
b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/prometheus/metainfo.xml
@@ -34,24 +34,13 @@
<component>
<name>prometheus_server</name>
<display-name>Prometheus Server</display-name>
- <category>master</category>
+ <category>server</category>
<cardinality>1+</cardinality>
- <command-script>
-
<script-id>org.apache.bigtop.manager.stack.infra.v1_0_0.prometheus.PrometheusServerScript</script-id>
- <script-type>java</script-type>
- <timeout>1200</timeout>
- </command-script>
</component>
</components>
<package-specifics>
<package-specific>
- <operating-systems>
- <os>centos7</os>
- <os>rocky8</os>
- <os>openeuler22</os>
- <os>openeuler24</os>
- </operating-systems>
<architectures>
<arch>x86_64</arch>
</architectures>
@@ -63,10 +52,6 @@
</packages>
</package-specific>
<package-specific>
- <operating-systems>
- <os>openeuler22</os>
- <os>openeuler24</os>
- </operating-systems>
<architectures>
<arch>aarch64</arch>
</architectures>
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/param/BigtopParams.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/param/BigtopParams.java
index b57d9ee9..b30efc93 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/param/BigtopParams.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/param/BigtopParams.java
@@ -20,29 +20,10 @@ package org.apache.bigtop.manager.stack.bigtop.param;
import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload;
import org.apache.bigtop.manager.stack.core.param.BaseParams;
-import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
public abstract class BigtopParams extends BaseParams {
protected BigtopParams(CommandPayload commandPayload) {
super(commandPayload);
}
-
- public String stackBinDir() {
- return "";
- }
-
- public String stackLibDir() {
- return "";
- }
-
- /**
- * service home dir
- */
- @Override
- public String serviceHome() {
- String rootDir = LocalSettings.cluster().getRootDir();
- String service = this.commandPayload.getServiceName();
- return rootDir + "/" + service.toLowerCase();
- }
}
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkHistoryServerScript.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkHistoryServerScript.java
index 34663933..0c4a4103 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkHistoryServerScript.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkHistoryServerScript.java
@@ -39,9 +39,9 @@ public class FlinkHistoryServerScript extends
AbstractServerScript {
public ShellResult start(Params params) {
configure(params);
FlinkParams flinkParams = (FlinkParams) params;
- String hadoopClasspath = flinkParams.stackBinDir() + "/hadoop
classpath";
- String cmd = "export HADOOP_CLASSPATH=`" + hadoopClasspath + "`;" +
flinkParams.stackLibDir()
- + "/flink/bin/historyserver.sh start";
+ String hadoopClasspath = flinkParams.hadoopHome() + "/bin/hadoop
classpath";
+ String cmd = "export HADOOP_CLASSPATH=`" + hadoopClasspath + "`;" +
flinkParams.serviceHome()
+ + "/bin/historyserver.sh start";
try {
return LinuxOSUtils.sudoExecCmd(cmd, flinkParams.user());
} catch (Exception e) {
@@ -52,7 +52,7 @@ public class FlinkHistoryServerScript extends
AbstractServerScript {
@Override
public ShellResult stop(Params params) {
FlinkParams flinkParams = (FlinkParams) params;
- String cmd = flinkParams.stackLibDir() + "/flink/bin/historyserver.sh
stop";
+ String cmd = flinkParams.serviceHome() + "/bin/historyserver.sh stop";
try {
return LinuxOSUtils.sudoExecCmd(cmd, flinkParams.user());
} catch (Exception e) {
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkParams.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkParams.java
index 8a16fa58..6d7d4bfb 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkParams.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkParams.java
@@ -119,16 +119,11 @@ public class FlinkParams extends BigtopParams {
return "/etc/flink/conf";
}
- @Override
- public String serviceHome() {
- return stackLibDir() + "/flink";
- }
-
public String hadoopConfDir() {
return "/etc/hadoop/conf";
}
public String hadoopHome() {
- return stackLibDir() + "/hadoop";
+ return stackHome() + "/hadoop";
}
}
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 b8fb1217..4d5c3371 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
@@ -145,16 +145,11 @@ public class HdfsParams extends BigtopParams {
return "/etc/hadoop/conf";
}
- @Override
- public String serviceHome() {
- return stackLibDir() + "/hadoop";
- }
-
public String hdfsHome() {
- return stackLibDir() + "/hadoop-hdfs";
+ return stackHome() + "/hadoop-hdfs";
}
public String hdfsExec() {
- return stackBinDir() + "/hdfs";
+ return serviceHome() + "/bin/hdfs";
}
}
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/mapred/Mapreduce2Params.java
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/mapred/Mapreduce2Params.java
index 8c763420..e5c23e1c 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/mapred/Mapreduce2Params.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/mapred/Mapreduce2Params.java
@@ -77,24 +77,19 @@ public class Mapreduce2Params extends BigtopParams {
return "/etc/hadoop/conf";
}
- @Override
- public String serviceHome() {
- return stackLibDir() + "/hadoop";
- }
-
public String hdfsHome() {
- return stackLibDir() + "/hadoop-hdfs";
+ return stackHome() + "/hadoop-hdfs";
}
public String yarnHome() {
- return stackLibDir() + "/hadoop-yarn";
+ return stackHome() + "/hadoop-yarn";
}
public String mapredHome() {
- return stackLibDir() + "/hadoop-mapreduce";
+ return stackHome() + "/hadoop-mapreduce";
}
public String mapredExec() {
- return stackBinDir() + "/mapred";
+ return serviceHome() + "/bin/mapred";
}
}
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 002157b6..c9193447 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
@@ -79,24 +79,19 @@ public class TezParams extends BigtopParams {
return "/etc/tez/conf";
}
- @Override
- public String serviceHome() {
- return stackLibDir() + "/tez";
- }
-
public String hadoopConfDir() {
return "/etc/hadoop/conf";
}
public String hadoopHome() {
- return stackLibDir() + "/hadoop";
+ return stackHome() + "/hadoop";
}
public String hdfsHome() {
- return stackLibDir() + "/hadoop-hdfs";
+ return stackHome() + "/hadoop-hdfs";
}
public String yarnHome() {
- return stackLibDir() + "/hadoop-yarn";
+ return stackHome() + "/hadoop-yarn";
}
}
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 ebf6ee5e..16f2095d 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
@@ -107,24 +107,19 @@ public class YarnParams extends BigtopParams {
return "/etc/hadoop/conf";
}
- @Override
- public String serviceHome() {
- return stackLibDir() + "/hadoop";
- }
-
public String hdfsHome() {
- return stackLibDir() + "/hadoop-hdfs";
+ return stackHome() + "/hadoop-hdfs";
}
public String yarnExec() {
- return stackBinDir() + "/yarn";
+ return stackHome() + "/yarn";
}
public String yarnHome() {
- return stackLibDir() + "/hadoop-yarn";
+ return stackHome() + "/hadoop-yarn";
}
public String mapredHome() {
- return stackLibDir() + "/hadoop-mapreduce";
+ return stackHome() + "/hadoop-mapreduce";
}
}
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 7ef3a423..f570bf3a 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
@@ -21,7 +21,6 @@ package org.apache.bigtop.manager.stack.core.executor;
import org.apache.bigtop.manager.common.constants.MessageConstants;
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.CustomCommandInfo;
import org.apache.bigtop.manager.common.shell.ShellResult;
import org.apache.bigtop.manager.common.utils.CaseUtils;
import org.apache.bigtop.manager.common.utils.Environments;
@@ -34,7 +33,6 @@ import org.apache.bigtop.manager.stack.core.spi.script.Script;
import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.Method;
-import java.util.List;
import java.util.Map;
@Slf4j
@@ -44,7 +42,11 @@ public class StackExecutor {
private static final Map<String, Hook> HOOK_MAP = new
PrioritySPIFactory<>(Hook.class).getSPIMap();
- private static Script getCommandScript(String scriptId) {
+ private static Script getCommandScript(CommandPayload commandPayload) {
+ String componentName = commandPayload.getComponentName();
+ String packageName = getPackageName(commandPayload);
+ String scriptId =
+ packageName + "." + CaseUtils.toCamelCase(componentName,
CaseUtils.SEPARATOR_UNDERSCORE) + "Script";
Script script = SCRIPT_MAP.get(scriptId);
if (script == null) {
throw new StackException("Cannot find Script Class {0}", scriptId);
@@ -53,19 +55,11 @@ public class StackExecutor {
return script;
}
- private static Script getCustomScript(String customCommand,
List<CustomCommandInfo> customCommands) {
- Script script = null;
- for (CustomCommandInfo customCommandInfo : customCommands) {
- if (customCommandInfo.getName().equals(customCommand)) {
- script =
getCommandScript(customCommandInfo.getCommandScript().getScriptId());
- }
- }
-
- if (script == null) {
- throw new StackException("Cannot find script class {0}",
customCommand);
- }
-
- return script;
+ private static String getPackageName(CommandPayload commandPayload) {
+ return "org.apache.bigtop.manager.stack" + "."
+ + CaseUtils.toLowerCase(commandPayload.getStackName()) + ".v"
+ + commandPayload.getStackVersion().replaceAll("\\.", "_") + "."
+ + CaseUtils.toLowerCase(commandPayload.getServiceName());
}
private static void runBeforeHook(String command, Params params) {
@@ -84,20 +78,15 @@ public class StackExecutor {
public static ShellResult execute(CommandPayload commandPayload) {
try {
- String command;
- Script script;
- if
(commandPayload.getCommand().name().equals(Command.CUSTOM.name())) {
- command = commandPayload.getCustomCommand();
- script = getCustomScript(command,
commandPayload.getCustomCommands());
- } else {
- command = commandPayload.getCommand().name();
- script =
getCommandScript(commandPayload.getCommandScript().getScriptId());
- }
+ String command = commandPayload.getCommand() == Command.CUSTOM
+ ? commandPayload.getCustomCommand()
+ : commandPayload.getCommand().name();
+ Script script = getCommandScript(commandPayload);
String methodName = CaseUtils.toCamelCase(command,
CaseUtils.SEPARATOR_UNDERSCORE, false);
Method method = script.getClass().getMethod(methodName,
Params.class);
- String paramsClassName = script.getClass().getPackageName() + "."
+ String paramsClassName = getPackageName(commandPayload) + "."
+ CaseUtils.toCamelCase(commandPayload.getServiceName()) +
"Params";
Class<?> paramsClass = Class.forName(paramsClassName);
Params params = (Params)