导航菜单

页面标题

页面副标题

管控平台 v5.2.3.0. - EDUDefStrategyHelper.java 源代码

正在查看: 管控平台 v5.2.3.0. 应用的 EDUDefStrategyHelper.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.iflytek.edu.log.bizbase.config;

import android.text.TextUtils;
import com.iflytek.edu.apm.base.utils.EDUJsonUtil;
import com.iflytek.edu.log.bizbase.config.EDULogApmDefaultStrategyBean;
import com.iflytek.edu.log.bizbase.config.EDULogBigDataDefaultStrategyBean;
import com.iflytek.edu.log.constant.EDULogStoUpConstant;
import com.iflytek.edu.statistics.log.config.component.EDUComponentConstant;
import java.util.ArrayList;

public class EDUDefStrategyHelper {
    private static final String TAG = "EDUDefStrategyHelper";

    public static String completeHost(String host) {
        if (TextUtils.isEmpty(host) || TextUtils.equals(host.substring(host.length() - 1), "/")) {
            return host;
        }
        return host + "/";
    }

    public String getApmStrategy(boolean isRelease) {
        return EDUJsonUtil.toJsonString(getApmStrategyBean(isRelease));
    }

    public EDULogApmDefaultStrategyBean getApmStrategyBean(boolean isRelease) {
        EDULogApmDefaultStrategyBean eDULogApmDefaultStrategyBean = new EDULogApmDefaultStrategyBean();
        EDULogApmDefaultStrategyBean.AllCollectBean allCollectBean = new EDULogApmDefaultStrategyBean.AllCollectBean();
        allCollectBean.setAllSwitch(ApmEnum.ALL_SWITCH_COLLECT.value);
        eDULogApmDefaultStrategyBean.setAllCollect(allCollectBean);
        EDULogApmDefaultStrategyBean.AddrBean addrBean = new EDULogApmDefaultStrategyBean.AddrBean();
        addrBean.setBigDataHost((!isRelease ? ApmEnum.BIGDATA_TEST_HOST : ApmEnum.BIGDATA_RELEASE_HOST).value);
        eDULogApmDefaultStrategyBean.setAddr(addrBean);
        EDULogApmDefaultStrategyBean.UploadBean uploadBean = new EDULogApmDefaultStrategyBean.UploadBean();
        uploadBean.setAllSwitch(ApmEnum.ALL_SWITCH_UPLOAD.value);
        uploadBean.setCheckInterval(ApmEnum.CHECK_INTERVAL.value);
        uploadBean.setMaxCacheCount(ApmEnum.MAX_CACHE_COUNT.value);
        uploadBean.setDbCount(ApmEnum.DB_COUNT.value);
        uploadBean.setDbFileSize(ApmEnum.DB_FILE_SIZE.value);
        uploadBean.setMaxStagnantTime(ApmEnum.MAX_STAGNANT_TIME.value);
        eDULogApmDefaultStrategyBean.setUpload(uploadBean);
        return eDULogApmDefaultStrategyBean;
    }

    public String getBigdataStrategy() {
        return EDUJsonUtil.toJsonString(getBigdataStrategyBean());
    }

    public EDULogBigDataDefaultStrategyBean getBigdataStrategyBean() {
        EDULogBigDataDefaultStrategyBean eDULogBigDataDefaultStrategyBean = new EDULogBigDataDefaultStrategyBean();
        EDULogBigDataDefaultStrategyBean.CollectBean collectBean = new EDULogBigDataDefaultStrategyBean.CollectBean();
        collectBean.setAllSwitch(BigDataEnum.ALL_SWITCH.valueInt);
        collectBean.setAutoPageSwitch(BigDataEnum.AUTO_PAGE_SWITCH.valueInt);
        collectBean.setJsBridgeSwitch(BigDataEnum.JS_BRIDGE_SWITCH.valueInt);
        collectBean.setMaxExtSize(BigDataEnum.MAX_EXT_SIZE.valueInt);
        ArrayList arrayList = new ArrayList();
        EDULogBigDataDefaultStrategyBean.CollectBean.DetailBean detailBean = new EDULogBigDataDefaultStrategyBean.CollectBean.DetailBean();
        detailBean.setAttrName(BigDataEnum.MAC_SWITCH.key);
        detailBean.setAttrName(BigDataEnum.MAC_SWITCH.value);
        arrayList.add(detailBean);
        EDULogBigDataDefaultStrategyBean.CollectBean.DetailBean detailBean2 = new EDULogBigDataDefaultStrategyBean.CollectBean.DetailBean();
        detailBean2.setAttrName(BigDataEnum.IMSI_SWITCH.key);
        detailBean2.setAttrName(BigDataEnum.IMSI_SWITCH.value);
        arrayList.add(detailBean2);
        EDULogBigDataDefaultStrategyBean.CollectBean.DetailBean detailBean3 = new EDULogBigDataDefaultStrategyBean.CollectBean.DetailBean();
        detailBean3.setAttrName(BigDataEnum.IMEI_SWITCH.key);
        detailBean3.setAttrName(BigDataEnum.IMEI_SWITCH.value);
        arrayList.add(detailBean3);
        EDULogBigDataDefaultStrategyBean.CollectBean.DetailBean detailBean4 = new EDULogBigDataDefaultStrategyBean.CollectBean.DetailBean();
        detailBean4.setAttrName(BigDataEnum.SN_SWITCH.key);
        detailBean4.setAttrName(BigDataEnum.SN_SWITCH.value);
        arrayList.add(detailBean4);
        EDULogBigDataDefaultStrategyBean.CollectBean.DetailBean detailBean5 = new EDULogBigDataDefaultStrategyBean.CollectBean.DetailBean();
        detailBean5.setAttrName(BigDataEnum.ARDID_SWITCH.key);
        detailBean5.setAttrName(BigDataEnum.ARDID_SWITCH.value);
        arrayList.add(detailBean5);
        collectBean.setDetail(arrayList);
        eDULogBigDataDefaultStrategyBean.setCollect(collectBean);
        eDULogBigDataDefaultStrategyBean.setDebugModule(BigDataEnum.DEBUG_MODE.value);
        return eDULogBigDataDefaultStrategyBean;
    }

    public enum BigDataEnum {
        ALL_SWITCH(1, true),
        DEBUG_MODE("0", 0, false),
        MAX_EXT_SIZE(9600),
        MAC_SWITCH("mac", "0", false),
        IMSI_SWITCH("imsi", "0", false),
        IMEI_SWITCH("imei", "0", false),
        SN_SWITCH("sn", "0", false),
        ARDID_SWITCH("ardId", "0", false),
        AUTO_PAGE_SWITCH(0, false),
        JS_BRIDGE_SWITCH(0, false);

        private String key;
        public String value;
        public boolean valueBool;
        public int valueInt;

        BigDataEnum(String value) {
            this.value = value;
        }

        BigDataEnum(boolean value) {
            this.valueBool = value;
        }

        BigDataEnum(int valueInt, boolean value) {
            this.valueInt = valueInt;
            this.valueBool = value;
        }

        BigDataEnum(String key, String value) {
            this.key = key;
            this.value = value;
        }

        BigDataEnum(String key, String value, boolean valueBool) {
            this.key = key;
            this.value = value;
            this.valueBool = valueBool;
        }

        BigDataEnum(String val, int valueInt, boolean valueBool) {
            this.value = val;
            this.valueInt = valueInt;
            this.valueBool = valueBool;
        }

        BigDataEnum(int value) {
            this.valueInt = value;
        }
    }

    public enum ApmEnum {
        IS_APP_MODE(true),
        SWITCH_CHILD_COMPONENT(true),
        ALL_SWITCH_COLLECT("1", true),
        ALL_SWITCH_UPLOAD("1", true),
        BIGDATA_TEST_HOST("http://test.dcp.ceshiservice.cn/"),
        BIGDATA_RELEASE_HOST(EDUComponentConstant.BIGDATA_HOST_RELEASE),
        APM_RELEASE_HOST("https://csmp.changyan.cn/"),
        APM_TEST_HOST("http://csmp.ceshiservice.cn/"),
        CHECK_INTERVAL("600000", EDULogStoUpConstant.EDU_LOG_DEFAULT_MAX_TIME_INTERVAL),
        MAX_STAGNANT_TIME("3000", 3000),
        DB_FILE_SIZE("1024"),
        MAX_CACHE_COUNT("30", 30),
        DB_COUNT("100", 100);

        private String key;
        public String value;
        public boolean valueBool;
        public int valueInt;
        public long valueLong;

        ApmEnum(String value, boolean valueBool) {
            this.valueBool = valueBool;
            this.value = value;
        }

        ApmEnum(String value, long valueLong) {
            this.valueLong = valueLong;
            this.value = value;
        }

        ApmEnum(String value) {
            this.value = value;
        }

        ApmEnum(boolean value) {
            this.valueBool = value;
        }

        ApmEnum(int valueInt, boolean value) {
            this.valueInt = valueInt;
            this.valueBool = value;
        }
    }
}