public static ShellResult config()

in bigtop-manager-stack/bigtop-manager-stack-extra/src/main/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelSetup.java [41:140]


    public static ShellResult config(Params params) {
        SeaTunnelParams seatunnelParams = (SeaTunnelParams) params;
        String user = seatunnelParams.user();
        String group = seatunnelParams.group();

        List<String> masterHostPortList = hostPort("seatunnel_master", seatunnelParams.getSeatunnelMasterPort(), 10);
        List<String> workerHostPortList = hostPort("seatunnel_worker", seatunnelParams.getSeatunnelWorkerPort(), 10);
        List<String> clientHostPortList = hostPort("seatunnel_master", seatunnelParams.getSeatunnelMasterPort(), 6);

        List<String> masterWorkerHostPortList = Stream.concat(masterHostPortList.stream(), workerHostPortList.stream())
                .toList();
        String clusterMasterWorkerHostPort = String.join("\n", masterWorkerHostPortList);
        String clusterMasterHostPort = String.join("\n", clientHostPortList);

        Map<String, Object> globalParamsMap = seatunnelParams.getGlobalParamsMap();
        globalParamsMap.put("cluster_master_worker_host_port", clusterMasterWorkerHostPort);
        globalParamsMap.put("cluster_master_host_port", clusterMasterHostPort);

        LinuxFileUtils.toFileByTemplate(
                seatunnelParams.getSeatunnelContent(),
                MessageFormat.format("{0}/seatunnel.yaml", seatunnelParams.confDir()),
                user,
                group,
                Constants.PERMISSION_644,
                seatunnelParams.getGlobalParamsMap());

        LinuxFileUtils.toFileByTemplate(
                seatunnelParams.getSeatunnelEnvContent(),
                MessageFormat.format("{0}/seatunnel-env.sh", seatunnelParams.confDir()),
                user,
                group,
                Constants.PERMISSION_644,
                seatunnelParams.getGlobalParamsMap());

        LinuxFileUtils.toFileByTemplate(
                seatunnelParams.getSeatunnelMasterContent(),
                MessageFormat.format("{0}/hazelcast-master.yaml", seatunnelParams.confDir()),
                user,
                group,
                Constants.PERMISSION_644,
                globalParamsMap);

        LinuxFileUtils.toFileByTemplate(
                seatunnelParams.getSeatunnelWorkerContent(),
                MessageFormat.format("{0}/hazelcast-worker.yaml", seatunnelParams.confDir()),
                user,
                group,
                Constants.PERMISSION_644,
                globalParamsMap);

        LinuxFileUtils.toFileByTemplate(
                seatunnelParams.getSeatunnelClientContent(),
                MessageFormat.format("{0}/hazelcast-client.yaml", seatunnelParams.confDir()),
                user,
                group,
                Constants.PERMISSION_644,
                globalParamsMap);

        LinuxFileUtils.toFileByTemplate(
                seatunnelParams.getJvmMasterOptionsContent(),
                MessageFormat.format("{0}/jvm_master_options", seatunnelParams.confDir()),
                user,
                group,
                Constants.PERMISSION_644,
                seatunnelParams.getGlobalParamsMap());

        LinuxFileUtils.toFileByTemplate(
                seatunnelParams.getJvmWorkerOptionsContent(),
                MessageFormat.format("{0}/jvm_worker_options", seatunnelParams.confDir()),
                user,
                group,
                Constants.PERMISSION_644,
                seatunnelParams.getGlobalParamsMap());

        LinuxFileUtils.toFileByTemplate(
                seatunnelParams.getJvmClientOptionsContent(),
                MessageFormat.format("{0}/jvm_client_options", seatunnelParams.confDir()),
                user,
                group,
                Constants.PERMISSION_644,
                seatunnelParams.getGlobalParamsMap());

        LinuxFileUtils.toFileByTemplate(
                seatunnelParams.getLog4j2Content(),
                MessageFormat.format("{0}/log4j2.properties", seatunnelParams.confDir()),
                user,
                group,
                Constants.PERMISSION_644,
                seatunnelParams.getGlobalParamsMap());

        LinuxFileUtils.toFileByTemplate(
                seatunnelParams.getLog4j2ClientContent(),
                MessageFormat.format("{0}/log4j2_client.properties", seatunnelParams.confDir()),
                user,
                group,
                Constants.PERMISSION_644,
                seatunnelParams.getGlobalParamsMap());

        return ShellResult.success("SeaTunnel Configure success!");
    }