ComponentsDefine.java 2.6 KB
Newer Older
1 2 3
package org.skywalking.apm.network.trace.component;

/**
4 5
 * The supported list of skywalking java sniffer.
 *
6 7 8
 * @author wusheng
 */
public class ComponentsDefine {
P
pengys5 已提交
9

10
    public static final OfficialComponent TOMCAT = new OfficialComponent(1, "Tomcat");
11 12 13 14

    public static final OfficialComponent HTTPCLIENT = new OfficialComponent(2, "HttpClient");

    public static final OfficialComponent DUBBO = new OfficialComponent(3, "Dubbo");
A
ascrutae 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

    public static final OfficialComponent H2 = new OfficialComponent(4, "H2");

    public static final OfficialComponent MYSQL = new OfficialComponent(5, "Mysql");

    public static final OfficialComponent ORACLE = new OfficialComponent(6, "ORACLE");

    public static final OfficialComponent REDIS = new OfficialComponent(7, "Redis");

    public static final OfficialComponent MOTAN = new OfficialComponent(8, "Motan");

    public static final OfficialComponent MONGODB = new OfficialComponent(9, "MongoDB");

    public static final OfficialComponent RESIN = new OfficialComponent(10, "Resin");

    public static final OfficialComponent FEIGN = new OfficialComponent(11, "Feign");

    public static final OfficialComponent OKHTTP = new OfficialComponent(12, "OKHttp");
33

A
ascrutae 已提交
34 35 36
    public static final OfficialComponent SPRING_REST_TEMPLATE = new OfficialComponent(13, "SpringRestTemplate");

    public static final OfficialComponent SPRING_MVC_ANNOTATION = new OfficialComponent(14, "SpringMVCAnnotation");
A
ascrutae 已提交
37

A
ascrutae 已提交
38 39
    public static final OfficialComponent STRUTS2 = new OfficialComponent(14, "Struts2");

P
pengys5 已提交
40 41 42 43 44 45 46 47 48
    private static ComponentsDefine instance = new ComponentsDefine();

    private String[] components;

    public static ComponentsDefine getInstance() {
        return instance;
    }

    public ComponentsDefine() {
A
ascrutae 已提交
49
        components = new String[16];
P
pengys5 已提交
50 51 52 53 54 55 56 57 58 59 60 61
        addComponent(TOMCAT);
        addComponent(HTTPCLIENT);
        addComponent(DUBBO);
        addComponent(H2);
        addComponent(MYSQL);
        addComponent(ORACLE);
        addComponent(REDIS);
        addComponent(MOTAN);
        addComponent(MONGODB);
        addComponent(RESIN);
        addComponent(FEIGN);
        addComponent(OKHTTP);
A
ascrutae 已提交
62 63
        addComponent(SPRING_REST_TEMPLATE);
        addComponent(SPRING_MVC_ANNOTATION);
A
ascrutae 已提交
64
        addComponent(STRUTS2);
P
pengys5 已提交
65 66 67 68 69 70 71 72
    }

    private void addComponent(OfficialComponent component) {
        components[component.getId()] = component.getName();
    }

    public String getComponentName(int componentId) {
        if (componentId > components.length - 1 || componentId == 0) {
73
            return null;
P
pengys5 已提交
74 75
        } else {
            return components[componentId];
76 77
        }
    }
78
}