Instance.java 3.8 KB
Newer Older
P
peng-yongsheng 已提交
1
/*
wu-sheng's avatar
wu-sheng 已提交
2 3 4 5 6 7
 * 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
P
peng-yongsheng 已提交
8 9 10 11 12 13 14 15 16 17 18
 *
 *     http://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.
 *
 */

19
package org.apache.skywalking.apm.collector.storage.table.register;
P
peng-yongsheng 已提交
20

21
import org.apache.skywalking.apm.collector.core.data.Column;
22
import org.apache.skywalking.apm.collector.core.data.AbstractData;
23 24
import org.apache.skywalking.apm.collector.core.data.operator.CoverOperation;
import org.apache.skywalking.apm.collector.core.data.operator.NonOperation;
P
peng-yongsheng 已提交
25 26 27 28

/**
 * @author peng-yongsheng
 */
29
public class Instance extends AbstractData {
P
peng-yongsheng 已提交
30 31 32 33 34 35 36 37 38 39 40

    private static final Column[] STRING_COLUMNS = {
        new Column(InstanceTable.COLUMN_ID, new NonOperation()),
        new Column(InstanceTable.COLUMN_AGENT_UUID, new CoverOperation()),
        new Column(InstanceTable.COLUMN_OS_INFO, new CoverOperation()),
    };

    private static final Column[] LONG_COLUMNS = {
        new Column(InstanceTable.COLUMN_REGISTER_TIME, new CoverOperation()),
        new Column(InstanceTable.COLUMN_HEARTBEAT_TIME, new CoverOperation()),
    };
41

P
peng-yongsheng 已提交
42
    private static final Column[] DOUBLE_COLUMNS = {};
43

P
peng-yongsheng 已提交
44 45 46
    private static final Column[] INTEGER_COLUMNS = {
        new Column(InstanceTable.COLUMN_APPLICATION_ID, new CoverOperation()),
        new Column(InstanceTable.COLUMN_INSTANCE_ID, new CoverOperation()),
47 48 49 50 51
        new Column(InstanceTable.COLUMN_ADDRESS_ID, new CoverOperation()),
    };

    private static final Column[] BOOLEAN_COLUMNS = {
        new Column(InstanceTable.COLUMN_IS_ADDRESS, new CoverOperation()),
P
peng-yongsheng 已提交
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
    };

    private static final Column[] BYTE_COLUMNS = {};

    public Instance(String id) {
        super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
    }

    public String getId() {
        return getDataString(0);
    }

    public int getApplicationId() {
        return getDataInteger(0);
    }

    public void setApplicationId(Integer applicationId) {
        setDataInteger(0, applicationId);
    }

    public String getAgentUUID() {
        return getDataString(1);
    }

    public void setAgentUUID(String agentUUID) {
        setDataString(1, agentUUID);
    }

    public long getRegisterTime() {
        return getDataLong(0);
    }

    public void setRegisterTime(Long registerTime) {
        setDataLong(0, registerTime);
    }

    public int getInstanceId() {
        return getDataInteger(1);
    }

    public void setInstanceId(Integer instanceId) {
        setDataInteger(1, instanceId);
    }

    public long getHeartBeatTime() {
        return getDataLong(1);
    }

    public void setHeartBeatTime(Long heartBeatTime) {
        setDataLong(1, heartBeatTime);
    }

    public String getOsInfo() {
        return getDataString(2);
    }

    public void setOsInfo(String osInfo) {
        setDataString(2, osInfo);
    }
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126

    public int getAddressId() {
        return getDataInteger(2);
    }

    public void setAddressId(int addressId) {
        setDataInteger(2, addressId);
    }

    public boolean getIsAddress() {
        return getDataBoolean(0);
    }

    public void setIsAddress(boolean isAddress) {
        setDataBoolean(0, isAddress);
    }
P
peng-yongsheng 已提交
127
}