public static void toFile()

in bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxFileUtils.java [67:100]


    public static void toFile(
            ConfigType type,
            String filename,
            String owner,
            String group,
            String permissions,
            Object content,
            Object paramMap) {
        log.info("Generating file: [{}]", filename);
        if (type == null || StringUtils.isBlank(filename) || content == null) {
            log.error("type, filename, content must not be null");
            return;
        }

        String tmpPath = "/tmp/" + generateRandomFileName();
        switch (type) {
            case PROPERTIES, XML, ENV, CONTENT:
                TemplateUtils.map2Template(type, tmpPath, content, paramMap);
                break;
            case YAML:
                YamlUtils.writeYaml(tmpPath, content);
                break;
            case JSON:
                JsonUtils.writeToFile(tmpPath, content);
                break;
            case UNKNOWN:
                log.info("no need to write");
                break;
        }

        moveFile(tmpPath, filename);
        updateOwner(filename, owner, group, false);
        updatePermissions(filename, permissions, false);
    }